]> git.saurik.com Git - apple/configd.git/commitdiff
configd-289.tar.gz mac-os-x-106 mac-os-x-1061 v289
authorApple <opensource@apple.com>
Tue, 25 Aug 2009 00:03:45 +0000 (00:03 +0000)
committerApple <opensource@apple.com>
Tue, 25 Aug 2009 00:03:45 +0000 (00:03 +0000)
183 files changed:
Plugins/ATconfig/Info.plist
Plugins/IPMonitor/Info.plist
Plugins/IPMonitor/Makefile [new file with mode: 0644]
Plugins/IPMonitor/Resolvers.plist [deleted file]
Plugins/IPMonitor/dns-configuration.c
Plugins/IPMonitor/dns-configuration.h
Plugins/IPMonitor/ip_plugin.c
Plugins/IPMonitor/set-hostname.c
Plugins/IPMonitor/smb-configuration.c
Plugins/IPMonitor/test_ipv4_routelist_filter.sh [new file with mode: 0644]
Plugins/IPMonitor/test_ipv4_routelist_reference.txt [new file with mode: 0644]
Plugins/IPMonitor/test_reference.sh [new file with mode: 0644]
Plugins/InterfaceNamer/Info.plist
Plugins/InterfaceNamer/ifnamer.c
Plugins/KernelEventMonitor/Info.plist
Plugins/KernelEventMonitor/ev_dlil.c
Plugins/KernelEventMonitor/ev_ipv4.c
Plugins/KernelEventMonitor/ev_ipv4.h
Plugins/KernelEventMonitor/eventmon.c
Plugins/Kicker/Info.plist
Plugins/LinkConfiguration/Info.plist
Plugins/Logger/Info-Embedded.plist [new file with mode: 0644]
Plugins/Logger/Info.plist [new file with mode: 0644]
Plugins/Logger/Makefile [new file with mode: 0644]
Plugins/Logger/logger.c [new file with mode: 0644]
Plugins/NetworkIdentification/Info.plist
Plugins/NetworkIdentification/NetworkIdentification.c
Plugins/PreferencesMonitor/Info.plist
Plugins/PreferencesMonitor/prefsmon.c
SCMonitor/English.lproj/Localizable.strings
SCMonitor/Info.plist
SCMonitor/monitor.c
SystemConfiguration.fproj/BondConfiguration.c
SystemConfiguration.fproj/BondConfiguration.h [deleted file]
SystemConfiguration.fproj/BondConfigurationPrivate.h [deleted file]
SystemConfiguration.fproj/DHCPClientPreferences.h
SystemConfiguration.fproj/English.lproj/Localizable.strings
SystemConfiguration.fproj/English.lproj/NetworkInterface.strings
SystemConfiguration.fproj/Info-Embedded.plist [new file with mode: 0644]
SystemConfiguration.fproj/Info.plist
SystemConfiguration.fproj/LinkConfiguration.h
SystemConfiguration.fproj/NetworkConfiguration.plist
SystemConfiguration.fproj/SCD.c
SystemConfiguration.fproj/SCDAdd.c
SystemConfiguration.fproj/SCDConsoleUser.c
SystemConfiguration.fproj/SCDGet.c
SystemConfiguration.fproj/SCDHostName.c
SystemConfiguration.fproj/SCDList.c
SystemConfiguration.fproj/SCDLock.c
SystemConfiguration.fproj/SCDNotifierAdd.c
SystemConfiguration.fproj/SCDNotifierCancel.c
SystemConfiguration.fproj/SCDNotifierGetChanges.c
SystemConfiguration.fproj/SCDNotifierInformViaCallback.c
SystemConfiguration.fproj/SCDNotifierInformViaFD.c
SystemConfiguration.fproj/SCDNotifierInformViaMachPort.c
SystemConfiguration.fproj/SCDNotifierInformViaSignal.c
SystemConfiguration.fproj/SCDNotifierRemove.c
SystemConfiguration.fproj/SCDNotifierSetKeys.c
SystemConfiguration.fproj/SCDNotifierWait.c
SystemConfiguration.fproj/SCDNotify.c
SystemConfiguration.fproj/SCDOpen.c
SystemConfiguration.fproj/SCDPrivate.c
SystemConfiguration.fproj/SCDRemove.c
SystemConfiguration.fproj/SCDSet.c
SystemConfiguration.fproj/SCDSnapshot.c
SystemConfiguration.fproj/SCDTouch.c
SystemConfiguration.fproj/SCDUnlock.c
SystemConfiguration.fproj/SCDynamicStore.h
SystemConfiguration.fproj/SCDynamicStoreCopyDHCPInfo.h
SystemConfiguration.fproj/SCDynamicStoreCopySpecific.h
SystemConfiguration.fproj/SCDynamicStoreCopySpecificPrivate.h
SystemConfiguration.fproj/SCDynamicStoreInternal.h
SystemConfiguration.fproj/SCDynamicStoreKey.h
SystemConfiguration.fproj/SCDynamicStoreSetSpecificPrivate.h
SystemConfiguration.fproj/SCNetwork.h
SystemConfiguration.fproj/SCNetworkConfiguration.h
SystemConfiguration.fproj/SCNetworkConfigurationInternal.c
SystemConfiguration.fproj/SCNetworkConfigurationInternal.h
SystemConfiguration.fproj/SCNetworkConfigurationPrivate.h
SystemConfiguration.fproj/SCNetworkConnection.c
SystemConfiguration.fproj/SCNetworkConnection.h
SystemConfiguration.fproj/SCNetworkConnectionPrivate.c
SystemConfiguration.fproj/SCNetworkConnectionPrivate.h
SystemConfiguration.fproj/SCNetworkInterface.c
SystemConfiguration.fproj/SCNetworkProtocol.c
SystemConfiguration.fproj/SCNetworkReachability.c
SystemConfiguration.fproj/SCNetworkReachability.h
SystemConfiguration.fproj/SCNetworkService.c
SystemConfiguration.fproj/SCNetworkSet.c
SystemConfiguration.fproj/SCNetworkSignature.c
SystemConfiguration.fproj/SCNetworkSignature.h
SystemConfiguration.fproj/SCP.c
SystemConfiguration.fproj/SCPCommit.c
SystemConfiguration.fproj/SCPLock.c
SystemConfiguration.fproj/SCPOpen.c
SystemConfiguration.fproj/SCPPath.c
SystemConfiguration.fproj/SCPUnlock.c
SystemConfiguration.fproj/SCPreferences.h
SystemConfiguration.fproj/SCPreferencesInternal.h
SystemConfiguration.fproj/SCPreferencesKeychainPrivate.c
SystemConfiguration.fproj/SCPreferencesKeychainPrivate.h
SystemConfiguration.fproj/SCPreferencesPath.h
SystemConfiguration.fproj/SCPreferencesPathKey.h
SystemConfiguration.fproj/SCPreferencesPrivate.h
SystemConfiguration.fproj/SCPreferencesSetSpecific.h
SystemConfiguration.fproj/SCPrivate.h
SystemConfiguration.fproj/SCProxies.c
SystemConfiguration.fproj/SCSchemaDefinitions.c
SystemConfiguration.fproj/SCSchemaDefinitions.h
SystemConfiguration.fproj/SCSchemaDefinitionsPrivate.h
SystemConfiguration.fproj/SystemConfiguration.h
SystemConfiguration.fproj/VLANConfiguration.c
SystemConfiguration.fproj/VLANConfiguration.h [deleted file]
SystemConfiguration.fproj/config_types.h
SystemConfiguration.fproj/dy_framework.c
SystemConfiguration.fproj/dy_framework.h
SystemConfiguration.fproj/genSCPreferences.c
SystemConfiguration.fproj/helper/SCHelper_client.c
SystemConfiguration.fproj/helper/SCHelper_client.h
SystemConfiguration.fproj/helper/SCHelper_server.c
SystemConfiguration.fproj/helper/com.apple.SCHelper-embedded.plist [new file with mode: 0644]
SystemConfiguration.fproj/helper/com.apple.SCHelper.plist [new file with mode: 0644]
SystemConfiguration.fproj/update-headers [new file with mode: 0755]
configd.tproj/_SCD.c
configd.tproj/_SCD.h
configd.tproj/_configadd.c
configd.tproj/_configclose.c
configd.tproj/_configget.c
configd.tproj/_configlist.c
configd.tproj/_configlock.c
configd.tproj/_confignotify.c
configd.tproj/_configopen.c
configd.tproj/_configremove.c
configd.tproj/_configset.c
configd.tproj/_configtouch.c
configd.tproj/_notifyadd.c
configd.tproj/_notifycancel.c
configd.tproj/_notifyremove.c
configd.tproj/_notifyviafd.c
configd.tproj/_notifyviaport.c
configd.tproj/_notifyviasignal.c
configd.tproj/_snapshot.c
configd.tproj/com.apple.configd.plist
configd.tproj/configd.8
configd.tproj/configd.h
configd.tproj/configd.m
configd.tproj/configd_server.c
configd.tproj/configd_server.h
configd.tproj/entitlements.plist [new file with mode: 0644]
configd.tproj/notify_server.c
configd.tproj/pattern.c
configd.tproj/plugin_support.c
configd.tproj/session.c
configd.tproj/session.h
configd.xcodeproj/project.pbxproj
dnsinfo/dnsinfo.h
dnsinfo/dnsinfo_copy.c
dnsinfo/dnsinfo_create.c
dnsinfo/dnsinfo_create.h
dnsinfo/dnsinfo_flatfile.c [new file with mode: 0644]
dnsinfo/dnsinfo_private.c
dnsinfo/dnsinfo_private.h
dnsinfo/dnsinfo_server.c
dnsinfo/dnsinfo_server.h
dnsinfo/shared_dns_info.defs
dnsinfo/shared_dns_info_types.h
get-mobility-info
preferences.xml [deleted file]
scselect.tproj/scselect.c
scutil.tproj/commands.c
scutil.tproj/dictionary.c
scutil.tproj/net.c
scutil.tproj/net_interface.c
scutil.tproj/net_interface.h
scutil.tproj/net_protocol.c
scutil.tproj/net_service.c
scutil.tproj/net_set.c
scutil.tproj/notifications.c
scutil.tproj/prefs.c
scutil.tproj/scutil.8
scutil.tproj/scutil.c
scutil.tproj/tests.c
scutil.tproj/tests.h

index 83b7060858117703fd76caff281e0319edc3857d..b00efea444e07f99a1e9db4089a989489427cb36 100644 (file)
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
-       <string>SystemConfiguration</string>
+       <string>com.apple.SystemConfiguration.ATconfig</string>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.9.2</string>
+       <string>1.10</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.9.2</string>
+       <string>1.10</string>
        <key>Builtin</key>
        <true/>
        <key>Requires</key>
        <key>Builtin</key>
        <true/>
        <key>Requires</key>
index 71a500e4c6029f71cb2cc60985bda2889ef7bfc0..58acde2a0af53c1d3410c7e2fa4054998fce4da8 100644 (file)
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
-       <string>SystemConfiguration</string>
+       <string>com.apple.SystemConfiguration.IPMonitor</string>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.9.2</string>
+       <string>1.10</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.9.2</string>
+       <string>1.10</string>
        <key>Requires</key>
        <array>
                <string>com.apple.SystemConfiguration.IPConfiguration</string>
        <key>Requires</key>
        <array>
                <string>com.apple.SystemConfiguration.IPConfiguration</string>
        </array>
        <key>Builtin</key>
        <true/>
        </array>
        <key>Builtin</key>
        <true/>
+       <key>mdns_timeout</key>
+       <integer>2</integer>
        <key>pdns_timeout</key>
        <integer>5</integer>
        <key>pdns_timeout</key>
        <integer>5</integer>
+       <key>AppendStateArrayToSetupArray</key>
+       <false/>
 </dict>
 </plist>
 </dict>
 </plist>
diff --git a/Plugins/IPMonitor/Makefile b/Plugins/IPMonitor/Makefile
new file mode 100644 (file)
index 0000000..80077c8
--- /dev/null
@@ -0,0 +1,24 @@
+test_dns: Makefile dns-configuration.h dns-configuration.c
+       cc -Wall -g -o test_dns -DMAIN dns-configuration.c -framework SystemConfiguration -framework CoreFoundation -ldnsinfo
+
+test_smb: Makefile smb-configuration.h smb-configuration.c
+       cc -Wall -g -o test_smb -DMAIN -DDEBUG smb-configuration.c -framework SystemConfiguration -framework CoreFoundation
+
+test_ipv4_routelist: ip_plugin.c
+       cc -Wall -g -o test_ipv4_routelist -DTEST_IPV4_ROUTELIST smb-configuration.c ip_plugin.c -framework SystemConfiguration -framework CoreFoundation -ldnsinfo
+
+IPMonitor: ip_plugin.c
+       cc -Wall -g -o IPMonitor -DTEST_IPMONITOR smb-configuration.c ip_plugin.c -framework SystemConfiguration -framework CoreFoundation -ldnsinfo
+
+test_ipv4_routelist_reference.txt: test_ipv4_routelist
+       sh test_reference.sh create test_ipv4_routelist test_ipv4_routelist_reference.txt test_ipv4_routelist_filter.sh
+
+test_ipv4_routelist_test: test_ipv4_routelist
+       sh test_reference.sh test test_ipv4_routelist test_ipv4_routelist_reference.txt test_ipv4_routelist_filter.sh
+
+
+clean:
+       rm -rf  test_dns test_dns.dSYM  \
+               test_smb test_smb.dSYM  \
+               test_ipv4_routelist test_ipv4_routelist.dSYM    \
+               IPMonitor IPMonitor.dSYM
diff --git a/Plugins/IPMonitor/Resolvers.plist b/Plugins/IPMonitor/Resolvers.plist
deleted file mode 100644 (file)
index f7fcd96..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<array>
-       <dict>
-               <key>Options</key>
-               <string>mdns</string>
-               <key>ServerTimeout</key>
-               <integer>2</integer>
-               <key>SupplementalMatchDomains</key>
-               <array>
-                       <string>local</string>
-                       <string>254.169.in-addr.arpa</string>
-                       <string>8.e.f.ip6.arpa</string>
-                       <string>9.e.f.ip6.arpa</string>
-                       <string>a.e.f.ip6.arpa</string>
-                       <string>b.e.f.ip6.arpa</string>
-               </array>
-       </dict>
-</array>
-</plist>
index 8db803818b1b3de9094ef38d3885404a3412504e..e5b860af3919efc5103df9c8b7f4857f1c62ce0f 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -28,6 +28,7 @@
  * - initial revision
  */
 
  * - initial revision
  */
 
+#include <TargetConditionals.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <arpa/inet.h>
 #include <arpa/nameser.h>
 #include <resolv.h>
 #include <arpa/inet.h>
 #include <arpa/nameser.h>
 #include <resolv.h>
+#if    !TARGET_OS_IPHONE
+#include <notify.h>
+extern uint32_t notify_monitor_file(int token, const char *name, int flags);
+#endif // !TARGET_OS_IPHONE
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <dnsinfo_create.h>
 
 #include <dns_sd.h>
 #include <dnsinfo_create.h>
 
 #include <dns_sd.h>
+#ifndef        kDNSServiceCompMulticastDNS
+#define        kDNSServiceCompMulticastDNS     "MulticastDNS"
+#endif
 #ifndef        kDNSServiceCompPrivateDNS
 #define        kDNSServiceCompPrivateDNS       "PrivateDNS"
 #endif
 
 #ifndef        kDNSServiceCompPrivateDNS
 #define        kDNSServiceCompPrivateDNS       "PrivateDNS"
 #endif
 
-/* pre-defined (supplemental) resolver configurations */
-static  CFArrayRef      S_predefined   = NULL;
+/* multicast DNS resolver configurations */
+static CFNumberRef     S_mdns_timeout  = NULL;
 
 /* private DNS resolver configurations */
 static CFNumberRef     S_pdns_timeout  = NULL;
 
 /* private DNS resolver configurations */
 static CFNumberRef     S_pdns_timeout  = NULL;
@@ -196,36 +204,6 @@ add_supplemental(CFMutableArrayRef supplemental, CFDictionaryRef dns, uint32_t d
 }
 
 
 }
 
 
-static void
-add_predefined_resolvers(CFMutableArrayRef supplemental)
-{
-       CFIndex i;
-       CFIndex n;
-
-       if (S_predefined == NULL) {
-               return;
-       }
-
-       n = CFArrayGetCount(S_predefined);
-       for (i = 0; i < n; i++) {
-               uint32_t        defaultOrder;
-               CFDictionaryRef dns;
-
-               dns = CFArrayGetValueAtIndex(S_predefined, i);
-               if (!isA_CFDictionary(dns)) {
-                       continue;
-               }
-
-               defaultOrder = DEFAULT_SEARCH_ORDER
-                              + (DEFAULT_SEARCH_ORDER / 2)
-                              + ((DEFAULT_SEARCH_ORDER / 1000) * i);
-               add_supplemental(supplemental, dns, defaultOrder);
-       }
-
-       return;
-}
-
-
 #define        N_QUICK 32
 
 
 #define        N_QUICK 32
 
 
@@ -288,6 +266,48 @@ add_supplemental_resolvers(CFMutableArrayRef supplemental, CFDictionaryRef servi
 }
 
 
 }
 
 
+static void
+add_multicast_resolvers(CFMutableArrayRef supplemental, CFArrayRef multicastResolvers)
+{
+       CFIndex i;
+       CFIndex n;
+
+       n = isA_CFArray(multicastResolvers) ? CFArrayGetCount(multicastResolvers) : 0;
+       for (i = 0; i < n; i++) {
+               uint32_t                defaultOrder;
+               CFStringRef             domain;
+               CFNumberRef             num;
+               CFMutableDictionaryRef  resolver;
+
+               domain = CFArrayGetValueAtIndex(multicastResolvers, i);
+               if (!isA_CFString(domain) || (CFStringGetLength(domain) == 0)) {
+                       continue;
+               }
+
+               defaultOrder = DEFAULT_SEARCH_ORDER
+               + (DEFAULT_SEARCH_ORDER / 2)
+               + ((DEFAULT_SEARCH_ORDER / 1000) * i);
+
+               resolver = CFDictionaryCreateMutable(NULL,
+                                                    0,
+                                                    &kCFTypeDictionaryKeyCallBacks,
+                                                    &kCFTypeDictionaryValueCallBacks);
+               CFDictionarySetValue(resolver, kSCPropNetDNSDomainName, domain);
+               CFDictionarySetValue(resolver, kSCPropNetDNSOptions, CFSTR("mdns"));
+               num = CFNumberCreate(NULL, kCFNumberIntType, &defaultOrder);
+               CFDictionarySetValue(resolver, kSCPropNetDNSSearchOrder, num);
+               CFRelease(num);
+               if (S_mdns_timeout != NULL) {
+                       CFDictionarySetValue(resolver, kSCPropNetDNSServerTimeout, S_mdns_timeout);
+               }
+               add_resolver(supplemental, resolver);
+               CFRelease(resolver);
+       }
+
+       return;
+}
+
+
 static void
 add_private_resolvers(CFMutableArrayRef supplemental, CFArrayRef privateResolvers)
 {
 static void
 add_private_resolvers(CFMutableArrayRef supplemental, CFArrayRef privateResolvers)
 {
@@ -424,7 +444,7 @@ update_search_domains(CFMutableDictionaryRef *defaultDomain, CFArrayRef suppleme
        CFIndex                 defaultSearchIndex      = 0;
        CFIndex                 i;
        CFMutableArrayRef       mySearchDomains;
        CFIndex                 defaultSearchIndex      = 0;
        CFIndex                 i;
        CFMutableArrayRef       mySearchDomains;
-       CFMutableArrayRef       mySupplemental          = (CFMutableArrayRef)supplemental;
+       CFMutableArrayRef       mySupplemental          = NULL;
        CFIndex                 n_supplemental;
        Boolean                 searchDomainAdded       = FALSE;
 
        CFIndex                 n_supplemental;
        Boolean                 searchDomainAdded       = FALSE;
 
@@ -506,6 +526,7 @@ update_search_domains(CFMutableDictionaryRef *defaultDomain, CFArrayRef suppleme
                                  CFRangeMake(0, n_supplemental),
                                  compareBySearchOrder,
                                  NULL);
                                  CFRangeMake(0, n_supplemental),
                                  compareBySearchOrder,
                                  NULL);
+               supplemental = mySupplemental;
        }
 
        for (i = 0; i < n_supplemental; i++) {
        }
 
        for (i = 0; i < n_supplemental; i++) {
@@ -516,12 +537,22 @@ update_search_domains(CFMutableDictionaryRef *defaultDomain, CFArrayRef suppleme
                CFStringRef     supplementalDomain;
                uint32_t        supplementalOrder;
 
                CFStringRef     supplementalDomain;
                uint32_t        supplementalOrder;
 
-               dns = CFArrayGetValueAtIndex(mySupplemental, i);
+               dns = CFArrayGetValueAtIndex(supplemental, i);
 
                options = CFDictionaryGetValue(dns, kSCPropNetDNSOptions);
 
                options = CFDictionaryGetValue(dns, kSCPropNetDNSOptions);
-               if (isA_CFString(options) && CFEqual(options, CFSTR("pdns"))) {
-                       // don't add private resolver domains to the search list
-                       continue;
+               if (isA_CFString(options)) {
+                       CFRange range;
+
+                       if (CFEqual(options, CFSTR("pdns"))) {
+                               // don't add private resolver domains to the search list
+                               continue;
+                       }
+
+                       range = CFStringFind(options, CFSTR("interface="), 0);
+                       if (range.location != kCFNotFound) {
+                               // don't add scoped resolver domains to the search list
+                               continue;
+                       }
                }
 
                supplementalDomain = CFDictionaryGetValue(dns, kSCPropNetDNSDomainName);
                }
 
                supplementalDomain = CFDictionaryGetValue(dns, kSCPropNetDNSDomainName);
@@ -581,7 +612,7 @@ update_search_domains(CFMutableDictionaryRef *defaultDomain, CFArrayRef suppleme
        }
 
        CFRelease(mySearchDomains);
        }
 
        CFRelease(mySearchDomains);
-       if (mySupplemental != supplemental) CFRelease(mySupplemental);
+       if (mySupplemental != NULL) CFRelease(mySupplemental);
        return;
 }
 
        return;
 }
 
@@ -682,6 +713,64 @@ create_resolver(CFDictionaryRef dns)
                }
        }
 
                }
        }
 
+       // process sortlist
+       list = CFDictionaryGetValue(dns, kSCPropNetDNSSortList);
+       if (isA_CFArray(list)) {
+               CFIndex i;
+               CFIndex n       = CFArrayGetCount(list);
+
+               for (i = 0; i < n; i++) {
+                       char            buf[128];
+                       char            *slash;
+                       dns_sortaddr_t  sortaddr;
+
+                       str = CFArrayGetValueAtIndex(list, i);
+                       if (!isA_CFString(str)) {
+                               continue;
+                       }
+
+                       if (_SC_cfstring_to_cstring(str, buf, sizeof(buf), kCFStringEncodingASCII) == NULL) {
+                               continue;
+                       }
+
+                       slash = strchr(buf, '/');
+                       if (slash != NULL) {
+                               *slash = '\0';
+                       }
+
+                       bzero(&sortaddr, sizeof(sortaddr));
+                       if (inet_aton(buf, &sortaddr.address) != 1) {
+                               /* if address not valid */
+                               continue;
+                       }
+
+                       if (slash != NULL) {
+                               if (inet_aton(slash + 1, &sortaddr.mask) != 1) {
+                                       /* if subnet mask not valid */
+                                       continue;
+                               }
+                       } else {
+                               in_addr_t       a;
+                               in_addr_t       m;
+
+                               a = ntohl(sortaddr.address.s_addr);
+                               if (IN_CLASSA(a)) {
+                                       m = IN_CLASSA_NET;
+                               } else if (IN_CLASSB(a)) {
+                                       m = IN_CLASSB_NET;
+                               } else if (IN_CLASSC(a)) {
+                                       m = IN_CLASSC_NET;
+                               } else {
+                                       continue;
+                               }
+
+                               sortaddr.mask.s_addr = htonl(m);
+                       }
+
+                       _dns_resolver_add_sortaddr(&_resolver, &sortaddr);
+               }
+       }
+
        // process port
        num = CFDictionaryGetValue(dns, kSCPropNetDNSServerPort);
        if (isA_CFNumber(num)) {
        // process port
        num = CFDictionaryGetValue(dns, kSCPropNetDNSServerPort);
        if (isA_CFNumber(num)) {
@@ -723,19 +812,23 @@ void
 dns_configuration_set(CFDictionaryRef   defaultResolver,
                      CFDictionaryRef   services,
                      CFArrayRef        serviceOrder,
 dns_configuration_set(CFDictionaryRef   defaultResolver,
                      CFDictionaryRef   services,
                      CFArrayRef        serviceOrder,
+                     CFArrayRef        multicastResolvers,
                      CFArrayRef        privateResolvers)
 {
        CFIndex                 i;
        CFMutableDictionaryRef  myDefault;
                      CFArrayRef        privateResolvers)
 {
        CFIndex                 i;
        CFMutableDictionaryRef  myDefault;
-       CFStringRef             myDomain        = NULL;
        uint32_t                myOrder         = DEFAULT_SEARCH_ORDER;
        Boolean                 myOrderAdded    = FALSE;
        CFIndex                 n_supplemental;
        CFNumberRef             order;
        dns_create_resolver_t   resolver;
        uint32_t                myOrder         = DEFAULT_SEARCH_ORDER;
        Boolean                 myOrderAdded    = FALSE;
        CFIndex                 n_supplemental;
        CFNumberRef             order;
        dns_create_resolver_t   resolver;
-       CFArrayRef              search;
        CFMutableArrayRef       supplemental;
 
        CFMutableArrayRef       supplemental;
 
+#ifdef SPECIAL_HANDLING_FOR_DEFAULT_DOMAIN
+       CFStringRef             myDomain        = NULL;
+       CFArrayRef              search;
+#endif // SPECIAL_HANDLING_FOR_DEFAULT_DOMAIN
+
        if (defaultResolver == NULL) {
                myDefault = CFDictionaryCreateMutable(NULL,
                                                      0,
        if (defaultResolver == NULL) {
                myDefault = CFDictionaryCreateMutable(NULL,
                                                      0,
@@ -763,6 +856,7 @@ dns_configuration_set(CFDictionaryRef   defaultResolver,
 
        // identify search[] list and/or domain name
 
 
        // identify search[] list and/or domain name
 
+#ifdef SPECIAL_HANDLING_FOR_DEFAULT_DOMAIN
        search = CFDictionaryGetValue(myDefault, kSCPropNetDNSSearchDomains);
        if (isA_CFArray(search) && (CFArrayGetCount(search) > 0)) {
                myDomain = CFArrayGetValueAtIndex(search, 0);
        search = CFDictionaryGetValue(myDefault, kSCPropNetDNSSearchDomains);
        if (isA_CFArray(search) && (CFArrayGetCount(search) > 0)) {
                myDomain = CFArrayGetValueAtIndex(search, 0);
@@ -787,6 +881,7 @@ dns_configuration_set(CFDictionaryRef   defaultResolver,
                add_resolver(supplemental, mySupplemental);
                CFRelease(mySupplemental);
        }
                add_resolver(supplemental, mySupplemental);
                CFRelease(mySupplemental);
        }
+#endif // SPECIAL_HANDLING_FOR_DEFAULT_DOMAIN
 
        // collect (and add) any supplemental resolver configurations
 
 
        // collect (and add) any supplemental resolver configurations
 
@@ -800,12 +895,13 @@ dns_configuration_set(CFDictionaryRef   defaultResolver,
 
        update_search_domains(&myDefault, supplemental);
 
 
        update_search_domains(&myDefault, supplemental);
 
-       // add any pre-defined resolver configurations
+       // collect (and add) any "multicast" resolver configurations
 
 
-       add_predefined_resolvers(supplemental);
+       add_multicast_resolvers(supplemental, multicastResolvers);
 
        // check if the "match for default domain" (above) is really needed
 
 
        // check if the "match for default domain" (above) is really needed
 
+#ifdef SPECIAL_HANDLING_FOR_DEFAULT_DOMAIN
        if (myDomain != NULL) {
                Boolean sharedDomain    = FALSE;
 
        if (myDomain != NULL) {
                Boolean sharedDomain    = FALSE;
 
@@ -844,6 +940,7 @@ dns_configuration_set(CFDictionaryRef   defaultResolver,
                        CFArrayRemoveValueAtIndex(supplemental, 0);
                }
        }
                        CFArrayRemoveValueAtIndex(supplemental, 0);
                }
        }
+#endif // SPECIAL_HANDLING_FOR_DEFAULT_DOMAIN
 
        // establish resolver configuration
 
 
        // establish resolver configuration
 
@@ -883,6 +980,12 @@ dns_configuration_set(CFDictionaryRef   defaultResolver,
                        _dns_resolver_free(&resolver);
                }
 
                        _dns_resolver_free(&resolver);
                }
 
+#if    !TARGET_OS_IPHONE
+               // add flatfile resolvers
+
+               _dnsinfo_flatfile_add_resolvers(&_config);
+#endif // !TARGET_OS_IPHONE
+
                // save configuration
 
                if (!_dns_configuration_store(&_config)) {
                // save configuration
 
                if (!_dns_configuration_store(&_config)) {
@@ -899,44 +1002,85 @@ dns_configuration_set(CFDictionaryRef   defaultResolver,
 }
 
 
 }
 
 
+#if    !TARGET_OS_IPHONE
+static SCDynamicStoreRef       dns_configuration_store;
+static SCDynamicStoreCallBack  dns_configuration_callout;
+
 static void
 static void
-load_predefined_resolvers(CFBundleRef bundle)
+dns_configuration_changed(CFMachPortRef port, void *msg, CFIndex size, void *info)
 {
 {
-       Boolean                 ok;
-       CFURLRef                url;
-       CFStringRef             xmlError        = NULL;
-       CFDataRef               xmlResolvers    = NULL;
+       CFStringRef     key             = CFSTR(_PATH_RESOLVER_DIR);
+       CFArrayRef      keys;
+       Boolean         resolvers_now;
+       static Boolean  resolvers_save  = FALSE;
+       struct stat     statbuf;
+
+       resolvers_now = (stat(_PATH_RESOLVER_DIR, &statbuf) == 0);
+       if (!resolvers_save && (resolvers_save == resolvers_now)) {
+               // if we did not (and still do not) have an "/etc/resolvers"
+               // directory than this notification is the result of a change
+               // to the "/etc" directory.
+               return;
+       }
+       resolvers_save = resolvers_now;
+
+       SCLog(TRUE, LOG_DEBUG, CFSTR(_PATH_RESOLVER_DIR " changed"));
 
 
-       url = CFBundleCopyResourceURL(bundle, CFSTR("Resolvers"), CFSTR("plist"), NULL);
-       if (url == NULL) {
+       // fake a "DNS" change
+       keys = CFArrayCreate(NULL, (const void **)&key, 1, &kCFTypeArrayCallBacks);
+       (*dns_configuration_callout)(dns_configuration_store, keys, NULL);
+       CFRelease(keys);
+       return;
+}
+
+
+__private_extern__
+void
+dns_configuration_monitor(SCDynamicStoreRef store, SCDynamicStoreCallBack callout)
+{
+       CFMachPortRef           mp;
+       mach_port_t             notify_port;
+       int                     notify_token;
+       CFRunLoopSourceRef      rls;
+       uint32_t                status;
+
+       dns_configuration_store   = store;
+       dns_configuration_callout = callout;
+
+       status = notify_register_mach_port(_PATH_RESOLVER_DIR, &notify_port, 0, &notify_token);
+       if (status != NOTIFY_STATUS_OK) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("notify_register_mach_port() failed"));
                return;
        }
 
                return;
        }
 
-       ok = CFURLCreateDataAndPropertiesFromResource(NULL, url, &xmlResolvers, NULL, NULL, NULL);
-       CFRelease(url);
-       if (!ok || (xmlResolvers == NULL)) {
+       status = notify_monitor_file(notify_token, "/private" _PATH_RESOLVER_DIR, 0);
+       if (status != NOTIFY_STATUS_OK) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("notify_monitor_file() failed"));
+               (void)notify_cancel(notify_token);
                return;
        }
 
                return;
        }
 
-       /* convert the XML data into a property list */
-       S_predefined = CFPropertyListCreateFromXMLData(NULL, xmlResolvers, kCFPropertyListImmutable, &xmlError);
-       CFRelease(xmlResolvers);
-       if (S_predefined == NULL) {
-               if (xmlError != NULL) {
-                       SCLog(TRUE, LOG_DEBUG, CFSTR("add_predefined_resolvers: %@"), xmlError);
-                       CFRelease(xmlError);
-               }
+       mp = CFMachPortCreateWithPort(NULL, notify_port, dns_configuration_changed, NULL, NULL);
+       if (mp == NULL) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("CFMachPortCreateWithPort() failed"));
+               (void)notify_cancel(notify_token);
                return;
        }
 
                return;
        }
 
-       if (!isA_CFArray(S_predefined)) {
-               CFRelease(S_predefined);
-               S_predefined = NULL;
+       rls = CFMachPortCreateRunLoopSource(NULL, mp, -1);
+       if (rls == NULL) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreateRunLoopSource() failed"));
+               CFRelease(mp);
+               (void)notify_cancel(notify_token);
                return;
        }
                return;
        }
+       CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
+       CFRelease(rls);
 
 
+       CFRelease(mp);
        return;
 }
        return;
 }
+#endif // !TARGET_OS_IPHONE
 
 
 __private_extern__
 
 
 __private_extern__
@@ -947,11 +1091,13 @@ dns_configuration_init(CFBundleRef bundle)
 
        dict = CFBundleGetInfoDictionary(bundle);
        if (isA_CFDictionary(dict)) {
 
        dict = CFBundleGetInfoDictionary(bundle);
        if (isA_CFDictionary(dict)) {
+               S_mdns_timeout = CFDictionaryGetValue(dict, CFSTR("mdns_timeout"));
+               S_mdns_timeout = isA_CFNumber(S_mdns_timeout);
+
                S_pdns_timeout = CFDictionaryGetValue(dict, CFSTR("pdns_timeout"));
                S_pdns_timeout = isA_CFNumber(S_pdns_timeout);
        }
 
                S_pdns_timeout = CFDictionaryGetValue(dict, CFSTR("pdns_timeout"));
                S_pdns_timeout = isA_CFNumber(S_pdns_timeout);
        }
 
-       load_predefined_resolvers(bundle);
        return;
 }
 
        return;
 }
 
@@ -987,6 +1133,7 @@ main(int argc, char **argv)
 {
        CFDictionaryRef         entities;
        CFStringRef             key;
 {
        CFDictionaryRef         entities;
        CFStringRef             key;
+       CFArrayRef              multicast_resolvers;
        CFStringRef             pattern;
        CFMutableArrayRef       patterns;
        CFStringRef             primary         = NULL;
        CFStringRef             pattern;
        CFMutableArrayRef       patterns;
        CFStringRef             primary         = NULL;
@@ -1050,6 +1197,14 @@ main(int argc, char **argv)
                service_order = CFDictionaryGetValue(setup_global_ipv4, kSCPropNetServiceOrder);
        }
 
                service_order = CFDictionaryGetValue(setup_global_ipv4, kSCPropNetServiceOrder);
        }
 
+       // get multicast resolvers
+       key = SCDynamicStoreKeyCreate(NULL, CFSTR("%@/%@/%@"),
+                                     kSCDynamicStoreDomainState,
+                                     kSCCompNetwork,
+                                     CFSTR(kDNSServiceCompMulticastDNS));
+       multicast_resolvers = SCDynamicStoreCopyValue(store, key);
+       CFRelease(key);
+
        // get private resolvers
        key = SCDynamicStoreKeyCreate(NULL, CFSTR("%@/%@/%@"),
                                      kSCDynamicStoreDomainState,
        // get private resolvers
        key = SCDynamicStoreKeyCreate(NULL, CFSTR("%@/%@/%@"),
                                      kSCDynamicStoreDomainState,
@@ -1060,11 +1215,16 @@ main(int argc, char **argv)
 
        // update DNS configuration
        dns_configuration_init(CFBundleGetMainBundle());
 
        // update DNS configuration
        dns_configuration_init(CFBundleGetMainBundle());
-       dns_configuration_set(primaryDNS, service_state_dict, service_order, private_resolvers);
+       dns_configuration_set(primaryDNS,
+                             service_state_dict,
+                             service_order,
+                             multicast_resolvers,
+                             private_resolvers);
 
        // cleanup
        if (setup_global_ipv4 != NULL)  CFRelease(setup_global_ipv4);
        if (state_global_ipv4 != NULL)  CFRelease(state_global_ipv4);
 
        // cleanup
        if (setup_global_ipv4 != NULL)  CFRelease(setup_global_ipv4);
        if (state_global_ipv4 != NULL)  CFRelease(state_global_ipv4);
+       if (multicast_resolvers != NULL) CFRelease(multicast_resolvers);
        if (private_resolvers != NULL)  CFRelease(private_resolvers);
        CFRelease(service_state_dict);
        CFRelease(store);
        if (private_resolvers != NULL)  CFRelease(private_resolvers);
        CFRelease(service_state_dict);
        CFRelease(store);
index 7c45f5353dfe2982b3296b7450e7dd5d0fd1bbe7..51062b020f7e4c9723a8957fa6f2f787849f6e0a 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2006, 2008, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -24,6 +24,7 @@
 #ifndef _DNS_CONFIGURATION_H
 #define _DNS_CONFIGURATION_H
 
 #ifndef _DNS_CONFIGURATION_H
 #define _DNS_CONFIGURATION_H
 
+#include <TargetConditionals.h>
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 
@@ -31,9 +32,16 @@ __BEGIN_DECLS
 
 void   dns_configuration_init          (CFBundleRef            bundle);
 
 
 void   dns_configuration_init          (CFBundleRef            bundle);
 
+
+#if    !TARGET_OS_IPHONE
+void   dns_configuration_monitor       (SCDynamicStoreRef      store,
+                                        SCDynamicStoreCallBack callout);
+#endif // !TARGET_OS_IPHONE
+
 void   dns_configuration_set           (CFDictionaryRef        defaultResolver,
                                         CFDictionaryRef        services,
                                         CFArrayRef             serviceOrder,
 void   dns_configuration_set           (CFDictionaryRef        defaultResolver,
                                         CFDictionaryRef        services,
                                         CFArrayRef             serviceOrder,
+                                        CFArrayRef             multicastResolvers,
                                         CFArrayRef             privateResolvers);
 
 __END_DECLS
                                         CFArrayRef             privateResolvers);
 
 __END_DECLS
index 4999309d7c3cbd3c263a4304815c551fb4230bbb..e5c7b141d008288795aa42e3f4831a7056bf571a 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2007 Apple Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2009 Apple Inc.  All Rights Reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -63,6 +63,9 @@
  *
  * June 20, 2006       Allan Nathanson (ajn@apple.com)
  * - add SMB configuration
  *
  * June 20, 2006       Allan Nathanson (ajn@apple.com)
  * - add SMB configuration
+ *
+ * December 5, 2007    Dieter Siegmund (dieter@apple.com)
+ * - added support for multiple scoped routes
  */
 
 #include <stdlib.h>
  */
 
 #include <stdlib.h>
 #include <notify.h>
 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <notify.h>
 
 #include <SystemConfiguration/SystemConfiguration.h>
+#include <SystemConfiguration/SCDynamicStoreCopyDHCPInfo.h>
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>     /* for SCLog() */
 #include <dnsinfo.h>
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>     /* for SCLog() */
 #include <dnsinfo.h>
+#if    !TARGET_OS_IPHONE
+#include <dnsinfo_create.h>
+#endif /* !TARGET_OS_IPHONE */
 
 #include <dns_sd.h>
 
 #include <dns_sd.h>
+#ifndef        kDNSServiceCompMulticastDNS
+#define        kDNSServiceCompMulticastDNS     "MulticastDNS"
+#endif
 #ifndef        kDNSServiceCompPrivateDNS
 #define        kDNSServiceCompPrivateDNS       "PrivateDNS"
 #endif
 
 #ifndef        kDNSServiceCompPrivateDNS
 #define        kDNSServiceCompPrivateDNS       "PrivateDNS"
 #endif
 
+enum {
+    kProtocolFlagsNone         = 0x0,
+    kProtocolFlagsIPv4         = 0x1,
+    kProtocolFlagsIPv6         = 0x2
+};
+typedef uint8_t        ProtocolFlags;
+
+enum {
+    kDebugFlag1                = 0x00000001,
+    kDebugFlag2                = 0x00000002,
+    kDebugFlag4                = 0x00000004,
+    kDebugFlag8                = 0x00000008,
+    kDebugFlagDefault  = kDebugFlag1,
+    kDebugFlagAll      = 0xffffffff
+};
+
+#ifdef TEST_IPV4_ROUTELIST
+#define ROUTELIST_DEBUG(a, f) { if ((S_IPMonitor_debug & (f)) != 0)  printf a ;}
+#else
+#define ROUTELIST_DEBUG(a, f)
+#endif
+
 #include "set-hostname.h"
 #include "dns-configuration.h"
 #include "set-hostname.h"
 #include "dns-configuration.h"
+#if    !TARGET_OS_IPHONE
 #include "smb-configuration.h"
 #include "smb-configuration.h"
+#endif /* !TARGET_OS_IPHONE */
+
+#define PPP_PREFIX     "ppp"
 
 #define IP_FORMAT      "%d.%d.%d.%d"
 #define IP_CH(ip)      ((u_char *)(ip))
 #define IP_LIST(ip)    IP_CH(ip)[0],IP_CH(ip)[1],IP_CH(ip)[2],IP_CH(ip)[3]
 
 
 #define IP_FORMAT      "%d.%d.%d.%d"
 #define IP_CH(ip)      ((u_char *)(ip))
 #define IP_LIST(ip)    IP_CH(ip)[0],IP_CH(ip)[1],IP_CH(ip)[2],IP_CH(ip)[3]
 
-/* debug output on/off */
-static boolean_t               S_IPMonitor_debug = FALSE;
+typedef uint32_t       Rank;
+
+enum {
+    kRankFirst         = 0,
+    kRankLast          = UINT_MAX
+};
+
+/*
+ * IPv4 Route management
+ */
+
+typedef uint32_t       RouteFlags;
+
+enum {
+    kRouteIsDirectToInterfaceFlag      = 0x00000001,
+    kRouteIsNotSubnetLocalFlag                 = 0x00000002,
+    kRouteChooseFirstFlag              = 0x00000004,
+    kRouteChooseLastFlag               = 0x00000008,
+    kRouteChooseNeverFlag              = 0x00000010,
+    kRouteIsScopedFlag                 = 0x00000020,
+    kRouteWantScopedFlag               = (kRouteChooseNeverFlag|kRouteIsScopedFlag),
+};
+
+typedef struct {
+    struct in_addr     dest;
+    struct in_addr     mask;
+    struct in_addr     gateway;
+    char               ifname[IFNAMSIZ];
+    unsigned int       ifindex;
+    struct in_addr     ifa;
+    Rank               rank;
+    RouteFlags         flags;
+} IPv4Route, *IPv4RouteRef;
+
+typedef struct {
+    int                        count;
+    int                        size;
+    IPv4Route          list[1];        /* variable length */
+} IPv4RouteList, *IPv4RouteListRef;
+
+enum {
+    kIPv4RouteListAddRouteCommand,
+    kIPv4RouteListRemoveRouteCommand
+};
+
+typedef uint32_t       IPv4RouteListApplyCommand;
+
+typedef void IPv4RouteListApplyCallBackFunc(IPv4RouteListApplyCommand cmd,
+                                           IPv4RouteRef route, void * arg);
+typedef IPv4RouteListApplyCallBackFunc * IPv4RouteListApplyCallBackFuncPtr;
+
+/* SCDynamicStore session */
+static SCDynamicStoreRef       S_session = NULL;
+
+/* debug output flags */
+static uint32_t                        S_IPMonitor_debug = 0;
 
 /* are we netbooted?  If so, don't touch the default route */
 static boolean_t               S_netboot = FALSE;
 
 
 /* are we netbooted?  If so, don't touch the default route */
 static boolean_t               S_netboot = FALSE;
 
+/* is scoped routing enabled? */
+#ifdef RTF_IFSCOPE
+static boolean_t               S_scopedroute = FALSE;
+#endif /* RTF_IFSCOPE */
+
 /* dictionary to hold per-service state: key is the serviceID */
 static CFMutableDictionaryRef  S_service_state_dict = NULL;
 /* dictionary to hold per-service state: key is the serviceID */
 static CFMutableDictionaryRef  S_service_state_dict = NULL;
+static CFMutableDictionaryRef  S_ipv4_service_rank_dict = NULL;
+static CFMutableDictionaryRef  S_ipv6_service_rank_dict = NULL;
 
 /* if set, a PPP interface overrides the primary */
 static boolean_t               S_ppp_override_primary = FALSE;
 
 /* if set, a PPP interface overrides the primary */
 static boolean_t               S_ppp_override_primary = FALSE;
@@ -116,32 +213,35 @@ static CFStringRef                S_primary_ipv4 = NULL;
 static CFStringRef             S_primary_ipv6 = NULL;
 static CFStringRef             S_primary_dns = NULL;
 static CFStringRef             S_primary_proxies = NULL;
 static CFStringRef             S_primary_ipv6 = NULL;
 static CFStringRef             S_primary_dns = NULL;
 static CFStringRef             S_primary_proxies = NULL;
-static CFStringRef             S_primary_smb = NULL;
 
 static CFStringRef             S_state_global_ipv4 = NULL;
 static CFStringRef             S_state_global_ipv6 = NULL;
 static CFStringRef             S_state_global_dns = NULL;
 static CFStringRef             S_state_global_proxies = NULL;
 
 static CFStringRef             S_state_global_ipv4 = NULL;
 static CFStringRef             S_state_global_ipv6 = NULL;
 static CFStringRef             S_state_global_dns = NULL;
 static CFStringRef             S_state_global_proxies = NULL;
-static CFStringRef             S_state_global_smb = NULL;
 static CFStringRef             S_state_service_prefix = NULL;
 static CFStringRef             S_setup_global_ipv4 = NULL;
 static CFStringRef             S_setup_global_proxies = NULL;
 static CFStringRef             S_state_service_prefix = NULL;
 static CFStringRef             S_setup_global_ipv4 = NULL;
 static CFStringRef             S_setup_global_proxies = NULL;
-static CFStringRef             S_setup_global_smb = NULL;
 static CFStringRef             S_setup_service_prefix = NULL;
 
 static CFStringRef             S_setup_service_prefix = NULL;
 
+static CFStringRef             S_multicast_resolvers = NULL;
 static CFStringRef             S_private_resolvers = NULL;
 
 static CFStringRef             S_private_resolvers = NULL;
 
-static struct in_addr          S_router_subnet = { 0 };
-static struct in_addr          S_router_subnet_mask = { 0 };
+static IPv4RouteListRef                S_ipv4_routelist = NULL;
 
 static const struct in_addr    S_ip_zeros = { 0 };
 static const struct in6_addr   S_ip6_zeros = IN6ADDR_ANY_INIT;
 
 
 static const struct in_addr    S_ip_zeros = { 0 };
 static const struct in6_addr   S_ip6_zeros = IN6ADDR_ANY_INIT;
 
+static boolean_t               S_append_state = FALSE;
 
 
-#define kRouterNeedsLocalIP    CFSTR("com.apple.IPMonitor.RouterNeedsLocalIP")
-#define kRouterIsDirect                CFSTR("com.apple.IPMonitor.IsDirect")
+#if    !TARGET_OS_IPHONE
+static CFStringRef             S_primary_smb = NULL;
+static CFStringRef             S_state_global_smb = NULL;
+static CFStringRef             S_setup_global_smb = NULL;
+#endif /* !TARGET_OS_IPHONE */
 
 
+#if    !TARGET_OS_IPHONE
 #define VAR_RUN_RESOLV_CONF    "/var/run/resolv.conf"
 #define VAR_RUN_RESOLV_CONF    "/var/run/resolv.conf"
+#endif /* !TARGET_OS_IPHONE */
 
 #ifndef KERN_NETBOOT
 #define KERN_NETBOOT           40      /* int: are we netbooted? 1=yes,0=no */
 
 #ifndef KERN_NETBOOT
 #define KERN_NETBOOT           40      /* int: are we netbooted? 1=yes,0=no */
@@ -151,29 +251,42 @@ static const struct in6_addr      S_ip6_zeros = IN6ADDR_ANY_INIT;
  ** entityType*, GetEntityChanges*
  ** - definitions for the entity types we handle
  **/
  ** entityType*, GetEntityChanges*
  ** - definitions for the entity types we handle
  **/
-#define ENTITY_TYPES_COUNT     5
 enum {
     kEntityTypeIPv4    = 0,
 enum {
     kEntityTypeIPv4    = 0,
-    kEntityTypeIPv6    = 1,
-    kEntityTypeDNS     = 2,
-    kEntityTypeProxies = 3,
-    kEntityTypeSMB     = 4,
+    kEntityTypeIPv6,
+    kEntityTypeDNS,
+    kEntityTypeProxies,
+#if    !TARGET_OS_IPHONE
+    kEntityTypeSMB,
+#endif /* !TARGET_OS_IPHONE */
+    ENTITY_TYPES_COUNT,
+    kEntityTypeServiceOptions  = 31
 };
 typedef uint32_t       EntityType;
 
 };
 typedef uint32_t       EntityType;
 
-static CFStringRef entityTypeNames[ENTITY_TYPES_COUNT];
+static const CFStringRef *entityTypeNames[ENTITY_TYPES_COUNT] = {
+    &kSCEntNetIPv4,    /* 0 */
+    &kSCEntNetIPv6,    /* 1 */
+    &kSCEntNetDNS,     /* 2 */
+    &kSCEntNetProxies, /* 3 */
+#if    !TARGET_OS_IPHONE
+    &kSCEntNetSMB,     /* 4 */
+#endif /* !TARGET_OS_IPHONE */
+};
 
 
-typedef boolean_t (GetEntityChangesFunc)(CFStringRef serviceID,
-                                        CFDictionaryRef state_dict,
-                                        CFDictionaryRef setup_dict,
-                                        CFDictionaryRef info);
+typedef boolean_t GetEntityChangesFunc(CFStringRef serviceID,
+                                      CFDictionaryRef state_dict,
+                                      CFDictionaryRef setup_dict,
+                                      CFDictionaryRef info);
 typedef GetEntityChangesFunc * GetEntityChangesFuncRef;
 
 static GetEntityChangesFunc get_ipv4_changes;
 static GetEntityChangesFunc get_ipv6_changes;
 static GetEntityChangesFunc get_dns_changes;
 static GetEntityChangesFunc get_proxies_changes;
 typedef GetEntityChangesFunc * GetEntityChangesFuncRef;
 
 static GetEntityChangesFunc get_ipv4_changes;
 static GetEntityChangesFunc get_ipv6_changes;
 static GetEntityChangesFunc get_dns_changes;
 static GetEntityChangesFunc get_proxies_changes;
+#if    !TARGET_OS_IPHONE
 static GetEntityChangesFunc get_smb_changes;
 static GetEntityChangesFunc get_smb_changes;
+#endif /* !TARGET_OS_IPHONE */
 
 static void
 my_CFRelease(void * t);
 
 static void
 my_CFRelease(void * t);
@@ -189,7 +302,9 @@ static const GetEntityChangesFuncRef entityChangeFunc[ENTITY_TYPES_COUNT] = {
     get_ipv6_changes,  /* 1 */
     get_dns_changes,   /* 2 */
     get_proxies_changes,/* 3 */
     get_ipv6_changes,  /* 1 */
     get_dns_changes,   /* 2 */
     get_proxies_changes,/* 3 */
+#if    !TARGET_OS_IPHONE
     get_smb_changes,   /* 4 */
     get_smb_changes,   /* 4 */
+#endif /* !TARGET_OS_IPHONE */
 };
 
 /**
 };
 
 /**
@@ -266,24 +381,27 @@ keyChangeListApplyToStore(keyChangeListRef keys, SCDynamicStoreRef session)
     if (set == NULL && remove == NULL && notify == NULL) {
        return;
     }
     if (set == NULL && remove == NULL && notify == NULL) {
        return;
     }
-    if (S_IPMonitor_debug) {
+    if (S_IPMonitor_debug & kDebugFlag1) {
        if (set != NULL) {
        if (set != NULL) {
-           SCLog(TRUE, LOG_INFO, CFSTR("IPMonitor: Setting:\n%@\n"), set);
+           SCLog(TRUE, LOG_NOTICE, CFSTR("IPMonitor: Setting:\n%@"),
+                 set);
        }
        if (remove != NULL) {
        }
        if (remove != NULL) {
-           SCLog(TRUE, LOG_INFO, CFSTR("IPMonitor: Removing:\n%@\n"), remove);
+           SCLog(TRUE, LOG_NOTICE, CFSTR("IPMonitor: Removing:\n%@"),
+                 remove);
        }
        if (notify != NULL) {
        }
        if (notify != NULL) {
-           SCLog(TRUE, LOG_INFO, CFSTR("IPMonitor: Notifying:\n%@\n"), notify);
+           SCLog(TRUE, LOG_NOTICE, CFSTR("IPMonitor: Notifying:\n%@"),
+                 notify);
        }
     }
     (void)SCDynamicStoreSetMultiple(session, set, remove, notify);
 
     status = notify_post("com.apple.system.config.network_change");
     if (status == NOTIFY_STATUS_OK) {
        }
     }
     (void)SCDynamicStoreSetMultiple(session, set, remove, notify);
 
     status = notify_post("com.apple.system.config.network_change");
     if (status == NOTIFY_STATUS_OK) {
-           SCLog(TRUE, LOG_INFO, CFSTR("network configuration changed."));
+       SCLog(TRUE, LOG_NOTICE, CFSTR("network configuration changed."));
     } else {
     } else {
-       SCLog(TRUE, LOG_INFO,
+       SCLog(TRUE, LOG_NOTICE,
              CFSTR("IPMonitor: notify_post() failed: error=%ld"), status);
     }
 
              CFSTR("IPMonitor: notify_post() failed: error=%ld"), status);
     }
 
@@ -291,7 +409,7 @@ keyChangeListApplyToStore(keyChangeListRef keys, SCDynamicStoreRef session)
 }
 
 static boolean_t
 }
 
 static boolean_t
-S_netboot_root()
+S_is_network_boot()
 {
     int mib[2];
     size_t len;
 {
     int mib[2];
     size_t len;
@@ -304,6 +422,23 @@ S_netboot_root()
     return (netboot);
 }
 
     return (netboot);
 }
 
+#ifdef RTF_IFSCOPE
+static boolean_t
+S_is_scoped_routing_enabled()
+{
+    int            scopedroute = 0;
+    size_t  len                = sizeof(scopedroute);
+
+    if ((sysctlbyname("net.inet.ip.scopedroute",
+                     &scopedroute, &len,
+                     NULL, 0) == -1)
+       && (errno != ENOENT)) {
+       SCLog(TRUE, LOG_ERR, CFSTR("sysctlbyname() failed: %s"), strerror(errno));
+    }
+    return (scopedroute);
+}
+#endif /* RTF_IFSCOPE */
+
 static void
 my_CFArrayAppendUniqueValue(CFMutableArrayRef arr, CFTypeRef new)
 {
 static void
 my_CFArrayAppendUniqueValue(CFMutableArrayRef arr, CFTypeRef new)
 {
@@ -351,6 +486,15 @@ my_CFDictionaryGetDictionary(CFDictionaryRef dict, CFStringRef key)
     return (isA_CFDictionary(CFDictionaryGetValue(dict, key)));
 }
 
     return (isA_CFDictionary(CFDictionaryGetValue(dict, key)));
 }
 
+static CFArrayRef
+my_CFDictionaryGetArray(CFDictionaryRef dict, CFStringRef key)
+{
+    if (isA_CFDictionary(dict) == NULL) {
+       return (NULL);
+    }
+    return (isA_CFArray(CFDictionaryGetValue(dict, key)));
+}
+
 static boolean_t
 cfstring_to_ipvx(int family, CFStringRef str, void * addr, int addr_size)
 {
 static boolean_t
 cfstring_to_ipvx(int family, CFStringRef str, void * addr, int addr_size)
 {
@@ -395,186 +539,953 @@ cfstring_to_ip6(CFStringRef str, struct in6_addr * ip6_p)
     return (cfstring_to_ipvx(AF_INET6, str, ip6_p, sizeof(*ip6_p)));
 }
 
     return (cfstring_to_ipvx(AF_INET6, str, ip6_p, sizeof(*ip6_p)));
 }
 
-/*
- * Function: parse_component
- * Purpose:
- *   Given a string 'key' and a string prefix 'prefix',
- *   return the next component in the slash '/' separated
- *   key.
- *
- * Examples:
- * 1. key = "a/b/c" prefix = "a/"
- *    returns "b"
- * 2. key = "a/b/c" prefix = "a/b/"
- *    returns "c"
- */
 static CFStringRef
 static CFStringRef
-parse_component(CFStringRef key, CFStringRef prefix)
+setup_service_key(CFStringRef serviceID, CFStringRef entity)
 {
 {
-    CFMutableStringRef comp;
-    CFRange            range;
+    return (SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                       kSCDynamicStoreDomainSetup,
+                                                       serviceID,
+                                                       entity));
+}
 
 
-    if (CFStringHasPrefix(key, prefix) == FALSE) {
-       return (NULL);
-    }
-    comp = CFStringCreateMutableCopy(NULL, 0, key);
-    if (comp == NULL) {
-       return (NULL);
-    }
-    CFStringDelete(comp, CFRangeMake(0, CFStringGetLength(prefix)));
-    range = CFStringFind(comp, CFSTR("/"), 0);
-    if (range.location == kCFNotFound) {
-       return (comp);
-    }
-    range.length = CFStringGetLength(comp) - range.location;
-    CFStringDelete(comp, range);
-    return (comp);
+static CFStringRef
+state_service_key(CFStringRef serviceID, CFStringRef entity)
+{
+    return (SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                       kSCDynamicStoreDomainState,
+                                                       serviceID,
+                                                       entity));
 }
 
 }
 
-static CFMutableDictionaryRef
-service_dict_copy(CFStringRef serviceID)
+static CFDictionaryRef
+get_service_setup_entity(CFDictionaryRef service_info, CFStringRef serviceID,
+                        CFStringRef entity)
 {
 {
-    CFDictionaryRef            d = NULL;
-    CFMutableDictionaryRef     service_dict;
+    CFStringRef                setup_key;
+    CFDictionaryRef    setup_dict;
 
 
-    /* create a modifyable dictionary, a copy or a new one */
-    d = CFDictionaryGetValue(S_service_state_dict, serviceID);
-    if (d == NULL) {
-       service_dict
-           = CFDictionaryCreateMutable(NULL, 0,
-                                       &kCFTypeDictionaryKeyCallBacks,
-                                       &kCFTypeDictionaryValueCallBacks);
-    }
-    else {
-       service_dict = CFDictionaryCreateMutableCopy(NULL, 0, d);
+    setup_key = setup_service_key(serviceID, entity);
+    setup_dict = my_CFDictionaryGetDictionary(service_info, setup_key);
+    my_CFRelease(&setup_key);
+    return (setup_dict);
+}
+
+static CFDictionaryRef
+get_service_state_entity(CFDictionaryRef service_info, CFStringRef serviceID,
+                        CFStringRef entity)
+{
+    CFStringRef                state_key;
+    CFDictionaryRef    state_dict;
+
+    state_key = state_service_key(serviceID, entity);
+    state_dict = my_CFDictionaryGetDictionary(service_info, state_key);
+    my_CFRelease(&state_key);
+    return (state_dict);
+}
+
+static boolean_t
+dict_get_first_ip(CFDictionaryRef dict, CFStringRef prop, struct in_addr * ip_p)
+{
+    CFArrayRef         ip_list;
+
+    ip_list = CFDictionaryGetValue(dict, prop);
+    if (isA_CFArray(ip_list) != NULL
+       && CFArrayGetCount(ip_list) > 0
+       && cfstring_to_ip(CFArrayGetValueAtIndex(ip_list, 0), ip_p)) {
+       return (TRUE);
     }
     }
-    return (service_dict);
+    return (FALSE);
 }
 
 static boolean_t
 }
 
 static boolean_t
-service_dict_set(CFStringRef serviceID, CFStringRef entity,
-                CFDictionaryRef new_dict)
+get_override_primary(CFDictionaryRef dict)
 {
 {
-    boolean_t                  changed = FALSE;
-    CFDictionaryRef            old;
-    CFMutableDictionaryRef     service_dict;
+    CFTypeRef  override;
 
 
-    service_dict = service_dict_copy(serviceID);
-    old = CFDictionaryGetValue(service_dict, entity);
-    if (new_dict == NULL) {
-       if (old != NULL) {
-           SCLog(S_IPMonitor_debug, LOG_INFO,
-                 CFSTR("IPMonitor: serviceID %@ removed %@ dictionary = %@"),
-                 serviceID, entity, old);
-           CFDictionaryRemoveValue(service_dict, entity);
-           changed = TRUE;
+    override = CFDictionaryGetValue(dict, kSCPropNetOverridePrimary);
+    if (isA_CFNumber(override) != NULL) {
+       int     val = 0;
+
+       CFNumberGetValue((CFNumberRef)override, kCFNumberIntType, &val);
+       if (val != 0) {
+           return (TRUE);
        }
     }
        }
     }
-    else {
-       if (old == NULL || CFEqual(new_dict, old) == FALSE) {
-           SCLog(S_IPMonitor_debug, LOG_INFO,
-                 CFSTR("IPMonitor: serviceID %@ changed %@"
-                       " dictionary\nold %@\nnew %@"), serviceID, entity,
-                 (old != NULL) ? (CFTypeRef)old : (CFTypeRef)CFSTR("<none>"),
-                 new_dict);
-           CFDictionarySetValue(service_dict, entity, new_dict);
-           changed = TRUE;
+    else if (isA_CFBoolean(override) != NULL) {
+       if (CFBooleanGetValue(override)) {
+           return (TRUE);
        }
     }
        }
     }
-    if (CFDictionaryGetCount(service_dict) == 0) {
-       CFDictionaryRemoveValue(S_service_state_dict, serviceID);
-    }
-    else {
-       CFDictionarySetValue(S_service_state_dict, serviceID, service_dict);
-    }
-    my_CFRelease(&service_dict);
-    return (changed);
+    return (FALSE);
 }
 
 }
 
-static CFDictionaryRef
-service_dict_get(CFStringRef serviceID, CFStringRef entity)
+/**
+ ** IPv4Route*
+ **/
+
+static __inline__ struct in_addr
+subnet_addr(struct in_addr addr, struct in_addr mask)
 {
 {
-    CFDictionaryRef    service_dict;
+    struct in_addr     net;
 
 
-    service_dict = CFDictionaryGetValue(S_service_state_dict, serviceID);
-    if (service_dict == NULL) {
-       return (NULL);
-    }
-    return (CFDictionaryGetValue(service_dict, entity));
+    net.s_addr = addr.s_addr & mask.s_addr;
+    return (net);
 }
 
 }
 
-#define        ALLOW_EMTPY_STRING      1<<0
-
-static CFTypeRef
-sanitize_prop(CFTypeRef val, uint32_t flags)
+static __inline__ int
+uint32_cmp(uint32_t a, uint32_t b)
 {
 {
-    if (val != NULL) {
-       if (isA_CFString(val)) {
-           CFMutableStringRef  str;
+    int                ret;
 
 
-           str = CFStringCreateMutableCopy(NULL, 0, (CFStringRef)val);
-           CFStringTrimWhitespace(str);
-           if (!(flags & ALLOW_EMTPY_STRING) && (CFStringGetLength(str) == 0)) {
-               CFRelease(str);
-               str = NULL;
-           }
-           val = str;
-       } else {
-           CFRetain(val);
-       }
+    if (a == b) {
+       ret = 0;
+    }
+    else if (a < b) {
+       ret = -1;
+    }
+    else {
+       ret = 1;
     }
     }
+    return (ret);
+}
 
 
-    return val;
+static __inline__ int
+in_addr_cmp(struct in_addr a, struct in_addr b)
+{
+    return (uint32_cmp(ntohl(a.s_addr), ntohl(b.s_addr)));
 }
 
 }
 
-static void
-merge_array_prop(CFMutableDictionaryRef        dict,
-                CFStringRef            key,
-                CFDictionaryRef        state_dict,
-                CFDictionaryRef        setup_dict,
-                uint32_t               flags,
-                Boolean                append)
+static __inline__ int
+RankCompare(Rank a, Rank b)
 {
 {
-    CFMutableArrayRef  merge_prop;
-    CFArrayRef         setup_prop = NULL;
-    CFArrayRef         state_prop = NULL;
+    return (uint32_cmp(a, b));
+}
 
 
-    if (setup_dict != NULL) {
-       setup_prop = isA_CFArray(CFDictionaryGetValue(setup_dict, key));
+static __inline__ int
+RouteFlagsCompare(RouteFlags a, RouteFlags b)
+{
+    return (uint32_cmp(a, b));
+}
+
+static void
+IPv4RouteCopyDescriptionWithString(IPv4RouteRef r, CFMutableStringRef str)
+{
+    CFStringAppendFormat(str, NULL,
+                        CFSTR("Dest " IP_FORMAT
+                              " Mask " IP_FORMAT
+                              " Gate " IP_FORMAT
+                              " Ifp %s Ifa " IP_FORMAT),
+                        IP_LIST(&r->dest),
+                        IP_LIST(&r->mask),
+                        IP_LIST(&r->gateway),
+                        (r->ifname[0] != '\0') ? r->ifname : "<none>",
+                        IP_LIST(&r->ifa));
+    if ((r->flags & kRouteIsNotSubnetLocalFlag) != 0) {
+       CFStringAppend(str, CFSTR(" [non-local]"));
     }
     }
-    if (state_dict != NULL) {
-       state_prop = isA_CFArray(CFDictionaryGetValue(state_dict, key));
+    else if ((r->flags & kRouteIsDirectToInterfaceFlag) != 0) {
+       CFStringAppend(str, CFSTR(" [direct]"));
     }
     }
-
-    if ((setup_prop == NULL) && (state_prop == NULL)) {
-       return;
+    if ((r->flags & kRouteChooseFirstFlag) != 0) {
+       CFStringAppend(str, CFSTR(" [first]"));
     }
     }
+    if ((r->flags & kRouteChooseLastFlag) != 0) {
+       CFStringAppend(str, CFSTR(" [last]"));
+    }
+    if ((r->flags & kRouteChooseNeverFlag) != 0) {
+       CFStringAppend(str, CFSTR(" [never]"));
+    }
+    if ((r->flags & kRouteIsScopedFlag) != 0) {
+       CFStringAppend(str, CFSTR(" [SCOPED]"));
+    }
+    else if ((r->flags & kRouteWantScopedFlag) != 0) {
+       CFStringAppend(str, CFSTR(" [SCOPED*]"));
+    }
+    return;
+}
 
 
-    merge_prop = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-    if (setup_prop != NULL) {
-       CFIndex i;
-       CFIndex n;
-
-       n = CFArrayGetCount(setup_prop);
-       for (i = 0; i < n; i++) {
-           CFTypeRef   val;
+static CFStringRef
+IPv4RouteCopyDescription(IPv4RouteRef r)
+{
+    CFMutableStringRef str;
 
 
-           val = CFArrayGetValueAtIndex(setup_prop, i);
-           val = sanitize_prop(val, flags);
-           if (val != NULL) {
-               CFArrayAppendValue(merge_prop, val);
-               CFRelease(val);
-           }
-       }
-    }
-    if (state_prop != NULL) {
-       CFIndex i;
-       CFIndex n;
-       CFRange setup_range     = CFRangeMake(0, CFArrayGetCount(merge_prop));
+    str = CFStringCreateMutable(NULL, 0);
+    IPv4RouteCopyDescriptionWithString(r, str);
+    return (str);
+}
 
 
-       n = CFArrayGetCount(state_prop);
-       for (i = 0; i < n; i++) {
-           CFTypeRef   val;
+static __inline__ void
+IPv4RoutePrint(IPv4RouteRef route)
+{
+    CFStringRef        str = IPv4RouteCopyDescription(route);
+
+    SCPrint(TRUE, stdout, CFSTR("%@"), str);
+    CFRelease(str);
+    return;
+}
+
+static __inline__ void
+IPv4RouteLog(IPv4RouteRef route)
+{
+    CFStringRef        str = IPv4RouteCopyDescription(route);
+
+    SCLog(TRUE, LOG_NOTICE, CFSTR("%@"), str);
+    CFRelease(str);
+    return;
+}
+
+static int
+IPv4RouteCompare(IPv4RouteRef a, Rank a_rank,
+                IPv4RouteRef b, Rank b_rank, boolean_t * same_dest)
+{
+    int                cmp;
+
+    *same_dest = FALSE;
+    cmp = in_addr_cmp(a->dest, b->dest);
+    if (cmp == 0) {
+       cmp = in_addr_cmp(a->mask, b->mask);
+       if (cmp == 0) {
+           int         name_cmp = strcmp(a->ifname, b->ifname);
+
+           if (name_cmp == 0) {
+               cmp = 0;
+           }
+           else {
+               boolean_t a_never = (a->flags & kRouteChooseNeverFlag) != 0;
+               boolean_t b_never = (b->flags & kRouteChooseNeverFlag) != 0;
+               *same_dest = TRUE;
+
+               if (a_never != b_never) {
+                   if (a_never) {
+                       cmp = 1;
+                   }
+                   else {
+                       cmp = -1;
+                   }
+               }
+               else {
+                   boolean_t a_last = (a->flags & kRouteChooseLastFlag) != 0;
+                   boolean_t b_last = (b->flags & kRouteChooseLastFlag) != 0;
+
+                   if (a_last != b_last) {
+                       if (a_last) {
+                           cmp = 1;
+                       }
+                       else {
+                           cmp = -1;
+                       }
+                   }
+                   else {
+                       boolean_t a_first = (a->flags & kRouteChooseFirstFlag) != 0;
+                       boolean_t b_first = (b->flags & kRouteChooseFirstFlag) != 0;
+
+                       if (a_first != b_first) {
+                           if (a_first) {
+                               cmp = -1;
+                           }
+                           else {
+                               cmp = 1;
+                           }
+                       }
+                       else {
+                           cmp = RankCompare(a_rank, b_rank);
+                           if (cmp == 0) {
+                               cmp = name_cmp;
+                           }
+                       }
+                   }
+               }
+           }
+       }
+    }
+    if ((S_IPMonitor_debug & kDebugFlag8) != 0) {
+       CFStringRef     a_str;
+       CFStringRef     b_str;
+       char            ch;
+
+       if (cmp < 0) {
+           ch = '<';
+       }
+       else if (cmp == 0) {
+           ch = '=';
+       }
+       else {
+           ch = '>';
+       }
+       a_str = IPv4RouteCopyDescription(a);
+       b_str = IPv4RouteCopyDescription(b);
+       SCLog(TRUE, LOG_NOTICE, CFSTR("%@ rank %u %c %@ rank %u"),
+             a_str, a_rank, ch, b_str, b_rank);
+       CFRelease(a_str);
+       CFRelease(b_str);
+    }
+    return (cmp);
+}
+
+static CFStringRef
+IPv4RouteListCopyDescription(IPv4RouteListRef routes)
+{
+    int                        i;
+    IPv4RouteRef       r;
+    CFMutableStringRef str;
+
+    str = CFStringCreateMutable(NULL, 0);
+    CFStringAppendFormat(str, NULL, CFSTR("<IPv4RouteList[%d]> = {"),
+                        routes->count);
+    for (i = 0, r = routes->list; i < routes->count; i++, r++) {
+       CFStringAppendFormat(str, NULL, CFSTR("\n%2d. "), i);
+       IPv4RouteCopyDescriptionWithString(r, str);
+    }
+    CFStringAppend(str, CFSTR("\n}\n"));
+    return (str);
+}
+
+static __inline__ void
+IPv4RouteListPrint(IPv4RouteListRef routes)
+{
+    CFStringRef        str = IPv4RouteListCopyDescription(routes);
+
+    SCPrint(TRUE, stdout, CFSTR("%@"), str);
+    CFRelease(str);
+    return;
+}
+
+static __inline__ void
+IPv4RouteListLog(IPv4RouteListRef routes)
+{
+    CFStringRef        str = IPv4RouteListCopyDescription(routes);
+
+    SCLog(TRUE, LOG_NOTICE, CFSTR("%@"), str);
+    CFRelease(str);
+    return;
+}
+
+static __inline__ unsigned int
+IPv4RouteListComputeSize(unsigned int n)
+{
+    return (offsetof(IPv4RouteList, list[n]));
+}
+
+static IPv4RouteRef
+IPv4RouteListFindRoute(IPv4RouteListRef routes, IPv4RouteRef route)
+{
+    int                        i;
+    IPv4RouteRef       scan_result = NULL;
+    IPv4RouteRef       scan;
+
+    for (i = 0, scan = routes->list; i < routes->count; i++, scan++) {
+       if ((scan->dest.s_addr == route->dest.s_addr)
+           && (scan->mask.s_addr == route->mask.s_addr)
+           && (strcmp(scan->ifname, route->ifname) == 0)
+           && (scan->ifa.s_addr == route->ifa.s_addr)
+           && (scan->gateway.s_addr == route->gateway.s_addr)) {
+           /*
+            * So far, the routes look the same.  If the flags
+            * are also equiv than we've found a match.
+            */
+           RouteFlags  r_flags;
+           RouteFlags  s_flags;
+
+           s_flags = scan->flags;
+           if ((s_flags & kRouteWantScopedFlag) != 0) {
+               s_flags |= kRouteWantScopedFlag;
+           }
+           r_flags = route->flags;
+           if ((r_flags & kRouteWantScopedFlag) != 0) {
+               r_flags |= kRouteWantScopedFlag;
+           }
+           if (s_flags == r_flags) {
+               scan_result = scan;
+               break;
+           }
+       }
+    }
+    return (scan_result);
+}
+
+static void
+IPv4RouteListApply(IPv4RouteListRef old_routes, IPv4RouteListRef new_routes,
+                  IPv4RouteListApplyCallBackFuncPtr func, void * arg)
+{
+    int                        i;
+    IPv4RouteRef       scan;
+
+    if (old_routes == new_routes && old_routes == NULL) {
+       /* both old and new are NULL, so there's nothing to do */
+       return;
+    }
+    if (old_routes != NULL) {
+       for (i = 0, scan = old_routes->list;
+            i < old_routes->count;
+            i++, scan++) {
+           IPv4RouteRef        new_route = NULL;
+
+           if (new_routes != NULL) {
+               new_route = IPv4RouteListFindRoute(new_routes, scan);
+           }
+           if (new_route == NULL) {
+               if (func != NULL) {
+                   (*func)(kIPv4RouteListRemoveRouteCommand, scan, arg);
+               }
+           }
+       }
+    }
+    if (new_routes != NULL) {
+       for (i = 0, scan = new_routes->list;
+            i < new_routes->count;
+            i++, scan++) {
+           IPv4RouteRef        old_route = NULL;
+
+           if (old_routes != NULL) {
+               old_route = IPv4RouteListFindRoute(old_routes, scan);
+           }
+           if (old_route == NULL) {
+               if (func != NULL) {
+                   (*func)(kIPv4RouteListAddRouteCommand, scan, arg);
+               }
+           }
+       }
+    }
+    return;
+}
+
+/*
+ * Function: IPv4RouteListAddRoute
+ *
+ * Purpose:
+ *   Add the given IPv4Route to the list of routes, eliminating lower-ranked
+ *   duplicates on the same interface, and marking any lower ranked duplicates
+ *   on other interfaces with kRouteIsScopedFlag.
+ *
+ *   This routine assumes that if routes is not NULL, it is malloc'd memory.
+ *
+ * Returns:
+ *   Route list updated with the given route, possibly a different pointer,
+ *   due to using realloc'd memory.
+ */
+
+enum {
+    kScopeNone = 0,
+    kScopeThis = 1,
+    kScopeNext         = 2
+};
+
+static IPv4RouteListRef
+IPv4RouteListAddRoute(IPv4RouteListRef routes, int init_size,
+                     IPv4RouteRef this_route, Rank this_rank)
+{
+    int                        i;
+    int                        scope_which = kScopeNone;
+    IPv4RouteRef       scan;
+    int                        where = -1;
+
+    if (routes == NULL) {
+       routes = (IPv4RouteListRef)malloc(IPv4RouteListComputeSize(init_size));
+       routes->size = init_size;
+       routes->count = 0;
+    }
+    for (i = 0, scan = routes->list; i < routes->count;
+        i++, scan++) {
+       int             cmp;
+       boolean_t       same_dest;
+
+       cmp = IPv4RouteCompare(this_route, this_rank, scan, scan->rank, &same_dest);
+       if (cmp < 0) {
+           if (where == -1) {
+               if (same_dest == TRUE) {
+                   if ((scan->flags & kRouteIsScopedFlag) != 0) {
+                       ROUTELIST_DEBUG(("Hit 1: set scope on self\n"),
+                                       kDebugFlag8);
+                       scope_which = kScopeThis;
+                   }
+                   else {
+                       ROUTELIST_DEBUG(("Hit 2: set scope on next\n"),
+                                       kDebugFlag8);
+                       scope_which = kScopeNext;
+                   }
+               }
+               /* remember our insertion point, but keep going to find a dup */
+               where = i;
+           }
+       }
+       else if (cmp == 0) {
+           /* exact match */
+           if (where != -1) {
+               /* this route is a duplicate */
+               ROUTELIST_DEBUG(("Hit 3: removing [%d]\n", i), kDebugFlag8);
+               routes->count--;
+               if (i == routes->count) {
+                   /* last slot, decrementing gets rid of it */
+               }
+               else {
+                   bcopy(routes->list + i + 1,
+                         routes->list + i,
+                         sizeof(routes->list[0]) * (routes->count - i));
+               }
+               break;
+           }
+           /* resolve conflict using rank */
+           if (this_rank < scan->rank) {
+               boolean_t       is_scoped = FALSE;
+
+               if (scan->flags & kRouteIsScopedFlag) {
+                   is_scoped = TRUE;
+               }
+               ROUTELIST_DEBUG(("Hit 4:replacing [%d] rank %u < %u\n", i,
+                                this_rank,
+                                scan->rank), kDebugFlag8);
+               *scan = *this_route;
+               scan->rank = this_rank;
+               if (is_scoped) {
+                   /* preserve whether route was scoped */
+                   ROUTELIST_DEBUG(("Hit 5: preserved scope\n"), kDebugFlag8);
+                   scan->flags |= kRouteIsScopedFlag;
+               }
+           }
+           /* we're done */
+           goto done;
+       }
+       else {
+           if (same_dest == TRUE) {
+               if (scope_which == kScopeNone) {
+                   ROUTELIST_DEBUG(("Hit 10: set scope on self\n"),
+                                   kDebugFlag8);
+                   scope_which = kScopeThis;
+               }
+           }
+#ifdef TEST_IPV4_ROUTELIST
+           else if (where != -1) {
+               /* not possible because we maintain a sorted list */
+               ROUTELIST_DEBUG(("Hit 11: moved past routes - can't happen\n"),
+                               kDebugFlag8);
+               break;
+           }
+#endif /* TEST_IPV4_ROUTELIST */
+       }
+    }
+    if (routes->size == routes->count) {
+       int                     how_many;
+       IPv4RouteListRef        new_routes;
+       int                     old_size;
+
+       /* double the size */
+       old_size = routes->size;
+       how_many = old_size * 2;
+       new_routes = (IPv4RouteListRef)
+           realloc(routes, IPv4RouteListComputeSize(how_many));
+       if (new_routes == NULL) {
+           /* no memory */
+           goto done;
+       }
+       ROUTELIST_DEBUG(("increasing size from %d to %d\n", old_size,
+                        how_many), kDebugFlag8);
+       new_routes->size = how_many;
+       routes = new_routes;
+    }
+    if (where == -1) {
+       /* add it to the end */
+       where = routes->count;
+    }
+    else {
+       /* insert it at [where] */
+       bcopy(routes->list + where,
+             routes->list + where + 1,
+             sizeof(routes->list[0]) * (routes->count - where));
+    }
+    /* copy the route */
+    routes->list[where] = *this_route;
+    routes->list[where].rank = this_rank;
+
+    /* set the scope */
+    switch (scope_which) {
+    case kScopeThis:
+       routes->list[where].flags |= kRouteIsScopedFlag;
+       break;
+    case kScopeNext:
+       routes->list[where + 1].flags |= kRouteIsScopedFlag;
+       break;
+    default:
+    case kScopeNone:
+       break;
+    }
+    routes->count++;
+ done:
+    return (routes);
+}
+
+/*
+ * Function: IPv4RouteListAddRouteList
+ *
+ * Purpose:
+ *   Invoke IPv4RouteListAddRoute for each route in the given list.
+ *
+ * Returns:
+ *   See IPv4RouteListAddRoute for more information.
+ */
+static IPv4RouteListRef
+IPv4RouteListAddRouteList(IPv4RouteListRef routes, int init_size,
+                         IPv4RouteListRef service_routes, Rank rank)
+{
+    int                i;
+    IPv4RouteRef       scan;
+
+    for (i = 0, scan = service_routes->list;
+        i < service_routes->count; i++, scan++) {
+       routes = IPv4RouteListAddRoute(routes, init_size, scan, rank);
+    }
+    return (routes);
+}
+
+static boolean_t
+plist_get_cstring(CFDictionaryRef dict, CFStringRef prop_name,
+                 char * buf, int buf_size)
+{
+    CFStringRef        val;
+
+    val = CFDictionaryGetValue(dict, prop_name);
+    if (isA_CFString(val) == NULL) {
+       return (FALSE);
+    }
+    if (CFStringGetCString(val, buf, buf_size, kCFStringEncodingASCII)
+       == FALSE) {
+       return (FALSE);
+    }
+    return (TRUE);
+}
+
+/*
+ * Function: IPv4RouteListCreateWithDictionary
+ *
+ * Purpose:
+ *   Given the service ipv4 entity dictionary, generate the list of routes.
+ *   Currently, this includes just the default route and subnet route,
+ *   if the service has a subnet mask.
+ *
+ * Returns:
+ *   If the passed in route_list is NULL or too small, this routine
+ *   allocates malloc'd memory to hold the routes.
+ */
+static IPv4RouteListRef
+IPv4RouteListCreateWithDictionary(IPv4RouteListRef routes,
+                                 CFDictionaryRef dict,
+                                 CFStringRef primaryRank)
+{
+    struct in_addr     addr = { 0 };
+    RouteFlags         flags = 0;
+    unsigned int       ifindex;
+    char               ifn[IFNAMSIZ];
+    struct in_addr     mask = { 0 };
+    int                        n;
+    IPv4RouteRef       r;
+    struct in_addr     subnet = { 0 };
+    struct in_addr     router = { 0 };
+
+    if (dict == NULL) {
+       return (NULL);
+    }
+    if (plist_get_cstring(dict, kSCPropInterfaceName, ifn, sizeof(ifn))
+       == FALSE) {
+       return (NULL);
+    }
+#ifdef TEST_IPV4_ROUTELIST
+    ifindex = 0;
+#else /* TEST_IPV4_ROUTELIST */
+    ifindex = if_nametoindex(ifn);
+    if (ifindex == 0) {
+       /* interface doesn't exist */
+       return (NULL);
+    }
+#endif /* TEST_IPV4_ROUTELIST */
+    if (cfstring_to_ip(CFDictionaryGetValue(dict, kSCPropNetIPv4Router),
+                      &router) == 0) {
+       (void)dict_get_first_ip(dict, kSCPropNetIPv4DestAddresses, &router);
+    }
+    n = 1;
+    if (dict_get_first_ip(dict, kSCPropNetIPv4Addresses, &addr)
+       && dict_get_first_ip(dict, kSCPropNetIPv4SubnetMasks, &mask)) {
+       /* subnet route */
+       subnet = subnet_addr(addr, mask);
+       /* ignore link-local subnets, let IPConfiguration handle them for now */
+       if (ntohl(subnet.s_addr) != IN_LINKLOCALNETNUM) {
+           n++;
+       }
+    }
+    if (addr.s_addr == 0) {
+       /* thanks for playing */
+       return (NULL);
+    }
+    if (router.s_addr == 0) {
+       flags |= kRouteIsDirectToInterfaceFlag | kRouteChooseLastFlag;
+    }
+    else {
+       /*
+        * If the router address is our address and the subnet mask is
+        * not 255.255.255.255, assume all routes are local to the interface.
+        */
+       if (addr.s_addr == router.s_addr
+           && ifn[0] != '\0' && mask.s_addr != INADDR_BROADCAST) {
+           flags |= kRouteIsDirectToInterfaceFlag;
+       }
+       if (primaryRank != NULL) {
+           if (CFEqual(primaryRank, kSCValNetServicePrimaryRankNever)) {
+               flags |= kRouteChooseNeverFlag;
+           } else if (CFEqual(primaryRank, kSCValNetServicePrimaryRankFirst)) {
+               flags |= kRouteChooseFirstFlag;
+           } else if (CFEqual(primaryRank, kSCValNetServicePrimaryRankLast)) {
+               flags |= kRouteChooseLastFlag;
+           }
+       } else if (get_override_primary(dict)) {
+           flags |= kRouteChooseFirstFlag;
+       }
+    }
+    if (n > 1 && (flags & kRouteIsDirectToInterfaceFlag) == 0
+       && subnet.s_addr != subnet_addr(router, mask).s_addr) {
+       flags |= kRouteIsNotSubnetLocalFlag;
+    }
+
+    if (routes == NULL || routes->size < n) {
+       routes = (IPv4RouteListRef)malloc(IPv4RouteListComputeSize(n));
+       routes->size = n;
+    }
+    bzero(routes, IPv4RouteListComputeSize(n));
+    routes->count = n;
+
+    /* start at the beginning */
+    r = routes->list;
+
+    /* add the default route */
+    r->ifindex = ifindex;
+    strlcpy(r->ifname, ifn, sizeof(r->ifname));
+    r->ifa = addr;
+    r->flags = flags;
+    if ((flags & kRouteIsDirectToInterfaceFlag) == 0) {
+           r->gateway = router;
+    }
+    else {
+           r->gateway = addr;
+    }
+    r++;
+    n--;
+
+    /* add the subnet route */
+    if (n > 0) {
+       r->ifindex = ifindex;
+       r->gateway = addr;
+       r->dest = subnet;
+       r->mask = mask;
+       strlcpy(r->ifname, ifn, sizeof(r->ifname));
+       r->ifa = addr;
+       r->flags = flags & (kRouteChooseFirstFlag|kRouteChooseLastFlag|kRouteChooseNeverFlag);
+    }
+
+    return (routes);
+}
+
+/*
+ * Function: parse_component
+ * Purpose:
+ *   Given a string 'key' and a string prefix 'prefix',
+ *   return the next component in the slash '/' separated
+ *   key.
+ *
+ * Examples:
+ * 1. key = "a/b/c" prefix = "a/"
+ *    returns "b"
+ * 2. key = "a/b/c" prefix = "a/b/"
+ *    returns "c"
+ */
+static CFStringRef
+parse_component(CFStringRef key, CFStringRef prefix)
+{
+    CFMutableStringRef comp;
+    CFRange            range;
+
+    if (CFStringHasPrefix(key, prefix) == FALSE) {
+       return (NULL);
+    }
+    comp = CFStringCreateMutableCopy(NULL, 0, key);
+    if (comp == NULL) {
+       return (NULL);
+    }
+    CFStringDelete(comp, CFRangeMake(0, CFStringGetLength(prefix)));
+    range = CFStringFind(comp, CFSTR("/"), 0);
+    if (range.location == kCFNotFound) {
+       return (comp);
+    }
+    range.length = CFStringGetLength(comp) - range.location;
+    CFStringDelete(comp, range);
+    return (comp);
+}
+
+static CFMutableDictionaryRef
+service_dict_copy(CFStringRef serviceID)
+{
+    CFDictionaryRef            d = NULL;
+    CFMutableDictionaryRef     service_dict;
+
+    /* create a modifyable dictionary, a copy or a new one */
+    d = CFDictionaryGetValue(S_service_state_dict, serviceID);
+    if (d == NULL) {
+       service_dict
+           = CFDictionaryCreateMutable(NULL, 0,
+                                       &kCFTypeDictionaryKeyCallBacks,
+                                       &kCFTypeDictionaryValueCallBacks);
+    }
+    else {
+       service_dict = CFDictionaryCreateMutableCopy(NULL, 0, d);
+    }
+    return (service_dict);
+}
+
+static void
+dump_service_entity(CFStringRef serviceID, CFStringRef entity,
+                   CFStringRef operation, CFTypeRef val)
+{
+    CFStringRef        this_val = NULL;
+
+    if (isA_CFData(val) && CFEqual(entity, kSCEntNetIPv4)) {
+       this_val = IPv4RouteListCopyDescription((IPv4RouteListRef)
+                                               CFDataGetBytePtr(val));
+       if (this_val != NULL) {
+           val = this_val;
+       }
+    }
+    if (val == NULL) {
+       val = CFSTR("<none>");
+    }
+    SCLog(TRUE, LOG_NOTICE, CFSTR("IPMonitor: serviceID %@ %@ %@ value = %@"),
+         serviceID, operation, entity, val);
+    my_CFRelease(&this_val);
+    return;
+}
+
+static boolean_t
+service_dict_set(CFStringRef serviceID, CFStringRef entity,
+                CFTypeRef new_val)
+{
+    boolean_t                  changed = FALSE;
+    CFTypeRef                  old_val;
+    CFMutableDictionaryRef     service_dict;
+
+    service_dict = service_dict_copy(serviceID);
+    old_val = CFDictionaryGetValue(service_dict, entity);
+    if (new_val == NULL) {
+       if (old_val != NULL) {
+           if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
+               dump_service_entity(serviceID, entity, CFSTR("Removed:"),
+                                  old_val);
+           }
+           CFDictionaryRemoveValue(service_dict, entity);
+           changed = TRUE;
+       }
+    }
+    else {
+       if (old_val == NULL || CFEqual(new_val, old_val) == FALSE) {
+           if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
+               dump_service_entity(serviceID, entity,
+                                   CFSTR("Changed: old"), old_val);
+               dump_service_entity(serviceID, entity,
+                                   CFSTR("Changed: new"), new_val);
+           }
+           CFDictionarySetValue(service_dict, entity, new_val);
+           changed = TRUE;
+       }
+    }
+    if (CFDictionaryGetCount(service_dict) == 0) {
+       CFDictionaryRemoveValue(S_service_state_dict, serviceID);
+    }
+    else {
+       CFDictionarySetValue(S_service_state_dict, serviceID, service_dict);
+    }
+    my_CFRelease(&service_dict);
+    return (changed);
+}
+
+static CFDictionaryRef
+service_dict_get(CFStringRef serviceID, CFStringRef entity)
+{
+    CFDictionaryRef    service_dict;
+
+    service_dict = CFDictionaryGetValue(S_service_state_dict, serviceID);
+    if (service_dict == NULL) {
+       return (NULL);
+    }
+    return (CFDictionaryGetValue(service_dict, entity));
+}
+
+#define        ALLOW_EMPTY_STRING      0x1
+
+static CFTypeRef
+sanitize_prop(CFTypeRef val, uint32_t flags)
+{
+    if (val != NULL) {
+       if (isA_CFString(val)) {
+           CFMutableStringRef  str;
+
+           str = CFStringCreateMutableCopy(NULL, 0, (CFStringRef)val);
+           CFStringTrimWhitespace(str);
+           if (!(flags & ALLOW_EMPTY_STRING) && (CFStringGetLength(str) == 0)) {
+               CFRelease(str);
+               str = NULL;
+           }
+           val = str;
+       } else {
+           CFRetain(val);
+       }
+    }
+
+    return val;
+}
+
+static void
+merge_array_prop(CFMutableDictionaryRef        dict,
+                CFStringRef            key,
+                CFDictionaryRef        state_dict,
+                CFDictionaryRef        setup_dict,
+                uint32_t               flags,
+                Boolean                append)
+{
+    CFMutableArrayRef  merge_prop;
+    CFArrayRef         setup_prop = NULL;
+    CFArrayRef         state_prop = NULL;
+
+    if (setup_dict != NULL) {
+       setup_prop = isA_CFArray(CFDictionaryGetValue(setup_dict, key));
+    }
+    if (state_dict != NULL) {
+       state_prop = isA_CFArray(CFDictionaryGetValue(state_dict, key));
+    }
+
+    if ((setup_prop == NULL) && (state_prop == NULL)) {
+       return;
+    }
+
+    merge_prop = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+    if (setup_prop != NULL) {
+       CFIndex i;
+       CFIndex n;
+
+       n = CFArrayGetCount(setup_prop);
+       for (i = 0; i < n; i++) {
+           CFTypeRef   val;
+
+           val = CFArrayGetValueAtIndex(setup_prop, i);
+           val = sanitize_prop(val, flags);
+           if (val != NULL) {
+               CFArrayAppendValue(merge_prop, val);
+               CFRelease(val);
+           }
+       }
+    }
+    if (state_prop != NULL
+       && (setup_prop == NULL || S_append_state)) {
+       CFIndex i;
+       CFIndex n;
+       CFRange setup_range     = CFRangeMake(0, CFArrayGetCount(merge_prop));
+
+       n = CFArrayGetCount(state_prop);
+       for (i = 0; i < n; i++) {
+           CFTypeRef   val;
 
            val = CFArrayGetValueAtIndex(state_prop, i);
            val = sanitize_prop(val, flags);
 
            val = CFArrayGetValueAtIndex(state_prop, i);
            val = sanitize_prop(val, flags);
@@ -615,91 +1526,73 @@ pick_prop(CFMutableDictionaryRef dict,
            CFRelease(val);
        }
 
            CFRelease(val);
        }
 
-       return;
-}
-
-/**
- ** GetEntityChangesFunc functions
- **/
-static __inline__ struct in_addr
-subnet_addr(struct in_addr addr, struct in_addr mask)
-{
-    struct in_addr     net;
-
-    net.s_addr = htonl((uint32_t)ntohl(addr.s_addr)
-                      & (uint32_t)ntohl(mask.s_addr));
-    return (net);
+       return;
 }
 
 }
 
+/**
+ ** GetEntityChangesFunc functions
+ **/
 static boolean_t
 get_ipv4_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
                 CFDictionaryRef setup_dict, CFDictionaryRef info)
 {
 static boolean_t
 get_ipv4_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
                 CFDictionaryRef setup_dict, CFDictionaryRef info)
 {
-    struct in_addr             addr = { 0 };
-    CFArrayRef                 addrs;
-    boolean_t                  changed = FALSE;
-    CFMutableDictionaryRef     dict = NULL;
-    struct in_addr             mask = { 0 };
-    CFArrayRef                 masks;
-    CFDictionaryRef            new_dict = NULL;
-    CFStringRef                        router = NULL;
-    boolean_t                  valid_ip = FALSE;
-    boolean_t                  valid_mask = FALSE;
+    boolean_t                  changed         = FALSE;
+    CFMutableDictionaryRef     dict            = NULL;
+    CFStringRef                        primaryRank     = NULL;
+    IPv4RouteListRef           r;
+#define R_STATIC               3
+    IPv4RouteListRef           routes;
+    char                       routes_buf[IPv4RouteListComputeSize(R_STATIC)];
+    CFDataRef                  routes_data     = NULL;
+    CFDictionaryRef            service_options;
 
     if (state_dict == NULL) {
        goto done;
     }
 
     if (state_dict == NULL) {
        goto done;
     }
-    addrs = isA_CFArray(CFDictionaryGetValue(state_dict,
-                                            kSCPropNetIPv4Addresses));
-    if (addrs != NULL && CFArrayGetCount(addrs) > 0) {
-       valid_ip = cfstring_to_ip(CFArrayGetValueAtIndex(addrs, 0), &addr);
-    }
-    masks = isA_CFArray(CFDictionaryGetValue(state_dict,
-                                            kSCPropNetIPv4SubnetMasks));
-    if (masks != NULL && CFArrayGetCount(masks) > 0) {
-       valid_mask = cfstring_to_ip(CFArrayGetValueAtIndex(masks, 0), &mask);
-    }
-    if (valid_ip == FALSE) {
-       SCLog(S_IPMonitor_debug, LOG_INFO,
-             CFSTR("IPMonitor: %@ has no valid IP address, ignoring"),
-             serviceID);
-       goto done;
+    service_options = service_dict_get(serviceID, kSCEntNetService);
+    if (service_options != NULL) {
+       primaryRank = CFDictionaryGetValue(service_options, kSCPropNetServicePrimaryRank);
     }
     dict = CFDictionaryCreateMutableCopy(NULL, 0, state_dict);
     if (setup_dict != NULL) {
     }
     dict = CFDictionaryCreateMutableCopy(NULL, 0, state_dict);
     if (setup_dict != NULL) {
+       CFStringRef     router;
+       struct in_addr  router_ip;
+
        router = CFDictionaryGetValue(setup_dict,
                                      kSCPropNetIPv4Router);
        router = CFDictionaryGetValue(setup_dict,
                                      kSCPropNetIPv4Router);
-       if (router != NULL) {
+       if (router != NULL
+           && cfstring_to_ip(router, &router_ip)) {
            CFDictionarySetValue(dict,
                                 kSCPropNetIPv4Router,
                                 router);
        }
     }
            CFDictionarySetValue(dict,
                                 kSCPropNetIPv4Router,
                                 router);
        }
     }
-
-    /* check whether the router is direct, or non-local */
-    router = CFDictionaryGetValue(dict, kSCPropNetIPv4Router);
-    if (router != NULL) {
-       struct in_addr          router_ip;
-
-       if (cfstring_to_ip(router, &router_ip)) {
-           if (router_ip.s_addr == addr.s_addr) {
-               /* default route routes directly to the interface */
-               CFDictionarySetValue(dict, kRouterIsDirect, kCFBooleanTrue);
-           }
-           else if (valid_mask
-                    && subnet_addr(addr, mask).s_addr
-                    != subnet_addr(router_ip, mask).s_addr) {
-               /* router is not on the same subnet */
-               CFDictionarySetValue(dict, kRouterNeedsLocalIP,
-                                    kCFBooleanTrue);
-           }
+    routes = (IPv4RouteListRef)routes_buf;
+    routes->size = R_STATIC;
+    routes->count = 0;
+    r = IPv4RouteListCreateWithDictionary(routes, dict, primaryRank);
+    if (r != NULL) {
+       routes_data = CFDataCreate(NULL,
+                                  (const void *)r,
+                                  IPv4RouteListComputeSize(r->count));
+       if (r != routes) {
+           free(r);
        }
     }
        }
     }
-    new_dict = dict;
-
- done:
-    changed = service_dict_set(serviceID, kSCEntNetIPv4, new_dict);
-    my_CFRelease(&new_dict);
+    else {
+       SCLog(TRUE, LOG_NOTICE,
+             CFSTR("IPMonitor: %@ invalid IPv4 dictionary = %@"),
+             serviceID,
+             dict);
+    }
+  done:
+    changed = service_dict_set(serviceID, kSCEntNetIPv4, routes_data);
+    if (routes_data == NULL) {
+       /* clean up the rank too */
+       CFDictionaryRemoveValue(S_ipv4_service_rank_dict, serviceID);
+    }
+    my_CFRelease(&dict);
+    my_CFRelease(&routes_data);
     return (changed);
 }
 
     return (changed);
 }
 
@@ -713,6 +1606,7 @@ get_ipv6_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
     CFMutableDictionaryRef     dict = NULL;
     CFDictionaryRef            new_dict = NULL;
     CFStringRef                        router = NULL;
     CFMutableDictionaryRef     dict = NULL;
     CFDictionaryRef            new_dict = NULL;
     CFStringRef                        router = NULL;
+    struct in6_addr            router_ip;
     boolean_t                  valid_ip = FALSE;
 
     if (state_dict == NULL) {
     boolean_t                  valid_ip = FALSE;
 
     if (state_dict == NULL) {
@@ -724,24 +1618,38 @@ get_ipv6_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
        valid_ip = cfstring_to_ip6(CFArrayGetValueAtIndex(addrs, 0), &addr);
     }
     if (valid_ip == FALSE) {
        valid_ip = cfstring_to_ip6(CFArrayGetValueAtIndex(addrs, 0), &addr);
     }
     if (valid_ip == FALSE) {
-       SCLog(S_IPMonitor_debug, LOG_INFO,
-             CFSTR("IPMonitor: %@ has no valid IPv6 address, ignoring"),
-             serviceID);
+       if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
+           SCLog(TRUE, LOG_NOTICE,
+                 CFSTR("IPMonitor: %@ has no valid IPv6 address, ignoring"),
+                 serviceID);
+       }
        goto done;
     }
     dict = CFDictionaryCreateMutableCopy(NULL, 0, state_dict);
     if (setup_dict != NULL) {
        router = CFDictionaryGetValue(setup_dict,
                                      kSCPropNetIPv6Router);
        goto done;
     }
     dict = CFDictionaryCreateMutableCopy(NULL, 0, state_dict);
     if (setup_dict != NULL) {
        router = CFDictionaryGetValue(setup_dict,
                                      kSCPropNetIPv6Router);
-       if (router != NULL) {
+       if (router != NULL && cfstring_to_ip6(router, &router_ip)) {
            CFDictionarySetValue(dict,
                                 kSCPropNetIPv6Router,
                                 router);
        }
     }
            CFDictionarySetValue(dict,
                                 kSCPropNetIPv6Router,
                                 router);
        }
     }
+    else {
+       router = CFDictionaryGetValue(dict,
+                                     kSCPropNetIPv6Router);
+       if (router != NULL
+           && cfstring_to_ip6(router, &router_ip) == FALSE) {
+           CFDictionaryRemoveValue(dict, kSCPropNetIPv6Router);
+       }
+    }
     new_dict = dict;
  done:
     changed = service_dict_set(serviceID, kSCEntNetIPv6, new_dict);
     new_dict = dict;
  done:
     changed = service_dict_set(serviceID, kSCEntNetIPv6, new_dict);
+    if (new_dict == NULL) {
+       /* clean up the rank too */
+       CFDictionaryRemoveValue(S_ipv6_service_rank_dict, serviceID);
+    }
     my_CFRelease(&new_dict);
     return (changed);
 }
     my_CFRelease(&new_dict);
     return (changed);
 }
@@ -765,10 +1673,99 @@ dns_has_supplemental(CFStringRef serviceID)
     return CFDictionaryContainsKey(dns_dict, kSCPropNetDNSSupplementalMatchDomains);
 }
 
     return CFDictionaryContainsKey(dns_dict, kSCPropNetDNSSupplementalMatchDomains);
 }
 
+static void
+accumulate_dns_servers(CFArrayRef in_servers, ProtocolFlags active_protos,
+                      CFMutableArrayRef out_servers)
+{
+    int                        count;
+    int                        i;
+
+    count = CFArrayGetCount(in_servers);
+    for (i = 0; i < count; i++) {
+       CFStringRef     addr = CFArrayGetValueAtIndex(in_servers, i);
+       struct in6_addr ipv6_addr;
+       struct in_addr  ip_addr;
+
+       if (cfstring_to_ip(addr, &ip_addr)) {
+           /* IPv4 address */
+           if ((active_protos & kProtocolFlagsIPv4) == 0
+               && ntohl(ip_addr.s_addr) != INADDR_LOOPBACK) {
+               if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
+                   syslog(LOG_NOTICE,
+                          "IPMonitor: no IPv4 connectivity, "
+                          "ignoring DNS server address " IP_FORMAT,
+                          IP_LIST(&ip_addr));
+               }
+               continue;
+           }
+       }
+       else if (cfstring_to_ip6(addr, &ipv6_addr)) {
+           /* IPv6 address */
+           if ((active_protos & kProtocolFlagsIPv6) == 0
+               && !IN6_IS_ADDR_LOOPBACK(&ipv6_addr)) {
+               if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
+                   char        str[128];
+
+                   str[0] = '\0';
+                   inet_ntop(AF_INET6, &ipv6_addr, str, sizeof(str));
+                   syslog(LOG_NOTICE,
+                          "IPMonitor: no IPv6 connectivity, "
+                          "ignoring DNS server address %s",
+                          str);
+               }
+               continue;
+           }
+       }
+       else {
+           /* bad IP address */
+           SCLog(TRUE, LOG_NOTICE,
+                 CFSTR("IPMonitor: ignoring bad DNS server address '%@'"),
+                 addr);
+           continue;
+       }
+       /* DNS server is valid and one we want */
+       CFArrayAppendValue(out_servers, addr);
+    }
+    return;
+}
+
+static void
+merge_dns_servers(CFMutableDictionaryRef new_dict,
+                 CFArrayRef state_servers,
+                 CFArrayRef setup_servers,
+                 ProtocolFlags active_protos)
+{
+    CFMutableArrayRef  dns_servers;
+
+    if (state_servers == NULL && setup_servers == NULL) {
+       /* no DNS servers */
+       return;
+    }
+    dns_servers = CFArrayCreateMutable(NULL, 0,
+                                      &kCFTypeArrayCallBacks);
+    if (setup_servers != NULL) {
+       accumulate_dns_servers(setup_servers, active_protos,
+                              dns_servers);
+    }
+    if ((CFArrayGetCount(dns_servers) == 0 || S_append_state)
+       && state_servers != NULL) {
+       accumulate_dns_servers(state_servers, active_protos,
+                              dns_servers);
+    }
+    if (CFArrayGetCount(dns_servers) != 0) {
+       CFDictionarySetValue(new_dict,
+                            kSCPropNetDNSServerAddresses, dns_servers);
+    }
+    my_CFRelease(&dns_servers);
+    return;
+}
+
+
 static boolean_t
 get_dns_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
                CFDictionaryRef setup_dict, CFDictionaryRef info)
 {
 static boolean_t
 get_dns_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
                CFDictionaryRef setup_dict, CFDictionaryRef info)
 {
+    ProtocolFlags              active_protos = kProtocolFlagsNone;
     boolean_t                  changed = FALSE;
     CFStringRef                        domain;
     int                                i;
     boolean_t                  changed = FALSE;
     CFStringRef                        domain;
     int                                i;
@@ -778,9 +1775,8 @@ get_dns_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
        Boolean         append;
     } merge_list[] = {
        { kSCPropNetDNSSearchDomains,                   0,                      FALSE },
        Boolean         append;
     } merge_list[] = {
        { kSCPropNetDNSSearchDomains,                   0,                      FALSE },
-       { kSCPropNetDNSServerAddresses,                 0,                      FALSE },
        { kSCPropNetDNSSortList,                        0,                      FALSE },
        { kSCPropNetDNSSortList,                        0,                      FALSE },
-       { kSCPropNetDNSSupplementalMatchDomains,        ALLOW_EMTPY_STRING,     TRUE  },
+       { kSCPropNetDNSSupplementalMatchDomains,        ALLOW_EMPTY_STRING,     TRUE  },
        { kSCPropNetDNSSupplementalMatchOrders,         0,                      TRUE  },
     };
     CFMutableDictionaryRef      new_dict = NULL;
        { kSCPropNetDNSSupplementalMatchOrders,         0,                      TRUE  },
     };
     CFMutableDictionaryRef      new_dict = NULL;
@@ -797,16 +1793,37 @@ get_dns_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
        goto done;
     }
 
        goto done;
     }
 
-    if ((service_dict_get(serviceID, kSCEntNetIPv4) == NULL) &&
-       (service_dict_get(serviceID, kSCEntNetIPv6) == NULL)) {
-       /* there is no IPv4 nor IPv6 */
-       goto done;
+    if (service_dict_get(serviceID, kSCEntNetIPv4) != NULL) {
+       active_protos |= kProtocolFlagsIPv4;
     }
     }
-
-    // merge DNS configuration
+    if (service_dict_get(serviceID, kSCEntNetIPv6) != NULL) {
+       active_protos |= kProtocolFlagsIPv6;
+    }
+    /* merge DNS configuration */
     new_dict = CFDictionaryCreateMutable(NULL, 0,
                                         &kCFTypeDictionaryKeyCallBacks,
                                         &kCFTypeDictionaryValueCallBacks);
     new_dict = CFDictionaryCreateMutable(NULL, 0,
                                         &kCFTypeDictionaryKeyCallBacks,
                                         &kCFTypeDictionaryValueCallBacks);
+    if (active_protos == kProtocolFlagsNone) {
+       /* there is no IPv4 nor IPv6 */
+       if (state_dict == NULL) {
+           /* no DNS information at all */
+           goto done;
+       }
+       merge_dns_servers(new_dict,
+                         my_CFDictionaryGetArray(state_dict,
+                                                 kSCPropNetDNSServerAddresses),
+                         NULL,
+                         kProtocolFlagsIPv4 | kProtocolFlagsIPv6);
+       setup_dict = NULL;
+    }
+    else {
+       merge_dns_servers(new_dict,
+                         my_CFDictionaryGetArray(state_dict,
+                                                 kSCPropNetDNSServerAddresses),
+                         my_CFDictionaryGetArray(setup_dict,
+                                                 kSCPropNetDNSServerAddresses),
+                         active_protos);
+    }
 
     for (i = 0; i < sizeof(merge_list)/sizeof(merge_list[0]); i++) {
        merge_array_prop(new_dict,
 
     for (i = 0; i < sizeof(merge_list)/sizeof(merge_list[0]); i++) {
        merge_array_prop(new_dict,
@@ -824,28 +1841,43 @@ get_dns_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
                  0);
     }
 
                  0);
     }
 
+    if (active_protos == kProtocolFlagsNone) {
+       /* there is no IPv4 nor IPv6, only supplemental DNS */
+       if (CFDictionaryContainsKey(new_dict,
+                                   kSCPropNetDNSSupplementalMatchDomains)) {
+           /* only keep State: supplemental */
+           CFDictionaryRemoveValue(new_dict, kSCPropNetDNSDomainName);
+           CFDictionaryRemoveValue(new_dict, kSCPropNetDNSSearchDomains);
+           CFDictionaryRemoveValue(new_dict, kSCPropNetDNSSearchOrder);
+           CFDictionaryRemoveValue(new_dict, kSCPropNetDNSSortList);
+       } else {
+           goto done;
+       }
+    }
     if (CFDictionaryGetCount(new_dict) == 0) {
        my_CFRelease(&new_dict);
        goto done;
     }
 
     if (CFDictionaryGetCount(new_dict) == 0) {
        my_CFRelease(&new_dict);
        goto done;
     }
 
-    /*
-     * ensure any specified domain name (e.g. the domain returned by
-     * a DHCP server) is in the search list.
-     */
-    domain = CFDictionaryGetValue(new_dict, kSCPropNetDNSDomainName);
-    if (isA_CFString(domain)) {
-       CFArrayRef      search;
-
-       search = CFDictionaryGetValue(new_dict, kSCPropNetDNSSearchDomains);
-       if (isA_CFArray(search) &&
-           !CFArrayContainsValue(search, CFRangeMake(0, CFArrayGetCount(search)), domain)) {
-           CFMutableArrayRef   new_search;
-
-           new_search = CFArrayCreateMutableCopy(NULL, 0, search);
-           CFArrayAppendValue(new_search, domain);
-           CFDictionarySetValue(new_dict, kSCPropNetDNSSearchDomains, new_search);
-           my_CFRelease(&new_search);
+    if (S_append_state) {
+       /*
+        * ensure any specified domain name (e.g. the domain returned by
+        * a DHCP server) is in the search list.
+        */
+       domain = CFDictionaryGetValue(new_dict, kSCPropNetDNSDomainName);
+       if (isA_CFString(domain)) {
+           CFArrayRef      search;
+
+           search = CFDictionaryGetValue(new_dict, kSCPropNetDNSSearchDomains);
+           if (isA_CFArray(search) &&
+               !CFArrayContainsValue(search, CFRangeMake(0, CFArrayGetCount(search)), domain)) {
+               CFMutableArrayRef   new_search;
+
+               new_search = CFArrayCreateMutableCopy(NULL, 0, search);
+               CFArrayAppendValue(new_search, domain);
+               CFDictionarySetValue(new_dict, kSCPropNetDNSSearchDomains, new_search);
+               my_CFRelease(&new_search);
+           }
        }
     }
 
        }
     }
 
@@ -855,29 +1887,249 @@ get_dns_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
     return (changed);
 }
 
     return (changed);
 }
 
+static void
+merge_dict(const void *key, const void *value, void *context)
+{
+       CFMutableDictionaryRef  dict    = (CFMutableDictionaryRef)context;
+
+       CFDictionarySetValue(dict, key, value);
+       return;
+}
+
+#define        PROXY_AUTO_DISCOVERY_URL        252
+
+static CFStringRef
+wpadURL_dhcp(CFDictionaryRef dhcp_options)
+{
+    CFStringRef        urlString       = NULL;
+
+    if (isA_CFDictionary(dhcp_options)) {
+       CFDataRef       data;
+
+       data = DHCPInfoGetOptionData(dhcp_options, PROXY_AUTO_DISCOVERY_URL);
+       if (data != NULL) {
+           CFURLRef    url;
+
+           url = CFURLCreateWithBytes(NULL,
+                                      CFDataGetBytePtr(data),
+                                      CFDataGetLength(data),
+                                      kCFStringEncodingUTF8,
+                                      NULL);
+           if (url != NULL) {
+               urlString = CFURLGetString(url);
+               if (urlString != NULL) {
+                   CFRetain(urlString);
+               }
+               CFRelease(url);
+           }
+       }
+    }
+
+    return urlString;
+}
+
+static CFStringRef
+wpadURL_dns(void)
+{
+    CFURLRef   url;
+    CFStringRef        urlString       = NULL;
+
+    url = CFURLCreateWithString(NULL, CFSTR("http://wpad/wpad.dat"), NULL);
+    if (url != NULL) {
+       urlString = CFURLGetString(url);
+       if (urlString != NULL) {
+           CFRetain(urlString);
+       }
+       CFRelease(url);
+    }
+
+    return urlString;
+}
+
 static boolean_t
 get_proxies_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
                    CFDictionaryRef setup_dict, CFDictionaryRef info)
 {
     boolean_t                  changed = FALSE;
 static boolean_t
 get_proxies_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
                    CFDictionaryRef setup_dict, CFDictionaryRef info)
 {
     boolean_t                  changed = FALSE;
-    CFDictionaryRef            new_dict = NULL;
+    CFMutableDictionaryRef     new_dict = NULL;
+    struct {
+           CFStringRef key1;   /* an "enable" key */
+           CFStringRef key2;
+           CFStringRef key3;
+    } pick_list[] = {
+           { kSCPropNetProxiesFTPEnable,       kSCPropNetProxiesFTPProxy,      kSCPropNetProxiesFTPPort        },
+           { kSCPropNetProxiesGopherEnable,    kSCPropNetProxiesGopherProxy,   kSCPropNetProxiesGopherPort     },
+           { kSCPropNetProxiesHTTPEnable,      kSCPropNetProxiesHTTPProxy,     kSCPropNetProxiesHTTPPort       },
+           { kSCPropNetProxiesHTTPSEnable,     kSCPropNetProxiesHTTPSProxy,    kSCPropNetProxiesHTTPSPort      },
+           { kSCPropNetProxiesRTSPEnable,      kSCPropNetProxiesRTSPProxy,     kSCPropNetProxiesRTSPPort       },
+           { kSCPropNetProxiesSOCKSEnable,     kSCPropNetProxiesSOCKSProxy,    kSCPropNetProxiesSOCKSPort      },
+           { kSCPropNetProxiesProxyAutoConfigEnable,
+             kSCPropNetProxiesProxyAutoConfigURLString,
+             NULL, },
+           { kSCPropNetProxiesProxyAutoDiscoveryEnable,
+             NULL,
+             NULL, }
+    };
 
     if ((service_dict_get(serviceID, kSCEntNetIPv4) == NULL) &&
        (service_dict_get(serviceID, kSCEntNetIPv6) == NULL)) {
        /* there is no IPv4 nor IPv6 */
        goto done;
     }
 
     if ((service_dict_get(serviceID, kSCEntNetIPv4) == NULL) &&
        (service_dict_get(serviceID, kSCEntNetIPv6) == NULL)) {
        /* there is no IPv4 nor IPv6 */
        goto done;
     }
-    if (setup_dict != NULL) {
-       new_dict = setup_dict;
+
+    if ((setup_dict != NULL) && (state_dict != NULL)) {
+       CFIndex                 i;
+       CFMutableDictionaryRef  setup_copy;
+
+       /*
+        * Merge the per-service "Setup:" and "State:" proxy information with
+        * the "Setup:" information always taking precedence.  Additionally,
+        * ensure that if any group of "Setup:" values (e.g. Enabled, Proxy,
+        * Port) is defined than all of the values for that group will be
+        * used.  That is, we don't allow mixing some of the values from
+        * the "Setup:" keys and others from the "State:" keys.
+        */
+       new_dict   = CFDictionaryCreateMutableCopy(NULL, 0, state_dict);
+       setup_copy = CFDictionaryCreateMutableCopy(NULL, 0, setup_dict);
+       for (i = 0; i < sizeof(pick_list)/sizeof(pick_list[0]); i++) {
+           if (CFDictionaryContainsKey(setup_copy, pick_list[i].key1)) {
+               /*
+                * if a "Setup:" enabled key has been provided than we want to
+                * ignore all of the "State:" keys
+                */
+               CFDictionaryRemoveValue(new_dict, pick_list[i].key1);
+               if (pick_list[i].key2 != NULL) {
+                   CFDictionaryRemoveValue(new_dict, pick_list[i].key2);
+               }
+               if (pick_list[i].key3 != NULL) {
+                   CFDictionaryRemoveValue(new_dict, pick_list[i].key3);
+               }
+           } else if (CFDictionaryContainsKey(state_dict, pick_list[i].key1) ||
+                      ((pick_list[i].key2 != NULL) && CFDictionaryContainsKey(state_dict, pick_list[i].key2)) ||
+                      ((pick_list[i].key3 != NULL) && CFDictionaryContainsKey(state_dict, pick_list[i].key3))) {
+               /*
+                * if a "Setup:" enabled key has not been provided and we have
+                * some" "State:" keys than we remove all of of "Setup:" keys
+                */
+               CFDictionaryRemoveValue(setup_copy, pick_list[i].key1);
+               if (pick_list[i].key2 != NULL) {
+                   CFDictionaryRemoveValue(setup_copy, pick_list[i].key2);
+               }
+               if (pick_list[i].key3 != NULL) {
+                   CFDictionaryRemoveValue(setup_copy, pick_list[i].key3);
+               }
+           }
+       }
+
+       /* merge the "Setup:" keys */
+       CFDictionaryApplyFunction(setup_copy, merge_dict, new_dict);
+       CFRelease(setup_copy);
+
+       if (CFDictionaryGetCount(new_dict) == 0) {
+           CFRelease(new_dict);
+           new_dict = NULL;
+       }
     }
     }
-    else {
-       new_dict = state_dict;
+    else if (setup_dict != NULL) {
+       new_dict = CFDictionaryCreateMutableCopy(NULL, 0, setup_dict);
+    }
+    else if (state_dict != NULL) {
+       new_dict = CFDictionaryCreateMutableCopy(NULL, 0, state_dict);
+    }
+
+    /* process WPAD */
+    if (new_dict != NULL) {
+       CFDictionaryRef dhcp_options;
+       CFNumberRef     num;
+       CFNumberRef     wpad        = NULL;
+       int             wpadEnabled = 0;
+       CFStringRef     wpadURL     = NULL;
+
+       if (CFDictionaryGetValueIfPresent(new_dict,
+                                         kSCPropNetProxiesProxyAutoDiscoveryEnable,
+                                         (const void **)&num) &&
+           isA_CFNumber(num)) {
+           /* if we have a WPAD key */
+           wpad = num;
+           if (!CFNumberGetValue(num, kCFNumberIntType, &wpadEnabled)) {
+               /* if we don't like the enabled key/value */
+               wpadEnabled = 0;
+           }
+       }
+
+       if (wpadEnabled) {
+           int pacEnabled  = 0;
+
+           num = CFDictionaryGetValue(new_dict, kSCPropNetProxiesProxyAutoConfigEnable);
+           if (!isA_CFNumber(num) ||
+               !CFNumberGetValue(num, kCFNumberIntType, &pacEnabled)) {
+               /* if we don't like the enabled key/value */
+               pacEnabled = 0;
+           }
+
+           if (pacEnabled) {
+               CFStringRef     pacURL;
+
+               pacURL = CFDictionaryGetValue(new_dict, kSCPropNetProxiesProxyAutoConfigURLString);
+               if (!isA_CFString(pacURL)) {
+                   /* if we don't like the PAC URL */
+                   pacEnabled = 0;
+               }
+           }
+
+           if (pacEnabled) {
+               /*
+                * we already have a PAC URL so disable WPAD.
+                */
+               wpadEnabled = 0;
+               goto setWPAD;
+           }
+
+           /*
+            * if WPAD is enabled and we don't already have a PAC URL then
+            * we check for a DHCP provided URL.  If not available, we use
+            * a PAC URL pointing to a well-known file (wpad.dat) on a
+            * well-known host (wpad.<domain>).
+            */
+           dhcp_options = get_service_state_entity(info, serviceID, kSCEntNetDHCP);
+           wpadURL = wpadURL_dhcp(dhcp_options);
+           if (wpadURL == NULL) {
+               wpadURL = wpadURL_dns();
+           }
+           if (wpadURL == NULL) {
+               wpadEnabled = 0;    /* if we don't have a WPAD URL */
+               goto setWPAD;
+           }
+
+           pacEnabled = 1;
+           num = CFNumberCreate(NULL, kCFNumberIntType, &pacEnabled);
+           CFDictionarySetValue(new_dict,
+                                kSCPropNetProxiesProxyAutoConfigEnable,
+                                num);
+           CFRelease(num);
+           CFDictionarySetValue(new_dict,
+                                kSCPropNetProxiesProxyAutoConfigURLString,
+                                wpadURL);
+           CFRelease(wpadURL);
+       }
+
+     setWPAD:
+       if (wpad != NULL) {
+           num = CFNumberCreate(NULL, kCFNumberIntType, &wpadEnabled);
+           CFDictionarySetValue(new_dict,
+                                kSCPropNetProxiesProxyAutoDiscoveryEnable,
+                                num);
+           CFRelease(num);
+       }
     }
     }
+
  done:
     changed = service_dict_set(serviceID, kSCEntNetProxies, new_dict);
  done:
     changed = service_dict_set(serviceID, kSCEntNetProxies, new_dict);
+    if (new_dict != NULL) CFRelease(new_dict);
     return (changed);
 }
 
     return (changed);
 }
 
+#if    !TARGET_OS_IPHONE
 static boolean_t
 get_smb_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
                CFDictionaryRef setup_dict, CFDictionaryRef info)
 static boolean_t
 get_smb_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
                CFDictionaryRef setup_dict, CFDictionaryRef info)
@@ -902,7 +2154,7 @@ get_smb_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
        goto done;
     }
 
        goto done;
     }
 
-    // merge SMB configuration
+    /* merge SMB configuration */
     new_dict = CFDictionaryCreateMutable(NULL, 0,
                                         &kCFTypeDictionaryKeyCallBacks,
                                         &kCFTypeDictionaryValueCallBacks);
     new_dict = CFDictionaryCreateMutable(NULL, 0,
                                         &kCFTypeDictionaryKeyCallBacks,
                                         &kCFTypeDictionaryValueCallBacks);
@@ -931,23 +2183,90 @@ get_smb_changes(CFStringRef serviceID, CFDictionaryRef state_dict,
     my_CFRelease(&new_dict);
     return (changed);
 }
     my_CFRelease(&new_dict);
     return (changed);
 }
+#endif /* !TARGET_OS_IPHONE */
 
 
-static CFStringRef
-state_service_key(CFStringRef serviceID, CFStringRef entity)
+static boolean_t
+get_rank_changes(CFStringRef serviceID, CFDictionaryRef state_options,
+                CFDictionaryRef setup_options, CFDictionaryRef info)
 {
 {
-    return (SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
-                                                       kSCDynamicStoreDomainState,
-                                                       serviceID,
-                                                       entity));
+    boolean_t                  changed         = FALSE;
+    CFMutableDictionaryRef      new_dict       = NULL;
+    CFStringRef                        new_rank        = NULL;
+    CFStringRef                        setup_rank      = NULL;
+    CFStringRef                        state_rank      = NULL;
+
+
+    /*
+     * Check "PrimaryRank" setting
+     *
+     * Note: Rank Never > Rank Last > Rank First > Rank None
+     */
+    if (isA_CFDictionary(setup_options)) {
+       setup_rank = CFDictionaryGetValue(setup_options, kSCPropNetServicePrimaryRank);
+       setup_rank = isA_CFString(setup_rank);
+    }
+    if (isA_CFDictionary(state_options)) {
+       state_rank = CFDictionaryGetValue(state_options, kSCPropNetServicePrimaryRank);
+       state_rank = isA_CFString(state_rank);
+    }
+
+    if (((setup_rank != NULL) && CFEqual(setup_rank, kSCValNetServicePrimaryRankNever)) ||
+       ((state_rank != NULL) && CFEqual(state_rank, kSCValNetServicePrimaryRankNever))) {
+       new_rank = kSCValNetServicePrimaryRankNever;
+    }
+    else if (((setup_rank != NULL) && CFEqual(setup_rank, kSCValNetServicePrimaryRankLast)) ||
+            ((state_rank != NULL) && CFEqual(state_rank, kSCValNetServicePrimaryRankLast))) {
+       new_rank = kSCValNetServicePrimaryRankLast;
+    }
+    else if (((setup_rank != NULL) && CFEqual(setup_rank, kSCValNetServicePrimaryRankFirst)) ||
+            ((state_rank != NULL) && CFEqual(state_rank, kSCValNetServicePrimaryRankFirst))) {
+       new_rank = kSCValNetServicePrimaryRankFirst;
+    }
+
+    if (new_rank != NULL) {
+       new_dict = CFDictionaryCreateMutable(NULL, 0,
+                                            &kCFTypeDictionaryKeyCallBacks,
+                                            &kCFTypeDictionaryValueCallBacks);
+       CFDictionarySetValue(new_dict, kSCPropNetServicePrimaryRank, new_rank);
+    }
+
+    changed = service_dict_set(serviceID, kSCEntNetService, new_dict);
+    my_CFRelease(&new_dict);
+    return (changed);
 }
 
 }
 
-static CFStringRef
-setup_service_key(CFStringRef serviceID, CFStringRef entity)
+static void
+add_service_keys(CFStringRef serviceID, CFMutableArrayRef keys, CFMutableArrayRef patterns)
 {
 {
-    return (SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
-                                                       kSCDynamicStoreDomainSetup,
-                                                       serviceID,
-                                                       entity));
+    int                        i;
+    CFStringRef                key;
+
+    if (CFEqual(serviceID, kSCCompAnyRegex)) {
+       keys = patterns;
+    }
+
+    for (i = 0; i < ENTITY_TYPES_COUNT; i++) {
+       key = setup_service_key(serviceID, *entityTypeNames[i]);
+       CFArrayAppendValue(keys, key);
+       CFRelease(key);
+       key = state_service_key(serviceID, *entityTypeNames[i]);
+       CFArrayAppendValue(keys, key);
+       CFRelease(key);
+    }
+
+    key = state_service_key(serviceID, kSCEntNetDHCP);
+    CFArrayAppendValue(patterns, key);
+    CFRelease(key);
+
+    key = setup_service_key(serviceID, NULL);
+    CFArrayAppendValue(patterns, key);
+    CFRelease(key);
+    key = state_service_key(serviceID, NULL);
+    CFArrayAppendValue(patterns, key);
+    CFRelease(key);
+
+
+    return;
 }
 
 static CFDictionaryRef
 }
 
 static CFDictionaryRef
@@ -955,157 +2274,172 @@ services_info_copy(SCDynamicStoreRef session, CFArrayRef service_list)
 {
     int                        count;
     CFMutableArrayRef  get_keys;
 {
     int                        count;
     CFMutableArrayRef  get_keys;
-    int                        i;
-    int                        s;
+    CFMutableArrayRef  get_patterns;
     CFDictionaryRef    info;
     CFDictionaryRef    info;
+    int                        s;
 
     count = CFArrayGetCount(service_list);
     get_keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
     count = CFArrayGetCount(service_list);
     get_keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+    get_patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
     CFArrayAppendValue(get_keys, S_setup_global_ipv4);
     CFArrayAppendValue(get_keys, S_setup_global_proxies);
 
     CFArrayAppendValue(get_keys, S_setup_global_ipv4);
     CFArrayAppendValue(get_keys, S_setup_global_proxies);
+#if    !TARGET_OS_IPHONE
     CFArrayAppendValue(get_keys, S_setup_global_smb);
     CFArrayAppendValue(get_keys, S_setup_global_smb);
+#endif /* !TARGET_OS_IPHONE */
+    CFArrayAppendValue(get_keys, S_multicast_resolvers);
     CFArrayAppendValue(get_keys, S_private_resolvers);
 
     for (s = 0; s < count; s++) {
        CFStringRef     serviceID = CFArrayGetValueAtIndex(service_list, s);
 
     CFArrayAppendValue(get_keys, S_private_resolvers);
 
     for (s = 0; s < count; s++) {
        CFStringRef     serviceID = CFArrayGetValueAtIndex(service_list, s);
 
-       for (i = 0; i < ENTITY_TYPES_COUNT; i++) {
-           CFStringRef setup_key;
-           CFStringRef state_key;
-
-           setup_key = setup_service_key(serviceID, entityTypeNames[i]);
-           state_key = state_service_key(serviceID, entityTypeNames[i]);
-           CFArrayAppendValue(get_keys, setup_key);
-           CFArrayAppendValue(get_keys, state_key);
-           my_CFRelease(&setup_key);
-           my_CFRelease(&state_key);
-       }
+       add_service_keys(serviceID, get_keys, get_patterns);
     }
 
     }
 
-    info = SCDynamicStoreCopyMultiple(session, get_keys, NULL);
+    info = SCDynamicStoreCopyMultiple(session, get_keys, get_patterns);
     my_CFRelease(&get_keys);
     my_CFRelease(&get_keys);
+    my_CFRelease(&get_patterns);
     return (info);
 }
 
     return (info);
 }
 
-static CFDictionaryRef
-get_service_setup_entity(CFDictionaryRef service_info, CFStringRef serviceID,
-                        CFStringRef entity)
-{
-    CFStringRef                setup_key;
-    CFDictionaryRef    setup_dict;
-
-    setup_key = setup_service_key(serviceID, entity);
-    setup_dict = my_CFDictionaryGetDictionary(service_info, setup_key);
-    my_CFRelease(&setup_key);
-    return (setup_dict);
-}
-
-static CFDictionaryRef
-get_service_state_entity(CFDictionaryRef service_info, CFStringRef serviceID,
-                        CFStringRef entity)
-{
-    CFStringRef                state_key;
-    CFDictionaryRef    state_dict;
-
-    state_key = state_service_key(serviceID, entity);
-    state_dict = my_CFDictionaryGetDictionary(service_info, state_key);
-    my_CFRelease(&state_key);
-    return (state_dict);
-}
-
 static int                     rtm_seq = 0;
 
 static int                     rtm_seq = 0;
 
-static boolean_t
-ipv4_route(int cmd, struct in_addr gateway, struct in_addr netaddr,
-          struct in_addr netmask, char * ifname, struct in_addr ifa,
-          boolean_t is_direct)
+static int
+ipv4_route_open_socket(void)
 {
 {
-    boolean_t                  default_route = (netaddr.s_addr == 0);
-    int                                len;
-    boolean_t                  ret = TRUE;
-    struct {
-       struct rt_msghdr        hdr;
-       struct sockaddr_in      dst;
-       struct sockaddr_in      gway;
-       struct sockaddr_in      mask;
-       struct sockaddr_dl      ifp;
-       struct sockaddr_in      ifa;
-    }                          rtmsg;
-    int                                sockfd = -1;
-
-    if (default_route && S_netboot) {
-       return (TRUE);
-    }
+    int sockfd;
 
     if ((sockfd = socket(PF_ROUTE, SOCK_RAW, AF_INET)) == -1) {
 
     if ((sockfd = socket(PF_ROUTE, SOCK_RAW, AF_INET)) == -1) {
-       SCLog(TRUE, LOG_INFO,
-             CFSTR("IPMonitor: ipv4_route: open routing socket failed, %s"),
+       SCLog(TRUE, LOG_NOTICE,
+             CFSTR("IPMonitor: ipv4_route_open_socket: socket failed, %s"),
              strerror(errno));
              strerror(errno));
-       return (FALSE);
     }
     }
+    return (sockfd);
+}
 
 
-    memset(&rtmsg, 0, sizeof(rtmsg));
-    rtmsg.hdr.rtm_type = cmd;
-    if (default_route) {
-       if (is_direct) {
-           /* if router is directly reachable, don't set the gateway flag */
-           rtmsg.hdr.rtm_flags = RTF_UP | RTF_STATIC;
-       }
-       else {
-           rtmsg.hdr.rtm_flags = RTF_UP | RTF_GATEWAY | RTF_STATIC;
-       }
+/*
+ * Define: ROUTE_MSG_ADDRS_SPACE
+ * Purpose:
+ *   Since sizeof(sockaddr_dl) > sizeof(sockaddr_in), we need space for
+ *   3 sockaddr_in's and 2 sockaddr_dl's, but pad it just in case
+ *   someone changes the code and doesn't think to modify this.
+ */
+#define ROUTE_MSG_ADDRS_SPACE  (3 * sizeof(struct sockaddr_in) \
+                                + 2 * sizeof(struct sockaddr_dl) \
+                                + 128)
+typedef struct {
+    struct rt_msghdr   hdr;
+    char               addrs[ROUTE_MSG_ADDRS_SPACE];
+} route_msg;
+
+static int
+ipv4_route(int sockfd,
+          int cmd, struct in_addr gateway, struct in_addr netaddr,
+          struct in_addr netmask, char * ifname, unsigned int ifindex,
+          struct in_addr ifa, RouteFlags flags)
+{
+    boolean_t                  default_route = (netaddr.s_addr == 0);
+    int                                len;
+    int                                ret = 0;
+    route_msg                  rtmsg;
+    union {
+       struct sockaddr_in *    in_p;
+       struct sockaddr_dl *    dl_p;
+       void *                  ptr;
+    } rtaddr;
+
+    if (default_route && S_netboot) {
+       return (0);
     }
     }
-    else {
-       rtmsg.hdr.rtm_flags = RTF_UP | RTF_CLONING | RTF_STATIC;
+
+    if (ifname == NULL) {
+       /* this should not happen, but rather than crash, return an error */
+       syslog(LOG_NOTICE,
+              "IPMonitor: ipv4_route ifname is NULL on network address %s",
+              inet_ntoa(netaddr));
+       return (EBADF);
     }
     }
+    memset(&rtmsg, 0, sizeof(rtmsg));
+    rtmsg.hdr.rtm_type = cmd;
     rtmsg.hdr.rtm_version = RTM_VERSION;
     rtmsg.hdr.rtm_seq = ++rtm_seq;
     rtmsg.hdr.rtm_version = RTM_VERSION;
     rtmsg.hdr.rtm_seq = ++rtm_seq;
-    rtmsg.hdr.rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK;
-    rtmsg.dst.sin_len = sizeof(rtmsg.dst);
-    rtmsg.dst.sin_family = AF_INET;
-    rtmsg.dst.sin_addr = netaddr;
-    rtmsg.gway.sin_len = sizeof(rtmsg.gway);
-    rtmsg.gway.sin_family = AF_INET;
-    rtmsg.gway.sin_addr = gateway;
-    rtmsg.mask.sin_len = sizeof(rtmsg.mask);
-    rtmsg.mask.sin_family = AF_INET;
-    rtmsg.mask.sin_addr = netmask;
-
-    len = sizeof(rtmsg);
-    if (ifname) {
-       rtmsg.hdr.rtm_addrs |= RTA_IFP | RTA_IFA;
-       /* copy the interface name */
-       rtmsg.ifp.sdl_len = sizeof(rtmsg.ifp);
-       rtmsg.ifp.sdl_family = AF_LINK;
-       rtmsg.ifp.sdl_nlen = strlen(ifname);
-       bcopy(ifname, rtmsg.ifp.sdl_data, rtmsg.ifp.sdl_nlen);
-       /* and the interface address */
-       rtmsg.ifa.sin_len = sizeof(rtmsg.ifa);
-       rtmsg.ifa.sin_family = AF_INET;
-       rtmsg.ifa.sin_addr = ifa;
+    rtmsg.hdr.rtm_addrs
+       = RTA_DST | RTA_GATEWAY | RTA_NETMASK | RTA_IFP | RTA_IFA;
+    if (default_route
+       && (flags & kRouteIsDirectToInterfaceFlag) == 0) {
+       rtmsg.hdr.rtm_flags = RTF_UP | RTF_GATEWAY | RTF_STATIC;
     }
     else {
     }
     else {
-       /* no ifp/ifa information */
-       len -= sizeof(rtmsg.ifp) + sizeof(rtmsg.ifa);
+       rtmsg.hdr.rtm_flags = RTF_UP | RTF_CLONING | RTF_STATIC;
     }
     }
-    rtmsg.hdr.rtm_msglen = len;
-    if (write(sockfd, &rtmsg, len) == -1) {
-       if ((cmd == RTM_ADD) && (errno == EEXIST)) {
-           /* no sense complaining about a route that already exists */
-       }
-       else if ((cmd == RTM_DELETE) && (errno == ESRCH)) {
-           /* no sense complaining about a route that isn't there */
+    if ((flags & kRouteWantScopedFlag) != 0) {
+#ifdef RTF_IFSCOPE
+       if (!S_scopedroute) {
+           return (0);
        }
        }
-       else {
-           SCLog(S_IPMonitor_debug, LOG_INFO,
-                 CFSTR("IPMonitor ipv4_route: "
-                       "write routing socket failed, %s"), strerror(errno));
-           ret = FALSE;
+       if (ifindex == 0) {
+           /* specifically asked for a scoped route, yet no index supplied */
+           syslog(LOG_NOTICE,
+                  "IPMonitor: ipv4_route index is 0 on %s-scoped route %s",
+                  ifname, inet_ntoa(netaddr));
+           return (EBADF);
        }
        }
+       rtmsg.hdr.rtm_index = ifindex;
+       rtmsg.hdr.rtm_flags |= RTF_IFSCOPE;
+#else /* RTF_IFSCOPE */
+       return (0);
+#endif /* RTF_IFSCOPE */
     }
 
     }
 
-    close(sockfd);
+    rtaddr.ptr = rtmsg.addrs;
+
+    /* dest */
+    rtaddr.in_p->sin_len = sizeof(*rtaddr.in_p);
+    rtaddr.in_p->sin_family = AF_INET;
+    rtaddr.in_p->sin_addr = netaddr;
+    rtaddr.ptr += sizeof(*rtaddr.in_p);
+
+    /* gateway */
+    if ((rtmsg.hdr.rtm_flags & RTF_GATEWAY) != 0) {
+       /* gateway is an IP address */
+       rtaddr.in_p->sin_len = sizeof(*rtaddr.in_p);
+       rtaddr.in_p->sin_family = AF_INET;
+       rtaddr.in_p->sin_addr = gateway;
+       rtaddr.ptr += sizeof(*rtaddr.in_p);
+    }
+    else {
+       /* gateway is the interface itself */
+       rtaddr.dl_p->sdl_len = sizeof(*rtaddr.dl_p);
+       rtaddr.dl_p->sdl_family = AF_LINK;
+       rtaddr.dl_p->sdl_nlen = strlen(ifname);
+       bcopy(ifname, rtaddr.dl_p->sdl_data, rtaddr.dl_p->sdl_nlen);
+       rtaddr.ptr += sizeof(*rtaddr.dl_p);
+    }
+
+    /* mask */
+    rtaddr.in_p->sin_len = sizeof(*rtaddr.in_p);
+    rtaddr.in_p->sin_family = AF_INET;
+    rtaddr.in_p->sin_addr = netmask;
+    rtaddr.ptr += sizeof(*rtaddr.in_p);
+
+    /* interface name */
+    rtaddr.dl_p->sdl_len = sizeof(*rtaddr.dl_p);
+    rtaddr.dl_p->sdl_family = AF_LINK;
+    rtaddr.dl_p->sdl_nlen = strlen(ifname);
+    bcopy(ifname, rtaddr.dl_p->sdl_data, rtaddr.dl_p->sdl_nlen);
+    rtaddr.ptr += sizeof(*rtaddr.dl_p);
+
+    /* interface address */
+    rtaddr.in_p->sin_len = sizeof(*rtaddr.in_p);
+    rtaddr.in_p->sin_family = AF_INET;
+    rtaddr.in_p->sin_addr = ifa;
+    rtaddr.ptr += sizeof(*rtaddr.in_p);
+
+    len = sizeof(rtmsg.hdr) + (rtaddr.ptr - (void *)rtmsg.addrs);
+    rtmsg.hdr.rtm_msglen = len;
+    if (write(sockfd, &rtmsg, len) == -1) {
+       ret = errno;
+    }
     return (ret);
 }
 
     return (ret);
 }
 
@@ -1135,7 +2469,7 @@ ipv6_route(int cmd, struct in6_addr gateway, struct in6_addr netaddr,
        gateway.__u6_addr.__u6_addr16[1] = (uint16_t)htons(index);
     }
     if ((sockfd = socket(PF_ROUTE, SOCK_RAW, AF_INET)) == -1) {
        gateway.__u6_addr.__u6_addr16[1] = (uint16_t)htons(index);
     }
     if ((sockfd = socket(PF_ROUTE, SOCK_RAW, AF_INET)) == -1) {
-       SCLog(TRUE, LOG_INFO,
+       SCLog(TRUE, LOG_NOTICE,
              CFSTR("IPMonitor ipv6_route: open routing socket failed, %s"),
              strerror(errno));
        return (FALSE);
              CFSTR("IPMonitor ipv6_route: open routing socket failed, %s"),
              strerror(errno));
        return (FALSE);
@@ -1188,9 +2522,11 @@ ipv6_route(int cmd, struct in6_addr gateway, struct in6_addr netaddr,
            /* no sense complaining about a route that isn't there */
        }
        else {
            /* no sense complaining about a route that isn't there */
        }
        else {
-           SCLog(S_IPMonitor_debug, LOG_INFO,
-                 CFSTR("IPMonitor ipv6_route: write routing"
-                       " socket failed, %s"), strerror(errno));
+           if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
+               SCLog(TRUE, LOG_NOTICE,
+                     CFSTR("IPMonitor ipv6_route: write routing"
+                           " socket failed, %s"), strerror(errno));
+           }
            ret = FALSE;
        }
     }
            ret = FALSE;
        }
     }
@@ -1199,144 +2535,56 @@ ipv6_route(int cmd, struct in6_addr gateway, struct in6_addr netaddr,
     return (ret);
 }
 
     return (ret);
 }
 
-static boolean_t
-ipv4_subnet_route_add(struct in_addr local_ip,
-                     struct in_addr subnet, struct in_addr mask, char * ifname)
-{
-    if (S_IPMonitor_debug) {
-       SCLog(TRUE, LOG_INFO,
-             CFSTR("IPMonitor: IPv4 route add -net "
-                   IP_FORMAT " -netmask %s interface %s"),
-             IP_LIST(&subnet), inet_ntoa(mask), ifname);
-    }
-    return (ipv4_route(RTM_ADD, local_ip, subnet, mask, ifname, local_ip,
-                      FALSE));
-}
-
-static boolean_t
-ipv4_subnet_route_delete(struct in_addr subnet, struct in_addr mask)
-{
-    if (S_IPMonitor_debug) {
-       SCLog(TRUE, LOG_INFO,
-             CFSTR("IPMonitor: IPv4 route delete -net "
-                   IP_FORMAT " %s"),
-             IP_LIST(&subnet), inet_ntoa(mask));
-    }
-    return (ipv4_route(RTM_DELETE, S_ip_zeros, subnet, mask, NULL,
-                      S_ip_zeros, FALSE));
-}
-
-
-static boolean_t
-ipv4_default_route_delete(void)
-{
-    if (S_IPMonitor_debug) {
-       SCLog(TRUE, LOG_INFO, CFSTR("IPMonitor: IPv4 route delete default"));
-    }
-    return (ipv4_route(RTM_DELETE, S_ip_zeros, S_ip_zeros, S_ip_zeros, NULL,
-                      S_ip_zeros, FALSE));
-}
-
-static boolean_t
-ipv4_default_route_add(struct in_addr router, char * ifname,
-                      struct in_addr local_ip, boolean_t is_direct)
-{
-    if (S_IPMonitor_debug) {
-       SCLog(TRUE, LOG_INFO,
-             CFSTR("IPMonitor: IPv4 route add default"
-                   " %s interface %s direct %d"),
-             inet_ntoa(router), ifname, is_direct);
-    }
-    return (ipv4_route(RTM_ADD, router, S_ip_zeros, S_ip_zeros, ifname,
-                      local_ip, is_direct));
-}
-
-static boolean_t
-ipv4_default_route_change(struct in_addr router, char * ifname,
-                         struct in_addr local_ip, boolean_t is_direct)
-{
-    if (S_IPMonitor_debug) {
-       SCLog(TRUE, LOG_INFO,
-             CFSTR("IPMonitor: IPv4 route change default"
-                   " %s interface %s direct %d"),
-             inet_ntoa(router), ifname, is_direct);
-    }
-    return (ipv4_route(RTM_CHANGE, router, S_ip_zeros, S_ip_zeros, ifname,
-                      local_ip, is_direct));
-}
-
 static boolean_t
 ipv6_default_route_delete(void)
 {
 static boolean_t
 ipv6_default_route_delete(void)
 {
-    if (S_IPMonitor_debug) {
-       SCLog(TRUE, LOG_INFO, CFSTR("IPMonitor: IPv6 route delete default"));
+    if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
+       SCLog(TRUE, LOG_NOTICE, CFSTR("IPMonitor: IPv6 route delete default"));
     }
     }
-    return (ipv6_route(RTM_DELETE, S_ip6_zeros, S_ip6_zeros, S_ip6_zeros, NULL, FALSE));
+    return (ipv6_route(RTM_DELETE, S_ip6_zeros, S_ip6_zeros, S_ip6_zeros,
+                      NULL, FALSE));
 }
 
 static boolean_t
 ipv6_default_route_add(struct in6_addr router, char * ifname,
                       boolean_t is_direct)
 {
 }
 
 static boolean_t
 ipv6_default_route_add(struct in6_addr router, char * ifname,
                       boolean_t is_direct)
 {
-    if (S_IPMonitor_debug) {
+    if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
        char    str[128];
 
        str[0] = '\0';
 
        inet_ntop(AF_INET6, &router, str, sizeof(str));
        char    str[128];
 
        str[0] = '\0';
 
        inet_ntop(AF_INET6, &router, str, sizeof(str));
-       SCLog(TRUE,LOG_INFO,
+       SCLog(TRUE, LOG_NOTICE,
              CFSTR("IPMonitor: IPv6 route add default"
                    " %s interface %s direct %d"),
              str, ifname, is_direct);
     }
              CFSTR("IPMonitor: IPv6 route add default"
                    " %s interface %s direct %d"),
              str, ifname, is_direct);
     }
-    return (ipv6_route(RTM_ADD, router, S_ip6_zeros, S_ip6_zeros, ifname, is_direct));
+    return (ipv6_route(RTM_ADD, router, S_ip6_zeros, S_ip6_zeros,
+                      ifname, is_direct));
 }
 
 
 }
 
 
-static boolean_t
-multicast_route_delete()
+static int
+multicast_route_delete(int sockfd)
 {
     struct in_addr gateway = { htonl(INADDR_LOOPBACK) };
     struct in_addr netaddr = { htonl(INADDR_UNSPEC_GROUP) };
     struct in_addr netmask = { htonl(IN_CLASSD_NET) };
 
 {
     struct in_addr gateway = { htonl(INADDR_LOOPBACK) };
     struct in_addr netaddr = { htonl(INADDR_UNSPEC_GROUP) };
     struct in_addr netmask = { htonl(IN_CLASSD_NET) };
 
-    return (ipv4_route(RTM_DELETE, gateway, netaddr, netmask, "lo0",
-                      gateway, FALSE));
+    return (ipv4_route(sockfd, RTM_DELETE, gateway, netaddr, netmask, "lo0", 0,
+                      gateway, 0));
 }
 
 }
 
-static boolean_t
-multicast_route_add()
+static int
+multicast_route_add(int sockfd)
 {
     struct in_addr gateway = { htonl(INADDR_LOOPBACK) };
     struct in_addr netaddr = { htonl(INADDR_UNSPEC_GROUP) };
     struct in_addr netmask = { htonl(IN_CLASSD_NET) };
 
 {
     struct in_addr gateway = { htonl(INADDR_LOOPBACK) };
     struct in_addr netaddr = { htonl(INADDR_UNSPEC_GROUP) };
     struct in_addr netmask = { htonl(IN_CLASSD_NET) };
 
-    return (ipv4_route(RTM_ADD, gateway, netaddr, netmask, "lo0",
-                      gateway, FALSE));
-}
-
-static void
-set_ipv4_router(struct in_addr * router, char * ifname,
-               struct in_addr * local_ip, boolean_t is_direct)
-{
-    if (S_router_subnet.s_addr != 0) {
-       ipv4_subnet_route_delete(S_router_subnet, S_router_subnet_mask);
-       S_router_subnet.s_addr = S_router_subnet_mask.s_addr = 0;
-    }
-    /* assign the new default route, ensure local multicast route available */
-    (void)ipv4_default_route_delete();
-    if (router != NULL) {
-       (void)ipv4_default_route_add(*router, ifname,
-                                    (local_ip != NULL)
-                                    ? *local_ip : S_ip_zeros,
-                                    is_direct);
-       (void)multicast_route_delete();
-    }
-    else {
-       (void)multicast_route_add();
-    }
-
-    return;
+    return (ipv4_route(sockfd, RTM_ADD, gateway, netaddr, netmask, "lo0", 0,
+                      gateway, 0));
 }
 
 static void
 }
 
 static void
@@ -1350,6 +2598,7 @@ set_ipv6_router(struct in6_addr * router, char * ifname, boolean_t is_direct)
     return;
 }
 
     return;
 }
 
+#if    !TARGET_OS_IPHONE
 static __inline__ void
 empty_dns()
 {
 static __inline__ void
 empty_dns()
 {
@@ -1369,6 +2618,16 @@ set_dns(CFArrayRef val_search_domains,
        CFIndex i;
        CFIndex n;
 
        CFIndex i;
        CFIndex n;
 
+       SCPrint(TRUE, f, CFSTR("#\n"));
+       SCPrint(TRUE, f, CFSTR("# Mac OS X Notice\n"));
+       SCPrint(TRUE, f, CFSTR("#\n"));
+       SCPrint(TRUE, f, CFSTR("# This file is not used by the host name and address resolution\n"));
+       SCPrint(TRUE, f, CFSTR("# or the DNS query routing mechanisms used by most processes on\n"));
+       SCPrint(TRUE, f, CFSTR("# this Mac OS X system.\n"));
+       SCPrint(TRUE, f, CFSTR("#\n"));
+       SCPrint(TRUE, f, CFSTR("# This file is automatically generated.\n"));
+       SCPrint(TRUE, f, CFSTR("#\n"));
+
        if (isA_CFString(val_domain_name)) {
            SCPrint(TRUE, f, CFSTR("domain %@\n"), val_domain_name);
        }
        if (isA_CFString(val_domain_name)) {
            SCPrint(TRUE, f, CFSTR("domain %@\n"), val_domain_name);
        }
@@ -1418,6 +2677,7 @@ set_dns(CFArrayRef val_search_domains,
     }
     return;
 }
     }
     return;
 }
+#endif /* !TARGET_OS_IPHONE */
 
 static boolean_t
 router_is_our_ipv6_address(CFStringRef router, CFArrayRef addr_list)
 
 static boolean_t
 router_is_our_ipv6_address(CFStringRef router, CFArrayRef addr_list)
@@ -1438,90 +2698,243 @@ router_is_our_ipv6_address(CFStringRef router, CFArrayRef addr_list)
     return (FALSE);
 }
 
     return (FALSE);
 }
 
-static void
-update_ipv4(CFDictionaryRef    service_info,
-           CFStringRef         primary,
-           keyChangeListRef    keys)
+static IPv4RouteListRef
+service_dict_get_ipv4_routelist(CFDictionaryRef service_dict)
 {
 {
-    CFDictionaryRef    ipv4_dict = NULL;
+    CFDataRef          data;
+    IPv4RouteListRef   routes = NULL;
 
 
-    if (primary != NULL) {
-       CFDictionaryRef service_dict;
+    data = (CFDataRef)CFDictionaryGetValue(service_dict, kSCEntNetIPv4);
+    if (data != NULL) {
+       routes = (IPv4RouteListRef)CFDataGetBytePtr(data);
+    }
+    return (routes);
+}
 
 
-       service_dict = CFDictionaryGetValue(S_service_state_dict, primary);
-       if (service_dict != NULL) {
-           ipv4_dict = CFDictionaryGetValue(service_dict, kSCEntNetIPv4);
+typedef struct apply_ipv4_route_context {
+    IPv4RouteListRef   old;
+    IPv4RouteListRef   new;
+    int                        sockfd;
+} apply_ipv4_route_context_t;
+
+/* add/remove a router/32 subnet */
+static int
+ipv4_route_gateway(int sockfd, int cmd, char * ifn_p,
+                  IPv4RouteRef def_route)
+{
+    struct in_addr             mask;
+
+    mask.s_addr = htonl(INADDR_BROADCAST);
+    return (ipv4_route(sockfd, cmd, def_route->ifa,
+                      def_route->gateway, mask, ifn_p, def_route->ifindex,
+                      def_route->ifa,
+                      (def_route->flags & kRouteWantScopedFlag)));
+}
+
+/*
+ * Function: apply_ipv4_route
+ * Purpose:
+ *   Callback function that adds/removes the specified route.
+ */
+static void
+apply_ipv4_route(IPv4RouteListApplyCommand cmd, IPv4RouteRef route, void * arg)
+{
+    apply_ipv4_route_context_t *context = (apply_ipv4_route_context_t *)arg;
+    char *                     ifn_p;
+    int                                retval;
+
+    ifn_p = route->ifname;
+    switch (cmd) {
+    case kIPv4RouteListAddRouteCommand:
+       if ((route->flags & kRouteIsNotSubnetLocalFlag) != 0) {
+           retval = ipv4_route_gateway(context->sockfd, RTM_ADD,
+                                       ifn_p, route);
+           if (retval == EEXIST) {
+               /* delete and add again */
+               (void)ipv4_route_gateway(context->sockfd, RTM_DELETE,
+                                        ifn_p, route);
+               retval = ipv4_route_gateway(context->sockfd, RTM_ADD,
+                                           ifn_p, route);
+           }
+           if (retval != 0) {
+               SCLog(TRUE, LOG_NOTICE,
+                     CFSTR("IPMonitor apply_ipv4_route failed to add"
+                           " %s/32 route, %s"),
+                     inet_ntoa(route->gateway), strerror(retval));
+           }
+           else if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
+               SCLog(TRUE, LOG_NOTICE, CFSTR("Added IPv4 Route %s/32"),
+                     inet_ntoa(route->gateway));
+           }
+       }
+       retval = ipv4_route(context->sockfd,
+                           RTM_ADD, route->gateway,
+                           route->dest, route->mask, ifn_p, route->ifindex,
+                           route->ifa, route->flags);
+       if (retval == EEXIST) {
+           /* delete and add again */
+           (void)ipv4_route(context->sockfd,
+                            RTM_DELETE, route->gateway,
+                            route->dest, route->mask, ifn_p, route->ifindex,
+                            route->ifa, route->flags);
+           retval = ipv4_route(context->sockfd,
+                               RTM_ADD, route->gateway,
+                               route->dest, route->mask,
+                               ifn_p, route->ifindex,
+                               route->ifa, route->flags);
+       }
+       if (retval != 0) {
+           SCLog(TRUE, LOG_NOTICE,
+                 CFSTR("IPMonitor apply_ipv4_route failed to add"
+                       " route, %s:"), strerror(retval));
+           IPv4RouteLog(route);
+       }
+       else if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
+           SCLog(TRUE, LOG_NOTICE,
+                 CFSTR("Added IPv4 route new[%d] = "),
+                 route - context->new->list);
+           IPv4RouteLog(route);
        }
        }
+       break;
+    case kIPv4RouteListRemoveRouteCommand:
+       retval = ipv4_route(context->sockfd,
+                           RTM_DELETE, route->gateway,
+                           route->dest, route->mask, ifn_p, route->ifindex,
+                           route->ifa, route->flags);
+       if (retval != 0) {
+           if (retval != ESRCH) {
+               SCLog(TRUE, LOG_NOTICE,
+                     CFSTR("IPMonitor apply_ipv4_route failed to remove"
+                           " route, %s: "), strerror(retval));
+               IPv4RouteLog(route);
+           }
+       }
+       else if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
+           SCLog(TRUE, LOG_NOTICE,
+                 CFSTR("Removed IPv4 route old[%d] = "),
+                 route - context->old->list);
+           IPv4RouteLog(route);
+       }
+       if ((route->flags & kRouteIsNotSubnetLocalFlag) != 0) {
+           retval = ipv4_route_gateway(context->sockfd, RTM_DELETE,
+                                       ifn_p, route);
+           if (retval != 0) {
+               SCLog(TRUE, LOG_NOTICE,
+                     CFSTR("IPMonitor apply_ipv4_route failed to remove"
+                           " %s/32 route, %s: "),
+                     inet_ntoa(route->gateway), strerror(retval));
+           }
+           else if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
+               SCLog(TRUE, LOG_NOTICE, CFSTR("Removed IPv4 Route %s/32"),
+                     inet_ntoa(route->gateway));
+           }
+       }
+       break;
+    default:
+       break;
     }
     }
-    if (ipv4_dict != NULL) {
-       CFMutableDictionaryRef  dict = NULL;
-       CFStringRef             if_name = NULL;
-       char                    ifn[IFNAMSIZ + 1] = { '\0' };
-       char *                  ifn_p = NULL;
-       boolean_t               is_direct = FALSE;
-       struct in_addr          local_ip = { 0 };
-       CFStringRef             local_ip_cf;
-       CFArrayRef              local_ip_list;
-       boolean_t               needs_local_ip = FALSE;
-       struct in_addr          router = { 0 };
-       CFStringRef             val_router = NULL;
+    return;
+}
 
 
-       dict = CFDictionaryCreateMutable(NULL, 0,
-                                        &kCFTypeDictionaryKeyCallBacks,
-                                        &kCFTypeDictionaryValueCallBacks);
-       local_ip_list = CFDictionaryGetValue(ipv4_dict,
-                                            kSCPropNetIPv4Addresses);
-       local_ip_cf = CFArrayGetValueAtIndex(local_ip_list, 0);
-       cfstring_to_ip(local_ip_cf, &local_ip);
-       val_router = CFDictionaryGetValue(ipv4_dict, kSCPropNetIPv4Router);
-       if (val_router != NULL) {
-           cfstring_to_ip(val_router, &router);
-           CFDictionarySetValue(dict, kSCPropNetIPv4Router, val_router);
-           if (CFDictionaryContainsKey(ipv4_dict, kRouterIsDirect)) {
-               is_direct = TRUE;
+/*
+ * Function: update_ipv4
+ *
+ * Purpose:
+ *   Update the IPv4 configuration based on the latest information.
+ *   Publish the State:/Network/Global/IPv4 information, and update the
+ *   IPv4 routing table.  IPv4RouteListApply() invokes our callback,
+ *   apply_ipv4_route(), to install/remove the routes.
+ */
+static void
+update_ipv4(CFStringRef                primary,
+           IPv4RouteListRef    new_routelist,
+           keyChangeListRef    keys)
+{
+    apply_ipv4_route_context_t context;
+
+    if (keys != NULL) {
+       if (new_routelist != NULL && primary != NULL) {
+           char *                      ifn_p = NULL;
+           IPv4RouteRef                r;
+           CFMutableDictionaryRef      dict = NULL;
+
+           dict = CFDictionaryCreateMutable(NULL, 0,
+                                            &kCFTypeDictionaryKeyCallBacks,
+                                            &kCFTypeDictionaryValueCallBacks);
+           /* the first entry is the default route */
+           r = new_routelist->list;
+           if (r->gateway.s_addr != 0) {
+               CFStringRef             router;
+
+               router = CFStringCreateWithCString(NULL,
+                                                  inet_ntoa(r->gateway),
+                                                  kCFStringEncodingASCII);
+               if (router != NULL) {
+                   CFDictionarySetValue(dict, kSCPropNetIPv4Router, router);
+                   CFRelease(router);
+               }
            }
            }
-           else if (CFDictionaryContainsKey(ipv4_dict, kRouterNeedsLocalIP)) {
-               needs_local_ip = TRUE;
+           if (r->ifname[0] != '\0') {
+               ifn_p = r->ifname;
+           }
+           if (ifn_p != NULL) {
+               CFStringRef             ifname_cf;
+
+               ifname_cf = CFStringCreateWithCString(NULL,
+                                                     ifn_p,
+                                                     kCFStringEncodingASCII);
+               if (ifname_cf != NULL) {
+                   CFDictionarySetValue(dict,
+                                        kSCDynamicStorePropNetPrimaryInterface,
+                                        ifname_cf);
+                   CFRelease(ifname_cf);
+               }
            }
            }
+           CFDictionarySetValue(dict, kSCDynamicStorePropNetPrimaryService,
+                                primary);
+           keyChangeListSetValue(keys, S_state_global_ipv4, dict);
+           CFRelease(dict);
        }
        else {
        }
        else {
-           is_direct = TRUE;
-           router = local_ip;
+           keyChangeListRemoveValue(keys, S_state_global_ipv4);
        }
        }
-       if_name = CFDictionaryGetValue(ipv4_dict, kSCPropInterfaceName);
-       if (if_name) {
-           CFDictionarySetValue(dict,
-                                kSCDynamicStorePropNetPrimaryInterface,
-                                if_name);
-           if (CFStringGetCString(if_name, ifn, sizeof(ifn),
-                                  kCFStringEncodingASCII)) {
-               ifn_p = ifn;
+    }
+
+    bzero(&context, sizeof(context));
+    context.sockfd = ipv4_route_open_socket();
+    if (context.sockfd != -1) {
+       if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
+           if (S_ipv4_routelist == NULL) {
+               SCLog(TRUE, LOG_NOTICE, CFSTR("Old Routes = <none>"));
+           }
+           else {
+               SCLog(TRUE, LOG_NOTICE, CFSTR("Old Routes = "));
+               IPv4RouteListLog(S_ipv4_routelist);
+           }
+           if (new_routelist == NULL) {
+               SCLog(TRUE, LOG_NOTICE, CFSTR("New Routes = <none>"));
+           }
+           else {
+               SCLog(TRUE, LOG_NOTICE, CFSTR("New Routes = "));
+               IPv4RouteListLog(new_routelist);
            }
        }
            }
        }
-       CFDictionarySetValue(dict, kSCDynamicStorePropNetPrimaryService,
-                            primary);
-       keyChangeListSetValue(keys, S_state_global_ipv4, dict);
-       CFRelease(dict);
-
-       /* route add default ... */
-       if (needs_local_ip) {
-           struct in_addr      m;
-
-           m.s_addr = htonl(INADDR_BROADCAST);
-           ipv4_subnet_route_add(local_ip, router, m, ifn_p);
-           set_ipv4_router(&local_ip, ifn_p, &local_ip, FALSE);
-           ipv4_default_route_change(router, ifn_p, local_ip, FALSE);
-           S_router_subnet = router;
-           S_router_subnet_mask = m;
+       context.old = S_ipv4_routelist;
+       context.new = new_routelist;
+       IPv4RouteListApply(S_ipv4_routelist, new_routelist,
+                          &apply_ipv4_route, (void *)&context);
+       if (new_routelist != NULL) {
+           (void)multicast_route_delete(context.sockfd);
        }
        else {
        }
        else {
-           set_ipv4_router(&router, ifn_p, &local_ip, is_direct);
+           (void)multicast_route_add(context.sockfd);
        }
        }
+       close(context.sockfd);
     }
     }
-    else {
-       keyChangeListRemoveValue(keys, S_state_global_ipv4);
-       set_ipv4_router(NULL, NULL, NULL, FALSE);
+    if (S_ipv4_routelist != NULL) {
+       free(S_ipv4_routelist);
     }
     }
+    S_ipv4_routelist = new_routelist;
     return;
 }
 
     return;
 }
 
@@ -1544,7 +2957,7 @@ update_ipv6(CFDictionaryRef       service_info,
        CFArrayRef              addrs;
        CFMutableDictionaryRef  dict = NULL;
        CFStringRef             if_name = NULL;
        CFArrayRef              addrs;
        CFMutableDictionaryRef  dict = NULL;
        CFStringRef             if_name = NULL;
-       char                    ifn[IFNAMSIZ + 1] = { '\0' };
+       char                    ifn[IFNAMSIZ] = { '\0' };
        char *                  ifn_p = NULL;
        boolean_t               is_direct = FALSE;
        CFStringRef             val_router = NULL;
        char *                  ifn_p = NULL;
        boolean_t               is_direct = FALSE;
        CFStringRef             val_router = NULL;
@@ -1610,14 +3023,18 @@ update_dns(CFDictionaryRef      service_info,
        }
     }
     if (dict == NULL) {
        }
     }
     if (dict == NULL) {
+#if    !TARGET_OS_IPHONE
        empty_dns();
        empty_dns();
+#endif /* !TARGET_OS_IPHONE */
        keyChangeListRemoveValue(keys, S_state_global_dns);
     }
     else {
        keyChangeListRemoveValue(keys, S_state_global_dns);
     }
     else {
+#if    !TARGET_OS_IPHONE
        set_dns(CFDictionaryGetValue(dict, kSCPropNetDNSSearchDomains),
                CFDictionaryGetValue(dict, kSCPropNetDNSDomainName),
                CFDictionaryGetValue(dict, kSCPropNetDNSServerAddresses),
                CFDictionaryGetValue(dict, kSCPropNetDNSSortList));
        set_dns(CFDictionaryGetValue(dict, kSCPropNetDNSSearchDomains),
                CFDictionaryGetValue(dict, kSCPropNetDNSDomainName),
                CFDictionaryGetValue(dict, kSCPropNetDNSServerAddresses),
                CFDictionaryGetValue(dict, kSCPropNetDNSSortList));
+#endif /* !TARGET_OS_IPHONE */
        keyChangeListSetValue(keys, S_state_global_dns, dict);
     }
     return;
        keyChangeListSetValue(keys, S_state_global_dns, dict);
     }
     return;
@@ -1629,23 +3046,27 @@ update_dnsinfo(CFDictionaryRef  service_info,
               keyChangeListRef keys,
               CFArrayRef       service_order)
 {
               keyChangeListRef keys,
               CFArrayRef       service_order)
 {
-    CFArrayRef privateResolvers;
+    CFDictionaryRef    dict    = NULL;
+    CFArrayRef         multicastResolvers;
+    CFArrayRef         privateResolvers;
 
 
-    privateResolvers = CFDictionaryGetValue(service_info, S_private_resolvers);
+    multicastResolvers = CFDictionaryGetValue(service_info, S_multicast_resolvers);
+    privateResolvers   = CFDictionaryGetValue(service_info, S_private_resolvers);
 
 
-    if (primary == NULL) {
-       dns_configuration_set(NULL, NULL, NULL, privateResolvers);
-    } else {
-       CFDictionaryRef dict            = NULL;
+    if (primary != NULL) {
        CFDictionaryRef service_dict;
 
        service_dict = CFDictionaryGetValue(S_service_state_dict, primary);
        if (service_dict != NULL) {
            dict = CFDictionaryGetValue(service_dict, kSCEntNetDNS);
        }
        CFDictionaryRef service_dict;
 
        service_dict = CFDictionaryGetValue(S_service_state_dict, primary);
        if (service_dict != NULL) {
            dict = CFDictionaryGetValue(service_dict, kSCEntNetDNS);
        }
-
-       dns_configuration_set(dict, S_service_state_dict, service_order, privateResolvers);
     }
     }
+
+    dns_configuration_set(dict,
+                         S_service_state_dict,
+                         service_order,
+                         multicastResolvers,
+                         privateResolvers);
     keyChangeListNotifyKey(keys, S_state_global_dns);
     return;
 }
     keyChangeListNotifyKey(keys, S_state_global_dns);
     return;
 }
@@ -1655,7 +3076,7 @@ update_proxies(CFDictionaryRef    service_info,
               CFStringRef      primary,
               keyChangeListRef keys)
 {
               CFStringRef      primary,
               keyChangeListRef keys)
 {
-    CFDictionaryRef    dict = NULL;
+    CFDictionaryRef dict       = NULL;
 
     if (primary != NULL) {
        CFDictionaryRef service_dict;
 
     if (primary != NULL) {
        CFDictionaryRef service_dict;
@@ -1678,6 +3099,7 @@ update_proxies(CFDictionaryRef    service_info,
     return;
 }
 
     return;
 }
 
+#if    !TARGET_OS_IPHONE
 static void
 update_smb(CFDictionaryRef     service_info,
           CFStringRef          primary,
 static void
 update_smb(CFDictionaryRef     service_info,
           CFStringRef          primary,
@@ -1706,154 +3128,254 @@ update_smb(CFDictionaryRef    service_info,
 
     return;
 }
 
     return;
 }
+#endif /* !TARGET_OS_IPHONE */
 
 
-static unsigned int
-get_service_rank(CFStringRef proto_key, CFArrayRef order, CFStringRef serviceID)
+static Rank
+get_service_rank(CFArrayRef order, int n_order, CFStringRef serviceID)
 {
 {
-    CFDictionaryRef    d;
     CFIndex            i;
     CFIndex            i;
-    CFDictionaryRef    proto_dict;
-
-    if (serviceID == NULL) {
-       goto done;
-    }
-    d = CFDictionaryGetValue(S_service_state_dict, serviceID);
-    if (d == NULL) {
-       goto done;
-    }
-
-    proto_dict = CFDictionaryGetValue(d, proto_key);
-    if (proto_dict) {
-       CFStringRef     if_name;
-       CFNumberRef     override = NULL;
-
-       if_name = CFDictionaryGetValue(proto_dict, kSCPropInterfaceName);
-       if (S_ppp_override_primary == TRUE
-           && if_name != NULL
-           && CFStringHasPrefix(if_name, CFSTR("ppp"))) {
-           /* PPP override: make ppp* look the best */
-           /* Hack: should use interface type, not interface name */
-           return (0);
-       }
-       /* check for the "OverridePrimary" property */
-       override = CFDictionaryGetValue(proto_dict, kSCPropNetOverridePrimary);
-       if (isA_CFNumber(override) != NULL) {
-           int         val = 0;
-
-           CFNumberGetValue(override,  kCFNumberIntType, &val);
-           if (val != 0) {
-               return (0);
-           }
-       }
-    }
-
-    if (serviceID != NULL && order != NULL) {
-       CFIndex n = CFArrayGetCount(order);
+    Rank               rank = kRankLast;
 
 
-       for (i = 0; i < n; i++) {
+    if (serviceID != NULL && order != NULL && n_order > 0) {
+       for (i = 0; i < n_order; i++) {
            CFStringRef s = isA_CFString(CFArrayGetValueAtIndex(order, i));
 
            if (s == NULL) {
                continue;
            }
            if (CFEqual(serviceID, s)) {
            CFStringRef s = isA_CFString(CFArrayGetValueAtIndex(order, i));
 
            if (s == NULL) {
                continue;
            }
            if (CFEqual(serviceID, s)) {
-               return (i + 1);
+               rank = i + 1;
+               break;
            }
        }
     }
            }
        }
     }
-
- done:
-    return (UINT_MAX);
+    return (rank);
 }
 
 /**
  ** Service election:
  **/
 }
 
 /**
  ** Service election:
  **/
-typedef boolean_t (*routerCheckFunc)(CFStringRef str);
+/*
+ * Function: rank_dict_get_service_rank
+ * Purpose:
+ *   Retrieve the service rank in the given dictionary.
+ */
+static Rank
+rank_dict_get_service_rank(CFDictionaryRef rank_dict, CFStringRef serviceID)
+{
+    CFNumberRef                rank;
+    Rank               rank_val = kRankLast;
 
 
-static boolean_t
-check_ipv4_router(CFStringRef router)
+    rank = CFDictionaryGetValue(rank_dict, serviceID);
+    if (rank != NULL) {
+       CFNumberGetValue(rank, kCFNumberSInt32Type, &rank_val);
+    }
+    return (rank_val);
+}
+
+/*
+ * Function: rank_dict_set_service_rank
+ * Purpose:
+ *   Save the results of ranking the service so we can look it up later without
+ *   repeating all of the ranking code.
+ */
+static void
+rank_dict_set_service_rank(CFMutableDictionaryRef rank_dict,
+                          CFStringRef serviceID, Rank rank_val)
 {
 {
-    struct in_addr     ip;
+    CFNumberRef                rank;
 
 
-    return (cfstring_to_ip(router, &ip));
+    rank = CFNumberCreate(NULL, kCFNumberSInt32Type, (const void *)&rank_val);
+    if (rank != NULL) {
+       CFDictionarySetValue(rank_dict, serviceID, rank);
+       CFRelease(rank);
+    }
+    return;
 }
 
 }
 
+typedef struct election_info {
+    int                        n_services;
+    CFArrayRef         order;
+    int                        n_order;
+    CFStringRef                serviceID;
+    CFDictionaryRef    service_dict;
+    Rank               service_rank;
+    boolean_t          choose_last;
+} election_info_t;
+
+typedef boolean_t election_func_t(void * context, election_info_t * info);
+
+/*
+ * Function: elect_ipv4
+ * Purpose:
+ *   This function builds the list of IPv4 routes that should be active.
+ *   As elect_new_primary() invokes us with each service, we build up the
+ *   result in the passed in context, a pointer to an IPv4RouteListRef.
+ */
 static boolean_t
 static boolean_t
-check_ipv6_router(CFStringRef router)
+elect_ipv4(void * context, election_info_t * info)
 {
 {
-    struct in6_addr    ip6;
+    IPv4RouteListRef * routes_p = (IPv4RouteListRef *)context;
+    IPv4RouteListRef   service_routes;
 
 
-    return (cfstring_to_ip6(router, &ip6));
+    service_routes = service_dict_get_ipv4_routelist(info->service_dict);
+    if (service_routes == NULL) {
+       return (FALSE);
+    }
+    if ((service_routes->list->flags & kRouteChooseFirstFlag) != 0) {
+       info->service_rank = kRankFirst;
+    }
+    else if (S_ppp_override_primary
+            && (strncmp(PPP_PREFIX, service_routes->list->ifname,
+                        sizeof(PPP_PREFIX) - 1) == 0)) {
+       /* PPP override: make ppp* look the best */
+       /* Hack: should use interface type, not interface name */
+       info->service_rank = kRankFirst;
+    }
+    else {
+       info->service_rank = get_service_rank(info->order, info->n_order,
+                                             info->serviceID);
+       if ((service_routes->list->flags & kRouteChooseLastFlag) != 0) {
+           info->choose_last = TRUE;
+       }
+    }
+    if (routes_p != NULL) {
+       *routes_p = IPv4RouteListAddRouteList(*routes_p,
+                                             info->n_services * 3,
+                                             service_routes,
+                                             info->service_rank);
+    }
+    if ((service_routes->list->flags & kRouteChooseNeverFlag) != 0) {
+       /* never elect as primary */
+       return (FALSE);
+    }
+    rank_dict_set_service_rank(S_ipv4_service_rank_dict,
+                              info->serviceID, info->service_rank);
+    return (TRUE);
 }
 
 }
 
-struct election_state {
-    routerCheckFunc            router_check;
-    CFStringRef                        proto_key; /* e.g. kSCEntNetIPv4 */
-    CFStringRef                        router_key;/* e.g. kSCPropNetIPv4Router */
-    CFArrayRef                 order;
-    CFStringRef                        new_primary;
-    boolean_t                  new_has_router;
-    unsigned int               new_primary_index;
-};
-
-static void
-elect_protocol(const void * key, const void * value, void * context)
+static boolean_t
+elect_ipv6(void * context, election_info_t * info)
 {
 {
-    struct election_state *    elect_p = (struct election_state *)context;
-    CFDictionaryRef            proto_dict = NULL;
-    CFStringRef                        router;
-    boolean_t                  router_valid = FALSE;
-    CFStringRef                        serviceID = (CFStringRef)key;
-    CFDictionaryRef            service_dict = (CFDictionaryRef)value;
-    unsigned int               service_index;
+    CFStringRef                if_name;
+    CFStringRef                primaryRank     = NULL;
+    CFDictionaryRef    proto_dict;
+    CFStringRef                router;
+    CFDictionaryRef    service_options;
 
 
-    proto_dict = CFDictionaryGetValue(service_dict, elect_p->proto_key);
+    proto_dict = CFDictionaryGetValue(info->service_dict, kSCEntNetIPv6);
     if (proto_dict == NULL) {
     if (proto_dict == NULL) {
-       return;
+       return (FALSE);
     }
     }
-    router = CFDictionaryGetValue(proto_dict, elect_p->router_key);
-    router_valid = (*elect_p->router_check)(router);
-    if (router_valid == FALSE && elect_p->new_has_router == TRUE) {
-       /* skip it */
-       return;
+    service_options = service_dict_get(info->serviceID, kSCEntNetService);
+    if (service_options != NULL) {
+       primaryRank = CFDictionaryGetValue(service_options, kSCPropNetServicePrimaryRank);
+       if ((primaryRank != NULL)
+           && CFEqual(primaryRank, kSCValNetServicePrimaryRankNever)) {
+           return (FALSE);
+       }
     }
     }
-    service_index
-       = get_service_rank(elect_p->proto_key, elect_p->order, serviceID);
-    if (elect_p->new_primary == NULL
-       || service_index < elect_p->new_primary_index
-       || (router_valid && elect_p->new_has_router == FALSE)) {
-       my_CFRelease(&elect_p->new_primary);
-       elect_p->new_primary = CFRetain(serviceID);
-       elect_p->new_primary_index = service_index;
-       elect_p->new_has_router = router_valid;
+    router = CFDictionaryGetValue(proto_dict,
+                                 kSCPropNetIPv6Router);
+    if (router == NULL) {
+       info->choose_last = TRUE;
+       info->service_rank = kRankLast;
     }
     }
-    return;
+    else if ((primaryRank != NULL)
+            && CFEqual(primaryRank, kSCValNetServicePrimaryRankFirst)) {
+       info->service_rank = kRankFirst;
+    }
+    else if (get_override_primary(proto_dict)) {
+       info->service_rank = kRankFirst;
+    }
+    else if (S_ppp_override_primary
+            && CFDictionaryGetValueIfPresent(proto_dict,
+                                             kSCPropInterfaceName,
+                                             (const void **)&if_name)
+            && CFStringHasPrefix(if_name, CFSTR(PPP_PREFIX))) {
+       /* PPP override: make ppp* look the best */
+       /* Hack: should use interface type, not interface name */
+       info->service_rank = kRankFirst;
+    }
+    else {
+       info->service_rank = get_service_rank(info->order, info->n_order,
+                                             info->serviceID);
+    }
+    rank_dict_set_service_rank(S_ipv6_service_rank_dict,
+                              info->serviceID, info->service_rank);
+    return (TRUE);
 }
 
 }
 
+/*
+ * Function: elect_new_primary
+ * Purpose:
+ *   Walk the list of services, passing each service dictionary to "elect_func".
+ *   "elect_func" returns rank information about the service that let us
+ *   determine the new primary.
+ */
 static CFStringRef
 static CFStringRef
-elect_new_primary(CFArrayRef order, CFStringRef proto_key,
-                 CFStringRef router_key)
+elect_new_primary(election_func_t * elect_func, void * context,
+                 CFArrayRef order, int n_order)
 {
 {
-    struct election_state      elect;
+    int                        count;
+    int                        i;
+    election_info_t    info;
+    void * *           keys;
+#define N_KEYS_VALUES_STATIC   10
+    void *             keys_values_buf[N_KEYS_VALUES_STATIC * 2];
+    CFStringRef                new_primary = NULL;
+    Rank               new_primary_rank = kRankLast;
+    boolean_t          new_primary_choose_last = FALSE;
+    void * *           values;
+
+    count = CFDictionaryGetCount(S_service_state_dict);
+    if (count <= N_KEYS_VALUES_STATIC) {
+       keys = keys_values_buf;
+    }
+    else {
+       keys = (void * *)malloc(sizeof(*keys) * count * 2);
+    }
+    values = keys + count;
+    CFDictionaryGetKeysAndValues(S_service_state_dict,
+                                (const void * *)keys,
+                                (const void * *)values);
 
 
-    if (CFEqual(proto_key, kSCEntNetIPv4)) {
-       elect.router_check = check_ipv4_router;
+    info.n_services = count;
+    info.order = order;
+    info.n_order = n_order;
+    for (i = 0; i < count; i++) {
+       boolean_t       found_new_primary = FALSE;
+
+       info.serviceID = (CFStringRef)keys[i];
+       info.service_dict = (CFDictionaryRef)values[i];
+       info.service_rank = kRankLast;
+       info.choose_last = FALSE;
+
+       if ((*elect_func)(context, &info) == FALSE) {
+           continue;
+       }
+       if (new_primary == NULL) {
+           found_new_primary = TRUE;
+       }
+       else if (info.choose_last == new_primary_choose_last) {
+           found_new_primary = (info.service_rank < new_primary_rank);
+       }
+       else if (new_primary_choose_last) {
+           found_new_primary = TRUE;
+       }
+       if (found_new_primary) {
+           new_primary = info.serviceID;
+           new_primary_rank = info.service_rank;
+           new_primary_choose_last = info.choose_last;
+       }
     }
     }
-    else if (CFEqual(proto_key, kSCEntNetIPv6)) {
-       elect.router_check = check_ipv6_router;
+    if (new_primary != NULL) {
+       CFRetain(new_primary);
     }
     }
-    else {
-       return (NULL);
+    if (keys != keys_values_buf) {
+       free(keys);
     }
     }
-    elect.order = order;
-    elect.new_primary = NULL;
-    elect.new_primary_index = 0;
-    elect.new_has_router = FALSE;
-    elect.proto_key = proto_key;
-    elect.router_key = router_key;
-    CFDictionaryApplyFunction(S_service_state_dict, elect_protocol, &elect);
-    return (elect.new_primary);
+    return (new_primary);
 }
 
 static uint32_t
 }
 
 static uint32_t
@@ -1862,13 +3384,23 @@ service_changed(CFDictionaryRef services_info, CFStringRef serviceID)
     uint32_t           changed = 0;
     int                        i;
 
     uint32_t           changed = 0;
     int                        i;
 
+    /* update service options first (e.g. rank) */
+    if (get_rank_changes(serviceID,
+                        get_service_state_entity(services_info, serviceID,
+                                                 NULL),
+                        get_service_setup_entity(services_info, serviceID,
+                                                 NULL),
+                        services_info)) {
+       changed |= (1 << kEntityTypeServiceOptions);
+    }
+    /* update IPv4, IPv6, DNS, Proxies, SMB, ... */
     for (i = 0; i < ENTITY_TYPES_COUNT; i++) {
        GetEntityChangesFuncRef func = entityChangeFunc[i];
        if ((*func)(serviceID,
                    get_service_state_entity(services_info, serviceID,
     for (i = 0; i < ENTITY_TYPES_COUNT; i++) {
        GetEntityChangesFuncRef func = entityChangeFunc[i];
        if ((*func)(serviceID,
                    get_service_state_entity(services_info, serviceID,
-                                            entityTypeNames[i]),
+                                            *entityTypeNames[i]),
                    get_service_setup_entity(services_info, serviceID,
                    get_service_setup_entity(services_info, serviceID,
-                                            entityTypeNames[i]),
+                                            *entityTypeNames[i]),
                    services_info)) {
            changed |= (1 << i);
        }
                    services_info)) {
            changed |= (1 << i);
        }
@@ -1915,38 +3447,43 @@ set_new_primary(CFStringRef * primary_p, CFStringRef new_primary,
 
     if (new_primary != NULL) {
        if (primary != NULL && CFEqual(new_primary, primary)) {
 
     if (new_primary != NULL) {
        if (primary != NULL && CFEqual(new_primary, primary)) {
-           SCLog(S_IPMonitor_debug, LOG_INFO,
-                 CFSTR("IPMonitor: %@ is still primary %s"),
-                 new_primary, entity);
+           if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
+               SCLog(TRUE, LOG_NOTICE,
+                     CFSTR("IPMonitor: %@ is still primary %s"),
+                     new_primary, entity);
+           }
        }
        else {
            my_CFRelease(primary_p);
            *primary_p = CFRetain(new_primary);
        }
        else {
            my_CFRelease(primary_p);
            *primary_p = CFRetain(new_primary);
-           SCLog(S_IPMonitor_debug, LOG_INFO,
-                 CFSTR("IPMonitor: %@ is the new primary %s"),
-                 new_primary, entity);
+           if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
+               SCLog(TRUE, LOG_NOTICE,
+                     CFSTR("IPMonitor: %@ is the new primary %s"),
+                     new_primary, entity);
+           }
            changed = TRUE;
        }
     }
     else if (primary != NULL) {
            changed = TRUE;
        }
     }
     else if (primary != NULL) {
-       SCLog(S_IPMonitor_debug, LOG_INFO,
-             CFSTR("IPMonitor: %@ is no longer primary %s"), primary, entity);
+       if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
+           SCLog(TRUE, LOG_NOTICE,
+                 CFSTR("IPMonitor: %@ is no longer primary %s"),
+                 primary, entity);
+       }
        my_CFRelease(primary_p);
        changed = TRUE;
     }
     return (changed);
 }
 
        my_CFRelease(primary_p);
        changed = TRUE;
     }
     return (changed);
 }
 
-static unsigned int
-rank_service_entity(CFArrayRef order, CFStringRef primary,
-                   CFStringRef proto_key, CFStringRef entity)
+static Rank
+rank_service_entity(CFDictionaryRef rank_dict, CFStringRef serviceID,
+                   CFStringRef entity)
 {
 {
-    CFDictionaryRef    dict;
-    dict = service_dict_get(primary, entity);
-    if (dict == NULL) {
-       return (UINT_MAX);
+    if (service_dict_get(serviceID, entity) == NULL) {
+       return (kRankLast);
     }
     }
-    return (get_service_rank(proto_key, order, primary));
+    return (rank_dict_get_service_rank(rank_dict, serviceID));
 }
 
 static void
 }
 
 static void
@@ -1957,9 +3494,10 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
     boolean_t          dnsinfo_changed = FALSE;
     boolean_t          global_ipv4_changed = FALSE;
     boolean_t          global_ipv6_changed = FALSE;
     boolean_t          dnsinfo_changed = FALSE;
     boolean_t          global_ipv4_changed = FALSE;
     boolean_t          global_ipv6_changed = FALSE;
-    keyChangeList      keys;
     int                        i;
     int                        i;
+    keyChangeList      keys;
     CFIndex            n;
     CFIndex            n;
+    int                        n_service_order = 0;
     CFArrayRef         service_order;
     CFMutableArrayRef  service_changes = NULL;
     CFDictionaryRef    services_info = NULL;
     CFArrayRef         service_order;
     CFMutableArrayRef  service_changes = NULL;
     CFDictionaryRef    services_info = NULL;
@@ -1969,8 +3507,10 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
        return;
     }
 
        return;
     }
 
-    SCLog(S_IPMonitor_debug, LOG_INFO,
-         CFSTR("IPMonitor: changes %@ (%d)"), changed_keys, count);
+    if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
+       SCLog(TRUE, LOG_NOTICE,
+             CFSTR("IPMonitor: changes %@ (%d)"), changed_keys, count);
+    }
 
     keyChangeListInit(&keys);
     service_changes = CFArrayCreateMutable(NULL, 0,
 
     keyChangeListInit(&keys);
     service_changes = CFArrayCreateMutable(NULL, 0,
@@ -1986,14 +3526,24 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
                my_CFArrayAppendUniqueValue(service_changes, S_primary_proxies);
            }
        }
                my_CFArrayAppendUniqueValue(service_changes, S_primary_proxies);
            }
        }
+#if    !TARGET_OS_IPHONE
        else if (CFEqual(change, S_setup_global_smb)) {
            if (S_primary_smb != NULL) {
                my_CFArrayAppendUniqueValue(service_changes, S_primary_smb);
            }
        }
        else if (CFEqual(change, S_setup_global_smb)) {
            if (S_primary_smb != NULL) {
                my_CFArrayAppendUniqueValue(service_changes, S_primary_smb);
            }
        }
+#endif /* !TARGET_OS_IPHONE */
+       else if (CFEqual(change, S_multicast_resolvers)) {
+           dnsinfo_changed = TRUE;
+       }
        else if (CFEqual(change, S_private_resolvers)) {
            dnsinfo_changed = TRUE;
        }
        else if (CFEqual(change, S_private_resolvers)) {
            dnsinfo_changed = TRUE;
        }
+#if    !TARGET_OS_IPHONE
+       else if (CFEqual(change, CFSTR(_PATH_RESOLVER_DIR))) {
+           dnsinfo_changed = TRUE;
+       }
+#endif /* !TARGET_OS_IPHONE */
        else if (CFStringHasPrefix(change, S_state_service_prefix)) {
            CFStringRef serviceID = parse_component(change,
                                                    S_state_service_prefix);
        else if (CFStringHasPrefix(change, S_state_service_prefix)) {
            CFStringRef serviceID = parse_component(change,
                                                    S_state_service_prefix);
@@ -2016,8 +3566,11 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
     services_info = services_info_copy(session, service_changes);
     service_order = service_order_get(services_info);
     if (service_order != NULL) {
     services_info = services_info_copy(session, service_changes);
     service_order = service_order_get(services_info);
     if (service_order != NULL) {
-       SCLog(S_IPMonitor_debug, LOG_INFO,
-             CFSTR("IPMonitor: service_order %@ "), service_order);
+       n_service_order = CFArrayGetCount(service_order);
+       if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
+           SCLog(TRUE, LOG_NOTICE,
+                 CFSTR("IPMonitor: service_order %@ "), service_order);
+       }
     }
     n = CFArrayGetCount(service_changes);
     for (i = 0; i < n; i++) {
     }
     n = CFArrayGetCount(service_changes);
     for (i = 0; i < n; i++) {
@@ -2028,10 +3581,14 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
        serviceID = CFArrayGetValueAtIndex(service_changes, i);
        wasSupplemental = dns_has_supplemental(serviceID);
        changes = service_changed(services_info, serviceID);
        serviceID = CFArrayGetValueAtIndex(service_changes, i);
        wasSupplemental = dns_has_supplemental(serviceID);
        changes = service_changed(services_info, serviceID);
-
-       if (S_primary_ipv4 != NULL && CFEqual(S_primary_ipv4, serviceID)) {
+       if ((changes & (1 << kEntityTypeServiceOptions)) != 0) {
+           /* if __Service__ (e.g. PrimaryRank) changed */
+           global_ipv4_changed = TRUE;
+       }
+       else if (S_primary_ipv4 != NULL && CFEqual(S_primary_ipv4, serviceID)) {
+           // if we are looking at the primary [IPv4] service
            if ((changes & (1 << kEntityTypeIPv4)) != 0) {
            if ((changes & (1 << kEntityTypeIPv4)) != 0) {
-               update_ipv4(services_info, serviceID, &keys);
+               // and something changed for THIS service
                global_ipv4_changed = TRUE;
            }
        }
                global_ipv4_changed = TRUE;
            }
        }
@@ -2039,9 +3596,11 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
            global_ipv4_changed = TRUE;
        }
        if ((changes & (1 << kEntityTypeIPv6)) != 0) {
            global_ipv4_changed = TRUE;
        }
        if ((changes & (1 << kEntityTypeIPv6)) != 0) {
+           // if we are looking at the primary [IPv6] service
            if (S_primary_ipv6 != NULL && CFEqual(S_primary_ipv6, serviceID)) {
                update_ipv6(services_info, serviceID, &keys);
            }
            if (S_primary_ipv6 != NULL && CFEqual(S_primary_ipv6, serviceID)) {
                update_ipv6(services_info, serviceID, &keys);
            }
+           // and something changed for THIS service
            global_ipv6_changed = TRUE;
        }
        if ((changes & (1 << kEntityTypeDNS)) != 0) {
            global_ipv6_changed = TRUE;
        }
        if ((changes & (1 << kEntityTypeDNS)) != 0) {
@@ -2058,87 +3617,96 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
                update_proxies(services_info, serviceID, &keys);
            }
        }
                update_proxies(services_info, serviceID, &keys);
            }
        }
+#if    !TARGET_OS_IPHONE
        if ((changes & (1 << kEntityTypeSMB)) != 0) {
            if (S_primary_smb != NULL && CFEqual(S_primary_smb, serviceID)) {
                update_smb(services_info, serviceID, &keys);
            }
        }
        if ((changes & (1 << kEntityTypeSMB)) != 0) {
            if (S_primary_smb != NULL && CFEqual(S_primary_smb, serviceID)) {
                update_smb(services_info, serviceID, &keys);
            }
        }
+#endif /* !TARGET_OS_IPHONE */
     }
 
     if (global_ipv4_changed) {
     }
 
     if (global_ipv4_changed) {
-       CFStringRef new_primary;
+       IPv4RouteListRef        new_routelist = NULL;
+       CFStringRef             new_primary;
 
 
-       SCLog(S_IPMonitor_debug, LOG_INFO,
-             CFSTR("IPMonitor: IPv4 service election"));
-       new_primary = elect_new_primary(service_order,
-                                       kSCEntNetIPv4, kSCPropNetIPv4Router);
-       if (set_new_primary(&S_primary_ipv4, new_primary, "IPv4")) {
-           update_ipv4(services_info, S_primary_ipv4, &keys);
+       if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
+           SCLog(TRUE, LOG_NOTICE,
+                 CFSTR("IPMonitor: IPv4 service election"));
        }
        }
+       new_primary = elect_new_primary(&elect_ipv4, &new_routelist,
+                                       service_order, n_service_order);
+       (void)set_new_primary(&S_primary_ipv4, new_primary, "IPv4");
+       update_ipv4(S_primary_ipv4, new_routelist, &keys);
        my_CFRelease(&new_primary);
     }
     if (global_ipv6_changed) {
        CFStringRef new_primary;
 
        my_CFRelease(&new_primary);
     }
     if (global_ipv6_changed) {
        CFStringRef new_primary;
 
-       SCLog(S_IPMonitor_debug, LOG_INFO,
-             CFSTR("IPMonitor: IPv6 service election"));
-       new_primary = elect_new_primary(service_order,
-                                       kSCEntNetIPv6, kSCPropNetIPv6Router);
+       if ((S_IPMonitor_debug & kDebugFlag1) != 0) {
+           SCLog(TRUE, LOG_NOTICE,
+                 CFSTR("IPMonitor: IPv6 service election"));
+       }
+       new_primary = elect_new_primary(&elect_ipv6, NULL,
+                                       service_order, n_service_order);
        if (set_new_primary(&S_primary_ipv6, new_primary, "IPv6")) {
            update_ipv6(services_info, S_primary_ipv6, &keys);
        }
        my_CFRelease(&new_primary);
     }
     if (global_ipv4_changed || global_ipv6_changed) {
        if (set_new_primary(&S_primary_ipv6, new_primary, "IPv6")) {
            update_ipv6(services_info, S_primary_ipv6, &keys);
        }
        my_CFRelease(&new_primary);
     }
     if (global_ipv4_changed || global_ipv6_changed) {
-       CFStringRef     new_primary_dns;
-       CFStringRef     new_primary_proxies;
-       CFStringRef     new_primary_smb;
+       CFStringRef     new_primary_dns     = NULL;
+       CFStringRef     new_primary_proxies = NULL;
+#if    !TARGET_OS_IPHONE
+       CFStringRef     new_primary_smb     = NULL;
+#endif /* !TARGET_OS_IPHONE */
 
        if (S_primary_ipv4 != NULL && S_primary_ipv6 != NULL) {
            /* decide between IPv4 and IPv6 */
 
        if (S_primary_ipv4 != NULL && S_primary_ipv6 != NULL) {
            /* decide between IPv4 and IPv6 */
-           if (rank_service_entity(service_order, S_primary_ipv4,
-                                   kSCEntNetIPv4, kSCEntNetDNS)
-               <= rank_service_entity(service_order, S_primary_ipv6,
-                                      kSCEntNetIPv6, kSCEntNetDNS)) {
+           if (rank_service_entity(S_ipv4_service_rank_dict,
+                                   S_primary_ipv4, kSCEntNetDNS)
+               <= rank_service_entity(S_ipv6_service_rank_dict,
+                                      S_primary_ipv6, kSCEntNetDNS)) {
                new_primary_dns = S_primary_ipv4;
            }
            else {
                new_primary_dns = S_primary_ipv6;
            }
                new_primary_dns = S_primary_ipv4;
            }
            else {
                new_primary_dns = S_primary_ipv6;
            }
-           if (rank_service_entity(service_order, S_primary_ipv4,
-                                   kSCEntNetIPv4, kSCEntNetProxies)
-               <= rank_service_entity(service_order, S_primary_ipv6,
-                                      kSCEntNetIPv6, kSCEntNetProxies)) {
+           if (rank_service_entity(S_ipv4_service_rank_dict,
+                                   S_primary_ipv4, kSCEntNetProxies)
+               <= rank_service_entity(S_ipv6_service_rank_dict,
+                                      S_primary_ipv6, kSCEntNetProxies)) {
                new_primary_proxies = S_primary_ipv4;
            }
            else {
                new_primary_proxies = S_primary_ipv6;
            }
                new_primary_proxies = S_primary_ipv4;
            }
            else {
                new_primary_proxies = S_primary_ipv6;
            }
-           if (rank_service_entity(service_order, S_primary_ipv4,
-                                   kSCEntNetIPv4, kSCEntNetSMB)
-               <= rank_service_entity(service_order, S_primary_ipv6,
-                                      kSCEntNetIPv6, kSCEntNetSMB)) {
+#if    !TARGET_OS_IPHONE
+           if (rank_service_entity(S_ipv4_service_rank_dict,
+                                   S_primary_ipv4, kSCEntNetSMB)
+               <= rank_service_entity(S_ipv6_service_rank_dict,
+                                      S_primary_ipv6, kSCEntNetSMB)) {
                new_primary_smb = S_primary_ipv4;
            }
            else {
                new_primary_smb = S_primary_ipv6;
            }
                new_primary_smb = S_primary_ipv4;
            }
            else {
                new_primary_smb = S_primary_ipv6;
            }
+#endif /* !TARGET_OS_IPHONE */
 
        }
        else if (S_primary_ipv6 != NULL) {
            new_primary_dns     = S_primary_ipv6;
            new_primary_proxies = S_primary_ipv6;
 
        }
        else if (S_primary_ipv6 != NULL) {
            new_primary_dns     = S_primary_ipv6;
            new_primary_proxies = S_primary_ipv6;
+#if    !TARGET_OS_IPHONE
            new_primary_smb     = S_primary_ipv6;
            new_primary_smb     = S_primary_ipv6;
+#endif /* !TARGET_OS_IPHONE */
        }
        else if (S_primary_ipv4 != NULL) {
            new_primary_dns     = S_primary_ipv4;
            new_primary_proxies = S_primary_ipv4;
        }
        else if (S_primary_ipv4 != NULL) {
            new_primary_dns     = S_primary_ipv4;
            new_primary_proxies = S_primary_ipv4;
+#if    !TARGET_OS_IPHONE
            new_primary_smb     = S_primary_ipv4;
            new_primary_smb     = S_primary_ipv4;
-       }
-       else {
-           new_primary_dns     = NULL;
-           new_primary_proxies = NULL;
-           new_primary_smb     = NULL;
+#endif /* !TARGET_OS_IPHONE */
        }
 
        if (set_new_primary(&S_primary_dns, new_primary_dns, "DNS")) {
        }
 
        if (set_new_primary(&S_primary_dns, new_primary_dns, "DNS")) {
@@ -2148,9 +3716,11 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
        if (set_new_primary(&S_primary_proxies, new_primary_proxies, "Proxies")) {
            update_proxies(services_info, S_primary_proxies, &keys);
        }
        if (set_new_primary(&S_primary_proxies, new_primary_proxies, "Proxies")) {
            update_proxies(services_info, S_primary_proxies, &keys);
        }
+#if    !TARGET_OS_IPHONE
        if (set_new_primary(&S_primary_smb, new_primary_smb, "SMB")) {
            update_smb(services_info, S_primary_smb, &keys);
        }
        if (set_new_primary(&S_primary_smb, new_primary_smb, "SMB")) {
            update_smb(services_info, S_primary_smb, &keys);
        }
+#endif /* !TARGET_OS_IPHONE */
     }
     if (dnsinfo_changed) {
        update_dnsinfo(services_info, S_primary_dns, &keys, service_order);
     }
     if (dnsinfo_changed) {
        update_dnsinfo(services_info, S_primary_dns, &keys, service_order);
@@ -2162,34 +3732,26 @@ IPMonitorNotify(SCDynamicStoreRef session, CFArrayRef changed_keys,
     return;
 }
 
     return;
 }
 
-static void
-initEntityNames(void)
-{
-    entityTypeNames[0] = kSCEntNetIPv4;                /* 0 */
-    entityTypeNames[1] = kSCEntNetIPv6;                /* 1 */
-    entityTypeNames[2] = kSCEntNetDNS;         /* 2 */
-    entityTypeNames[3] = kSCEntNetProxies;     /* 3 */
-    entityTypeNames[4] = kSCEntNetSMB;         /* 4 */
-    return;
-}
-
 static void
 ip_plugin_init()
 {
 static void
 ip_plugin_init()
 {
-    int                        i;
-    CFStringRef                key;
     CFMutableArrayRef  keys = NULL;
     CFMutableArrayRef  patterns = NULL;
     CFRunLoopSourceRef rls = NULL;
     CFMutableArrayRef  keys = NULL;
     CFMutableArrayRef  patterns = NULL;
     CFRunLoopSourceRef rls = NULL;
-    SCDynamicStoreRef  session = NULL;
 
 
-    initEntityNames();
-    if (S_netboot_root() != 0) {
+    if (S_is_network_boot() != 0) {
        S_netboot = TRUE;
     }
        S_netboot = TRUE;
     }
-    session = SCDynamicStoreCreate(NULL, CFSTR("IPMonitor"),
+
+#ifdef RTF_IFSCOPE
+    if (S_is_scoped_routing_enabled() != 0) {
+       S_scopedroute = TRUE;
+    }
+#endif /* RTF_IFSCOPE */
+
+    S_session = SCDynamicStoreCreate(NULL, CFSTR("IPMonitor"),
                                   IPMonitorNotify, NULL);
                                   IPMonitorNotify, NULL);
-    if (session == NULL) {
+    if (S_session == NULL) {
        SCLog(TRUE, LOG_ERR,
              CFSTR("IPMonitor ip_plugin_init SCDynamicStoreCreate failed: %s"),
              SCErrorString(SCError()));
        SCLog(TRUE, LOG_ERR,
              CFSTR("IPMonitor ip_plugin_init SCDynamicStoreCreate failed: %s"),
              SCErrorString(SCError()));
@@ -2211,10 +3773,12 @@ ip_plugin_init()
        = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                     kSCDynamicStoreDomainState,
                                                     kSCEntNetProxies);
        = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                     kSCDynamicStoreDomainState,
                                                     kSCEntNetProxies);
+#if    !TARGET_OS_IPHONE
     S_state_global_smb
        = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                     kSCDynamicStoreDomainState,
                                                     kSCEntNetSMB);
     S_state_global_smb
        = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                     kSCDynamicStoreDomainState,
                                                     kSCEntNetSMB);
+#endif /* !TARGET_OS_IPHONE */
     S_setup_global_ipv4
        = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                     kSCDynamicStoreDomainSetup,
     S_setup_global_ipv4
        = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                     kSCDynamicStoreDomainSetup,
@@ -2223,10 +3787,12 @@ ip_plugin_init()
        = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                     kSCDynamicStoreDomainSetup,
                                                     kSCEntNetProxies);
        = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                     kSCDynamicStoreDomainSetup,
                                                     kSCEntNetProxies);
+#if    !TARGET_OS_IPHONE
     S_setup_global_smb
        = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                     kSCDynamicStoreDomainSetup,
                                                     kSCEntNetSMB);
     S_setup_global_smb
        = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                     kSCDynamicStoreDomainSetup,
                                                     kSCEntNetSMB);
+#endif /* !TARGET_OS_IPHONE */
     S_state_service_prefix
        = SCDynamicStoreKeyCreate(NULL, CFSTR("%@/%@/%@/"),
                                  kSCDynamicStoreDomainState,
     S_state_service_prefix
        = SCDynamicStoreKeyCreate(NULL, CFSTR("%@/%@/%@/"),
                                  kSCDynamicStoreDomainState,
@@ -2242,34 +3808,40 @@ ip_plugin_init()
                                    &kCFTypeDictionaryKeyCallBacks,
                                    &kCFTypeDictionaryValueCallBacks);
 
                                    &kCFTypeDictionaryKeyCallBacks,
                                    &kCFTypeDictionaryValueCallBacks);
 
+    S_ipv4_service_rank_dict
+       = CFDictionaryCreateMutable(NULL, 0,
+                                   &kCFTypeDictionaryKeyCallBacks,
+                                   &kCFTypeDictionaryValueCallBacks);
+
+    S_ipv6_service_rank_dict
+       = CFDictionaryCreateMutable(NULL, 0,
+                                   &kCFTypeDictionaryKeyCallBacks,
+                                   &kCFTypeDictionaryValueCallBacks);
+
     keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
     patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
     /* register for State: and Setup: per-service notifications */
     keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
     patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
     /* register for State: and Setup: per-service notifications */
-    for (i = 0; i < ENTITY_TYPES_COUNT; i++) {
-       key = state_service_key(kSCCompAnyRegex, entityTypeNames[i]);
-       CFArrayAppendValue(patterns, key);
-       CFRelease(key);
-       key = setup_service_key(kSCCompAnyRegex, entityTypeNames[i]);
-       CFArrayAppendValue(patterns, key);
-       CFRelease(key);
-    }
+    add_service_keys(kSCCompAnyRegex, keys, patterns);
 
     /* add notifier for ServiceOrder/PPPOverridePrimary changes for IPv4 */
 
     /* add notifier for ServiceOrder/PPPOverridePrimary changes for IPv4 */
-    key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
-                                                    kSCDynamicStoreDomainSetup,
-                                                    kSCEntNetIPv4);
-    CFArrayAppendValue(keys, key);
-    CFRelease(key);
+    CFArrayAppendValue(keys, S_setup_global_ipv4);
 
 
-    /* add notifier for Private DNS configuration */
+    /* add notifier for multicast DNS configuration (Bonjour/.local) */
+    S_multicast_resolvers = SCDynamicStoreKeyCreate(NULL, CFSTR("%@/%@/%@"),
+                                                   kSCDynamicStoreDomainState,
+                                                   kSCCompNetwork,
+                                                   CFSTR(kDNSServiceCompMulticastDNS));
+    CFArrayAppendValue(keys, S_multicast_resolvers);
+
+    /* add notifier for private DNS configuration (Back to My Mac) */
     S_private_resolvers = SCDynamicStoreKeyCreate(NULL, CFSTR("%@/%@/%@"),
                                                  kSCDynamicStoreDomainState,
                                                  kSCCompNetwork,
                                                  CFSTR(kDNSServiceCompPrivateDNS));
     CFArrayAppendValue(keys, S_private_resolvers);
 
     S_private_resolvers = SCDynamicStoreKeyCreate(NULL, CFSTR("%@/%@/%@"),
                                                  kSCDynamicStoreDomainState,
                                                  kSCCompNetwork,
                                                  CFSTR(kDNSServiceCompPrivateDNS));
     CFArrayAppendValue(keys, S_private_resolvers);
 
-    if (!SCDynamicStoreSetNotificationKeys(session, keys, patterns)) {
+    if (!SCDynamicStoreSetNotificationKeys(S_session, keys, patterns)) {
        SCLog(TRUE, LOG_ERR,
              CFSTR("IPMonitor ip_plugin_init "
                    "SCDynamicStoreSetNotificationKeys failed: %s"),
        SCLog(TRUE, LOG_ERR,
              CFSTR("IPMonitor ip_plugin_init "
                    "SCDynamicStoreSetNotificationKeys failed: %s"),
@@ -2277,7 +3849,7 @@ ip_plugin_init()
        goto done;
     }
 
        goto done;
     }
 
-    rls = SCDynamicStoreCreateRunLoopSource(NULL, session, 0);
+    rls = SCDynamicStoreCreateRunLoopSource(NULL, S_session, 0);
     if (rls == NULL) {
        SCLog(TRUE, LOG_ERR,
              CFSTR("IPMonitor ip_plugin_init "
     if (rls == NULL) {
        SCLog(TRUE, LOG_ERR,
              CFSTR("IPMonitor ip_plugin_init "
@@ -2290,17 +3862,20 @@ ip_plugin_init()
     CFRelease(rls);
 
     /* initialize dns configuration */
     CFRelease(rls);
 
     /* initialize dns configuration */
-    dns_configuration_set(NULL, NULL, NULL, NULL);
+    dns_configuration_set(NULL, NULL, NULL, NULL, NULL);
+#if    !TARGET_OS_IPHONE
     empty_dns();
     empty_dns();
-    (void)SCDynamicStoreRemoveValue(session, S_state_global_dns);
+#endif /* !TARGET_OS_IPHONE */
+    (void)SCDynamicStoreRemoveValue(S_session, S_state_global_dns);
 
 
+#if    !TARGET_OS_IPHONE
     /* initialize SMB configuration */
     /* initialize SMB configuration */
-    (void)SCDynamicStoreRemoveValue(session, S_state_global_smb);
+    (void)SCDynamicStoreRemoveValue(S_session, S_state_global_smb);
+#endif /* !TARGET_OS_IPHONE */
 
   done:
     my_CFRelease(&keys);
     my_CFRelease(&patterns);
 
   done:
     my_CFRelease(&keys);
     my_CFRelease(&patterns);
-    my_CFRelease(&session);
     return;
 }
 
     return;
 }
 
@@ -2309,29 +3884,60 @@ void
 prime_IPMonitor()
 {
     /* initialize multicast route */
 prime_IPMonitor()
 {
     /* initialize multicast route */
-    set_ipv4_router(NULL, NULL, NULL, FALSE);
+    update_ipv4(NULL, NULL, NULL);
+    return;
+}
+
+static boolean_t
+S_get_plist_boolean(CFDictionaryRef plist, CFStringRef key,
+                   boolean_t def)
+{
+    CFBooleanRef       b;
+    boolean_t          ret = def;
+
+    b = isA_CFBoolean(CFDictionaryGetValue(plist, key));
+    if (b != NULL) {
+       ret = CFBooleanGetValue(b);
+    }
+    return (ret);
 }
 
 __private_extern__
 void
 load_IPMonitor(CFBundleRef bundle, Boolean bundleVerbose)
 {
 }
 
 __private_extern__
 void
 load_IPMonitor(CFBundleRef bundle, Boolean bundleVerbose)
 {
+    CFDictionaryRef    info_dict;
+
+    info_dict = CFBundleGetInfoDictionary(bundle);
+    if (info_dict != NULL) {
+       S_append_state
+           = S_get_plist_boolean(info_dict,
+                                 CFSTR("AppendStateArrayToSetupArray"),
+                                 FALSE);
+    }
     if (bundleVerbose) {
     if (bundleVerbose) {
-       S_IPMonitor_debug = 1;
+       S_IPMonitor_debug = kDebugFlagDefault;
     }
 
     dns_configuration_init(bundle);
     ip_plugin_init();
 
     }
 
     dns_configuration_init(bundle);
     ip_plugin_init();
 
-    load_hostname(S_IPMonitor_debug);
-    load_smb_configuration(S_IPMonitor_debug);
+#if    !TARGET_OS_IPHONE
+    if (S_session != NULL) {
+       dns_configuration_monitor(S_session, IPMonitorNotify);
+    }
+#endif /* !TARGET_OS_IPHONE */
+
+    load_hostname((S_IPMonitor_debug & kDebugFlag1) != 0);
+#if    !TARGET_OS_IPHONE
+    load_smb_configuration((S_IPMonitor_debug & kDebugFlag1) != 0);
+#endif /* !TARGET_OS_IPHONE */
 
     return;
 }
 
 
 
     return;
 }
 
 
-#ifdef  MAIN
-#undef  MAIN
+#ifdef TEST_IPMONITOR
 #include "dns-configuration.c"
 #include "set-hostname.c"
 
 #include "dns-configuration.c"
 #include "set-hostname.c"
 
@@ -2339,14 +3945,607 @@ int
 main(int argc, char **argv)
 {
     _sc_log     = FALSE;
 main(int argc, char **argv)
 {
     _sc_log     = FALSE;
-    _sc_verbose = (argc > 1) ? TRUE : FALSE;
 
 
-    load_IPMonitor(CFBundleGetMainBundle(), (argc > 1) ? TRUE : FALSE);
+    S_IPMonitor_debug = kDebugFlag1;
+    if (argc > 1) {
+       S_IPMonitor_debug = strtoul(argv[1], NULL, 0);
+    }
+
+    load_IPMonitor(CFBundleGetMainBundle(), FALSE);
     prime_IPMonitor();
     CFRunLoopRun();
     /* not reached */
     exit(0);
     return 0;
 }
     prime_IPMonitor();
     CFRunLoopRun();
     /* not reached */
     exit(0);
     return 0;
 }
-#endif
+#endif /* TEST_IPMONITOR */
+
+#ifdef TEST_IPV4_ROUTELIST
+#include "dns-configuration.c"
+#include "set-hostname.c"
+
+struct ipv4_service_contents {
+    const char *       addr;
+    const char *       mask;
+    const char *       dest;
+    const char *       router;
+    const char *       ifname;
+    Rank               rank;
+    const CFStringRef  *primaryRank;
+};
+
+/*
+ *  addr       mask            dest            router          ifname  pri  primaryRank
+ */
+struct ipv4_service_contents en0_10 = {
+    "10.0.0.10", "255.255.255.0", NULL,                "10.0.0.1",     "en0",  10,  NULL
+};
+
+struct ipv4_service_contents en0_15 = {
+    "10.0.0.19", "255.255.255.0", NULL,                "10.0.0.1",     "en0",  15,  NULL
+};
+
+struct ipv4_service_contents en0_30 = {
+    "10.0.0.11", "255.255.255.0", NULL,        "10.0.0.1",     "en0",  30,  NULL
+};
+
+struct ipv4_service_contents en0_40 = {
+    "10.0.0.12", "255.255.255.0", NULL,        "10.0.0.1",     "en0",  40,  NULL
+};
+
+struct ipv4_service_contents en0_50 = {
+    "10.0.0.13", "255.255.255.0", NULL,        "10.0.0.1",     "en0",  50,  NULL
+};
+
+struct ipv4_service_contents en0_110 = {
+    "192.168.2.10", "255.255.255.0", NULL,     "192.168.2.1",  "en0",  110, NULL
+};
+
+struct ipv4_service_contents en0_1 = {
+    "17.202.40.191", "255.255.252.0", NULL,    "17.202.20.1",  "en0",  1,   NULL
+};
+
+struct ipv4_service_contents en1_20 = {
+    "10.0.0.20", "255.255.255.0", NULL,        "10.0.0.1",     "en1",  20,  NULL
+};
+
+struct ipv4_service_contents en1_2 = {
+    "17.202.42.24", "255.255.252.0", NULL,     "17.202.20.1",  "en1",  2,   NULL
+};
+
+struct ipv4_service_contents en1_125 = {
+    "192.168.2.20", "255.255.255.0", NULL,     "192.168.2.1",  "en1",  125, NULL
+};
+
+struct ipv4_service_contents fw0_25 = {
+    "192.168.2.30", "255.255.255.0", NULL,     "192.168.2.1",  "fw0",  25,  NULL
+};
+
+struct ipv4_service_contents fw0_21 = {
+    "192.168.3.30", "255.255.255.0", NULL,     "192.168.3.1",  "fw0",  21,  NULL
+};
+
+struct ipv4_service_contents ppp0_0_1 = {
+    "17.219.156.22", NULL, "17.219.156.1",     "17.219.156.1", "ppp0", 0,   NULL
+};
+
+struct ipv4_service_contents en0_test6 = {
+    "17.202.42.113",  "255.255.252.0", NULL,   "17.202.40.1",  "en0",  2,   NULL
+};
+struct ipv4_service_contents en1_test6 = {
+    "17.202.42.111",  "255.255.252.0", NULL,   "17.202.40.1",  "en1",  3,   NULL
+};
+struct ipv4_service_contents en2_test6 = {
+    "17.255.98.164",  "255.255.240.0", NULL,   "17.255.96.1",  "en2",  1,   NULL
+};
+
+struct ipv4_service_contents en0_test7 = {
+    "17.202.42.113",  "255.255.252.0", NULL,   "17.202.40.1",  "en0",  3,   NULL
+};
+struct ipv4_service_contents en1_test7 = {
+    "17.202.42.111",  "255.255.252.0", NULL,   "17.202.40.1",  "en1",  2,   NULL
+};
+struct ipv4_service_contents en2_test7 = {
+    "17.255.98.164",  "255.255.240.0", NULL,   "17.255.96.1",  "en2",  1,   NULL
+};
+struct ipv4_service_contents fw0_test6_and_7 = {
+    "169.254.11.33",  "255.255.0.0", NULL,     NULL,           "fw0", UINT_MAX,  NULL
+};
+
+struct ipv4_service_contents en0_10_last = {
+    "10.0.0.10", "255.255.255.0", NULL,                "10.0.0.1",     "en0",  10,  &kSCValNetServicePrimaryRankLast
+};
+
+struct ipv4_service_contents en0_10_never = {
+    "10.0.0.10", "255.255.255.0", NULL,                "10.0.0.1",     "en0",  10,  &kSCValNetServicePrimaryRankNever
+};
+
+struct ipv4_service_contents en1_20_first = {
+    "10.0.0.20", "255.255.255.0", NULL,        "10.0.0.1",     "en1",  20,  &kSCValNetServicePrimaryRankFirst
+};
+
+struct ipv4_service_contents en1_20_never = {
+    "10.0.0.20", "255.255.255.0", NULL,        "10.0.0.1",     "en1",  20,  &kSCValNetServicePrimaryRankNever
+};
+
+struct ipv4_service_contents * test1[] = {
+    &en0_40,
+    &en0_15,
+    &fw0_25,
+    &en0_30,
+    &en1_20,
+    &en0_50,
+    &en0_10,
+    NULL
+};
+
+struct ipv4_service_contents * test2[] = {
+    &en0_40,
+    &fw0_25,
+    &en0_30,
+    &en1_20,
+    &en0_50,
+    &en0_10,
+    NULL
+};
+
+struct ipv4_service_contents * test3[] = {
+    &en0_40,
+    &en1_20,
+    &en0_50,
+    &en0_10,
+    &en0_110,
+    &en1_125,
+    &fw0_25,
+    &fw0_21,
+    &en0_40,
+    &en0_30,
+    NULL
+};
+
+struct ipv4_service_contents * test4[] = {
+    &en0_1,
+    &en0_40,
+    &en0_30,
+    &en1_20,
+    &en1_2,
+    NULL
+};
+
+struct ipv4_service_contents * test5[] = {
+    &ppp0_0_1,
+    &en0_1,
+    &en0_40,
+    &en0_30,
+    &en1_20,
+    &en1_2,
+    NULL
+};
+
+struct ipv4_service_contents * test6[] = {
+    &en0_test6,
+    &en1_test6,
+    &en2_test6,
+    &fw0_test6_and_7,
+    NULL
+};
+
+struct ipv4_service_contents * test7[] = {
+    &en0_test7,
+    &en1_test7,
+    &en2_test7,
+    &fw0_test6_and_7,
+    NULL
+};
+
+struct ipv4_service_contents * test8[] = {
+    &en0_10,
+    &en1_20,
+    NULL
+};
+
+struct ipv4_service_contents * test9[] = {
+    &en0_10,
+    &en1_20_first,
+    &fw0_25,
+    NULL
+};
+
+struct ipv4_service_contents * test10[] = {
+    &en0_10_last,
+    &en1_20,
+    &fw0_25,
+    NULL
+};
+
+struct ipv4_service_contents * test11[] = {
+    &en0_10_never,
+    &en1_20,
+    &fw0_25,
+    NULL
+};
+
+struct ipv4_service_contents * test12[] = {
+    &en0_10,
+    &en1_20,
+    NULL
+};
+
+struct ipv4_service_contents * test13[] = {
+    &en0_10,
+    &en1_20_never,
+    NULL
+};
+
+struct ipv4_service_contents * test14[] = {
+    &en1_20_never,
+    NULL
+};
+
+static void
+dict_add_string(CFMutableDictionaryRef dict, CFStringRef prop_name,
+               const char * str)
+{
+    CFStringRef                prop_val;
+
+    if (str == NULL) {
+       return;
+    }
+    prop_val = CFStringCreateWithCString(NULL,
+                                        str,
+                                        kCFStringEncodingASCII);
+    CFDictionarySetValue(dict, prop_name, prop_val);
+    CFRelease(prop_val);
+    return;
+}
+
+static void
+dict_add_string_as_array(CFMutableDictionaryRef dict, CFStringRef prop_name,
+                        const char * str)
+{
+    CFArrayRef         array;
+    CFStringRef                prop_val;
+
+    if (str == NULL) {
+       return;
+    }
+    prop_val = CFStringCreateWithCString(NULL,
+                                        str,
+                                        kCFStringEncodingASCII);
+    array = CFArrayCreate(NULL,
+                         (const void **)&prop_val, 1,
+                         &kCFTypeArrayCallBacks);
+    CFRelease(prop_val);
+    CFDictionarySetValue(dict, prop_name, array);
+    CFRelease(array);
+    return;
+}
+
+static CFDictionaryRef
+make_IPv4_dict(struct ipv4_service_contents * t)
+{
+    CFMutableDictionaryRef     dict;
+
+    dict = CFDictionaryCreateMutable(NULL, 0,
+                                    &kCFTypeDictionaryKeyCallBacks,
+                                    &kCFTypeDictionaryValueCallBacks);
+    dict_add_string_as_array(dict, kSCPropNetIPv4Addresses, t->addr);
+    dict_add_string_as_array(dict, kSCPropNetIPv4SubnetMasks, t->mask);
+    dict_add_string_as_array(dict, kSCPropNetIPv4DestAddresses, t->dest);
+    dict_add_string(dict, kSCPropNetIPv4Router, t->router);
+    dict_add_string(dict, kSCPropInterfaceName, t->ifname);
+    return (dict);
+}
+
+static IPv4RouteListRef
+make_IPv4RouteList(struct ipv4_service_contents * * this_test)
+{
+    IPv4RouteListRef           r;
+    IPv4RouteListRef           routes;
+    char                       routes_buf[IPv4RouteListComputeSize(R_STATIC)];
+    IPv4RouteListRef           ret = NULL;
+    struct ipv4_service_contents * *   scan_test;
+
+    for (scan_test = this_test; *scan_test != NULL; scan_test++) {
+       CFDictionaryRef         dict;
+
+       dict = make_IPv4_dict(*scan_test);
+       if (dict == NULL) {
+           fprintf(stderr, "make_IPv4_dict failed\n");
+           exit(1);
+       }
+       routes = (IPv4RouteListRef)routes_buf;
+       routes->size = R_STATIC;
+       routes->count = 0;
+       r = IPv4RouteListCreateWithDictionary(routes, dict,
+               (*scan_test)->primaryRank ? *(*scan_test)->primaryRank : NULL);
+       if (r == NULL) {
+           fprintf(stderr, "IPv4RouteListCreateWithDictionary failed\n");
+           exit(1);
+       }
+       ret = IPv4RouteListAddRouteList(ret, 1, r, (*scan_test)->rank);
+       if (r != routes) {
+           free(r);
+       }
+       CFRelease(dict);
+    }
+    return (ret);
+}
+
+/*
+ * Function: run_test
+ * Purpose:
+ *   Runs through the given set of routes first in the forward direction,
+ *   then again backwards.  We should end up with exactly the same set of
+ *   routes at the end.
+ */
+static boolean_t
+run_test(const char * name, struct ipv4_service_contents * * this_test)
+{
+    CFStringRef                        descr;
+    boolean_t                  ret = FALSE;
+    IPv4RouteListRef           r;
+    IPv4RouteListRef           routes;
+    char                       routes_buf[IPv4RouteListComputeSize(R_STATIC)];
+    IPv4RouteListRef           routes1 = NULL, routes2 = NULL;
+    struct ipv4_service_contents * *   scan_test;
+
+    printf("\nStarting test %s\n", name);
+    for (scan_test = this_test; *scan_test != NULL; scan_test++) {
+       CFDictionaryRef         dict;
+
+       dict = make_IPv4_dict(*scan_test);
+       if (dict == NULL) {
+           fprintf(stderr, "make_IPv4_dict failed\n");
+           exit(1);
+       }
+       routes = (IPv4RouteListRef)routes_buf;
+       routes->size = R_STATIC;
+       routes->count = 0;
+       r = IPv4RouteListCreateWithDictionary(routes, dict,
+               (*scan_test)->primaryRank ? *(*scan_test)->primaryRank : NULL);
+       if (r == NULL) {
+           fprintf(stderr, "IPv4RouteListCreateWithDictionary failed\n");
+           exit(1);
+       }
+       if ((S_IPMonitor_debug & kDebugFlag4) != 0) {
+           descr = IPv4RouteListCopyDescription(r);
+           SCLog(TRUE, LOG_NOTICE, CFSTR("test: Adding %@"), descr);
+           CFRelease(descr);
+       }
+
+       routes1 = IPv4RouteListAddRouteList(routes1, 1, r, (*scan_test)->rank);
+       if (r != routes) {
+           free(r);
+       }
+       CFRelease(dict);
+    }
+    if ((S_IPMonitor_debug & kDebugFlag4) != 0) {
+       if (routes1 != NULL) {
+           descr = IPv4RouteListCopyDescription(routes1);
+           SCLog(TRUE, LOG_NOTICE, CFSTR("Routes are %@"), descr);
+           CFRelease(descr);
+       }
+    }
+    for (scan_test--; scan_test >= this_test; scan_test--) {
+       CFDictionaryRef         dict;
+
+       dict = make_IPv4_dict(*scan_test);
+       if (dict == NULL) {
+           fprintf(stderr, "make_IPv4_dict failed\n");
+           exit(1);
+       }
+       routes = (IPv4RouteListRef)routes_buf;
+       routes->size = R_STATIC;
+       routes->count = 0;
+       r = IPv4RouteListCreateWithDictionary(routes, dict,
+               (*scan_test)->primaryRank ? *(*scan_test)->primaryRank : NULL);
+       if (r == NULL) {
+           fprintf(stderr, "IPv4RouteListCreateWithDictionary failed\n");
+           exit(1);
+       }
+       if ((S_IPMonitor_debug & kDebugFlag4) != 0) {
+           descr = IPv4RouteListCopyDescription(r);
+           SCLog(TRUE, LOG_NOTICE, CFSTR("test: Adding %@"), descr);
+           CFRelease(descr);
+       }
+       routes2 = IPv4RouteListAddRouteList(routes2, 1, r, (*scan_test)->rank);
+       if (r != routes) {
+           free(r);
+       }
+       CFRelease(dict);
+    }
+    if ((S_IPMonitor_debug & kDebugFlag4) != 0) {
+       if (routes2 != NULL) {
+           descr = IPv4RouteListCopyDescription(routes2);
+           SCLog(TRUE, LOG_NOTICE, CFSTR("Routes are %@"), descr);
+           CFRelease(descr);
+       }
+    }
+    if ((routes1 != NULL && routes2 == NULL)
+       || (routes1 == NULL && routes2 != NULL)) {
+       fprintf(stderr, "routes1 is %sNULL but routes2 is %sNULL\n",
+              (routes1 != NULL) ? "not " : "",
+              (routes2 != NULL) ? "not " : "");
+    }
+    else if (routes1 != NULL && routes2 != NULL) {
+       /* check if they are different */
+       if (routes1->count != routes2->count) {
+           fprintf(stderr, "routes1 count %d != routes 2 count %d\n",
+                   routes1->count, routes2->count);
+       }
+       else if (bcmp(routes1, routes2,
+                     IPv4RouteListComputeSize(routes1->count)) != 0) {
+           fprintf(stderr, "routes1 and routes2 are different\n");
+       }
+       else {
+           printf("routes1 and routes2 are the same\n");
+           ret = TRUE;
+       }
+    }
+    if (routes1 != NULL) {
+       free(routes1);
+    }
+    if (routes2 != NULL) {
+       free(routes2);
+    }
+    return (ret);
+}
+
+typedef struct compare_context {
+    IPv4RouteListRef   old;
+    IPv4RouteListRef   new;
+} compare_context_t;
+
+static void
+compare_callback(IPv4RouteListApplyCommand cmd, IPv4RouteRef route, void * arg)
+{
+    compare_context_t *        context = (compare_context_t *)arg;
+
+    switch (cmd) {
+    case kIPv4RouteListAddRouteCommand:
+       printf("Add new[%d] = ", route - context->new->list);
+       IPv4RoutePrint(route);
+       printf("\n");
+       break;
+    case kIPv4RouteListRemoveRouteCommand:
+       printf("Remove old[%d] = ", route - context->old->list);
+       IPv4RoutePrint(route);
+       printf("\n");
+       break;
+    default:
+       break;
+    }
+    return;
+}
+
+static void
+compare_tests(struct ipv4_service_contents * * old_test,
+             struct ipv4_service_contents * * new_test)
+{
+    IPv4RouteListRef   new_routes;
+    IPv4RouteListRef   old_routes;
+    compare_context_t  context;
+
+    old_routes = make_IPv4RouteList(old_test);
+    new_routes = make_IPv4RouteList(new_test);
+
+    if (old_routes == NULL) {
+       printf("No Old Routes\n");
+    }
+    else {
+       printf("Old Routes = ");
+       IPv4RouteListPrint(old_routes);
+    }
+    if (new_routes == NULL) {
+       printf("No New Routes\n");
+    }
+    else {
+       printf("New Routes = ");
+       IPv4RouteListPrint(new_routes);
+    }
+    context.old = old_routes;
+    context.new = new_routes;
+    IPv4RouteListApply(old_routes, new_routes, compare_callback, &context);
+    if (old_routes != NULL) {
+       free(old_routes);
+    }
+    if (new_routes != NULL) {
+       free(new_routes);
+    }
+
+    return;
+}
+
+int
+main(int argc, char **argv)
+{
+    _sc_log     = FALSE;
+    _sc_verbose = (argc > 1) ? TRUE : FALSE;
+
+    S_IPMonitor_debug = kDebugFlag1 | kDebugFlag2 | kDebugFlag4;
+    if (argc > 1) {
+       S_IPMonitor_debug = strtoul(argv[1], NULL, 0);
+    }
+
+    if (run_test("test1", test1) == FALSE) {
+       fprintf(stderr, "test1 failed\n");
+       exit(1);
+    }
+    if (run_test("test2", test2) == FALSE) {
+       fprintf(stderr, "test2 failed\n");
+       exit(1);
+    }
+    if (run_test("test3", test4) == FALSE) {
+       fprintf(stderr, "test3 failed\n");
+       exit(1);
+    }
+    if (run_test("test4", test4) == FALSE) {
+       fprintf(stderr, "test4 failed\n");
+       exit(1);
+    }
+    if (run_test("test5", test5) == FALSE) {
+       fprintf(stderr, "test5 failed\n");
+       exit(1);
+    }
+
+    printf("\nCompare 1 to 2:\n");
+    compare_tests(test1, test2);
+
+    printf("\nCompare 2 to 1:\n");
+    compare_tests(test2, test1);
+
+    printf("\nCompare 1 to 1:\n");
+    compare_tests(test1, test1);
+
+    printf("\nCompare 1 to 3:\n");
+    compare_tests(test1, test3);
+
+    printf("\nCompare 3 to 1:\n");
+    compare_tests(test3, test1);
+
+    printf("\nCompare 2 to 3:\n");
+    compare_tests(test2, test3);
+
+    printf("\nCompare 3 to 2:\n");
+    compare_tests(test3, test2);
+
+    printf("\nCompare 3 to 4:\n");
+    compare_tests(test3, test4);
+
+    printf("\nCompare 5 to 4:\n");
+    compare_tests(test5, test4);
+
+    printf("\nCompare 6 to 7:\n");
+    compare_tests(test6, test7);
+
+    printf("\nCompare 7 to 6:\n");
+    compare_tests(test7, test6);
+
+    printf("\nCompare 8 to 9:\n");
+    compare_tests(test8, test9);
+
+    printf("\nCompare 8 to 10:\n");
+    compare_tests(test8, test10);
+
+    printf("\nCompare 8 to 11:\n");
+    compare_tests(test8, test11);
+
+    printf("\nCompare 12 to 13:\n");
+    compare_tests(test12, test13);
+
+    printf("\nCompare 13 to 14:\n");
+    compare_tests(test13, test14);
+
+    printf("\nChecking for leaks\n");
+    char    cmd[128];
+    sprintf(cmd, "leaks %d 2>&1", getpid());
+    fflush(stdout);
+    (void)system(cmd);
+
+    exit(0);
+    return (0);
+}
+
+#endif /* TEST_IPV4_ROUTELIST */
 
 
index ec381adadaa0cc2b32e5ffee9f782c44758fe693..41b0a0c7fbf5fbb8158b1ff99108837a0f7b1a3d 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 
 #include <notify.h>
 
 
 #include <notify.h>
 
-
 static SCDynamicStoreRef       store           = NULL;
 static CFRunLoopSourceRef      rls             = NULL;
 
 static Boolean                 dnsActive       = FALSE;
 static CFMachPortRef           dnsPort         = NULL;
 static SCDynamicStoreRef       store           = NULL;
 static CFRunLoopSourceRef      rls             = NULL;
 
 static Boolean                 dnsActive       = FALSE;
 static CFMachPortRef           dnsPort         = NULL;
-static CFRunLoopSourceRef      dnsRLS          = NULL;
 static struct timeval          dnsQueryStart;
 
 static Boolean                 _verbose        = FALSE;
 
 
 static struct timeval          dnsQueryStart;
 
 static Boolean                 _verbose        = FALSE;
 
 
-/* SPI (from SCNetworkReachability.c) */
-Boolean
-_SC_checkResolverReachabilityByAddress(SCDynamicStoreRef       *storeP,
-                                      SCNetworkConnectionFlags *flags,
-                                      Boolean                  *haveDNS,
-                                      struct sockaddr          *sa);
-
-
 #define        HOSTNAME_NOTIFY_KEY     "com.apple.system.hostname"
 
 
 #define        HOSTNAME_NOTIFY_KEY     "com.apple.system.hostname"
 
 
@@ -421,29 +411,6 @@ reverseDNSComplete(int32_t status, char *host, char *serv, void *context)
 }
 
 
 }
 
 
-static void
-getnameinfo_async_handleCFReply(CFMachPortRef port, void *msg, CFIndex size, void *info)
-{
-       int32_t status;
-
-       status = getnameinfo_async_handle_reply(msg);
-       if ((status == 0) && dnsActive) {
-               // if request has been re-queued
-               return;
-       }
-
-       if (port == dnsPort) {
-               CFRunLoopSourceInvalidate(dnsRLS);
-               CFRelease(dnsRLS);
-               dnsRLS = NULL;
-               CFRelease(dnsPort);
-               dnsPort = NULL;
-       }
-
-       return;
-}
-
-
 static CFStringRef
 replyMPCopyDescription(const void *info)
 {
 static CFStringRef
 replyMPCopyDescription(const void *info)
 {
@@ -456,11 +423,58 @@ replyMPCopyDescription(const void *info)
 }
 
 
 }
 
 
+static void
+getnameinfo_async_handleCFReply(CFMachPortRef port, void *msg, CFIndex size, void *info)
+{
+       mach_port_t     mp      = MACH_PORT_NULL;
+       int32_t         status;
+
+       if (port != dnsPort) {
+               // we've received a callback on the async DNS port but since the
+               // associated CFMachPort doesn't match than the request must have
+               // already been cancelled.
+               SCLog(TRUE, LOG_ERR, CFSTR("getnameinfo_async_handleCFReply(): port != dnsPort"));
+               return;
+       }
+
+       mp = CFMachPortGetPort(port);
+       CFMachPortInvalidate(dnsPort);
+       CFRelease(dnsPort);
+       dnsPort = NULL;
+       __MACH_PORT_DEBUG(mp != NULL, "*** set-hostname (after unscheduling)", mp);
+
+       status = getnameinfo_async_handle_reply(msg);
+       __MACH_PORT_DEBUG(mp != NULL, "*** set-hostname (after getnameinfo_async_handle_reply)", mp);
+       if ((status == 0) && dnsActive && (mp != MACH_PORT_NULL)) {
+               CFMachPortContext       context = { 0
+                                                 , (void *)store
+                                                 , CFRetain
+                                                 , CFRelease
+                                                 , replyMPCopyDescription
+               };
+               CFRunLoopSourceRef      rls;
+
+               // if request has been re-queued
+               dnsPort = CFMachPortCreateWithPort(NULL,
+                                                  mp,
+                                                  getnameinfo_async_handleCFReply,
+                                                  &context,
+                                                  NULL);
+               rls = CFMachPortCreateRunLoopSource(NULL, dnsPort, 0);
+               CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
+               CFRelease(rls);
+               __MACH_PORT_DEBUG(mp != NULL, "*** set-hostname (after rescheduling)", mp);
+       }
+
+       return;
+}
+
+
 static void
 start_dns_query(SCDynamicStoreRef store, CFStringRef address)
 {
        char                            addr[64];
 static void
 start_dns_query(SCDynamicStoreRef store, CFStringRef address)
 {
        char                            addr[64];
-       SCNetworkConnectionFlags        flags;
+       SCNetworkReachabilityFlags      flags;
        Boolean                         haveDNS;
        Boolean                         ok;
        struct sockaddr                 *sa;
        Boolean                         haveDNS;
        Boolean                         ok;
        struct sockaddr                 *sa;
@@ -504,8 +518,8 @@ start_dns_query(SCDynamicStoreRef store, CFStringRef address)
 
        ok = _SC_checkResolverReachabilityByAddress(&store, &flags, &haveDNS, sa);
        if (ok) {
 
        ok = _SC_checkResolverReachabilityByAddress(&store, &flags, &haveDNS, sa);
        if (ok) {
-               if (!(flags & kSCNetworkFlagsReachable) ||
-                       (flags & kSCNetworkFlagsConnectionRequired)) {
+               if (!(flags & kSCNetworkReachabilityFlagsReachable) ||
+                   (flags & kSCNetworkReachabilityFlagsConnectionRequired)) {
                        // if not reachable *OR* connection required
                        ok = FALSE;
                }
                        // if not reachable *OR* connection required
                        ok = FALSE;
                }
@@ -518,12 +532,13 @@ start_dns_query(SCDynamicStoreRef store, CFStringRef address)
                                                  , CFRelease
                                                  , replyMPCopyDescription
                                                  };
                                                  , CFRelease
                                                  , replyMPCopyDescription
                                                  };
-               mach_port_t             port;
                int32_t                 error;
                int32_t                 error;
+               mach_port_t             mp;
+               CFRunLoopSourceRef      rls;
 
                (void) gettimeofday(&dnsQueryStart, NULL);
 
 
                (void) gettimeofday(&dnsQueryStart, NULL);
 
-               error = getnameinfo_async_start(&port,
+               error = getnameinfo_async_start(&mp,
                                                sa,
                                                sa->sa_len,
                                                NI_NAMEREQD,    // flags
                                                sa,
                                                sa->sa_len,
                                                NI_NAMEREQD,    // flags
@@ -532,15 +547,18 @@ start_dns_query(SCDynamicStoreRef store, CFStringRef address)
                if (error != 0) {
                        goto done;
                }
                if (error != 0) {
                        goto done;
                }
+               __MACH_PORT_DEBUG(TRUE, "*** set-hostname (after getnameinfo_async_start)", mp);
 
                dnsActive = TRUE;
                dnsPort = CFMachPortCreateWithPort(NULL,
 
                dnsActive = TRUE;
                dnsPort = CFMachPortCreateWithPort(NULL,
-                                                  port,
+                                                  mp,
                                                   getnameinfo_async_handleCFReply,
                                                   &context,
                                                   NULL);
                                                   getnameinfo_async_handleCFReply,
                                                   &context,
                                                   NULL);
-               dnsRLS = CFMachPortCreateRunLoopSource(NULL, dnsPort, 0);
-               CFRunLoopAddSource(CFRunLoopGetCurrent(), dnsRLS, kCFRunLoopDefaultMode);
+               rls = CFMachPortCreateRunLoopSource(NULL, dnsPort, 0);
+               CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
+               CFRelease(rls);
+               __MACH_PORT_DEBUG(TRUE, "*** set-hostname (after scheduling)", mp);
        }
 
     done :
        }
 
     done :
@@ -559,13 +577,14 @@ update_hostname(SCDynamicStoreRef store, CFArrayRef changedKeys, void *info)
        // if active, cancel any in-progress attempt to resolve the primary IP address
 
        if (dnsPort != NULL) {
        // if active, cancel any in-progress attempt to resolve the primary IP address
 
        if (dnsPort != NULL) {
+               mach_port_t     mp      = CFMachPortGetPort(dnsPort);
+
                /* cancel the outstanding DNS query */
                /* cancel the outstanding DNS query */
-               getnameinfo_async_cancel(CFMachPortGetPort(dnsPort));
-               CFRunLoopSourceInvalidate(dnsRLS);
-               CFRelease(dnsRLS);
-               dnsRLS = NULL;
+               CFMachPortInvalidate(dnsPort);
                CFRelease(dnsPort);
                dnsPort = NULL;
                CFRelease(dnsPort);
                dnsPort = NULL;
+
+               getnameinfo_async_cancel(mp);
        }
 
        // get static hostname, if available
        }
 
        // get static hostname, if available
index ef120a05f73167398bf371a10364bfa2d97ed2f8..795dd43132f4b9ac87c36c8c6ccfffdd191c9a10 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2006-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -34,6 +34,7 @@
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <sys/stat.h>
 #include <sys/sysctl.h>
 #include <sys/time.h>
 #include <net/if.h>
 #include <sys/sysctl.h>
 #include <sys/time.h>
 #include <net/if.h>
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>             // for SCLog(), SCPrint()
 
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>             // for SCLog(), SCPrint()
 
-#define        SMB_STARTUP_DELAY       60.0
-#define        SMB_DEBOUNCE_DELAY      5.0
+#define        HW_MODEL_LEN            64                      // Note: must be >= NETBIOS_NAME_LEN (below)
 
 
-/* SPI (from SCNetworkReachability.c) */
-Boolean
-_SC_checkResolverReachabilityByAddress(SCDynamicStoreRef       *storeP,
-                                      SCNetworkConnectionFlags *flags,
-                                      Boolean                  *haveDNS,
-                                      struct sockaddr          *sa);
+#define        NETBIOS_NAME_LEN        16
 
 
+#define        SMB_STARTUP_DELAY       60.0
+#define        SMB_DEBOUNCE_DELAY      5.0
 
 static SCDynamicStoreRef       store           = NULL;
 static CFRunLoopSourceRef      rls             = NULL;
 
 static Boolean                 dnsActive       = FALSE;
 static CFMachPortRef           dnsPort         = NULL;
 
 static SCDynamicStoreRef       store           = NULL;
 static CFRunLoopSourceRef      rls             = NULL;
 
 static Boolean                 dnsActive       = FALSE;
 static CFMachPortRef           dnsPort         = NULL;
-static CFRunLoopSourceRef      dnsRLS          = NULL;
 static struct timeval          dnsQueryStart;
 
 static CFRunLoopTimerRef       timer           = NULL;
 static struct timeval          dnsQueryStart;
 
 static CFRunLoopTimerRef       timer           = NULL;
@@ -74,6 +70,23 @@ static CFRunLoopTimerRef     timer           = NULL;
 static Boolean                 _verbose        = FALSE;
 
 
 static Boolean                 _verbose        = FALSE;
 
 
+static Boolean
+isMacOSXServer()
+{
+       static enum { Unknown, Client, Server } isServer        = Unknown;
+
+       if (isServer == Unknown) {
+               int             ret;
+               struct stat     statbuf;
+
+               ret = stat("/System/Library/CoreServices/ServerVersion.plist", &statbuf);
+               isServer = (ret == 0) ? Server : Client;
+       }
+
+       return (isServer == Server) ? TRUE : FALSE;
+}
+
+
 static CFAbsoluteTime
 boottime(void)
 {
 static CFAbsoluteTime
 boottime(void)
 {
@@ -101,34 +114,102 @@ boottime(void)
 static CFStringRef
 copy_default_name(void)
 {
 static CFStringRef
 copy_default_name(void)
 {
-       CFStringRef             address;
-       SCNetworkInterfaceRef   interface;
-       CFMutableStringRef      name    = NULL;
+       char                    *cp;
+       char                    hwModel[HW_MODEL_LEN];
+       int                     mib[]           = { CTL_HW, HW_MODEL };
+       size_t                  n               = sizeof(hwModel);
+       int                     ret;
+       CFMutableStringRef      str;
+
+       // get HW model name
+       bzero(&hwModel, sizeof(hwModel));
+       ret = sysctl(mib, sizeof(mib) / sizeof(mib[0]), &hwModel, &n, NULL, 0);
+       if (ret != 0) {
+               SCLog(TRUE, LOG_ERR, CFSTR("sysctl() CTL_HW/HW_MODEL failed: %s"), strerror(errno));
+               return NULL;
+       }
 
 
-       interface = _SCNetworkInterfaceCreateWithBSDName(NULL, CFSTR("en0"),
-                                                        kIncludeNoVirtualInterfaces);
-       if (interface == NULL) {
-               goto done;
+       // truncate name
+       hwModel[NETBIOS_NAME_LEN - 1] = '\0';
+
+       // trim everything after (and including) a comma
+       cp = index(hwModel, ',');
+       if (cp != NULL) {
+               *cp = '\0';
        }
 
        }
 
-       address = SCNetworkInterfaceGetHardwareAddressString(interface);
-       if (address == NULL) {
-               goto done;
+       // trim any trailing digits
+       n = strlen(hwModel);
+       while (n > 0) {
+               if (!isdigit(hwModel[n - 1])) {
+                       break;
+               }
+               hwModel[--n] = '\0';
        }
 
        }
 
-       name = CFStringCreateMutableCopy(NULL, 0, address);
-       CFStringFindAndReplace(name,
-                              CFSTR(":"),
-                              CFSTR(""),
-                              CFRangeMake(0, CFStringGetLength(name)),
-                              0);
-       CFStringInsert(name, 0, CFSTR("MAC"));
-       CFStringUppercase(name, NULL);
+       // start off with the [trunated] HW model
+       str = CFStringCreateMutable(NULL, 0);
+       CFStringAppendFormat(str, NULL, CFSTR("%s"), hwModel);
+
+       //
+       // if there is room for at least one byte (two hex characters)
+       // of the MAC address than append that to the NetBIOS name.
+       //
+       //    NETBIOS_NAME_LEN  max length
+       //      -1              the last byte is reserved
+       //      -3              "-XX"
+       //
+       if (n < (NETBIOS_NAME_LEN - 1 - 3)) {
+               SCNetworkInterfaceRef   interface;
+
+               interface = _SCNetworkInterfaceCreateWithBSDName(NULL, CFSTR("en0"),
+                                                                kIncludeNoVirtualInterfaces);
+               if (interface != NULL) {
+                       CFMutableStringRef      en0_MAC;
+
+                       en0_MAC = (CFMutableStringRef)SCNetworkInterfaceGetHardwareAddressString(interface);
+                       if (en0_MAC != NULL) {
+                               CFIndex en0_MAC_len;
+
+                               // remove ":" characters from MAC address string
+                               en0_MAC = CFStringCreateMutableCopy(NULL, 0, en0_MAC);
+                               CFStringFindAndReplace(en0_MAC,
+                                                      CFSTR(":"),
+                                                      CFSTR(""),
+                                                      CFRangeMake(0, CFStringGetLength(en0_MAC)),
+                                                      0);
+
+                               //
+                               // compute how may bytes (characters) to append
+                               //    ... and limit that number to 6
+                               //
+                               //    NETBIOS_NAME_LEN  max length
+                               //      -1              the last byte is reserved
+                               //      -n              "iMac"
+                               //      -1              "-"
+                               //
+                               n = ((NETBIOS_NAME_LEN - 1 - n - 1) / 2) * 2;
+                               if (n > 6) {
+                                       n = 6;
+                               }
 
 
-    done :
+                               // remove what we don't want
+                               en0_MAC_len = CFStringGetLength(en0_MAC);
+                               if (en0_MAC_len > n) {
+                                       CFStringDelete(en0_MAC, CFRangeMake(0, en0_MAC_len - n));
+                               }
+
+                               // append
+                               CFStringAppendFormat(str, NULL, CFSTR("-%@"), en0_MAC);
+                               CFRelease(en0_MAC);
+                       }
 
 
-       if (interface != NULL) CFRelease(interface);
-       return name;
+                       CFRelease(interface);
+               }
+       }
+
+       CFStringUppercase(str, NULL);
+       return str;
 }
 
 
 }
 
 
@@ -211,45 +292,47 @@ smb_set_configuration(SCDynamicStoreRef store, CFDictionaryRef dict)
                goto done;
        }
 
                goto done;
        }
 
-       // Server description
-       str = SCDynamicStoreCopyComputerName(store, &macEncoding);
-       update_pref(prefs, CFSTR(kSMBPrefServerDescription), str, &changed);
-
-       // DOS code page
-       if (str != NULL) {
-               if (macEncoding == kCFStringEncodingMacRoman) {
-                       CFStringRef     key;
-                       CFDictionaryRef dict;
-
-                       // get region
-                       key = SCDynamicStoreKeyCreateComputerName(NULL);
-                       dict = SCDynamicStoreCopyValue(store, key);
-                       CFRelease(key);
-                       if (dict != NULL) {
-                               if (isA_CFDictionary(dict)) {
-                                       CFNumberRef     num;
-                                       SInt32          val;
-
-                                       num = CFDictionaryGetValue(dict, kSCPropSystemComputerNameRegion);
-                                       if (isA_CFNumber(num) &&
-                                           CFNumberGetValue(num, kCFNumberSInt32Type, &val)) {
-                                               macRegion = (uint32_t)val;
+       if (!isMacOSXServer()) {
+               // Server description
+               str = SCDynamicStoreCopyComputerName(store, &macEncoding);
+               update_pref(prefs, CFSTR(kSMBPrefServerDescription), str, &changed);
+               
+               // DOS code page
+               if (str != NULL) {
+                       if (macEncoding == kCFStringEncodingMacRoman) {
+                               CFStringRef     key;
+                               CFDictionaryRef dict;
+
+                               // get region
+                               key = SCDynamicStoreKeyCreateComputerName(NULL);
+                               dict = SCDynamicStoreCopyValue(store, key);
+                               CFRelease(key);
+                               if (dict != NULL) {
+                                       if (isA_CFDictionary(dict)) {
+                                               CFNumberRef     num;
+                                               SInt32          val;
+
+                                               num = CFDictionaryGetValue(dict, kSCPropSystemComputerNameRegion);
+                                               if (isA_CFNumber(num) &&
+                                                   CFNumberGetValue(num, kCFNumberSInt32Type, &val)) {
+                                                       macRegion = (uint32_t)val;
+                                               }
                                        }
                                        }
-                               }
 
 
-                               CFRelease(dict);
+                                       CFRelease(dict);
+                               }
                        }
                        }
-               }
 
 
+                       CFRelease(str);
+               } else {
+                       // Important: must have root acccess (eUID==0) to access the config file!
+                       __CFStringGetInstallationEncodingAndRegion((uint32_t *)&macEncoding, &macRegion);
+               }
+               _SC_dos_encoding_and_codepage(macEncoding, macRegion, &dosEncoding, &dosCodepage);
+               str = CFStringCreateWithFormat(NULL, NULL, CFSTR("%d"), dosCodepage);
+               update_pref(prefs, CFSTR(kSMBPrefDOSCodePage), str, &changed);
                CFRelease(str);
                CFRelease(str);
-       } else {
-               // Important: must have root acccess (eUID==0) to access the config file!
-               __CFStringGetInstallationEncodingAndRegion((uint32_t *)&macEncoding, &macRegion);
        }
        }
-       _SC_dos_encoding_and_codepage(macEncoding, macRegion, &dosEncoding, &dosCodepage);
-       str = CFStringCreateWithFormat(NULL, NULL, CFSTR("%d"), dosCodepage);
-       update_pref(prefs, CFSTR(kSMBPrefDOSCodePage), str, &changed);
-       CFRelease(str);
 
        // NetBIOS name
        str = CFDictionaryGetValue(dict, kSCPropNetSMBNetBIOSName);
 
        // NetBIOS name
        str = CFDictionaryGetValue(dict, kSCPropNetSMBNetBIOSName);
@@ -502,29 +585,6 @@ reverseDNSComplete(int32_t status, char *host, char *serv, void *context)
 }
 
 
 }
 
 
-static void
-getnameinfo_async_handleCFReply(CFMachPortRef port, void *msg, CFIndex size, void *info)
-{
-       int32_t status;
-
-       status = getnameinfo_async_handle_reply(msg);
-       if ((status == 0) && dnsActive) {
-               // if request has been re-queued
-               return;
-       }
-
-       if (port == dnsPort) {
-               CFRunLoopSourceInvalidate(dnsRLS);
-               CFRelease(dnsRLS);
-               dnsRLS = NULL;
-               CFRelease(dnsPort);
-               dnsPort = NULL;
-       }
-
-       return;
-}
-
-
 static CFStringRef
 replyMPCopyDescription(const void *info)
 {
 static CFStringRef
 replyMPCopyDescription(const void *info)
 {
@@ -537,11 +597,55 @@ replyMPCopyDescription(const void *info)
 }
 
 
 }
 
 
+static void
+getnameinfo_async_handleCFReply(CFMachPortRef port, void *msg, CFIndex size, void *info)
+{
+       mach_port_t     mp      = MACH_PORT_NULL;
+       int32_t         status;
+
+       if (port != dnsPort) {
+               // we've received a callback on the async DNS port but since the
+               // associated CFMachPort doesn't match than the request must have
+               // already been cancelled.
+               SCLog(TRUE, LOG_ERR, CFSTR("getnameinfo_async_handleCFReply(): port != dnsPort"));
+               return;
+       }
+
+       mp = CFMachPortGetPort(port);
+       CFMachPortInvalidate(dnsPort);
+       CFRelease(dnsPort);
+       dnsPort = NULL;
+
+       status = getnameinfo_async_handle_reply(msg);
+       if ((status == 0) && dnsActive && (mp != MACH_PORT_NULL)) {
+               CFMachPortContext       context = { 0
+                                                 , (void *)store
+                                                 , CFRetain
+                                                 , CFRelease
+                                                 , replyMPCopyDescription
+               };
+               CFRunLoopSourceRef      rls;
+
+               // if request has been re-queued
+               dnsPort = CFMachPortCreateWithPort(NULL,
+                                                  mp,
+                                                  getnameinfo_async_handleCFReply,
+                                                  &context,
+                                                  NULL);
+               rls = CFMachPortCreateRunLoopSource(NULL, dnsPort, 0);
+               CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
+               CFRelease(rls);
+       }
+
+       return;
+}
+
+
 static Boolean
 start_dns_query(SCDynamicStoreRef store, CFStringRef address)
 {
        char                            addr[64];
 static Boolean
 start_dns_query(SCDynamicStoreRef store, CFStringRef address)
 {
        char                            addr[64];
-       SCNetworkConnectionFlags        flags;
+       SCNetworkReachabilityFlags      flags;
        Boolean                         haveDNS;
        Boolean                         ok      = FALSE;
        struct sockaddr                 *sa;
        Boolean                         haveDNS;
        Boolean                         ok      = FALSE;
        struct sockaddr                 *sa;
@@ -584,8 +688,8 @@ start_dns_query(SCDynamicStoreRef store, CFStringRef address)
 
        ok = _SC_checkResolverReachabilityByAddress(&store, &flags, &haveDNS, sa);
        if (ok) {
 
        ok = _SC_checkResolverReachabilityByAddress(&store, &flags, &haveDNS, sa);
        if (ok) {
-               if (!(flags & kSCNetworkFlagsReachable) ||
-                   (flags & kSCNetworkFlagsConnectionRequired)) {
+               if (!(flags & kSCNetworkReachabilityFlagsReachable) ||
+                   (flags & kSCNetworkReachabilityFlagsConnectionRequired)) {
                        // if not reachable *OR* connection required
                        ok = FALSE;
                }
                        // if not reachable *OR* connection required
                        ok = FALSE;
                }
@@ -598,12 +702,13 @@ start_dns_query(SCDynamicStoreRef store, CFStringRef address)
                                                  , CFRelease
                                                  , replyMPCopyDescription
                                                  };
                                                  , CFRelease
                                                  , replyMPCopyDescription
                                                  };
-               mach_port_t             port;
                int32_t                 error;
                int32_t                 error;
+               mach_port_t             mp;
+               CFRunLoopSourceRef      rls;
 
                (void) gettimeofday(&dnsQueryStart, NULL);
 
 
                (void) gettimeofday(&dnsQueryStart, NULL);
 
-               error = getnameinfo_async_start(&port,
+               error = getnameinfo_async_start(&mp,
                                                sa,
                                                sa->sa_len,
                                                NI_NAMEREQD,    // flags
                                                sa,
                                                sa->sa_len,
                                                NI_NAMEREQD,    // flags
@@ -616,12 +721,13 @@ start_dns_query(SCDynamicStoreRef store, CFStringRef address)
 
                dnsActive = TRUE;
                dnsPort = CFMachPortCreateWithPort(NULL,
 
                dnsActive = TRUE;
                dnsPort = CFMachPortCreateWithPort(NULL,
-                                                  port,
+                                                  mp,
                                                   getnameinfo_async_handleCFReply,
                                                   &context,
                                                   NULL);
                                                   getnameinfo_async_handleCFReply,
                                                   &context,
                                                   NULL);
-               dnsRLS = CFMachPortCreateRunLoopSource(NULL, dnsPort, 0);
-               CFRunLoopAddSource(CFRunLoopGetCurrent(), dnsRLS, kCFRunLoopDefaultMode);
+               rls = CFMachPortCreateRunLoopSource(NULL, dnsPort, 0);
+               CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
+               CFRelease(rls);
        }
 
     done :
        }
 
     done :
@@ -732,13 +838,14 @@ configuration_changed(SCDynamicStoreRef store, CFArrayRef changedKeys, void *inf
 
        // if active, cancel any in-progress attempt to resolve the primary IP address
        if (dnsPort != NULL) {
 
        // if active, cancel any in-progress attempt to resolve the primary IP address
        if (dnsPort != NULL) {
+               mach_port_t     mp      = CFMachPortGetPort(dnsPort);
+
                /* cancel the outstanding DNS query */
                /* cancel the outstanding DNS query */
-               getnameinfo_async_cancel(CFMachPortGetPort(dnsPort));
-               CFRunLoopSourceInvalidate(dnsRLS);
-               CFRelease(dnsRLS);
-               dnsRLS = NULL;
+               CFMachPortInvalidate(dnsPort);
                CFRelease(dnsPort);
                dnsPort = NULL;
                CFRelease(dnsPort);
                dnsPort = NULL;
+
+               getnameinfo_async_cancel(mp);
        }
 
        // if active, cancel any queued configuration change
        }
 
        // if active, cancel any queued configuration change
@@ -920,7 +1027,7 @@ main(int argc, char **argv)
 
     done :
 
 
     done :
 
-       smb_update_configuration(NULL, store);
+       smb_update_configuration(NULL, (void *)store);
 
        CFRelease(store);
 
 
        CFRelease(store);
 
diff --git a/Plugins/IPMonitor/test_ipv4_routelist_filter.sh b/Plugins/IPMonitor/test_ipv4_routelist_filter.sh
new file mode 100644 (file)
index 0000000..924de28
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+sed '/Process [0-9][0-9]*: [0-9][0-9]* nodes malloced/d; s/^\(Process \)[0-9][0-9]*:\(.*\)/\1XXXX\2/'
diff --git a/Plugins/IPMonitor/test_ipv4_routelist_reference.txt b/Plugins/IPMonitor/test_ipv4_routelist_reference.txt
new file mode 100644 (file)
index 0000000..6698c5b
--- /dev/null
@@ -0,0 +1,768 @@
+
+Starting test test1
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.12
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.12 Ifp en0 Ifa 10.0.0.12
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.19
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.19 Ifp en0 Ifa 10.0.0.19
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30
+ 1. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.11
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.13
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.13 Ifp en0 Ifa 10.0.0.13
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+}
+
+Routes are <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.13
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.13 Ifp en0 Ifa 10.0.0.13
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.11
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30
+ 1. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.19
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.19 Ifp en0 Ifa 10.0.0.19
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.12
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.12 Ifp en0 Ifa 10.0.0.12
+}
+
+Routes are <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+}
+
+routes1 and routes2 are the same
+
+Starting test test2
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.12
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.12 Ifp en0 Ifa 10.0.0.12
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30
+ 1. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.11
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.13
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.13 Ifp en0 Ifa 10.0.0.13
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+}
+
+Routes are <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.13
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.13 Ifp en0 Ifa 10.0.0.13
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.11
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30
+ 1. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.12
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.12 Ifp en0 Ifa 10.0.0.12
+}
+
+Routes are <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+}
+
+routes1 and routes2 are the same
+
+Starting test test3
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local]
+ 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.12
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.12 Ifp en0 Ifa 10.0.0.12
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.11
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local]
+ 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24
+}
+
+Routes are <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local]
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] [SCOPED]
+ 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 [SCOPED]
+ 4. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191
+ 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 [SCOPED]
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local]
+ 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.11
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.12
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.12 Ifp en0 Ifa 10.0.0.12
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local]
+ 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191
+}
+
+Routes are <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local]
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] [SCOPED]
+ 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 [SCOPED]
+ 4. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191
+ 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 [SCOPED]
+}
+
+routes1 and routes2 are the same
+
+Starting test test4
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local]
+ 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.12
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.12 Ifp en0 Ifa 10.0.0.12
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.11
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local]
+ 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24
+}
+
+Routes are <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local]
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] [SCOPED]
+ 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 [SCOPED]
+ 4. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191
+ 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 [SCOPED]
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local]
+ 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.11
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.12
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.12 Ifp en0 Ifa 10.0.0.12
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local]
+ 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191
+}
+
+Routes are <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local]
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] [SCOPED]
+ 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 [SCOPED]
+ 4. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191
+ 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 [SCOPED]
+}
+
+routes1 and routes2 are the same
+
+Starting test test5
+test: Adding <IPv4RouteList[1]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.219.156.1 Ifp ppp0 Ifa 17.219.156.22
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local]
+ 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.12
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.12 Ifp en0 Ifa 10.0.0.12
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.11
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local]
+ 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24
+}
+
+Routes are <IPv4RouteList[7]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.219.156.1 Ifp ppp0 Ifa 17.219.156.22
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 [SCOPED]
+ 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191
+ 6. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 [SCOPED]
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local]
+ 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.11
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.12
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.12 Ifp en0 Ifa 10.0.0.12
+}
+
+test: Adding <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local]
+ 1. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191
+}
+
+test: Adding <IPv4RouteList[1]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.219.156.1 Ifp ppp0 Ifa 17.219.156.22
+}
+
+Routes are <IPv4RouteList[7]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.219.156.1 Ifp ppp0 Ifa 17.219.156.22
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 [SCOPED]
+ 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191
+ 6. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 [SCOPED]
+}
+
+routes1 and routes2 are the same
+
+Compare 1 to 2:
+Old Routes = <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+}
+New Routes = <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+}
+
+Compare 2 to 1:
+Old Routes = <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+}
+New Routes = <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+}
+
+Compare 1 to 1:
+Old Routes = <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+}
+New Routes = <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+}
+
+Compare 1 to 3:
+Old Routes = <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+}
+New Routes = <IPv4RouteList[9]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.3.1 Ifp fw0 Ifa 192.168.3.30 [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+ 6. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.10 Ifp en0 Ifa 192.168.2.10 [SCOPED]
+ 7. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.20 Ifp en1 Ifa 192.168.2.20 [SCOPED]
+ 8. Dest 192.168.3.0 Mask 255.255.255.0 Gate 192.168.3.30 Ifp fw0 Ifa 192.168.3.30
+}
+Remove old[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+Add new[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.3.1 Ifp fw0 Ifa 192.168.3.30 [SCOPED]
+Add new[6] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.10 Ifp en0 Ifa 192.168.2.10 [SCOPED]
+Add new[7] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.20 Ifp en1 Ifa 192.168.2.20 [SCOPED]
+Add new[8] = Dest 192.168.3.0 Mask 255.255.255.0 Gate 192.168.3.30 Ifp fw0 Ifa 192.168.3.30
+
+Compare 3 to 1:
+Old Routes = <IPv4RouteList[9]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.3.1 Ifp fw0 Ifa 192.168.3.30 [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+ 6. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.10 Ifp en0 Ifa 192.168.2.10 [SCOPED]
+ 7. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.20 Ifp en1 Ifa 192.168.2.20 [SCOPED]
+ 8. Dest 192.168.3.0 Mask 255.255.255.0 Gate 192.168.3.30 Ifp fw0 Ifa 192.168.3.30
+}
+New Routes = <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+}
+Remove old[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.3.1 Ifp fw0 Ifa 192.168.3.30 [SCOPED]
+Remove old[6] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.10 Ifp en0 Ifa 192.168.2.10 [SCOPED]
+Remove old[7] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.20 Ifp en1 Ifa 192.168.2.20 [SCOPED]
+Remove old[8] = Dest 192.168.3.0 Mask 255.255.255.0 Gate 192.168.3.30 Ifp fw0 Ifa 192.168.3.30
+Add new[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+
+Compare 2 to 3:
+Old Routes = <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+}
+New Routes = <IPv4RouteList[9]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.3.1 Ifp fw0 Ifa 192.168.3.30 [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+ 6. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.10 Ifp en0 Ifa 192.168.2.10 [SCOPED]
+ 7. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.20 Ifp en1 Ifa 192.168.2.20 [SCOPED]
+ 8. Dest 192.168.3.0 Mask 255.255.255.0 Gate 192.168.3.30 Ifp fw0 Ifa 192.168.3.30
+}
+Remove old[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+Add new[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.3.1 Ifp fw0 Ifa 192.168.3.30 [SCOPED]
+Add new[6] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.10 Ifp en0 Ifa 192.168.2.10 [SCOPED]
+Add new[7] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.20 Ifp en1 Ifa 192.168.2.20 [SCOPED]
+Add new[8] = Dest 192.168.3.0 Mask 255.255.255.0 Gate 192.168.3.30 Ifp fw0 Ifa 192.168.3.30
+
+Compare 3 to 2:
+Old Routes = <IPv4RouteList[9]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.3.1 Ifp fw0 Ifa 192.168.3.30 [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+ 6. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.10 Ifp en0 Ifa 192.168.2.10 [SCOPED]
+ 7. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.20 Ifp en1 Ifa 192.168.2.20 [SCOPED]
+ 8. Dest 192.168.3.0 Mask 255.255.255.0 Gate 192.168.3.30 Ifp fw0 Ifa 192.168.3.30
+}
+New Routes = <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+}
+Remove old[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.3.1 Ifp fw0 Ifa 192.168.3.30 [SCOPED]
+Remove old[6] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.10 Ifp en0 Ifa 192.168.2.10 [SCOPED]
+Remove old[7] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.20 Ifp en1 Ifa 192.168.2.20 [SCOPED]
+Remove old[8] = Dest 192.168.3.0 Mask 255.255.255.0 Gate 192.168.3.30 Ifp fw0 Ifa 192.168.3.30
+Add new[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+
+Compare 3 to 4:
+Old Routes = <IPv4RouteList[9]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.3.1 Ifp fw0 Ifa 192.168.3.30 [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+ 6. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.10 Ifp en0 Ifa 192.168.2.10 [SCOPED]
+ 7. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.20 Ifp en1 Ifa 192.168.2.20 [SCOPED]
+ 8. Dest 192.168.3.0 Mask 255.255.255.0 Gate 192.168.3.30 Ifp fw0 Ifa 192.168.3.30
+}
+New Routes = <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local]
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] [SCOPED]
+ 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 [SCOPED]
+ 4. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191
+ 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 [SCOPED]
+}
+Remove old[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+Remove old[1] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+Remove old[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.3.1 Ifp fw0 Ifa 192.168.3.30 [SCOPED]
+Remove old[3] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+Remove old[4] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+Remove old[5] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+Remove old[6] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.10 Ifp en0 Ifa 192.168.2.10 [SCOPED]
+Remove old[7] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.20 Ifp en1 Ifa 192.168.2.20 [SCOPED]
+Remove old[8] = Dest 192.168.3.0 Mask 255.255.255.0 Gate 192.168.3.30 Ifp fw0 Ifa 192.168.3.30
+Add new[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local]
+Add new[1] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] [SCOPED]
+Add new[2] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+Add new[3] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 [SCOPED]
+Add new[4] = Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191
+Add new[5] = Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 [SCOPED]
+
+Compare 5 to 4:
+Old Routes = <IPv4RouteList[7]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.219.156.1 Ifp ppp0 Ifa 17.219.156.22
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 [SCOPED]
+ 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191
+ 6. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 [SCOPED]
+}
+New Routes = <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local]
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en1 Ifa 17.202.42.24 [non-local] [SCOPED]
+ 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.11 Ifp en0 Ifa 10.0.0.11 [SCOPED]
+ 4. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.40.191 Ifp en0 Ifa 17.202.40.191
+ 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.24 Ifp en1 Ifa 17.202.42.24 [SCOPED]
+}
+Remove old[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.219.156.1 Ifp ppp0 Ifa 17.219.156.22
+Remove old[1] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local] [SCOPED]
+Add new[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.20.1 Ifp en0 Ifa 17.202.40.191 [non-local]
+
+Compare 6 to 7:
+Old Routes = <IPv4RouteList[7]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.255.96.1 Ifp en2 Ifa 17.255.98.164
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.40.1 Ifp en0 Ifa 17.202.42.113 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.40.1 Ifp en1 Ifa 17.202.42.111 [SCOPED]
+ 3. Dest 0.0.0.0 Mask 0.0.0.0 Gate 169.254.11.33 Ifp fw0 Ifa 169.254.11.33 [direct] [last] [SCOPED]
+ 4. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.113 Ifp en0 Ifa 17.202.42.113
+ 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.111 Ifp en1 Ifa 17.202.42.111 [SCOPED]
+ 6. Dest 17.255.96.0 Mask 255.255.240.0 Gate 17.255.98.164 Ifp en2 Ifa 17.255.98.164
+}
+New Routes = <IPv4RouteList[7]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.255.96.1 Ifp en2 Ifa 17.255.98.164
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.40.1 Ifp en1 Ifa 17.202.42.111 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.40.1 Ifp en0 Ifa 17.202.42.113 [SCOPED]
+ 3. Dest 0.0.0.0 Mask 0.0.0.0 Gate 169.254.11.33 Ifp fw0 Ifa 169.254.11.33 [direct] [last] [SCOPED]
+ 4. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.111 Ifp en1 Ifa 17.202.42.111
+ 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.113 Ifp en0 Ifa 17.202.42.113 [SCOPED]
+ 6. Dest 17.255.96.0 Mask 255.255.240.0 Gate 17.255.98.164 Ifp en2 Ifa 17.255.98.164
+}
+Remove old[4] = Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.113 Ifp en0 Ifa 17.202.42.113
+Remove old[5] = Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.111 Ifp en1 Ifa 17.202.42.111 [SCOPED]
+Add new[4] = Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.111 Ifp en1 Ifa 17.202.42.111
+Add new[5] = Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.113 Ifp en0 Ifa 17.202.42.113 [SCOPED]
+
+Compare 7 to 6:
+Old Routes = <IPv4RouteList[7]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.255.96.1 Ifp en2 Ifa 17.255.98.164
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.40.1 Ifp en1 Ifa 17.202.42.111 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.40.1 Ifp en0 Ifa 17.202.42.113 [SCOPED]
+ 3. Dest 0.0.0.0 Mask 0.0.0.0 Gate 169.254.11.33 Ifp fw0 Ifa 169.254.11.33 [direct] [last] [SCOPED]
+ 4. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.111 Ifp en1 Ifa 17.202.42.111
+ 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.113 Ifp en0 Ifa 17.202.42.113 [SCOPED]
+ 6. Dest 17.255.96.0 Mask 255.255.240.0 Gate 17.255.98.164 Ifp en2 Ifa 17.255.98.164
+}
+New Routes = <IPv4RouteList[7]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.255.96.1 Ifp en2 Ifa 17.255.98.164
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.40.1 Ifp en0 Ifa 17.202.42.113 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 17.202.40.1 Ifp en1 Ifa 17.202.42.111 [SCOPED]
+ 3. Dest 0.0.0.0 Mask 0.0.0.0 Gate 169.254.11.33 Ifp fw0 Ifa 169.254.11.33 [direct] [last] [SCOPED]
+ 4. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.113 Ifp en0 Ifa 17.202.42.113
+ 5. Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.111 Ifp en1 Ifa 17.202.42.111 [SCOPED]
+ 6. Dest 17.255.96.0 Mask 255.255.240.0 Gate 17.255.98.164 Ifp en2 Ifa 17.255.98.164
+}
+Remove old[4] = Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.111 Ifp en1 Ifa 17.202.42.111
+Remove old[5] = Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.113 Ifp en0 Ifa 17.202.42.113 [SCOPED]
+Add new[4] = Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.113 Ifp en0 Ifa 17.202.42.113
+Add new[5] = Dest 17.202.40.0 Mask 255.255.252.0 Gate 17.202.42.111 Ifp en1 Ifa 17.202.42.111 [SCOPED]
+
+Compare 8 to 9:
+Old Routes = <IPv4RouteList[4]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+}
+New Routes = <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [first]
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [first]
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+}
+Remove old[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+Remove old[1] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+Remove old[2] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+Remove old[3] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+Add new[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [first]
+Add new[1] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 [SCOPED]
+Add new[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+Add new[3] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [first]
+Add new[4] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 [SCOPED]
+Add new[5] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+
+Compare 8 to 10:
+Old Routes = <IPv4RouteList[4]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+}
+New Routes = <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 [last] [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 [last] [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+}
+Remove old[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+Remove old[1] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+Remove old[2] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+Remove old[3] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+Add new[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20
+Add new[1] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+Add new[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 [last] [SCOPED]
+Add new[3] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+Add new[4] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 [last] [SCOPED]
+Add new[5] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+
+Compare 8 to 11:
+Old Routes = <IPv4RouteList[4]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+}
+New Routes = <IPv4RouteList[6]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+ 2. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 [never] [SCOPED]
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+ 4. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 [never] [SCOPED]
+ 5. Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+}
+Remove old[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+Remove old[1] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+Remove old[2] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+Remove old[3] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+Add new[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20
+Add new[1] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 192.168.2.1 Ifp fw0 Ifa 192.168.2.30 [SCOPED]
+Add new[2] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10 [never] [SCOPED]
+Add new[3] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20
+Add new[4] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10 [never] [SCOPED]
+Add new[5] = Dest 192.168.2.0 Mask 255.255.255.0 Gate 192.168.2.30 Ifp fw0 Ifa 192.168.2.30
+
+Compare 12 to 13:
+Old Routes = <IPv4RouteList[4]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+ 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [SCOPED]
+}
+New Routes = <IPv4RouteList[4]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [never] [SCOPED]
+ 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [never] [SCOPED]
+}
+
+Compare 13 to 14:
+Old Routes = <IPv4RouteList[4]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+ 1. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [never] [SCOPED]
+ 2. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+ 3. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [never] [SCOPED]
+}
+New Routes = <IPv4RouteList[2]> = {
+ 0. Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en1 Ifa 10.0.0.20 [never] [SCOPED*]
+ 1. Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.20 Ifp en1 Ifa 10.0.0.20 [never] [SCOPED*]
+}
+Remove old[0] = Dest 0.0.0.0 Mask 0.0.0.0 Gate 10.0.0.1 Ifp en0 Ifa 10.0.0.10
+Remove old[2] = Dest 10.0.0.0 Mask 255.255.255.0 Gate 10.0.0.10 Ifp en0 Ifa 10.0.0.10
+
+Checking for leaks
+Process XXXX 0 leaks for 0 total leaked bytes.
diff --git a/Plugins/IPMonitor/test_reference.sh b/Plugins/IPMonitor/test_reference.sh
new file mode 100644 (file)
index 0000000..c4df41f
--- /dev/null
@@ -0,0 +1,87 @@
+#!/bin/sh
+
+tmpfile=/tmp/test_reference_output$$.txt
+
+cleanup()
+{
+    if [ -f "${tmpfile}" ]; then
+       echo removing "${tmpfile}"
+       rm -f "${tmpfile}"
+    fi
+    exit 1
+}
+
+trap cleanup 1 2 3 15 
+
+run_program()
+{
+    program="${1}"
+    filter="${2}"
+    if [ "${filter}" = "" ]; then
+       ${program}
+    else
+       ${program} | ${filter}
+    fi
+}
+
+usage()
+{
+    echo "usage: $0 ( create | test ) <program> <reference_file> [ <filter> ]"
+    exit 1
+}
+
+command="${1}"
+program="${2}"
+ref_file="${3}"
+filter="${4}"
+
+if [ "${ref_file}" = "" ]; then
+    usage "${0}"
+fi
+
+if [ "${program}" = "" ]; then
+    usage "${0}"
+fi
+
+if [ ! -f "${program}" ]; then
+    echo "program '${program}' doesn't exit"
+    exit 1
+fi
+if [ ! -x "${program}" ]; then
+    program="sh ${program}"
+fi
+# echo "The program is ${program}"
+
+if [ ! "${filter}" = "" ]; then
+    if [ ! -f "${filter}" ]; then
+       echo "filter '${filter}' doesn't exit"
+       exit 1
+    fi
+    if [ ! -x "${filter}" ]; then
+       filter="sh ${filter}"
+    fi
+#    echo "The filter is ${filter}"
+else
+    echo no filter
+fi
+
+if [ "${command}" = "create" ]; then
+    run_program "${program}" "${filter}" > "${ref_file}"
+elif [ "${command}" = "test" ]; then
+    if [ ! -f "${ref_file}" ]; then
+       echo "reference file '${ref_file}' doesn't exist"
+       exit 1
+    fi
+    run_program "${program}" "${filter}" > "${tmpfile}"
+    cmp "${tmpfile}" "${ref_file}"
+    if [ ! $? -eq 0 ]; then
+       echo FAILURE
+       diff "${tmpfile}" "${ref_file}"
+       exit 1
+    fi
+    echo SUCCESS
+else
+    usage "${0}"
+fi
+
+exit 0
\ No newline at end of file
index baee3f180192b19d4d0f2e9135797c5119e4695a..1fede74dc3a56748cc20cad77bb228e912536e33 100644 (file)
@@ -2,6 +2,8 @@
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
+       <key>Builtin</key>
+       <true/>
        <key>CFBundleDevelopmentRegion</key>
        <string>English</string>
        <key>CFBundleExecutable</key>
        <key>CFBundleDevelopmentRegion</key>
        <string>English</string>
        <key>CFBundleExecutable</key>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
-       <string>SystemConfiguration</string>
+       <string>com.apple.SystemConfiguration.InterfaceNamer</string>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.9.2</string>
+       <string>1.10</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.9.2</string>
-       <key>Builtin</key>
-       <true/>
+       <string>1.10</string>
 </dict>
 </plist>
 </dict>
 </plist>
index 6d94985b9c68a821c02e83945e748745633db3ee..1637c7abf7cabac24f5bbb33b3cc615c2f18a516 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2001-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2001-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -170,6 +170,7 @@ static CFMutableDictionaryRef       S_state                 = NULL;
  */
 static CFRunLoopTimerRef       S_timer                 = NULL;
 
  */
 static CFRunLoopTimerRef       S_timer                 = NULL;
 
+#if    !TARGET_OS_IPHONE
 /*
  * Virtual network interface configuration
  *   S_prefs : SCPreferences to configuration
 /*
  * Virtual network interface configuration
  *   S_prefs : SCPreferences to configuration
@@ -179,6 +180,7 @@ static CFRunLoopTimerRef    S_timer                 = NULL;
 static SCPreferencesRef                S_prefs                 = NULL;
 static CFArrayRef              S_bonds                 = NULL;
 static CFArrayRef              S_vlans                 = NULL;
 static SCPreferencesRef                S_prefs                 = NULL;
 static CFArrayRef              S_bonds                 = NULL;
 static CFArrayRef              S_vlans                 = NULL;
+#endif /* !TARGET_OS_IPHONE */
 
 static void
 addTimestamp(CFMutableDictionaryRef dict, CFStringRef key)
 
 static void
 addTimestamp(CFMutableDictionaryRef dict, CFStringRef key)
@@ -446,6 +448,7 @@ updateStore(void)
     return;
 }
 
     return;
 }
 
+#if    !TARGET_OS_IPHONE
 static void
 updateVirtualNetworkInterfaceConfiguration(SCPreferencesRef            prefs,
                                           SCPreferencesNotification   notificationType,
 static void
 updateVirtualNetworkInterfaceConfiguration(SCPreferencesRef            prefs,
                                           SCPreferencesNotification   notificationType,
@@ -521,6 +524,7 @@ updateVirtualNetworkInterfaceConfiguration(SCPreferencesRef         prefs,
     SCPreferencesSynchronize(prefs);
     return;
 }
     SCPreferencesSynchronize(prefs);
     return;
 }
+#endif /* !TARGET_OS_IPHONE */
 
 static CFDictionaryRef
 createInterfaceDict(SCNetworkInterfaceRef interface)
 
 static CFDictionaryRef
 createInterfaceDict(SCNetworkInterfaceRef interface)
@@ -664,11 +668,23 @@ lookupAirPortInterface(CFArrayRef db_list, CFIndex * where)
 
        dict = CFArrayGetValueAtIndex(db_list, i);
        if_type = CFDictionaryGetValue(dict, CFSTR(kSCNetworkInterfaceType));
 
        dict = CFArrayGetValueAtIndex(db_list, i);
        if_type = CFDictionaryGetValue(dict, CFSTR(kSCNetworkInterfaceType));
-       if ((if_type != NULL) &&
-           CFEqual(if_type, kSCNetworkInterfaceTypeIEEE80211)) {
-           if (where)
-               *where = i;
-           return (dict);
+       if (if_type != NULL) {
+           if (CFEqual(if_type, kSCNetworkInterfaceTypeIEEE80211)) {
+               if (where)
+                   *where = i;
+               return (dict);
+           }
+       } else {
+           CFStringRef path;
+
+           path = CFDictionaryGetValue(dict, CFSTR(kIOPathMatchKey));
+           if ((CFStringFind(path, CFSTR("IO80211Interface")  , 0).location != kCFNotFound) ||
+               (CFStringFind(path, CFSTR("AirPort")           , 0).location != kCFNotFound) ||
+               (CFStringFind(path, CFSTR("AppleWireless80211"), 0).location != kCFNotFound)) {
+               if (where)
+                   *where = i;
+               return (dict);
+           }
        }
     }
     return (NULL);
        }
     }
     return (NULL);
@@ -1077,7 +1093,9 @@ updateInterfaces()
         *   in the HW config (or have yet to show up).
         */
        writeInterfaceList(S_dblist);
         *   in the HW config (or have yet to show up).
         */
        writeInterfaceList(S_dblist);
+#if    !TARGET_OS_IPHONE
        updateVirtualNetworkInterfaceConfiguration(NULL, kSCPreferencesNotificationApply, NULL);
        updateVirtualNetworkInterfaceConfiguration(NULL, kSCPreferencesNotificationApply, NULL);
+#endif /* !TARGET_OS_IPHONE */
        updateStore();
 
        if (S_iflist != NULL) {
        updateStore();
 
        if (S_iflist != NULL) {
@@ -1156,6 +1174,9 @@ compareMacAddress(const void *val1, const void *val2, void *context)
      return res;
 }
 
      return res;
 }
 
+#ifndef kIOPlatformUUIDKey
+#define kIOPlatformUUIDKey "IOPlatformUUID"
+#endif
 static void
 updatePlatformUUID()
 {
 static void
 updatePlatformUUID()
 {
@@ -1424,8 +1445,8 @@ iterateRegistryBusy(io_iterator_t iterator, CFArrayRef nodes, int *count)
                SCLog(TRUE, LOG_ERR,
                      CFSTR(MY_PLUGIN_NAME ": reportBusy IORegistryEntryGetLocationInPlane returned 0x%x"),
                      kr);
                SCLog(TRUE, LOG_ERR,
                      CFSTR(MY_PLUGIN_NAME ": reportBusy IORegistryEntryGetLocationInPlane returned 0x%x"),
                      kr);
+               CFRelease(str);
                goto next;
                goto next;
-               break;
        }
 
        CFArrayAppendValue(newNodes, str);
        }
 
        CFArrayAppendValue(newNodes, str);
@@ -1667,7 +1688,7 @@ setup_IOKit(CFBundleRef bundle)
     quietCallback((void *)S_notify,
                  MACH_PORT_NULL,
                  kIOMessageServiceBusyStateChange,
     quietCallback((void *)S_notify,
                  MACH_PORT_NULL,
                  kIOMessageServiceBusyStateChange,
-                 (void *)busy);
+                 (void *)(uintptr_t)busy);
 
     CFRunLoopAddSource(CFRunLoopGetCurrent(),
                       IONotificationPortGetRunLoopSource(S_notify),
 
     CFRunLoopAddSource(CFRunLoopGetCurrent(),
                       IONotificationPortGetRunLoopSource(S_notify),
@@ -1704,6 +1725,7 @@ setup_IOKit(CFBundleRef bundle)
     return ok;
 }
 
     return ok;
 }
 
+#if    !TARGET_OS_IPHONE
 static Boolean
 setup_Virtual(CFBundleRef bundle)
 {
 static Boolean
 setup_Virtual(CFBundleRef bundle)
 {
@@ -1727,15 +1749,18 @@ setup_Virtual(CFBundleRef bundle)
 
     // schedule
     if (!SCPreferencesScheduleWithRunLoop(S_prefs, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)) {
 
     // schedule
     if (!SCPreferencesScheduleWithRunLoop(S_prefs, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)) {
-       SCLog(TRUE, LOG_ERR,
-             CFSTR(MY_PLUGIN_NAME ": SCPreferencesScheduleWithRunLoop() failed: %s"),
-             SCErrorString(SCError()));
-       CFRelease(S_prefs);
-       return FALSE;
+       if (SCError() != kSCStatusNoStoreServer) {
+           SCLog(TRUE, LOG_ERR,
+                 CFSTR(MY_PLUGIN_NAME ": SCPreferencesScheduleWithRunLoop() failed: %s"),
+                       SCErrorString(SCError()));
+           CFRelease(S_prefs);
+           return FALSE;
+       }
     }
 
     return TRUE;
 }
     }
 
     return TRUE;
 }
+#endif /* !TARGET_OS_IPHONE */
 
 __private_extern__
 void
 
 __private_extern__
 void
@@ -1745,10 +1770,12 @@ load_InterfaceNamer(CFBundleRef bundle, Boolean bundleVerbose)
        S_debug = TRUE;
     }
 
        S_debug = TRUE;
     }
 
+#if    !TARGET_OS_IPHONE
     // setup virtual network interface monitoring
     if (!setup_Virtual(bundle)) {
        goto error;
     }
     // setup virtual network interface monitoring
     if (!setup_Virtual(bundle)) {
        goto error;
     }
+#endif /* !TARGET_OS_IPHONE */
 
     // setup [IOKit] network interface monitoring
     if (!setup_IOKit(bundle)) {
 
     // setup [IOKit] network interface monitoring
     if (!setup_IOKit(bundle)) {
index 79c5601b506da2a1a6ec5aba36c4a19b8b490815..9bc200b02f7934a72eed0cebfbfab8365a397f15 100644 (file)
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
-       <string>SystemConfiguration</string>
+       <string>com.apple.SystemConfiguration.KernelEventMonitor</string>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.9.2</string>
+       <string>1.10</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.9.2</string>
+       <string>1.10</string>
        <key>Requires</key>
        <array>
                <string>com.apple.SystemConfiguration.InterfaceNamer</string>
        <key>Requires</key>
        <array>
                <string>com.apple.SystemConfiguration.InterfaceNamer</string>
index debda25784e15c447a847745d6553379d86bad48..82487f37a297e06d0c4554fb77646d90d7d60c50 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2006, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -77,12 +77,9 @@ interface_update_status(const char *if_name, CFBooleanRef active,
 {
        CFStringRef             key             = NULL;
        CFMutableDictionaryRef  newDict         = NULL;
 {
        CFStringRef             key             = NULL;
        CFMutableDictionaryRef  newDict         = NULL;
-       CFBooleanRef            state           = NULL;
 
        key = create_interface_key(if_name);
        newDict = copy_entity(key);
 
        key = create_interface_key(if_name);
        newDict = copy_entity(key);
-       state = isA_CFBoolean(CFDictionaryGetValue(newDict,
-                                                  kSCPropNetLinkActive));
        /* if new status available, update cache */
        if (active == NULL) {
            CFDictionaryRemoveValue(newDict, kSCPropNetLinkActive);
        /* if new status available, update cache */
        if (active == NULL) {
            CFDictionaryRemoveValue(newDict, kSCPropNetLinkActive);
index 40518e47cb9c60a9e47ca5e828c17ddeb803ccaa..4f1c15fcef4471639443fc38e10eb5a552155090 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002-2005, 2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2002-2005, 2007, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include "cache.h"
 #include "ev_ipv4.h"
 
 #include "cache.h"
 #include "ev_ipv4.h"
 
-#ifndef kSCEntNetIPv4ARPCollision
-#define kSCEntNetIPv4ARPCollision      CFSTR("IPv4ARPCollision")
-#endif /* kSCEntNetIPv4ARPCollision */
+#ifndef        kSCEntNetIPv4ARPCollision
+#define        kSCEntNetIPv4ARPCollision       CFSTR("IPv4ARPCollision")
+#endif /* kSCEntNetIPv4ARPCollision */
 
 
-#ifndef kSCEntNetIPv4PortInUse
-#define kSCEntNetIPv4PortInUse         CFSTR("PortInUse")
-#endif /* kSCEntNetIPv4PortInUse */
+#if    !TARGET_OS_IPHONE
+#ifndef        kSCEntNetIPv4PortInUse
+#define        kSCEntNetIPv4PortInUse          CFSTR("PortInUse")
+#endif /* kSCEntNetIPv4PortInUse */
+#endif /* !TARGET_OS_IPHONE */
 
 #define IP_FORMAT      "%d.%d.%d.%d"
 #define IP_CH(ip, i)   (((u_char *)(ip))[i])
 
 #define IP_FORMAT      "%d.%d.%d.%d"
 #define IP_CH(ip, i)   (((u_char *)(ip))[i])
@@ -260,6 +262,7 @@ interface_collision_ipv4(const char *if_name, struct in_addr ip_addr, int hw_len
        return;
 }
 
        return;
 }
 
+#if    !TARGET_OS_IPHONE
 __private_extern__
 void
 port_in_use_ipv4(uint16_t port, pid_t req_pid)
 __private_extern__
 void
 port_in_use_ipv4(uint16_t port, pid_t req_pid)
@@ -277,3 +280,4 @@ port_in_use_ipv4(uint16_t port, pid_t req_pid)
        CFRelease(key);
        return;
 }
        CFRelease(key);
        return;
 }
+#endif /* !TARGET_OS_IPHONE */
index b4f17189c6057a9d9f1c477e8940354999756894..786cf095b9f8b90c6800939866ce587b62f69985 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2005, 2007, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -32,6 +32,7 @@
 #ifndef _EV_IPV4_H
 #define _EV_IPV4_H
 
 #ifndef _EV_IPV4_H
 #define _EV_IPV4_H
 
+#include <TargetConditionals.h>
 #include <netinet/in_var.h>
 
 __BEGIN_DECLS
 #include <netinet/in_var.h>
 
 __BEGIN_DECLS
@@ -40,7 +41,10 @@ void interface_update_ipv4   (struct ifaddrs *ifap, const char *if_name);
 void   interface_collision_ipv4(const char *if_name,
                                 struct in_addr ip_addr,
                                 int hw_len, const void * hw_addr);
 void   interface_collision_ipv4(const char *if_name,
                                 struct in_addr ip_addr,
                                 int hw_len, const void * hw_addr);
+#if    !TARGET_OS_IPHONE
 void   port_in_use_ipv4(uint16_t port, pid_t req_pid);
 void   port_in_use_ipv4(uint16_t port, pid_t req_pid);
+#endif /* !TARGET_OS_IPHONE */
+
 __END_DECLS
 
 #endif /* _EV_IPV4_H */
 __END_DECLS
 
 #endif /* _EV_IPV4_H */
index 9c74f178935002911a7224f7505021fb04317772..bc24c8fe11d2c3d6e6c7fc649476c83c91b8a4cc 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include "ev_dlil.h"
 #include "ev_ipv4.h"
 #include "ev_ipv6.h"
 #include "ev_dlil.h"
 #include "ev_ipv4.h"
 #include "ev_ipv6.h"
-#include "ev_appletalk.h"
-
 #include <notify.h>
 
 #include <notify.h>
 
+#if    !TARGET_OS_IPHONE && INCLUDE_APPLETALK
+#include "ev_appletalk.h"
+#endif /* !TARGET_OS_IPHONE && INCLUDE_APPLETALK */
+
 static const char *inetEventName[] = {
        "",
        "INET address added",
 static const char *inetEventName[] = {
        "",
        "INET address added",
@@ -92,6 +94,7 @@ static const char *dlEventName[] = {
        "KEV_DL_PROTO_DETACHED",
 };
 
        "KEV_DL_PROTO_DETACHED",
 };
 
+#if    !TARGET_OS_IPHONE && INCLUDE_APPLETALK
 static const char *atalkEventName[] = {
        "",
        "KEV_ATALK_ENABLED",
 static const char *atalkEventName[] = {
        "",
        "KEV_ATALK_ENABLED",
@@ -102,6 +105,7 @@ static const char *atalkEventName[] = {
        "KEV_ATALK_ROUTERDOWN",
        "KEV_ATALK_ZONELISTCHANGED"
 };
        "KEV_ATALK_ROUTERDOWN",
        "KEV_ATALK_ZONELISTCHANGED"
 };
+#endif /* !TARGET_OS_IPHONE && INCLUDE_APPLETALK */
 
 static const char *inet6EventName[] = {
        "",
 
 static const char *inet6EventName[] = {
        "",
@@ -113,12 +117,10 @@ static const char *inet6EventName[] = {
        "KEV_INET6_DEFROUTER"
 };
 
        "KEV_INET6_DEFROUTER"
 };
 
-
 __private_extern__ Boolean             network_changed = FALSE;
 __private_extern__ SCDynamicStoreRef   store           = NULL;
 __private_extern__ Boolean             _verbose        = FALSE;
 
 __private_extern__ Boolean             network_changed = FALSE;
 __private_extern__ SCDynamicStoreRef   store           = NULL;
 __private_extern__ Boolean             _verbose        = FALSE;
 
-
 __private_extern__
 int
 dgram_socket(int domain)
 __private_extern__
 int
 dgram_socket(int domain)
@@ -242,6 +244,7 @@ dlEventNameString(uint32_t event_code)
        return ("New Apple network DL subcode");
 }
 
        return ("New Apple network DL subcode");
 }
 
+#if    !TARGET_OS_IPHONE && INCLUDE_APPLETALK
 static const char *
 atalkEventNameString(uint32_t event_code)
 {
 static const char *
 atalkEventNameString(uint32_t event_code)
 {
@@ -250,7 +253,7 @@ atalkEventNameString(uint32_t event_code)
        }
        return ("New Apple network AppleTalk subcode");
 }
        }
        return ("New Apple network AppleTalk subcode");
 }
-
+#endif /* !TARGET_OS_IPHONE && INCLUDE_APPLETALK */
 
 static void
 copy_if_name(struct net_event_data * ev, char * ifr_name, int ifr_len)
 
 static void
 copy_if_name(struct net_event_data * ev, char * ifr_name, int ifr_len)
@@ -305,6 +308,7 @@ processEvent_Apple_Network(struct kern_event_msg *ev_msg)
                                                                 ev->hw_addr);
                                        break;
                                }
                                                                 ev->hw_addr);
                                        break;
                                }
+#if    !TARGET_OS_IPHONE
                                case KEV_INET_PORTINUSE : {
                                        struct kev_in_portinuse * ev;
                                        ev = (struct kev_in_portinuse *)event_data;
                                case KEV_INET_PORTINUSE : {
                                        struct kev_in_portinuse * ev;
                                        ev = (struct kev_in_portinuse *)event_data;
@@ -315,6 +319,7 @@ processEvent_Apple_Network(struct kern_event_msg *ev_msg)
                                        port_in_use_ipv4(ev->port, ev->req_pid);
                                        break;
                                }
                                        port_in_use_ipv4(ev->port, ev->req_pid);
                                        break;
                                }
+#endif /* !TARGET_OS_IPHONE */
                                default :
                                        handled = FALSE;
                                        break;
                                default :
                                        handled = FALSE;
                                        break;
@@ -438,6 +443,7 @@ processEvent_Apple_Network(struct kern_event_msg *ev_msg)
                        }
                        break;
                }
                        }
                        break;
                }
+#if    !TARGET_OS_IPHONE && INCLUDE_APPLETALK
                case KEV_ATALK_SUBCLASS: {
                        struct kev_atalk_data * ev;
 
                case KEV_ATALK_SUBCLASS: {
                        struct kev_atalk_data * ev;
 
@@ -476,6 +482,7 @@ processEvent_Apple_Network(struct kern_event_msg *ev_msg)
                        }
                        break;
                }
                        }
                        break;
                }
+#endif /* !TARGET_OS_IPHONE && INCLUDE_APPLETALK */
                default :
                        handled = FALSE;
                        break;
                default :
                        handled = FALSE;
                        break;
@@ -493,7 +500,6 @@ processEvent_Apple_Network(struct kern_event_msg *ev_msg)
        return;
 }
 
        return;
 }
 
-
 static void
 processEvent_Apple_IOKit(struct kern_event_msg *ev_msg)
 {
 static void
 processEvent_Apple_IOKit(struct kern_event_msg *ev_msg)
 {
@@ -506,6 +512,17 @@ processEvent_Apple_IOKit(struct kern_event_msg *ev_msg)
        return;
 }
 
        return;
 }
 
+static void
+processEvent_Apple_System(struct kern_event_msg *ev_msg)
+{
+       switch (ev_msg->kev_subclass) {
+               default :
+                       logEvent(CFSTR("New Apple System subclass"), ev_msg);
+                       break;
+       }
+
+       return;
+}
 
 static void
 eventCallback(CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const void *data, void *info)
 
 static void
 eventCallback(CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const void *data, void *info)
@@ -539,6 +556,9 @@ eventCallback(CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const
                                        case KEV_IOKIT_CLASS :
                                                processEvent_Apple_IOKit(ev_msg);
                                                break;
                                        case KEV_IOKIT_CLASS :
                                                processEvent_Apple_IOKit(ev_msg);
                                                break;
+                                       case KEV_SYSTEM_CLASS :
+                                               processEvent_Apple_System(ev_msg);
+                                               break;
                                        default :
                                                /* unrecognized (Apple) event class */
                                                logEvent(CFSTR("New (Apple) class"), ev_msg);
                                        default :
                                                /* unrecognized (Apple) event class */
                                                logEvent(CFSTR("New (Apple) class"), ev_msg);
@@ -568,7 +588,6 @@ eventCallback(CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const
 
 }
 
 
 }
 
-
 __private_extern__
 void
 prime_KernelEventMonitor()
 __private_extern__
 void
 prime_KernelEventMonitor()
@@ -617,11 +636,13 @@ prime_KernelEventMonitor()
         */
        interface_update_ipv6(ifap, NULL);
 
         */
        interface_update_ipv6(ifap, NULL);
 
+#if    !TARGET_OS_IPHONE && INCLUDE_APPLETALK
        /*
         * update AppleTalk network addresses already assigned
         * to the interfaces.
         */
        interface_update_appletalk(ifap, NULL);
        /*
         * update AppleTalk network addresses already assigned
         * to the interfaces.
         */
        interface_update_appletalk(ifap, NULL);
+#endif /* !TARGET_OS_IPHONE && INCLUDE_APPLETALK */
 
        freeifaddrs(ifap);
 
 
        freeifaddrs(ifap);
 
@@ -638,29 +659,27 @@ prime_KernelEventMonitor()
        return;
 }
 
        return;
 }
 
-
 static CFStringRef
 kevSocketCopyDescription(const void *info)
 {
        return CFStringCreateWithFormat(NULL, NULL, CFSTR("<kernel event socket>"));
 }
 
 static CFStringRef
 kevSocketCopyDescription(const void *info)
 {
        return CFStringCreateWithFormat(NULL, NULL, CFSTR("<kernel event socket>"));
 }
 
-
 __private_extern__
 void
 load_KernelEventMonitor(CFBundleRef bundle, Boolean bundleVerbose)
 {
 __private_extern__
 void
 load_KernelEventMonitor(CFBundleRef bundle, Boolean bundleVerbose)
 {
-       int                     so;
-       int                     status;
-       struct kev_request      kev_req;
-       CFSocketRef             es;
        CFSocketContext         context = { 0
                                          , (void *)1
                                          , NULL
                                          , NULL
                                          , kevSocketCopyDescription
                                          };
        CFSocketContext         context = { 0
                                          , (void *)1
                                          , NULL
                                          , NULL
                                          , kevSocketCopyDescription
                                          };
+       CFSocketRef             es;
+       struct kev_request      kev_req;
        CFRunLoopSourceRef      rls;
        CFRunLoopSourceRef      rls;
+       int                     so;
+       int                     status;
 
        if (bundleVerbose) {
                _verbose = TRUE;
 
        if (bundleVerbose) {
                _verbose = TRUE;
@@ -715,11 +734,11 @@ load_KernelEventMonitor(CFBundleRef bundle, Boolean bundleVerbose)
        }
 
        /* Create a CFSocketRef for the PF_SYSTEM kernel event socket */
        }
 
        /* Create a CFSocketRef for the PF_SYSTEM kernel event socket */
-       es  = CFSocketCreateWithNative(NULL,
-                                      so,
-                                      kCFSocketReadCallBack,
-                                      eventCallback,
-                                      &context);
+       es = CFSocketCreateWithNative(NULL,
+                                     so,
+                                     kCFSocketReadCallBack,
+                                     eventCallback,
+                                     &context);
 
        /* Create and add a run loop source for the event socket */
        rls = CFSocketCreateRunLoopSource(NULL, es, 0);
 
        /* Create and add a run loop source for the event socket */
        rls = CFSocketCreateRunLoopSource(NULL, es, 0);
@@ -750,11 +769,13 @@ load_KernelEventMonitor(CFBundleRef bundle, Boolean bundleVerbose)
 #undef getIF
 #undef updateStore
 
 #undef getIF
 #undef updateStore
 
+#if    !TARGET_OS_IPHONE && INCLUDE_APPLETALK
 #define getIF          getIF_at
 #define updateStore    updateStore_at
 #include "ev_appletalk.c"
 #undef getIF
 #undef updateStore
 #define getIF          getIF_at
 #define updateStore    updateStore_at
 #include "ev_appletalk.c"
 #undef getIF
 #undef updateStore
+#endif /* !TARGET_OS_IPHONE && INCLUDE_APPLETALK */
 
 int
 main(int argc, char **argv)
 
 int
 main(int argc, char **argv)
index adc989c8d5b90a121cbdb14ba985e2ecd73ff5e4..21cece0c83c51dcce0f03241c22d84a563710cdc 100644 (file)
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
-       <string>SystemConfiguration</string>
+       <string>com.apple.SystemConfiguration.Kicker</string>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.9.2</string>
+       <string>1.10</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.9.2</string>
+       <string>1.10</string>
        <key>Requires</key>
        <array>
                <string>com.apple.SystemConfiguration.ATconfig</string>
        <key>Requires</key>
        <array>
                <string>com.apple.SystemConfiguration.ATconfig</string>
index da65bbefa62fb8253b5b34bb26e3792aa593f76a..3933e3ccaed17cdb4f764421b5be28bcf0bc3fe7 100644 (file)
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
-       <string>SystemConfiguration</string>
+       <string>com.apple.SystemConfiguration.LinkConfiguration</string>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.9.2</string>
+       <string>1.10</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.9.2</string>
+       <string>1.10</string>
        <key>Requires</key>
        <array>
                <string>com.apple.SystemConfiguration.InterfaceNamer</string>
        <key>Requires</key>
        <array>
                <string>com.apple.SystemConfiguration.InterfaceNamer</string>
diff --git a/Plugins/Logger/Info-Embedded.plist b/Plugins/Logger/Info-Embedded.plist
new file mode 100644 (file)
index 0000000..f9f67de
--- /dev/null
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>CFBundleDevelopmentRegion</key>
+       <string>English</string>
+       <key>CFBundleExecutable</key>
+       <string>Logger</string>
+       <key>CFBundleIdentifier</key>
+       <string>com.apple.SystemConfiguration.Logger</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>6.0</string>
+       <key>CFBundleName</key>
+       <string>com.apple.SystemConfiguration.Logger</string>
+       <key>CFBundlePackageType</key>
+       <string>BNDL</string>
+       <key>CFBundleShortVersionString</key>
+       <string>1.10</string>
+       <key>CFBundleSignature</key>
+       <string>????</string>
+       <key>CFBundleVersion</key>
+       <string>1.10</string>
+       <key>Enabled</key>
+       <true/>
+       <key>Verbose</key>
+       <false/>
+       <key>LOG_ALL</key>
+       <false/>
+       <key>LOG_IO_SYSTEMPOWER_EVENTS</key>
+       <true/>
+       <key>LOG_NETWORK_KERNEL_EVENTS</key>
+       <false/>
+       <key>LOG_NOTIFY_DNS_CONFIGURATION</key>
+       <true/>
+       <key>LOG_NOTIFY_NETWORK_CHANGE</key>
+       <false/>
+       <key>LOG_SC_NETWORKCHANGE</key>
+       <true/>
+       <key>LOG_SC_PRIMARYSERVICE</key>
+       <true/>
+       <key>LOG_SC_REACHABILITY</key>
+       <false/>
+       <key>LOG_SC_REACHABILITY_HOSTS</key>
+       <array>
+               <string>mail.me.com</string>
+       </array>
+</dict>
+</plist>
diff --git a/Plugins/Logger/Info.plist b/Plugins/Logger/Info.plist
new file mode 100644 (file)
index 0000000..83f8d68
--- /dev/null
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>CFBundleDevelopmentRegion</key>
+       <string>English</string>
+       <key>CFBundleExecutable</key>
+       <string>Logger</string>
+       <key>CFBundleIdentifier</key>
+       <string>com.apple.SystemConfiguration.Logger</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>6.0</string>
+       <key>CFBundleName</key>
+       <string>com.apple.SystemConfiguration.Logger</string>
+       <key>CFBundlePackageType</key>
+       <string>BNDL</string>
+       <key>CFBundleShortVersionString</key>
+       <string>1.10</string>
+       <key>CFBundleSignature</key>
+       <string>????</string>
+       <key>CFBundleVersion</key>
+       <string>1.10</string>
+       <key>Enabled</key>
+       <false/>
+       <key>Verbose</key>
+       <false/>
+       <key>LOG_ALL</key>
+       <false/>
+       <key>LOG_IO_SYSTEMPOWER_EVENTS</key>
+       <true/>
+       <key>LOG_IO_WAKEUUID_EVENTS</key>
+       <false/>
+       <key>LOG_NETWORK_KERNEL_EVENTS</key>
+       <true/>
+       <key>LOG_NOTIFY_DNS_CONFIGURATION</key>
+       <true/>
+       <key>LOG_NOTIFY_NETWORK_CHANGE</key>
+       <true/>
+       <key>LOG_NOTIFY_SMB_CONFIGURATION</key>
+       <true/>
+       <key>LOG_NOTIFY_UTMPX_CHANGE</key>
+       <false/>
+       <key>LOG_SC_BTMM_CONFIGURATION</key>
+       <true/>
+       <key>LOG_SC_CONSOLEUSER</key>
+       <true/>
+       <key>LOG_SC_DIRECTORYSERVICES_SEARCHPOLICY</key>
+       <true/>
+       <key>LOG_SC_NETWORKCHANGE</key>
+       <false/>
+       <key>LOG_SC_PRIMARYSERVICE</key>
+       <true/>
+       <key>LOG_SC_REACHABILITY</key>
+       <false/>
+       <key>LOG_SC_REACHABILITY_HOSTS</key>
+       <array>
+               <string>mail.me.com</string>
+       </array>
+</dict>
+</plist>
diff --git a/Plugins/Logger/Makefile b/Plugins/Logger/Makefile
new file mode 100644 (file)
index 0000000..1fa0070
--- /dev/null
@@ -0,0 +1,6 @@
+logger: logger.c
+       cc -Wall -g -DMAIN -o logger logger.c -framework CoreFoundation -framework SystemConfiguration -framework IOKit -ldnsinfo
+
+clean:
+       rm -rf logger logger.dSYM
+
diff --git a/Plugins/Logger/logger.c b/Plugins/Logger/logger.c
new file mode 100644 (file)
index 0000000..3abe51d
--- /dev/null
@@ -0,0 +1,1832 @@
+/*
+ * Copyright (c) 2005-2009 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+/*
+ * Modification History
+ *
+ * January 15, 2005            Allan Nathanson <ajn@apple.com>
+ * - initial revision
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/filio.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <net/if_media.h>
+#include <net/if_types.h>
+#include <net/if_var.h>
+#include <sys/kern_event.h>
+#include <netinet/in.h>
+#include <netinet/in_var.h>
+#include <netinet6/in6_var.h>
+#include <ifaddrs.h>
+#include <arpa/inet.h>
+
+#include <TargetConditionals.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+#include <SystemConfiguration/SCPrivate.h>
+#include <IOKit/IOKitLib.h>
+#include <IOKit/IOMessage.h>
+#include <IOKit/pwr_mgt/IOPM.h>
+#include <IOKit/pwr_mgt/IOPMLib.h>
+
+#include <dnsinfo.h>
+#include <notify.h>
+#include <utmpx.h>
+
+
+/* generic MessageTracer keys */
+#define MSGTRACER_KEY_DOMAIN    "com.apple.message.domain"
+#define MSGTRACER_KEY_SIG       "com.apple.message.signature"
+#define MSGTRACER_KEY_UUID      "com.apple.message.uuid"
+#define MSGTRACER_KEY_VALUE1    "com.apple.message.value"
+
+
+#define MY_ASL_FACILITY                "com.apple.SystemConfiguration.Logger"
+#define MY_MSGTRACER_DOMAIN    "com.apple.network.log"
+
+
+static aslmsg          log_msg = NULL;
+static io_connect_t    power   = MACH_PORT_NULL;
+static Boolean         verbose = FALSE;
+
+
+static char *
+elapsed()
+{
+       static char             str[128];
+       struct tm               tm_diff;
+       struct tm               tm_now;
+       struct timeval          tv_diff;
+       struct timeval          tv_now;
+       static struct timeval   tv_then = { 0, 0 };
+
+       (void)gettimeofday(&tv_now, NULL);
+
+       (void)localtime_r(&tv_now.tv_sec, &tm_now);
+
+       timersub(&tv_now, &tv_then, &tv_diff);
+       (void)localtime_r(&tv_diff.tv_sec, &tm_diff);
+#ifdef MAIN
+       sprintf(str, "%2d:%02d:%02d.%03d (+%ld.%03d)",
+               tm_now.tm_hour,
+               tm_now.tm_min,
+               tm_now.tm_sec,
+               tv_now.tv_usec / 1000,
+               tv_diff.tv_sec,
+               tv_diff.tv_usec / 1000);
+#else
+       sprintf(str, ".%03d (+%ld.%03d)",
+               tv_now.tv_usec / 1000,
+               tv_diff.tv_sec,
+               tv_diff.tv_usec / 1000);
+#endif
+
+       tv_then = tv_now;
+       return str;
+}
+
+
+#pragma mark -
+#pragma mark [Network] Kernel Events
+
+
+static CFStringRef
+copyInterfaceFlags(const char *if_name)
+{
+       const char *            iff_up          = "?  ";
+       struct ifreq            ifr;
+       const char              *ifm_active     = "?  ";
+       int                     sock;
+       CFStringRef             str             = NULL;
+
+       sock = socket(AF_INET, SOCK_DGRAM, 0);
+       if (sock == -1) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("socket() failed"));
+               return NULL;
+       }
+
+       bzero((char *)&ifr, sizeof(ifr));
+       (void) strncpy(ifr.ifr_name, if_name, sizeof(ifr.ifr_name));
+       if (ioctl(sock, SIOCGIFFLAGS, (caddr_t)&ifr) == 0) {
+               struct ifmediareq       ifm;
+
+               iff_up = (ifr.ifr_flags & IFF_UP) ? "yes" : "no ";
+
+               bzero((char *)&ifm, sizeof(ifm));
+               (void) strncpy(ifm.ifm_name, if_name, sizeof(ifm.ifm_name));
+               if ((ioctl(sock, SIOCGIFMEDIA, (caddr_t)&ifm) == 0) &&
+                   (ifm.ifm_count > 0) &&
+                   (ifm.ifm_status & IFM_AVALID)) {
+                       ifm_active = (ifm.ifm_status & IFM_ACTIVE) ? "yes" : "no ";
+               }
+
+               str = CFStringCreateWithFormat(NULL,
+                                              NULL,
+                                              CFSTR("\n%-5s: IFF_UP = %s IFM_ACTIVE = %s"),
+                                              if_name,
+                                              iff_up,
+                                              ifm_active);
+       }
+
+       (void)close(sock);
+
+       return str;
+}
+
+
+static int
+prefixLength(struct sockaddr_in6 *sin6)
+{
+       register u_int8_t       *name           = &sin6->sin6_addr.s6_addr[0];
+       register int            byte;
+       register int            bit;
+       int                     plen            = 0;
+
+       for (byte = 0; byte < sizeof(struct in6_addr); byte++, plen += 8) {
+               if (name[byte] != 0xff) {
+                       break;
+               }
+       }
+
+       if (byte == sizeof(struct in6_addr)) {
+               return plen;
+       }
+
+       for (bit = 7; bit != 0; bit--, plen++) {
+               if (!(name[byte] & (1 << bit))) {
+                       break;
+               }
+       }
+
+       for (; bit != 0; bit--) {
+               if (name[byte] & (1 << bit)) {
+                       return 0;
+               }
+       }
+
+       byte++;
+       for (; byte < sizeof(struct in6_addr); byte++) {
+               if (name[byte]) {
+                       return 0;
+               }
+       }
+
+       return plen;
+}
+
+
+static void
+KernelEvent_notification(CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const void *data, void *info)
+{
+       int                     so              = CFSocketGetNative(s);
+       int                     status;
+       char                    buf[1024];
+       struct kern_event_msg   *ev_msg         = (struct kern_event_msg *)&buf[0];
+       int                     offset          = 0;
+
+       status = recv(so, &buf, sizeof(buf), 0);
+       if (status == -1) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("recv() failed: %s"), strerror(errno));
+               CFSocketInvalidate(s);
+               return;
+       }
+
+       while (offset < status) {
+               if ((offset + ev_msg->total_size) > status) {
+                       SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("missed SYSPROTO_EVENT event, buffer not big enough"));
+                       break;
+               }
+
+               switch (ev_msg->vendor_code) {
+                       case KEV_VENDOR_APPLE :
+                               switch (ev_msg->kev_class) {
+                                       case KEV_NETWORK_CLASS : {
+                                               void    *event_data     = &ev_msg->event_data[0];
+
+                                               switch (ev_msg->kev_subclass) {
+                                                       case KEV_DL_SUBCLASS : {
+                                                               struct net_event_data   *ev;
+                                                               char                    if_name[IFNAMSIZ+1];
+
+                                                               ev = (struct net_event_data *)event_data;
+
+                                                               bzero(&if_name, sizeof(if_name));
+                                                               snprintf(if_name, IFNAMSIZ, "%s%d",
+                                                                        ev->if_name,
+                                                                        ev->if_unit);
+
+                                                               switch (ev_msg->event_code) {
+                                                                       case KEV_DL_IF_ATTACHED : {
+                                                                               SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                                                                                     CFSTR("%s kernel event: %s: attached"),
+                                                                                     elapsed(),
+                                                                                     if_name);
+                                                                               break;
+                                                                       }
+                                                                       case KEV_DL_IF_DETACHING  : {
+                                                                               SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                                                                                     CFSTR("%s kernel event: %s: detaching"),
+                                                                                     elapsed(),
+                                                                                     if_name);
+                                                                               break;
+                                                                       }
+                                                                       case KEV_DL_IF_DETACHED  : {
+                                                                               SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                                                                                     CFSTR("%s kernel event: %s: detached"),
+                                                                                     elapsed(),
+                                                                                     if_name);
+                                                                               break;
+                                                                       }
+                                                                       case KEV_DL_LINK_OFF : {
+                                                                               CFStringRef     str;
+
+                                                                               str = verbose ? copyInterfaceFlags(if_name) : NULL;
+                                                                               SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                                                                                     CFSTR("%s kernel event: %s: link down%@"),
+                                                                                     elapsed(),
+                                                                                     if_name,
+                                                                                     str != NULL ? str : CFSTR(""));
+                                                                               if (str != NULL) CFRelease(str);
+                                                                               break;
+                                                                       }
+                                                                       case KEV_DL_LINK_ON  : {
+                                                                               CFStringRef     str;
+
+                                                                               str = verbose ? copyInterfaceFlags(if_name) : NULL;
+                                                                               SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                                                                                     CFSTR("%s kernel event: %s: link up%@"),
+                                                                                     elapsed(),
+                                                                                     if_name,
+                                                                                     str != NULL ? str : CFSTR(""));
+                                                                               if (str != NULL) CFRelease(str);
+                                                                               break;
+                                                                       }
+                                                                       default :
+                                                                               break;
+                                                               }
+                                                               break;
+                                                       }
+                                                       case KEV_INET_SUBCLASS : {
+                                                               char                    addr[128];
+                                                               struct kev_in_data      *ev;
+                                                               char                    if_name[IFNAMSIZ+1];
+                                                               char                    mask[128];
+
+                                                               ev = (struct kev_in_data *)event_data;
+
+                                                               bzero(&if_name, sizeof(if_name));
+                                                               snprintf(if_name, IFNAMSIZ, "%s%d",
+                                                                        ev->link_data.if_name,
+                                                                        ev->link_data.if_unit);
+
+                                                               switch (ev_msg->event_code) {
+                                                                       case KEV_INET_NEW_ADDR :
+                                                                       case KEV_INET_CHANGED_ADDR :
+                                                                       case KEV_INET_ADDR_DELETED : {
+                                                                               struct sockaddr_in      sin;
+
+                                                                               bzero(&sin, sizeof(sin));
+                                                                               sin.sin_len    = sizeof(sin);
+                                                                               sin.sin_family = AF_INET;
+                                                                               sin.sin_addr   = ev->ia_addr;
+                                                                               _SC_sockaddr_to_string((struct sockaddr *)&sin, addr, sizeof(addr));
+
+                                                                               bzero(&sin, sizeof(sin));
+                                                                               sin.sin_len         = sizeof(sin);
+                                                                               sin.sin_family      = AF_INET;
+                                                                               sin.sin_addr.s_addr = ntohl(ev->ia_subnetmask);
+                                                                               _SC_sockaddr_to_string((struct sockaddr *)&sin, mask, sizeof(mask));
+                                                                               break;
+                                                                       }
+                                                                       default :
+                                                                               break;
+                                                               }
+
+                                                               switch (ev_msg->event_code) {
+                                                                       case KEV_INET_NEW_ADDR : {
+                                                                               SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                                                                                     CFSTR("%s kernel event: %s: IPv4 address added (%s/%s)"),
+                                                                                     elapsed(),
+                                                                                     if_name,
+                                                                                     addr,
+                                                                                     mask);
+                                                                               break;
+                                                                       }
+                                                                       case KEV_INET_CHANGED_ADDR : {
+                                                                               SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                                                                                     CFSTR("%s kernel event: %s: IPv4 address changed (%s/%s)"),
+                                                                                     elapsed(),
+                                                                                     if_name,
+                                                                                     addr,
+                                                                                     mask);
+                                                                               break;
+                                                                       }
+                                                                       case KEV_INET_ADDR_DELETED : {
+                                                                               SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                                                                                     CFSTR("%s kernel event: %s: IPv4 address removed (%s/%s)"),
+                                                                                     elapsed(),
+                                                                                     if_name,
+                                                                                     addr,
+                                                                                     mask);
+                                                                               break;
+                                                                       }
+                                                                       default :
+                                                                               break;
+                                                               }
+                                                               break;
+                                                       }
+                                                       case KEV_INET6_SUBCLASS : {
+                                                               char                    addr[128];
+                                                               struct kev_in6_data     *ev;
+                                                               char                    if_name[IFNAMSIZ+1];
+                                                               int                     plen    = 0;
+
+                                                               ev = (struct kev_in6_data *)event_data;
+
+                                                               bzero(&if_name, sizeof(if_name));
+                                                               snprintf(if_name, IFNAMSIZ, "%s%d",
+                                                                        ev->link_data.if_name,
+                                                                        ev->link_data.if_unit);
+
+                                                               switch (ev_msg->event_code) {
+                                                                       case KEV_INET6_NEW_USER_ADDR :
+                                                                       case KEV_INET6_NEW_LL_ADDR :
+                                                                       case KEV_INET6_CHANGED_ADDR :
+                                                                       case KEV_INET6_ADDR_DELETED : {
+                                                                               _SC_sockaddr_to_string((struct sockaddr *)&ev->ia_addr, addr, sizeof(addr));
+                                                                               plen = prefixLength(&ev->ia_prefixmask);
+                                                                               break;
+                                                                       }
+                                                                       default :
+                                                                               break;
+                                                               }
+
+                                                               switch (ev_msg->event_code) {
+                                                                       case KEV_INET6_NEW_USER_ADDR :
+                                                                       case KEV_INET6_NEW_LL_ADDR   : {
+                                                                               SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                                                                                     CFSTR("%s kernel event: %s: IPv6 address added (%s/%d)"),
+                                                                                     elapsed(),
+                                                                                     if_name,
+                                                                                     addr,
+                                                                                     plen);
+                                                                               break;
+                                                                       }
+                                                                       case KEV_INET6_CHANGED_ADDR : {
+                                                                               SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                                                                                     CFSTR("%s kernel event: %s: IPv6 address changed (%s/%d)"),
+                                                                                     elapsed(),
+                                                                                     if_name,
+                                                                                     addr,
+                                                                                     plen);
+                                                                               break;
+                                                                       }
+                                                                       case KEV_INET6_ADDR_DELETED : {
+                                                                               SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                                                                                     CFSTR("%s kernel event: %s: IPv6 address removed"),
+                                                                                     elapsed(),
+                                                                                     if_name);
+                                                                               break;
+                                                                       }
+                                                                       default :
+                                                                               break;
+                                                               }
+                                                               break;
+                                                       }
+                                                       default :
+                                                               break;
+                                               }
+                                               break;
+                                       }
+                                       default :
+                                               break;
+                               }
+                               break;
+                       default :
+                               /* unrecognized vendor code */
+                               break;
+               }
+               offset += ev_msg->total_size;
+               ev_msg = (struct kern_event_msg *)&buf[offset];
+       }
+
+       return;
+}
+
+
+static void
+add_KernelEvent_notification()
+{
+       CFSocketRef             es;
+       CFSocketContext         es_context      = { 0, NULL, NULL, NULL, NULL };
+       struct kev_request      kev_req;
+       CFRunLoopSourceRef      rls;
+       int                     so;
+       int                     yes = 1;
+
+       /* Open an event socket */
+       so = socket(PF_SYSTEM, SOCK_RAW, SYSPROTO_EVENT);
+       if (so == -1) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("socket() failed"));
+               return;
+       }
+
+       /* establish filter to return all events */
+       kev_req.vendor_code  = 0;
+       kev_req.kev_class    = 0;       /* Not used if vendor_code is 0 */
+       kev_req.kev_subclass = 0;       /* Not used if either kev_class OR vendor_code are 0 */
+       if (ioctl(so, SIOCSKEVFILT, &kev_req) == -1) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("ioctl(, SIOCSKEVFILT, ) failed"));
+               (void)close(so);
+               return;
+       }
+
+       if (ioctl(so, FIONBIO, &yes) == -1) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("ioctl(, FIONBIO, ) failed"));
+               (void)close(so);
+               return;
+       }
+
+       /* Create a CFSocketRef for the PF_SYSTEM kernel event socket */
+       es = CFSocketCreateWithNative(NULL,
+                                     so,
+                                     kCFSocketReadCallBack,
+                                     KernelEvent_notification,
+                                     &es_context);
+
+       /* Create and add a run loop source for the event socket */
+       rls = CFSocketCreateRunLoopSource(NULL, es, -1);
+       CFRelease(es);
+
+       CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
+       CFRelease(rls);
+
+       return;
+}
+
+
+#pragma mark -
+#pragma mark Power Management Events
+
+
+static void
+power_notification(void *refcon, io_service_t service, natural_t messageType, void *messageArgument)
+{
+       switch (messageType) {
+               case kIOMessageCanDevicePowerOff :
+                       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                             CFSTR("%s IORegisterForSystemPower: can device power off?"),
+                             elapsed());
+                       break;
+               case kIOMessageDeviceWillPowerOff :
+                       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                             CFSTR("%s IORegisterForSystemPower: device will power off"),
+                             elapsed());
+                       break;
+               case kIOMessageDeviceWillNotPowerOff :
+                       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                             CFSTR("%s IORegisterForSystemPower: device will not power off"),
+                             elapsed());
+                       break;
+               case kIOMessageDeviceHasPoweredOn :
+                       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                             CFSTR("%s IORegisterForSystemPower: device has powered on"),
+                             elapsed());
+                       break;
+               case kIOMessageCanSystemPowerOff :
+                       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                             CFSTR("%s IORegisterForSystemPower: can system power off?"),
+                             elapsed());
+                       break;
+               case kIOMessageSystemWillPowerOff :
+                       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                             CFSTR("%s IORegisterForSystemPower: system will power off"),
+                             elapsed());
+                       break;
+               case kIOMessageSystemWillNotPowerOff :
+                       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                             CFSTR("%s IORegisterForSystemPower: system will not power off"),
+                             elapsed());
+                       break;
+               case kIOMessageCanSystemSleep :
+                       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                             CFSTR("%s IORegisterForSystemPower: can system sleep?"),
+                             elapsed());
+                       /*
+                        * Idle sleep is about to kick in, but applications have
+                        * a chance to allow sleep (by calling IOAllowPowerChange)
+                        * or to prevent sleep (by calling IOCancelPowerChange).
+                        */
+                       IOAllowPowerChange(power, (long)messageArgument);
+                       break;
+               case kIOMessageSystemWillSleep :
+                       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                             CFSTR("%s IORegisterForSystemPower: system will sleep"),
+                             elapsed());
+                       IOAllowPowerChange(power, (long)messageArgument);
+                       break;
+               case kIOMessageSystemWillNotSleep :
+                       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                             CFSTR("%s IORegisterForSystemPower: system will not sleep"),
+                             elapsed());
+                       break;
+               case kIOMessageSystemHasPoweredOn :
+                       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                             CFSTR("%s IORegisterForSystemPower: system has powered on"),
+                             elapsed());
+                       break;
+               case kIOMessageSystemWillRestart :
+                       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                             CFSTR("%s IORegisterForSystemPower: system will restart"),
+                             elapsed());
+                       break;
+               case kIOMessageSystemWillPowerOn :
+                       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                             CFSTR("%s IORegisterForSystemPower: system will power on"),
+                             elapsed());
+                       break;
+               default :
+                       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                             CFSTR("%s IORegisterForSystemPower: message=%08lx"),
+                             elapsed(),
+                             (long unsigned int)messageType);
+                       break;
+       }
+
+       return;
+}
+
+
+static void
+add_power_notification()
+{
+       io_object_t             iterator;
+       IONotificationPortRef   notify;
+
+       power = IORegisterForSystemPower(0, &notify, power_notification, &iterator);
+       if (power == MACH_PORT_NULL) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("IORegisterForSystemPower() failed"));
+               return;
+       }
+
+       CFRunLoopAddSource(CFRunLoopGetCurrent(),
+                          IONotificationPortGetRunLoopSource(notify),
+                          kCFRunLoopCommonModes);
+
+       return;
+}
+
+
+#ifdef kIOPMMessageSleepWakeUUIDChange
+static void
+wake_uuid_notification(void *refcon, io_service_t service, natural_t messageType, void *messageArgument)
+{
+       CFStringRef     wake_uuid       = NULL;
+
+       if (messageType == kIOPMMessageSleepWakeUUIDChange) {
+               if (messageArgument == kIOPMMessageSleepWakeUUIDSet) {
+                       wake_uuid = IORegistryEntryCreateCFProperty(service, CFSTR(kIOPMSleepWakeUUIDKey), NULL, 0);
+               }
+
+               if (wake_uuid != NULL) {
+                       char    uuid[256];
+
+                       _SC_cfstring_to_cstring(wake_uuid, uuid, sizeof(uuid), kCFStringEncodingUTF8);
+                       asl_set(log_msg, MSGTRACER_KEY_DOMAIN, MY_MSGTRACER_DOMAIN);
+                       asl_set(log_msg, MSGTRACER_KEY_UUID  , uuid);
+
+                       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                             CFSTR("%s wake UUID notification: UUID set (%@)"),
+                             elapsed(),
+                             wake_uuid);
+
+                       CFRelease(wake_uuid);
+               } else {
+                       asl_unset(log_msg, MSGTRACER_KEY_DOMAIN);
+                       asl_unset(log_msg, MSGTRACER_KEY_UUID);
+
+                       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                             CFSTR("%s wake UUID notification: UUID not set"),
+                             elapsed());
+               }
+       }
+
+       return;
+}
+
+
+static void
+add_wake_uuid_notification()
+{
+       kern_return_t           kr;
+       io_object_t             notification    = IO_OBJECT_NULL;
+       IONotificationPortRef   notifyPort;
+       io_service_t            service;
+
+       notifyPort = IONotificationPortCreate(kIOMasterPortDefault);
+       service = IORegistryEntryFromPath(kIOMasterPortDefault,
+                                         kIOPowerPlane ":/IOPowerConnection/IOPMrootDomain");
+       kr = IOServiceAddInterestNotification(notifyPort,
+                                             service,
+                                             kIOGeneralInterest,
+                                             wake_uuid_notification,
+                                             NULL,                     // refCon
+                                             &notification);
+       if (kr != KERN_SUCCESS) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR,
+                     CFSTR("IOServiceAddInterestNotification() failed, kr=0x%x"),
+                     kr);
+               return;
+       }
+
+       CFRunLoopAddSource(CFRunLoopGetCurrent(),
+                          IONotificationPortGetRunLoopSource(notifyPort),
+                          kCFRunLoopDefaultMode);
+
+       wake_uuid_notification(NULL,
+                              service,
+                              kIOPMMessageSleepWakeUUIDChange,
+                              kIOPMMessageSleepWakeUUIDSet);
+
+       return;
+}
+#endif // kIOPMMessageSleepWakeUUIDChange
+
+
+#pragma mark -
+#pragma mark SCDynamicStore "network" Events
+
+
+static void
+NetworkChange_notification(SCDynamicStoreRef store, CFArrayRef changedKeys, void *context)
+{
+       CFIndex                 i;
+       CFIndex                 n;
+       CFMutableStringRef      str     = CFStringCreateMutable(NULL, 0);
+
+       CFStringAppendFormat(str,
+                            NULL,
+                            CFSTR("%s SCDynamicStore \"network\" notification"),
+                            elapsed());
+
+       n = CFArrayGetCount(changedKeys);
+       for (i = 0; i < n; i++) {
+               CFStringRef     key;
+
+               key = CFArrayGetValueAtIndex(changedKeys, i);
+               if (CFStringHasSuffix(key, kSCEntNetLink)) {
+                       CFDictionaryRef dict;
+                       const char      *val    = "?";
+
+                       dict = SCDynamicStoreCopyValue(store, key);
+                       if (dict != NULL) {
+                               CFBooleanRef    link;
+
+                               link = CFDictionaryGetValue(dict, kSCPropNetLinkActive);
+                               if (link != NULL) {
+                                       val = CFBooleanGetValue(link) ? "up" : "down";
+                               }
+
+                               CFRelease(dict);
+                       }
+                       CFStringAppendFormat(str, NULL, CFSTR("\n%@ (%s)"), key, val);
+               } else if (CFStringHasSuffix(key, kSCEntNetIPv4) ||
+                          CFStringHasSuffix(key, kSCEntNetIPv6)) {
+                       CFDictionaryRef dict;
+
+                       dict = SCDynamicStoreCopyValue(store, key);
+                       if (dict != NULL) {
+                               CFStringRef     val;
+
+                               val = _SCCopyDescription(dict, NULL);
+                               CFStringAppendFormat(str, NULL, CFSTR("\n%@ : %@"), key, val);
+                               CFRelease(val);
+                               CFRelease(dict);
+                       } else {
+                               CFStringAppendFormat(str, NULL, CFSTR("\n%@ : removed"), key);
+                       }
+               } else {
+                       CFStringAppendFormat(str, NULL, CFSTR("\n%@"), key);
+               }
+       }
+
+       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, CFSTR("%@"), str);
+       CFRelease(str);
+       return;
+}
+
+
+static void
+add_NetworkChange_notification()
+{
+       CFStringRef             dns_key;
+       CFStringRef             key;
+       CFMutableArrayRef       keys;
+       Boolean                 ok;
+       CFStringRef             pattern;
+       CFMutableArrayRef       patterns;
+       SCDynamicStoreRef       store;
+       CFRunLoopSourceRef      rls;
+
+       store = SCDynamicStoreCreate(NULL, CFSTR("Logger.bundle-NetworkChange"), NetworkChange_notification, NULL);
+       if (store == NULL) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreate() failed"));
+               return;
+       }
+
+       keys     = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+
+       // Interface list
+
+       key = SCDynamicStoreKeyCreateNetworkInterface(NULL, kSCDynamicStoreDomainState);
+       CFArrayAppendValue(keys, key);
+       CFRelease(key);
+
+       // IPv4
+
+       key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, kSCDynamicStoreDomainState, kSCEntNetIPv4);
+       CFArrayAppendValue(keys, key);
+       CFRelease(key);
+
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv4);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+
+       pattern = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv4);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+
+       // IPv6
+
+       key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, kSCDynamicStoreDomainState, kSCEntNetIPv6);
+       CFArrayAppendValue(keys, key);
+       CFRelease(key);
+
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv6);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+
+       pattern = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv6);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+
+       // Link
+
+       pattern = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetLink);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+
+       // AirPort (e.g. BSSID)
+
+       pattern = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetAirPort);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+
+       // DNS
+
+       key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, kSCDynamicStoreDomainState, kSCEntNetDNS);
+       CFArrayAppendValue(keys, key);
+       CFRelease(key);
+
+       dns_key = CFStringCreateWithCString(NULL,
+                                           dns_configuration_notify_key(),
+                                           kCFStringEncodingASCII);
+       key = CFStringCreateWithFormat(NULL, NULL, CFSTR("Notify:%@"), dns_key);
+       CFRelease(dns_key);
+       CFArrayAppendValue(keys, key);
+       CFRelease(key);
+
+       // Proxies
+
+       key = SCDynamicStoreKeyCreateProxies(NULL);
+       CFArrayAppendValue(keys, key);
+       CFRelease(key);
+
+       // ComputerName, LocalHostName
+
+       key = SCDynamicStoreKeyCreateComputerName(NULL);
+       CFArrayAppendValue(keys, key);
+       CFRelease(key);
+
+       key = SCDynamicStoreKeyCreateHostNames(NULL);
+       CFArrayAppendValue(keys, key);
+       CFRelease(key);
+
+       ok = SCDynamicStoreSetNotificationKeys(store, keys, patterns);
+       CFRelease(keys);
+       CFRelease(patterns);
+       if (!ok) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreSetNotificationKeys() failed"));
+               CFRelease(store);
+               return;
+       }
+
+       rls = SCDynamicStoreCreateRunLoopSource(NULL, store, -1);
+       if (rls == NULL) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreateRunLoopSource() failed"));
+               CFRelease(store);
+               return;
+       }
+       CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
+       CFRelease(rls);
+
+       CFRelease(store);
+       return;
+}
+
+
+static void
+PrimaryService_notification(SCDynamicStoreRef store, CFArrayRef changedKeys, void *context)
+{
+       CFDictionaryRef         entity;
+       CFStringRef             key;
+       static CFStringRef      oldPrimary      = NULL;
+       CFStringRef             newPrimary      = NULL;
+
+       key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, kSCDynamicStoreDomainState, kSCEntNetIPv4);
+       entity = SCDynamicStoreCopyValue(store, key);
+       CFRelease(key);
+       if (isA_CFDictionary(entity) &&
+           CFDictionaryGetValueIfPresent(entity,
+                                         kSCDynamicStorePropNetPrimaryService,
+                                         (const void **)&newPrimary) &&
+           isA_CFString(newPrimary)) {
+               CFRetain(newPrimary);
+       } else {
+               newPrimary = NULL;
+       }
+
+       if (!_SC_CFEqual(oldPrimary, newPrimary)) {
+               if (newPrimary != NULL) {
+                       CFStringRef     newInterface;
+
+                       newInterface = CFDictionaryGetValue(entity, kSCDynamicStorePropNetPrimaryInterface);
+                       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                             CFSTR("%s Primary service: %@ (%@)"),
+                             elapsed(),
+                             newPrimary,
+                             newInterface != NULL ? newInterface : CFSTR("?"));
+               } else {
+                       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+                             CFSTR("%s Primary service: removed"),
+                             elapsed());
+               }
+       }
+
+       if (oldPrimary != NULL) CFRelease(oldPrimary);
+       oldPrimary = newPrimary;
+
+       if (entity != NULL)     CFRelease(entity);
+       return;
+}
+
+
+static void
+add_PrimaryService_notification()
+{
+       CFStringRef             key;
+       CFMutableArrayRef       keys;
+       Boolean                 ok;
+       SCDynamicStoreRef       store;
+       CFRunLoopSourceRef      rls;
+
+       store = SCDynamicStoreCreate(NULL, CFSTR("Logger.bundle-PrimaryService"), PrimaryService_notification, NULL);
+       if (store == NULL) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreate() failed"));
+               return;
+       }
+
+       keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       key  = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, kSCDynamicStoreDomainState, kSCEntNetIPv4);
+       CFArrayAppendValue(keys, key);
+       CFRelease(key);
+
+       ok = SCDynamicStoreSetNotificationKeys(store, keys, NULL);
+       CFRelease(keys);
+       if (!ok) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreSetNotificationKeys() failed"));
+               CFRelease(store);
+               return;
+       }
+
+       rls = SCDynamicStoreCreateRunLoopSource(NULL, store, -1);
+       if (rls == NULL) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreateRunLoopSource() failed"));
+               CFRelease(store);
+               return;
+       }
+       CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
+       CFRelease(rls);
+
+       CFRelease(store);
+       return;
+}
+
+
+#pragma mark -
+#pragma mark Reachability Events
+
+
+static void
+reachability_notification(SCNetworkReachabilityRef ref, SCNetworkReachabilityFlags flags, void *info)
+{
+       CFStringRef     hostname        = (CFStringRef)info;
+
+       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+             CFSTR("%s reachability changed: %@: flags=0x%08x"),
+             elapsed(),
+             hostname,
+             flags);
+       return;
+}
+
+
+static void
+add_reachability_notification(CFArrayRef hosts)
+{
+       SCNetworkReachabilityContext    context = { 0, NULL, CFRetain, CFRelease, CFCopyDescription };
+       CFIndex                         i;
+       CFIndex                         n;
+       SCNetworkReachabilityRef        target;
+
+       struct watch {
+               in_addr_t       addr;
+               CFStringRef     name;
+       } watchAddresses[]      = { { 0,                        CFSTR("0.0.0.0")        },
+                                   { IN_LINKLOCALNETNUM,       CFSTR("169.254.0.0")    },
+                                   { (u_int32_t)0xe00000fb,    CFSTR("224.0.0.251")    },
+                                 };
+
+       for (i = 0; i < sizeof(watchAddresses)/sizeof(watchAddresses[0]); i++) {
+               struct sockaddr_in              sin;
+
+               bzero(&sin, sizeof(sin));
+               sin.sin_len    = sizeof(sin);
+               sin.sin_family = AF_INET;
+               sin.sin_addr.s_addr = htonl(watchAddresses[i].addr);
+
+               target = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&sin);
+               if (target == NULL) {
+                       SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCNetworkReachabilityCreateWithAddress() failed"));
+                       return;
+               }
+
+               context.info = (void *)watchAddresses[i].name;
+               if (!SCNetworkReachabilitySetCallback(target, reachability_notification, &context)) {
+                       SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCNetworkReachabilitySetCallback() failed"));
+                       CFRelease(target);
+                       return;
+               }
+
+               if (!SCNetworkReachabilityScheduleWithRunLoop(target, CFRunLoopGetCurrent(), kCFRunLoopCommonModes)) {
+                       SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCNetworkReachabilityScheduleWithRunLoop() failed"));
+                       CFRelease(target);
+                       return;
+               }
+
+               CFRelease(target);
+       }
+
+       n = (hosts != NULL) ? CFArrayGetCount(hosts) : 0;
+       for (i = 0; i < n; i++) {
+               CFStringRef     host;
+               char            *nodename;
+
+               host = CFArrayGetValueAtIndex(hosts, i);
+               if (!isA_CFString(host) || (CFStringGetLength(host) == 0)) {
+                       continue;
+               }
+
+               nodename = _SC_cfstring_to_cstring(host, NULL, 0, kCFStringEncodingUTF8);
+               target = SCNetworkReachabilityCreateWithName(NULL, nodename);
+               CFAllocatorDeallocate(NULL, nodename);
+               if (target == NULL) {
+                       SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCNetworkReachabilityCreateWithName() failed"));
+                       return;
+               }
+
+               context.info = (void *)host;
+               if (!SCNetworkReachabilitySetCallback(target, reachability_notification, &context)) {
+                       SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCNetworkReachabilitySetCallback() failed"));
+                       CFRelease(target);
+                       return;
+               }
+
+               if (!SCNetworkReachabilityScheduleWithRunLoop(target, CFRunLoopGetCurrent(), kCFRunLoopCommonModes)) {
+                       SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCNetworkReachabilityScheduleWithRunLoop() failed"));
+                       CFRelease(target);
+                       return;
+               }
+
+               CFRelease(target);
+       }
+
+       return;
+}
+
+
+#pragma mark -
+#pragma mark Console User/Information Events
+
+
+#if    !TARGET_OS_EMBEDDED
+static void
+console_notification(SCDynamicStoreRef store, CFArrayRef changedKeys, void *context)
+{
+       gid_t                   gid;
+       CFArrayRef              info;
+       CFMutableStringRef      str     = CFStringCreateMutable(NULL, 0);
+       uid_t                   uid;
+       CFStringRef             user;
+
+       CFStringAppendFormat(str,
+                            NULL,
+                            CFSTR("%s SCDynamicStore console notification"),
+                            elapsed());
+
+       user = SCDynamicStoreCopyConsoleUser(store, &uid, &gid);
+       if (user != NULL) {
+               CFStringAppendFormat(str, NULL, CFSTR("\nconsole user = %@"), user);
+               CFRelease(user);
+       } else {
+               CFStringAppendFormat(str, NULL, CFSTR("\nno console user"));
+       }
+
+       info = SCDynamicStoreCopyConsoleInformation(store);
+       if (info != NULL) {
+               CFIndex         i;
+               CFIndex         n;
+
+               n = CFArrayGetCount(info);
+               for (i = 0; i < n; i++) {
+                       CFDictionaryRef session;
+                       CFNumberRef     sessionID;
+                       CFStringRef     sessionUserName;
+                       CFBooleanRef    sessionOnConsole;
+
+                       session          = CFArrayGetValueAtIndex(info, i);
+                       sessionID        = CFDictionaryGetValue(session, kSCConsoleSessionID);
+                       sessionUserName  = CFDictionaryGetValue(session, kSCConsoleSessionUserName);
+                       sessionOnConsole = CFDictionaryGetValue(session, kSCConsoleSessionOnConsole);
+
+                       CFStringAppendFormat(str, NULL, CFSTR("\n%d : id=%@, user=%@, console=%s"),
+                                            i,
+                                            sessionID,
+                                            sessionUserName  != NULL ? sessionUserName : CFSTR("?"),
+                                            sessionOnConsole != NULL ? CFBooleanGetValue(sessionOnConsole) ? "yes"  : "no" : "?");
+               }
+
+               CFRelease(info);
+       }
+
+       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, CFSTR("%@"), str);
+       CFRelease(str);
+       return;
+}
+
+
+static void
+add_console_notification()
+{
+       CFStringRef             key;
+       CFMutableArrayRef       keys;
+       Boolean                 ok;
+       SCDynamicStoreRef       store;
+       CFRunLoopSourceRef      rls;
+
+       store = SCDynamicStoreCreate(NULL, CFSTR("Logger.bundle-console"), console_notification, NULL);
+       if (store == NULL) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreate() failed"));
+               return;
+       }
+
+       keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+
+       key = SCDynamicStoreKeyCreateConsoleUser(NULL);
+       CFArrayAppendValue(keys, key);
+       CFRelease(key);
+
+       ok = SCDynamicStoreSetNotificationKeys(store, keys, NULL);
+       CFRelease(keys);
+       if (!ok) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreSetNotificationKeys() failed"));
+               CFRelease(store);
+               return;
+       }
+
+       rls = SCDynamicStoreCreateRunLoopSource(NULL, store, -1);
+       if (rls == NULL) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreateRunLoopSource() failed"));
+               CFRelease(store);
+               return;
+       }
+       CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
+       CFRelease(rls);
+
+       CFRelease(store);
+       return;
+}
+#endif // !TARGET_OS_EMBEDDED
+
+
+#pragma mark -
+#pragma mark Directory Services Events
+
+
+//#include <DirectoryServices/DirServicesPriv.h>
+#ifndef        kDSStdNotifySearchPolicyChanged
+#define        kDSStdNotifySearchPolicyChanged "com.apple.DirectoryService.NotifyTypeStandard:SearchPolicyChanged"
+#endif
+
+
+#if    !TARGET_OS_EMBEDDED
+static void
+directoryServices_notification(SCDynamicStoreRef store, CFArrayRef changedKeys, void *context)
+{
+       CFIndex                 i;
+       CFIndex                 n;
+       CFMutableStringRef      str     = CFStringCreateMutable(NULL, 0);
+
+       CFStringAppendFormat(str,
+                            NULL,
+                            CFSTR("%s SCDynamicStore DirectoryServices notification"),
+                            elapsed());
+
+       n = CFArrayGetCount(changedKeys);
+       for (i = 0; i < n; i++) {
+               CFStringRef     key;
+
+               key = CFArrayGetValueAtIndex(changedKeys, i);
+               CFStringAppendFormat(str, NULL, CFSTR("\n%@"), key);
+       }
+
+       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, CFSTR("%@"), str);
+       CFRelease(str);
+       return;
+}
+
+
+static void
+add_DirectoryServices_notification()
+{
+       CFStringRef             key;
+       CFMutableArrayRef       keys;
+       Boolean                 ok;
+       SCDynamicStoreRef       store;
+       CFRunLoopSourceRef      rls;
+
+       store = SCDynamicStoreCreate(NULL, CFSTR("Logger.bundle-directoryServices"), directoryServices_notification, NULL);
+       if (store == NULL) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreate() failed"));
+               return;
+       }
+
+       keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+
+       key = CFSTR(kDSStdNotifySearchPolicyChanged);
+       CFArrayAppendValue(keys, key);
+//     CFRelease(key);
+
+       ok = SCDynamicStoreSetNotificationKeys(store, keys, NULL);
+       CFRelease(keys);
+       if (!ok) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreSetNotificationKeys() failed"));
+               CFRelease(store);
+               return;
+       }
+
+       rls = SCDynamicStoreCreateRunLoopSource(NULL, store, -1);
+       if (rls == NULL) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreateRunLoopSource() failed"));
+               CFRelease(store);
+               return;
+       }
+       CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
+       CFRelease(rls);
+
+       CFRelease(store);
+       return;
+}
+#endif // !TARGET_OS_EMBEDDED
+
+
+#pragma mark -
+#pragma mark DNS Configuration Events
+
+
+static void
+dnsinfo_notification(CFMachPortRef port, void *msg, CFIndex size, void *info)
+{
+       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+               CFSTR("%s dnsinfo notification"),
+               elapsed());
+
+       return;
+}
+
+
+static void
+add_dnsinfo_notification()
+{
+       const char              *key;
+       CFMachPortRef           mp;
+       mach_port_t             notify_port;
+       int                     notify_token;
+       CFRunLoopSourceRef      rls;
+       uint32_t                status;
+
+       key = dns_configuration_notify_key();
+       status = notify_register_mach_port(key, &notify_port, 0, &notify_token);
+       if (status != NOTIFY_STATUS_OK) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("notify_register_mach_port() failed"));
+               return;
+       }
+
+       mp = CFMachPortCreateWithPort(NULL, notify_port, dnsinfo_notification, NULL, NULL);
+       if (mp == NULL) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("CFMachPortCreateWithPort() failed"));
+               (void)notify_cancel(notify_token);
+               return;
+       }
+
+       rls = CFMachPortCreateRunLoopSource(NULL, mp, -1);
+       if (rls == NULL) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreateRunLoopSource() failed"));
+               CFRelease(mp);
+               (void)notify_cancel(notify_token);
+               return;
+       }
+       CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
+       CFRelease(rls);
+
+       CFRelease(mp);
+       return;
+}
+
+
+#pragma mark -
+#pragma mark Network Configuration Change Events
+
+
+#define        NETWORKCHANGED_NOTIFY_KEY       "com.apple.system.config.network_change"
+
+static void
+network_notification(CFMachPortRef port, void *msg, CFIndex size, void *info)
+{
+       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+             CFSTR("%s network_change notification"),
+             elapsed());
+
+       return;
+}
+
+
+static void
+add_network_notification()
+{
+       CFMachPortRef           mp;
+       mach_port_t             notify_port;
+       int                     notify_token;
+       CFRunLoopSourceRef      rls;
+       uint32_t                status;
+
+       status = notify_register_mach_port(NETWORKCHANGED_NOTIFY_KEY,
+                                          &notify_port,
+                                          0,
+                                          &notify_token);
+       if (status != NOTIFY_STATUS_OK) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("notify_register_mach_port() failed"));
+               return;
+       }
+
+       mp = CFMachPortCreateWithPort(NULL, notify_port, network_notification, NULL, NULL);
+       if (mp == NULL) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("CFMachPortCreateWithPort() failed"));
+               (void)notify_cancel(notify_token);
+               return;
+       }
+
+       rls = CFMachPortCreateRunLoopSource(NULL, mp, -1);
+       if (rls == NULL) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreateRunLoopSource() failed"));
+               CFRelease(mp);
+               (void)notify_cancel(notify_token);
+               return;
+       }
+       CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
+       CFRelease(rls);
+
+       CFRelease(mp);
+       return;
+}
+
+
+#pragma mark -
+#pragma mark SMB Configuration Events
+
+
+#define        SMBCONFIGURATION_NOTIFY_KEY     "com.apple.system.SystemConfiguration.smb_configuration"
+
+
+#if    !TARGET_OS_EMBEDDED
+static void
+smbconf_notification(CFMachPortRef port, void *msg, CFIndex size, void *info)
+{
+       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO,
+             CFSTR("%s smb.conf notification"),
+             elapsed());
+
+       return;
+}
+
+
+static void
+add_smbconf_notification()
+{
+       CFMachPortRef           mp;
+       mach_port_t             notify_port;
+       int                     notify_token;
+       CFRunLoopSourceRef      rls;
+       uint32_t                status;
+
+       status = notify_register_mach_port(SMBCONFIGURATION_NOTIFY_KEY,
+                                          &notify_port,
+                                          0,
+                                          &notify_token);
+       if (status != NOTIFY_STATUS_OK) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("notify_register_mach_port() failed"));
+               return;
+       }
+
+       mp = CFMachPortCreateWithPort(NULL, notify_port, smbconf_notification, NULL, NULL);
+       if (mp == NULL) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("CFMachPortCreateWithPort() failed"));
+               (void)notify_cancel(notify_token);
+               return;
+       }
+
+       rls = CFMachPortCreateRunLoopSource(NULL, mp, -1);
+       if (rls == NULL) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreateRunLoopSource() failed"));
+               CFRelease(mp);
+               (void)notify_cancel(notify_token);
+               return;
+       }
+       CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
+       CFRelease(rls);
+
+       CFRelease(mp);
+       return;
+}
+#endif // !TARGET_OS_EMBEDDED
+
+
+#pragma mark -
+#pragma mark pututxline Events
+
+
+#if    !TARGET_OS_EMBEDDED
+static const char *
+ut_time(struct utmpx *utmpx)
+{
+       static char     str[16];
+       struct tm       tm;
+
+       (void)localtime_r(&utmpx->ut_tv.tv_sec, &tm);
+       snprintf(str, sizeof(str), "%2d:%02d:%02d.%03d",
+               tm.tm_hour,
+               tm.tm_min,
+               tm.tm_sec,
+               utmpx->ut_tv.tv_usec / 1000);
+
+       return str;
+}
+
+
+static const char *
+ut_id(struct utmpx *utmpx)
+{
+       char            *cp;
+       static char     str[16];
+
+       cp = utmpx->ut_id + sizeof(utmpx->ut_id);
+       while(--cp >= utmpx->ut_id && isprint(*cp)) {}
+       if(cp < utmpx->ut_id) {
+               snprintf(str, sizeof(str), "%-4.4s", utmpx->ut_id);
+       } else {
+               snprintf(str, sizeof(str),
+                        "0x%2.2x%2.2x%2.2x%2.2x",
+                        utmpx->ut_id[0],
+                        utmpx->ut_id[1],
+                        utmpx->ut_id[2],
+                        utmpx->ut_id[3]);
+       }
+
+       return str;
+}
+
+
+static const char *
+ut_pid(struct utmpx *utmpx)
+{
+       static char     pid[16];
+
+       snprintf(pid, sizeof(pid), "%d", utmpx->ut_pid);
+
+       return pid;
+}
+
+
+static void
+pututxline_notification(CFMachPortRef port, void *msg, CFIndex size, void *info)
+{
+       CFMutableStringRef      str     = CFStringCreateMutable(NULL, 0);
+       struct utmpx            *utmpx;
+
+       CFStringAppendFormat(str,
+                            NULL,
+                            CFSTR("%s pututxline notification"),
+                            elapsed());
+
+       setutxent();
+       while ((utmpx = getutxent()) != NULL) {
+               const char *    entry_id        = NULL;
+               const char *    entry_line      = NULL;
+               const char *    entry_pid       = NULL;
+               const char *    entry_tv        = NULL;
+               const char *    entry_type;
+               const char *    entry_user      = NULL;
+               char            line[128];
+               int             n;
+
+               switch (utmpx->ut_type) {
+                       case BOOT_TIME :        // Time of a system boot.
+                               entry_type = "Boot";
+                               entry_tv   = ut_time(utmpx);
+                               break;
+                       case DEAD_PROCESS :     // A session leader exited.
+                               entry_type = "Dead process";
+                               entry_id   = ut_id  (utmpx);
+                               entry_pid  = ut_pid (utmpx);
+                               entry_tv   = ut_time(utmpx);
+                               break;
+                       case EMPTY :            // No valid user accounting information.
+                               continue;
+                       case INIT_PROCESS :     // A process spawned by init(8).
+                               entry_type = "Init process";
+                               entry_id   = ut_id  (utmpx);
+                               entry_pid  = ut_pid (utmpx);
+                               entry_tv   = ut_time(utmpx);
+                               break;
+                       case LOGIN_PROCESS :    // The session leader of a logged-in user.
+                               entry_type = "Login";
+                               entry_id   = ut_id  (utmpx);
+                               entry_user = utmpx->ut_user;
+                               entry_pid  = ut_pid (utmpx);
+                               entry_tv   = ut_time(utmpx);
+                               break;
+                       case NEW_TIME :         // Time after system clock change.
+                               entry_type = "New time";
+                               entry_tv   = ut_time(utmpx);
+                               break;
+                       case OLD_TIME :         // Time before system clock change.
+                               entry_type = "Old time";
+                               entry_tv   = ut_time(utmpx);
+                               break;
+                       case RUN_LVL :          // Run level.   Provided for compatibility, not used.
+                               entry_type = "Run level";
+                               break;
+                       case USER_PROCESS :     // A user process.
+                               entry_type = "User Process";
+                               entry_id   = ut_id  (utmpx);
+                               entry_user = utmpx->ut_user;
+                               entry_line = utmpx->ut_line;
+                               entry_pid  = ut_pid (utmpx);
+                               entry_tv   = ut_time(utmpx);
+                               break;
+                       case SHUTDOWN_TIME :    // Time of system shutdown
+                               entry_type = "Shutdown time";
+                               entry_tv   = ut_time(utmpx);
+                               break;
+                       default :
+                               entry_type = "Unknown";
+                               break;
+               }
+
+               snprintf(line, sizeof(line),
+                        // type  time    id=0x12345678 pid=12345 user=abcdefgh line
+                        "\n%-13s %2s%12s %3s%-10s %4s%-5s %5s%-8s %5s%s",
+                        entry_type,
+                        entry_tv   != NULL ? "@ "       : "",
+                        entry_tv   != NULL ? entry_tv   : "",  // hh:mm:ss.ddd
+                        entry_id   != NULL ? "id="      : "",
+                        entry_id   != NULL ? entry_id   : "",  // 0x12345678
+                        entry_pid  != NULL ? "pid="     : "",
+                        entry_pid  != NULL ? entry_pid  : "",  // #####
+                        entry_user != NULL ? "user="    : "",
+                        entry_user != NULL ? entry_user : "",  // <=256 chars
+                        entry_line != NULL ? "line="    : "",
+                        entry_line != NULL ? entry_line : ""   // <= 32 chars
+                       );
+
+               n = strlen(line) - 1;
+               while ((n > 0) && (line[n] == ' ')) {
+                       line[n] = '\0';
+                       --n;
+               }
+
+               CFStringAppendFormat(str, NULL, CFSTR("%s"), line);
+       }
+       endutxent();
+
+       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, CFSTR("%@"), str);
+       CFRelease(str);
+       return;
+}
+
+
+static void
+add_pututxline_notification()
+{
+       CFMachPortRef           mp;
+       mach_port_t             notify_port;
+       int                     notify_token;
+       CFRunLoopSourceRef      rls;
+       uint32_t                status;
+
+       status = notify_register_mach_port(UTMPX_CHANGE_NOTIFICATION, &notify_port, 0, &notify_token);
+       if (status != NOTIFY_STATUS_OK) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("notify_register_mach_port() failed"));
+               return;
+       }
+
+       mp = CFMachPortCreateWithPort(NULL, notify_port, pututxline_notification, NULL, NULL);
+       if (mp == NULL) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("CFMachPortCreateWithPort() failed"));
+               (void)notify_cancel(notify_token);
+               return;
+       }
+
+       rls = CFMachPortCreateRunLoopSource(NULL, mp, -1);
+       if (rls == NULL) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreateRunLoopSource() failed"));
+               CFRelease(mp);
+               (void)notify_cancel(notify_token);
+               return;
+       }
+       CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
+       CFRelease(rls);
+
+       CFRelease(mp);
+       return;
+}
+#endif // !TARGET_OS_EMBEDDED
+
+
+#pragma mark -
+#pragma mark BackToMyMac Status Events
+
+
+#ifndef        kDSStdNotifyBTMMStatusChanged
+#define        kDSStdNotifyBTMMStatusChanged "State:/Network/BackToMyMac"
+#endif
+
+
+#if    !TARGET_OS_EMBEDDED
+static void
+BTMM_notification(SCDynamicStoreRef store, CFArrayRef changedKeys, void *context)
+{
+       CFIndex                 i;
+       CFIndex                 n;
+       CFMutableStringRef      str     = CFStringCreateMutable(NULL, 0);
+
+       CFStringAppendFormat(str,
+                            NULL,
+                            CFSTR("%s SCDynamicStore Back to My Mac notification"),
+                            elapsed());
+
+       n = CFArrayGetCount(changedKeys);
+       for (i = 0; i < n; i++) {
+               CFStringRef     key;
+               CFDictionaryRef dict;
+
+               key = CFArrayGetValueAtIndex(changedKeys, i);
+               dict = SCDynamicStoreCopyValue(store, key);
+               if (dict != NULL) {
+                       CFStringRef     val;
+
+                       val = _SCCopyDescription(dict, NULL);
+                       CFStringAppendFormat(str, NULL, CFSTR("\n%@ : %@"), key, val);
+                       CFRelease(val);
+                       CFRelease(dict);
+               } else {
+                       CFStringAppendFormat(str, NULL, CFSTR("\n%@ : removed"), key);
+               }
+       }
+
+       SCLOG(NULL, log_msg, ~ASL_LEVEL_INFO, CFSTR("%@"), str);
+       CFRelease(str);
+       return;
+}
+
+
+static void
+add_BTMM_notification()
+{
+       CFStringRef             key;
+       CFMutableArrayRef       keys;
+       Boolean                 ok;
+       SCDynamicStoreRef       store;
+       CFRunLoopSourceRef      rls;
+
+       store = SCDynamicStoreCreate(NULL, CFSTR("Logger.bundle-BackToMyMac"), BTMM_notification, NULL);
+       if (store == NULL) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreate() failed"));
+               return;
+       }
+
+       keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+
+       key = CFSTR(kDSStdNotifyBTMMStatusChanged);
+       CFArrayAppendValue(keys, key);
+
+       ok = SCDynamicStoreSetNotificationKeys(store, keys, NULL);
+       CFRelease(keys);
+       if (!ok) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreSetNotificationKeys() failed"));
+               CFRelease(store);
+               return;
+       }
+
+       rls = SCDynamicStoreCreateRunLoopSource(NULL, store, -1);
+       if (rls == NULL) {
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCDynamicStoreCreateRunLoopSource() failed"));
+               CFRelease(store);
+               return;
+       }
+       CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
+       CFRelease(rls);
+
+       CFRelease(store);
+       return;
+}
+#endif // !TARGET_OS_EMBEDDED
+
+
+#pragma mark -
+
+
+static inline Boolean
+bValFromDictionary(CFDictionaryRef dict, CFStringRef key)
+{
+       CFBooleanRef    bVal;
+       Boolean         result  = FALSE;
+
+       if ((dict != NULL) &&
+           CFDictionaryGetValueIfPresent(dict, key, (const void **)&bVal) &&
+           isA_CFBoolean(bVal)) {
+               result = CFBooleanGetValue(bVal);
+       }
+
+       return result;
+}
+
+
+void
+load(CFBundleRef bundle, Boolean bundleVerbose)
+{
+       CFDictionaryRef config;
+       Boolean         log_all;
+
+       verbose = bundleVerbose;
+
+       log_msg = asl_new(ASL_TYPE_MSG);
+       asl_set(log_msg, ASL_KEY_FACILITY, MY_ASL_FACILITY);
+
+       elapsed();
+
+       config = CFBundleGetInfoDictionary(bundle);
+       config = isA_CFDictionary(config);
+       log_all = bValFromDictionary(config, CFSTR("LOG_ALL"));
+
+#ifdef kIOPMMessageSleepWakeUUIDChange
+       if (log_all || bValFromDictionary(config, CFSTR("LOG_IO_WAKEUUID_EVENTS"))) {
+               add_wake_uuid_notification();
+       }
+#endif // kIOPMMessageSleepWakeUUIDChange
+
+       if (log_all || bValFromDictionary(config, CFSTR("LOG_IO_SYSTEMPOWER_EVENTS"))) {
+               add_power_notification();
+       }
+
+       if (log_all || bValFromDictionary(config, CFSTR("LOG_NETWORK_KERNEL_EVENTS"))) {
+               add_KernelEvent_notification();
+       }
+
+       if (log_all || bValFromDictionary(config, CFSTR("LOG_NOTIFY_DNS_CONFIGURATION"))) {
+               add_dnsinfo_notification();
+       }
+
+       if (log_all || bValFromDictionary(config, CFSTR("LOG_NOTIFY_NETWORK_CHANGE"))) {
+               add_network_notification();
+       }
+
+#if    !TARGET_OS_EMBEDDED
+       if (log_all || bValFromDictionary(config, CFSTR("LOG_NOTIFY_SMB_CONFIGURATION"))) {
+               add_smbconf_notification();
+       }
+#endif // !TARGET_OS_EMBEDDED
+
+#if    !TARGET_OS_EMBEDDED
+       if (log_all || bValFromDictionary(config, CFSTR("LOG_NOTIFY_UTMPX_CHANGE"))) {
+               add_pututxline_notification();
+       }
+#endif // !TARGET_OS_EMBEDDED
+
+#if    !TARGET_OS_EMBEDDED
+       if (log_all || bValFromDictionary(config, CFSTR("LOG_SC_BTMM_CONFIGURATION"))) {
+               add_BTMM_notification();
+       }
+#endif // !TARGET_OS_EMBEDDED
+
+#if    !TARGET_OS_EMBEDDED
+       if (log_all || bValFromDictionary(config, CFSTR("LOG_SC_CONSOLEUSER"))) {
+               add_console_notification();
+       }
+#endif // !TARGET_OS_EMBEDDED
+
+#if    !TARGET_OS_EMBEDDED
+       if (log_all || bValFromDictionary(config, CFSTR("LOG_SC_DIRECTORYSERVICES_SEARCHPOLICY"))) {
+               add_DirectoryServices_notification();
+       }
+#endif // !TARGET_OS_EMBEDDED
+
+       if (log_all || bValFromDictionary(config, CFSTR("LOG_SC_NETWORKCHANGE"))) {
+               add_NetworkChange_notification();
+       }
+
+       if (log_all || bValFromDictionary(config, CFSTR("LOG_SC_PRIMARYSERVICE"))) {
+               add_PrimaryService_notification();
+       }
+
+       if (log_all || bValFromDictionary(config, CFSTR("LOG_SC_REACHABILITY"))) {
+               CFArrayRef      hosts   = NULL;
+
+               if ((config == NULL) ||
+                   !CFDictionaryGetValueIfPresent(config, CFSTR("LOG_SC_REACHABILITY_HOSTS"), (const void **)&hosts) ||
+                   !isA_CFArray(hosts) ||
+                   (CFArrayGetCount(hosts) == 0)) {
+                       hosts = NULL;
+               }
+
+               add_reachability_notification(hosts);
+       }
+
+       return;
+}
+
+#ifdef MAIN
+
+int
+main(int argc, char **argv)
+{
+       _sc_log     = FALSE;
+       _sc_verbose = (argc > 1) ? TRUE : FALSE;
+       _sc_debug   = TRUE;
+
+       load(CFBundleGetMainBundle(), (argc > 1) ? TRUE : FALSE);
+       CFRunLoopRun();
+       /* not reached */
+       exit(0);
+       return 0;
+}
+
+#endif /* MAIN */
index 1651cefa91cc183b7a4e41f53019615ce736371e..78e6222069d439d08c7db0766104724651ad98e3 100644 (file)
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
-       <string>SystemConfiguration</string>
+       <string>com.apple.SystemConfiguration.NetworkIdentification</string>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.9.2</string>
+       <string>1.10</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.9.2</string>
+       <string>1.10</string>
        <key>Builtin</key>
        <true/>
 </dict>
        <key>Builtin</key>
        <true/>
 </dict>
index c5444df39816b30b88a8a076cd3a2a0a03cfc814..3f5ad5127def3d7bdfaadb5191e1a5a5ce31780b 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2005-2007 Apple Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2007, 2009 Apple Inc.  All Rights Reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -965,7 +965,6 @@ ServiceWatcherUpdate(ServiceWatcherRef watcher, Boolean update_signatures)
                CFArrayInsertValueAtIndex(watcher->signatures, 0,
                                          new_sig_dict);
                CFRelease(new_sig_dict);
                CFArrayInsertValueAtIndex(watcher->signatures, 0,
                                          new_sig_dict);
                CFRelease(new_sig_dict);
-               sig_dict = new_sig_dict;
                save_signatures = TRUE;
            }
            active_dict
                save_signatures = TRUE;
            }
            active_dict
@@ -1216,17 +1215,6 @@ load_NetworkIdentification(CFBundleRef bundle, Boolean bundleVerbose)
     return;
 }
 
     return;
 }
 
-__private_extern__
-void
-stop_NetworkIdentification(CFRunLoopSourceRef stopRls)
-{
-    if (S_watcher != NULL) {
-       ServiceWatcherSaveSignatures(S_watcher);
-    }
-    CFRunLoopSourceSignal(stopRls);
-}
-
-
 #ifdef  TEST_NETWORKIDENTIFICATION
 #undef  TEST_NETWORKIDENTIFICATION
 
 #ifdef  TEST_NETWORKIDENTIFICATION
 #undef  TEST_NETWORKIDENTIFICATION
 
index 80aa6254dea28c77f95f5588fd15a0e12dd36b7f..722d01752b1c1d392783f73a069290a3a2a73758 100644 (file)
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
-       <string>SystemConfiguration</string>
+       <string>com.apple.SystemConfiguration.PreferencesMonitor</string>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.9.2</string>
+       <string>1.10</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.9.2</string>
+       <string>1.10</string>
        <key>Builtin</key>
        <true/>
        <key>Requires</key>
        <key>Builtin</key>
        <true/>
        <key>Requires</key>
index 5466f22386ec008bd9356a2bc7304b165ad325d4..637f82782ad6ca86e6e80af2f6c136bdf5dcf06f 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -35,6 +35,7 @@
  */
 
 
  */
 
 
+#include <TargetConditionals.h>
 #include <fcntl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -65,14 +66,16 @@ static CFMutableArrayRef    removedPrefsKeys;       /* old prefs keys to be removed */
 static Boolean                 _verbose        = FALSE;
 
 
 static Boolean                 _verbose        = FALSE;
 
 
-static void
+static Boolean
 establishNewPreferences()
 {
        CFBundleRef     bundle;
 establishNewPreferences()
 {
        CFBundleRef     bundle;
+       SCNetworkSetRef current         = NULL;
        Boolean         ok              = FALSE;
        int             sc_status       = kSCStatusFailed;
        SCNetworkSetRef set             = NULL;
        CFStringRef     setName         = NULL;
        Boolean         ok              = FALSE;
        int             sc_status       = kSCStatusFailed;
        SCNetworkSetRef set             = NULL;
        CFStringRef     setName         = NULL;
+       Boolean         updated         = FALSE;
 
        while (TRUE) {
                ok = SCPreferencesLock(prefs, TRUE);
 
        while (TRUE) {
                ok = SCPreferencesLock(prefs, TRUE);
@@ -82,40 +85,47 @@ establishNewPreferences()
 
                sc_status = SCError();
                if (sc_status == kSCStatusStale) {
 
                sc_status = SCError();
                if (sc_status == kSCStatusStale) {
-                       (void) SCPreferencesSynchronize(prefs);
+                       SCPreferencesSynchronize(prefs);
                } else {
                        SCLog(TRUE, LOG_ERR,
                              CFSTR("Could not acquire network configuration lock: %s"),
                              SCErrorString(sc_status));
                } else {
                        SCLog(TRUE, LOG_ERR,
                              CFSTR("Could not acquire network configuration lock: %s"),
                              SCErrorString(sc_status));
-                       return;
+                       return FALSE;
                }
        }
 
                }
        }
 
-       set = SCNetworkSetCreate(prefs);
-       if (set == NULL) {
-               ok = FALSE;
-               sc_status = SCError();
-               goto done;
+       current = SCNetworkSetCopyCurrent(prefs);
+       if (current != NULL) {
+               set = current;
        }
 
        }
 
-       bundle = _SC_CFBundleGet();
-       if (bundle != NULL) {
-               setName = CFBundleCopyLocalizedString(bundle,
-                                                     CFSTR("DEFAULT_SET_NAME"),
-                                                     CFSTR("Automatic"),
-                                                     NULL);
-       }
+       if (set == NULL) {
+               set = SCNetworkSetCreate(prefs);
+               if (set == NULL) {
+                       ok = FALSE;
+                       sc_status = SCError();
+                       goto done;
+               }
 
 
-       ok = SCNetworkSetSetName(set, (setName != NULL) ? setName : CFSTR("Automatic"));
-       if (!ok) {
-               sc_status = SCError();
-               goto done;
-       }
+               bundle = _SC_CFBundleGet();
+               if (bundle != NULL) {
+                       setName = CFBundleCopyLocalizedString(bundle,
+                                                             CFSTR("DEFAULT_SET_NAME"),
+                                                             CFSTR("Automatic"),
+                                                             NULL);
+               }
 
 
-       ok = SCNetworkSetSetCurrent(set);
-       if (!ok) {
-               sc_status = SCError();
-               goto done;
+               ok = SCNetworkSetSetName(set, (setName != NULL) ? setName : CFSTR("Automatic"));
+               if (!ok) {
+                       sc_status = SCError();
+                       goto done;
+               }
+
+               ok = SCNetworkSetSetCurrent(set);
+               if (!ok) {
+                       sc_status = SCError();
+                       goto done;
+               }
        }
 
        ok = SCNetworkSetEstablishDefaultConfiguration(set);
        }
 
        ok = SCNetworkSetEstablishDefaultConfiguration(set);
@@ -130,6 +140,7 @@ establishNewPreferences()
                ok = SCPreferencesCommitChanges(prefs);
                if (ok) {
                        SCLog(TRUE, LOG_NOTICE, CFSTR("New network configuration saved"));
                ok = SCPreferencesCommitChanges(prefs);
                if (ok) {
                        SCLog(TRUE, LOG_NOTICE, CFSTR("New network configuration saved"));
+                       updated = TRUE;
                } else {
                        sc_status = SCError();
                        if (sc_status == EROFS) {
                } else {
                        sc_status = SCError();
                        if (sc_status == EROFS) {
@@ -140,7 +151,7 @@ establishNewPreferences()
 
                /* apply (committed or temporary/read-only) changes */
                (void) SCPreferencesApplyChanges(prefs);
 
                /* apply (committed or temporary/read-only) changes */
                (void) SCPreferencesApplyChanges(prefs);
-       } else if (set != NULL) {
+       } else if ((current == NULL) && (set != NULL)) {
                (void) SCNetworkSetRemove(set);
        }
 
                (void) SCNetworkSetRemove(set);
        }
 
@@ -153,28 +164,35 @@ establishNewPreferences()
        (void)SCPreferencesUnlock(prefs);
        if (setName != NULL) CFRelease(setName);
        if (set != NULL) CFRelease(set);
        (void)SCPreferencesUnlock(prefs);
        if (setName != NULL) CFRelease(setName);
        if (set != NULL) CFRelease(set);
-       return;
+       return updated;
 }
 
 
 static Boolean
 }
 
 
 static Boolean
-quiet()
+quiet(Boolean *timeout)
 {
        CFDictionaryRef dict;
 {
        CFDictionaryRef dict;
-       Boolean         quiet   = FALSE;
+       Boolean         _quiet          = FALSE;
+       Boolean         _timeout        = FALSE;
 
        // check if quiet
        dict = SCDynamicStoreCopyValue(store, initKey);
        if (dict != NULL) {
 
        // check if quiet
        dict = SCDynamicStoreCopyValue(store, initKey);
        if (dict != NULL) {
-               if (isA_CFDictionary(dict) &&
-                   (CFDictionaryContainsKey(dict, CFSTR("*QUIET*")) ||
-                    CFDictionaryContainsKey(dict, CFSTR("*TIMEOUT*")))) {
-                       quiet = TRUE;
+               if (isA_CFDictionary(dict)) {
+                       if (CFDictionaryContainsKey(dict, CFSTR("*QUIET*"))) {
+                               _quiet = TRUE;
+                       }
+                       if (CFDictionaryContainsKey(dict, CFSTR("*TIMEOUT*"))) {
+                               _timeout = TRUE;
+                       }
                }
                CFRelease(dict);
        }
 
                }
                CFRelease(dict);
        }
 
-       return quiet;
+       if (timeout != NULL) {
+               *timeout = _timeout;
+       }
+       return _quiet;
 }
 
 
 }
 
 
@@ -215,8 +233,8 @@ watchQuietEnable()
        ok = SCDynamicStoreSetNotificationKeys(store, keys, NULL);
        CFRelease(keys);
        if (!ok) {
        ok = SCDynamicStoreSetNotificationKeys(store, keys, NULL);
        CFRelease(keys);
        if (!ok) {
-               SCPrint(TRUE, stderr,
-                       CFSTR("SCDynamicStoreSetNotificationKeys() failed: %s\n"), SCErrorString(SCError()));
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("SCDynamicStoreSetNotificationKeys() failed: %s\n"), SCErrorString(SCError()));
                watchQuietDisable();
        }
 
                watchQuietDisable();
        }
 
@@ -226,9 +244,26 @@ watchQuietEnable()
 static void
 watchQuietCallback(SCDynamicStoreRef store, CFArrayRef changedKeys, void *info)
 {
 static void
 watchQuietCallback(SCDynamicStoreRef store, CFArrayRef changedKeys, void *info)
 {
-       if (quiet()) {
+       Boolean _quiet;
+       Boolean _timeout        = FALSE;
+
+       _quiet = quiet(&_timeout);
+       if (_quiet
+#if    !TARGET_OS_IPHONE
+           || _timeout
+#endif /* !TARGET_OS_IPHONE */
+          ) {
                watchQuietDisable();
                watchQuietDisable();
-               establishNewPreferences();
+       }
+
+       if (_quiet || _timeout) {
+               static int      logged  = 0;
+
+               (void) establishNewPreferences();
+               if (_timeout && (logged++ == 0)) {
+                       SCLog(TRUE, LOG_NOTICE,
+                             CFSTR("Network configuration creation timed out waiting for IORegistry"));
+               }
        }
 
        return;
        }
 
        return;
@@ -554,6 +589,7 @@ updateConfiguration(SCPreferencesRef                prefs,
 {
 
 
 {
 
 
+#if    !TARGET_OS_IPHONE
        if ((notificationType & kSCPreferencesNotificationCommit) == kSCPreferencesNotificationCommit) {
                SCNetworkSetRef current;
 
        if ((notificationType & kSCPreferencesNotificationCommit) == kSCPreferencesNotificationCommit) {
                SCNetworkSetRef current;
 
@@ -564,6 +600,7 @@ updateConfiguration(SCPreferencesRef                prefs,
                        CFRelease(current);
                }
        }
                        CFRelease(current);
                }
        }
+#endif /* !TARGET_OS_IPHONE */
 
        if ((notificationType & kSCPreferencesNotificationApply) != kSCPreferencesNotificationApply) {
                return;
 
        if ((notificationType & kSCPreferencesNotificationApply) != kSCPreferencesNotificationApply) {
                return;
@@ -581,36 +618,6 @@ updateConfiguration(SCPreferencesRef               prefs,
 }
 
 
 }
 
 
-__private_extern__
-void
-stop_PreferencesMonitor(CFRunLoopSourceRef stopRls)
-{
-       // cleanup
-
-       watchQuietDisable();
-
-       if (prefs != NULL) {
-               if (!SCPreferencesUnscheduleFromRunLoop(prefs,
-                                                       CFRunLoopGetCurrent(),
-                                                       kCFRunLoopDefaultMode)) {
-                       SCLog(TRUE, LOG_ERR,
-                             CFSTR("SCPreferencesUnscheduleFromRunLoop() failed: %s"),
-                             SCErrorString(SCError()));
-               }
-               CFRelease(prefs);
-               prefs = NULL;
-       }
-
-       if (store != NULL) {
-               CFRelease(store);
-               store = NULL;
-       }
-
-       CFRunLoopSourceSignal(stopRls);
-       return;
-}
-
-
 __private_extern__
 void
 prime_PreferencesMonitor()
 __private_extern__
 void
 prime_PreferencesMonitor()
index bc1126f6f1db85db535961cc50786f2e528a5c72..254469037da82dfcc7cc9eed965dc5cbdea2726e 100644 (file)
Binary files a/SCMonitor/English.lproj/Localizable.strings and b/SCMonitor/English.lproj/Localizable.strings differ
index 3ecba743e508b375367c8aff89783ad4bb5893db..ca396d1bd1b81cb9942935298a873d0ef82963a8 100644 (file)
        <string>${EXECUTABLE_NAME}</string>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
        <string>${EXECUTABLE_NAME}</string>
        <key>CFBundlePackageType</key>
        <string>BNDL</string>
+       <key>CFBundleShortVersionString</key>
+       <string>1.10</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleSignature</key>
        <string>????</string>
-       <key>CFBundleShortVersionString</key>
-       <string>1.9.2</string>
        <key>CFBundleVersion</key>
        <key>CFBundleVersion</key>
-       <string>1.9.2</string>
+       <string>1.10</string>
        <key>CFPlugInDynamicRegistration</key>
        <string>NO</string>
        <key>CFPlugInFactories</key>
        <key>CFPlugInDynamicRegistration</key>
        <string>NO</string>
        <key>CFPlugInFactories</key>
@@ -36,5 +36,7 @@
        </dict>
        <key>CFPlugInUnloadFunction</key>
        <string></string>
        </dict>
        <key>CFPlugInUnloadFunction</key>
        <string></string>
+       <key>LimitLoadToSessionType</key>
+       <string>Aqua</string>
 </dict>
 </plist>
 </dict>
 </plist>
index 0afa500b85f5c64f0ba2a7193bb9c7bebd7820c1..17b347d757cbca92ad802a61db7fb6a3a9b5a1f8 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2007 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2007-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <asl.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
+#include <IOKit/IOKitLib.h>
+#include <IOKit/IOMessage.h>
 #include <ApplicationServices/ApplicationServices.h>
 #include "UserEventAgentInterface.h"
 
 #include <ApplicationServices/ApplicationServices.h>
 #include "UserEventAgentInterface.h"
 
-#define MY_BUNDLE_ID    CFSTR("com.apple.SystemConfiguration.SCMonitor")
+#define MY_BUNDLE_ID    "com.apple.SystemConfiguration.SCMonitor"
 #define        MY_ICON_PATH    "/System/Library/PreferencePanes/Network.prefPane/Contents/Resources/Network.icns"
 
 #define        NETWORK_PREF_APP        "/System/Library/PreferencePanes/Network.prefPane"
 #define        NETWORK_PREF_CMD        "New Interface"
 
 #define        MY_ICON_PATH    "/System/Library/PreferencePanes/Network.prefPane/Contents/Resources/Network.icns"
 
 #define        NETWORK_PREF_APP        "/System/Library/PreferencePanes/Network.prefPane"
 #define        NETWORK_PREF_CMD        "New Interface"
 
+/*
+ * The following keys/values control the actions taken when a new interface
+ * has been detected and whether we interact with the user.
+ *
+ * The keys/values can be provided globally (in SCMonitor.plugin's Info.plist
+ * file) or per-inteface in the IORegistry.
+ *
+ * For the "New Interface Detected Action" key we define the following [CFString]
+ * values :
+ *
+ *   "None"       No action, ignore this interface.
+ *   "Prompt"     Post a "new interface detected" notification to the user.
+ *   "Configure"  Automatically configure this interface without any
+ *                intervention.
+ *
+ *   Note: automatic configuration may require authorization if the logged
+ *         in user is NOT "root" (eUID==0) or if the "system.preferences"
+ *         administrator right is not currently available.
+ *
+ * An [older] "User Intervention" key is also supported.  That CFBoolean
+ * key, if present and TRUE, implies "Configure" configuration of the
+ * interface without intervention.
+ */
+
 typedef struct {
        UserEventAgentInterfaceStruct   *_UserEventAgentInterface;
        CFUUIDRef                       _factoryID;
        UInt32                          _refCount;
 
 typedef struct {
        UserEventAgentInterfaceStruct   *_UserEventAgentInterface;
        CFUUIDRef                       _factoryID;
        UInt32                          _refCount;
 
-       Boolean                         no_user_intervention;
+       aslmsg                          log_msg;
+
+       CFStringRef                     configuration_action;
 
        CFRunLoopSourceRef              monitorRls;
 
 
        CFRunLoopSourceRef              monitorRls;
 
-       CFMutableSetRef                 knownInterfaces;
+       IONotificationPortRef           notifyPort;
+       io_iterator_t                   notifyIterator;
+       CFMutableArrayRef               notifyNodes;
+
+       // interfaces that we already know about
+       CFMutableSetRef                 interfaces_known;
+
+       // interfaces that should be auto-configured (no user notification)
+       CFMutableArrayRef               interfaces_configure;
+
+       // interfaces that require user notification
+       CFMutableArrayRef               interfaces_prompt;
 
 
-       CFMutableArrayRef               userInterfaces;
        CFUserNotificationRef           userNotification;
        CFRunLoopSourceRef              userRls;
 } MyType;
        CFUserNotificationRef           userNotification;
        CFRunLoopSourceRef              userRls;
 } MyType;
@@ -63,11 +102,11 @@ static CFMutableDictionaryRef      notify_to_instance      = NULL;
 
 
 #pragma mark -
 
 
 #pragma mark -
-#pragma mark Watch for new [network] interfaces
+#pragma mark New interface notification / configuration
 
 
 static void
 
 
 static void
-open_NetworkPrefPane(void)
+open_NetworkPrefPane(MyType *myInstance)
 {
        AEDesc          aeDesc  = { typeNull, NULL };
        CFArrayRef      prefArray;
 {
        AEDesc          aeDesc  = { typeNull, NULL };
        CFArrayRef      prefArray;
@@ -87,7 +126,7 @@ open_NetworkPrefPane(void)
                              strlen(NETWORK_PREF_CMD),
                              &aeDesc);
        if (status != noErr) {
                              strlen(NETWORK_PREF_CMD),
                              &aeDesc);
        if (status != noErr) {
-               SCLog(TRUE, LOG_ERR, CFSTR("SCMonitor: AECreateDesc() failed: %d"), status);
+               SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR, CFSTR("SCMonitor: AECreateDesc() failed: %d"), status);
        }
 
        prefSpec.appURL         = NULL;
        }
 
        prefSpec.appURL         = NULL;
@@ -98,7 +137,7 @@ open_NetworkPrefPane(void)
 
        status = LSOpenFromURLSpec(&prefSpec, NULL);
        if (status != noErr) {
 
        status = LSOpenFromURLSpec(&prefSpec, NULL);
        if (status != noErr) {
-               SCLog(TRUE, LOG_ERR, CFSTR("SCMonitor: LSOpenFromURLSpec() failed: %d"), status);
+               SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR, CFSTR("SCMonitor: LSOpenFromURLSpec() failed: %d"), status);
        }
 
        CFRelease(prefArray);
        }
 
        CFRelease(prefArray);
@@ -110,9 +149,14 @@ open_NetworkPrefPane(void)
 static void
 notify_remove(MyType *myInstance, Boolean cancel)
 {
 static void
 notify_remove(MyType *myInstance, Boolean cancel)
 {
-       if (myInstance->userInterfaces != NULL) {
-               CFRelease(myInstance->userInterfaces);
-               myInstance->userInterfaces = NULL;
+       if (myInstance->interfaces_configure != NULL) {
+               CFRelease(myInstance->interfaces_configure);
+               myInstance->interfaces_configure = NULL;
+       }
+
+       if (myInstance->interfaces_prompt != NULL) {
+               CFRelease(myInstance->interfaces_prompt);
+               myInstance->interfaces_prompt = NULL;
        }
 
        if (myInstance->userRls != NULL) {
        }
 
        if (myInstance->userRls != NULL) {
@@ -127,7 +171,7 @@ notify_remove(MyType *myInstance, Boolean cancel)
 
                        status = CFUserNotificationCancel(myInstance->userNotification);
                        if (status != 0) {
 
                        status = CFUserNotificationCancel(myInstance->userNotification);
                        if (status != 0) {
-                               SCLog(TRUE, LOG_ERR,
+                               SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR,
                                      CFSTR("SCMonitor: CFUserNotificationCancel() failed, status=%d"),
                                      status);
                        }
                                      CFSTR("SCMonitor: CFUserNotificationCancel() failed, status=%d"),
                                      status);
                        }
@@ -157,7 +201,7 @@ notify_reply(CFUserNotificationRef userNotification, CFOptionFlags response_flag
                }
        }
        if (myInstance == NULL) {
                }
        }
        if (myInstance == NULL) {
-               SCLog(TRUE, LOG_ERR, CFSTR("SCMonitor: can't find user notification"));
+               SCLOG(NULL, NULL, ASL_LEVEL_ERR, CFSTR("SCMonitor: can't find user notification"));
                return;
        }
 
                return;
        }
 
@@ -165,7 +209,7 @@ notify_reply(CFUserNotificationRef userNotification, CFOptionFlags response_flag
        switch (response_flags & 0x3) {
                case kCFUserNotificationDefaultResponse:
                        // user asked to configure interface
        switch (response_flags & 0x3) {
                case kCFUserNotificationDefaultResponse:
                        // user asked to configure interface
-                       open_NetworkPrefPane();
+                       open_NetworkPrefPane(myInstance);
                        break;
                default:
                        // user cancelled
                        break;
                default:
                        // user cancelled
@@ -184,19 +228,18 @@ notify_add(MyType *myInstance)
        CFMutableDictionaryRef  dict    = NULL;
        SInt32                  error   = 0;
        CFIndex                 i;
        CFMutableDictionaryRef  dict    = NULL;
        SInt32                  error   = 0;
        CFIndex                 i;
-       CFMutableArrayRef       message;
-       CFIndex                 n       = CFArrayGetCount(myInstance->userInterfaces);
+       CFIndex                 n       = CFArrayGetCount(myInstance->interfaces_prompt);
        CFURLRef                url     = NULL;
 
        if (myInstance->userNotification != NULL) {
                CFMutableArrayRef       save    = NULL;
 
                if (n > 0) {
        CFURLRef                url     = NULL;
 
        if (myInstance->userNotification != NULL) {
                CFMutableArrayRef       save    = NULL;
 
                if (n > 0) {
-                       CFRetain(myInstance->userInterfaces);
-                       save = myInstance->userInterfaces;
+                       CFRetain(myInstance->interfaces_prompt);
+                       save = myInstance->interfaces_prompt;
                }
                notify_remove(myInstance, TRUE);
                }
                notify_remove(myInstance, TRUE);
-               myInstance->userInterfaces = save;
+               myInstance->interfaces_prompt = save;
                if (n == 0) {
                        return;
                }
                if (n == 0) {
                        return;
                }
@@ -208,16 +251,27 @@ notify_add(MyType *myInstance)
                                         &kCFTypeDictionaryValueCallBacks);
 
        // set localization URL
                                         &kCFTypeDictionaryValueCallBacks);
 
        // set localization URL
-       bundle = CFBundleGetBundleWithIdentifier(MY_BUNDLE_ID);
+       bundle = CFBundleGetBundleWithIdentifier(CFSTR(MY_BUNDLE_ID));
        if (bundle != NULL) {
                url = CFBundleCopyBundleURL(bundle);
        }
        if (bundle != NULL) {
                url = CFBundleCopyBundleURL(bundle);
        }
+#ifdef MAIN
+       if (url == NULL) {
+               url = CFURLCreateFromFileSystemRepresentation(NULL,
+                                                             (const UInt8 *)"/System/Library/UserEventPlugins/SCMonitor.plugin",
+                                                             strlen("/System/Library/UserEventPlugins/SCMonitor.plugin"),
+                                                             FALSE);
+               if (bundle == NULL) {
+                       bundle = CFBundleCreate(NULL, url);
+               }
+       }
+#endif // MAIN
        if (url != NULL) {
                // set URL
                CFDictionarySetValue(dict, kCFUserNotificationLocalizationURLKey, url);
                CFRelease(url);
        } else {
        if (url != NULL) {
                // set URL
                CFDictionarySetValue(dict, kCFUserNotificationLocalizationURLKey, url);
                CFRelease(url);
        } else {
-               SCLog(TRUE, LOG_NOTICE, CFSTR("SCMonitor: can't find bundle"));
+               SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR, CFSTR("SCMonitor: can't find bundle"));
                goto done;
        }
 
                goto done;
        }
 
@@ -237,29 +291,44 @@ notify_add(MyType *myInstance)
                             (n == 1) ? CFSTR("HEADER_1") : CFSTR("HEADER_N"));
 
        // message
                             (n == 1) ? CFSTR("HEADER_1") : CFSTR("HEADER_N"));
 
        // message
-       message = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-       CFArrayAppendValue(message,
-                          (n == 1) ? CFSTR("MESSAGE_S1") : CFSTR("MESSAGE_SN"));
-       for (i = 0; i < n; i++) {
+       if (n == 1) {
+               CFStringRef             format;
                SCNetworkInterfaceRef   interface;
                SCNetworkInterfaceRef   interface;
+               CFStringRef             message;
                CFStringRef             name;
 
                CFStringRef             name;
 
-               interface = CFArrayGetValueAtIndex(myInstance->userInterfaces, i);
+#define MESSAGE_1 "The \"%@\" network interface has not been set up. To set up this interface, use Network Preferences."
+
+               format = CFBundleCopyLocalizedString(bundle,
+                                                    CFSTR("MESSAGE_1"),
+                                                    CFSTR(MESSAGE_1),
+                                                    NULL);
+               interface = CFArrayGetValueAtIndex(myInstance->interfaces_prompt, 0);
                name = SCNetworkInterfaceGetLocalizedDisplayName(interface);
                name = SCNetworkInterfaceGetLocalizedDisplayName(interface);
-               if (n == 1) {
-                       CFArrayAppendValue(message, name);
-               } else {
-                       CFStringRef     str;
+               message = CFStringCreateWithFormat(NULL, NULL, format, name);
+               CFDictionarySetValue(dict, kCFUserNotificationAlertMessageKey, message);
+               CFRelease(message);
+               CFRelease(format);
+       } else {
+               CFMutableArrayRef       message;
 
 
+               message = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+               CFArrayAppendValue(message, CFSTR("MESSAGE_SN"));
+               for (i = 0; i < n; i++) {
+                       SCNetworkInterfaceRef   interface;
+                       CFStringRef             name;
+                       CFStringRef             str;
+
+                       interface = CFArrayGetValueAtIndex(myInstance->interfaces_prompt, i);
+                       name = SCNetworkInterfaceGetLocalizedDisplayName(interface);
                        str = CFStringCreateWithFormat(NULL, NULL, CFSTR("\r\t%@"), name);
                        CFArrayAppendValue(message, str);
                        CFRelease(str);
                }
                        str = CFStringCreateWithFormat(NULL, NULL, CFSTR("\r\t%@"), name);
                        CFArrayAppendValue(message, str);
                        CFRelease(str);
                }
+               CFArrayAppendValue(message, CFSTR("MESSAGE_EN"));
+               CFDictionarySetValue(dict, kCFUserNotificationAlertMessageKey, message);
+               CFRelease(message);
        }
        }
-       CFArrayAppendValue(message,
-                          (n == 1) ? CFSTR("MESSAGE_E1") : CFSTR("MESSAGE_EN"));
-       CFDictionarySetValue(dict, kCFUserNotificationAlertMessageKey, message);
-       CFRelease(message);
 
        // button titles
        CFDictionaryAddValue(dict, kCFUserNotificationDefaultButtonTitleKey,   CFSTR("OPEN_NP"));
 
        // button titles
        CFDictionaryAddValue(dict, kCFUserNotificationDefaultButtonTitleKey,   CFSTR("OPEN_NP"));
@@ -272,7 +341,7 @@ notify_add(MyType *myInstance)
                                                                &error,
                                                                dict);
        if (myInstance->userNotification == NULL) {
                                                                &error,
                                                                dict);
        if (myInstance->userNotification == NULL) {
-               SCLog(TRUE, LOG_ERR, CFSTR("SCMonitor: CFUserNotificationCreate() failed, %d"), error);
+               SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR, CFSTR("SCMonitor: CFUserNotificationCreate() failed, %d"), error);
                goto done;
        }
 
                goto done;
        }
 
@@ -282,7 +351,7 @@ notify_add(MyType *myInstance)
                                                                    notify_reply,
                                                                    0);
        if (myInstance->userRls == NULL) {
                                                                    notify_reply,
                                                                    0);
        if (myInstance->userRls == NULL) {
-               SCLog(TRUE, LOG_ERR, CFSTR("SCMonitor: CFUserNotificationCreateRunLoopSource() failed"));
+               SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR, CFSTR("SCMonitor: CFUserNotificationCreateRunLoopSource() failed"));
                CFRelease(myInstance->userNotification);
                myInstance->userNotification = NULL;
                goto done;
                CFRelease(myInstance->userNotification);
                myInstance->userNotification = NULL;
                goto done;
@@ -310,7 +379,7 @@ notify_configure(MyType *myInstance)
 {
        AuthorizationRef        authorization   = NULL;
        CFIndex                 i;
 {
        AuthorizationRef        authorization   = NULL;
        CFIndex                 i;
-       CFIndex                 n;
+       CFIndex                 n               = CFArrayGetCount(myInstance->interfaces_configure);
        Boolean                 ok;
        SCPreferencesRef        prefs           = NULL;
        SCNetworkSetRef         set             = NULL;
        Boolean                 ok;
        SCPreferencesRef        prefs           = NULL;
        SCNetworkSetRef         set             = NULL;
@@ -326,8 +395,8 @@ notify_configure(MyType *myInstance)
                                             flags,
                                             &authorization);
                if (status != errAuthorizationSuccess) {
                                             flags,
                                             &authorization);
                if (status != errAuthorizationSuccess) {
-                       SCLog(TRUE, LOG_ERR,
-                             CFSTR("AuthorizationCreate() failed: status = %d\n"),
+                       SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR,
+                             CFSTR("AuthorizationCreate() failed: status = %d"),
                              status);
                        return;
                }
                              status);
                        return;
                }
@@ -343,38 +412,37 @@ notify_configure(MyType *myInstance)
                }
        }
 
                }
        }
 
-       n = CFArrayGetCount(myInstance->userInterfaces);
        for (i = 0; i < n; i++) {
                SCNetworkInterfaceRef   interface;
        for (i = 0; i < n; i++) {
                SCNetworkInterfaceRef   interface;
-               
-               interface = CFArrayGetValueAtIndex(myInstance->userInterfaces, i);
+
+               interface = CFArrayGetValueAtIndex(myInstance->interfaces_configure, i);
                ok = SCNetworkSetEstablishDefaultInterfaceConfiguration(set, interface);
                if (ok) {
                        CFStringRef     name;
 
                        name = SCNetworkInterfaceGetLocalizedDisplayName(interface);
                ok = SCNetworkSetEstablishDefaultInterfaceConfiguration(set, interface);
                if (ok) {
                        CFStringRef     name;
 
                        name = SCNetworkInterfaceGetLocalizedDisplayName(interface);
-                       SCLog(TRUE, LOG_NOTICE, CFSTR("add service for %@"), name);
+                       SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_NOTICE, CFSTR("add service for %@"), name);
                }
        }
                }
        }
-       
+
        ok = SCPreferencesCommitChanges(prefs);
        if (!ok) {
        ok = SCPreferencesCommitChanges(prefs);
        if (!ok) {
-               SCLog(TRUE, LOG_ERR,
-                     CFSTR("SCPreferencesCommitChanges() failed: %s\n"),
+               SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR,
+                     CFSTR("SCPreferencesCommitChanges() failed: %s"),
                      SCErrorString(SCError()));
                      SCErrorString(SCError()));
-                goto done;
-        }
-               
-        ok = SCPreferencesApplyChanges(prefs);
+               goto done;
+       }
+
+       ok = SCPreferencesApplyChanges(prefs);
        if (!ok) {
        if (!ok) {
-                SCLog(TRUE, LOG_ERR,
-                     CFSTR("SCPreferencesApplyChanges() failed: %s\n"),
+               SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR,
+                     CFSTR("SCPreferencesApplyChanges() failed: %s"),
                      SCErrorString(SCError()));
                      SCErrorString(SCError()));
-                goto done;
-        }
+               goto done;
+       }
 
     done :
 
     done :
-       
+
        if (set != NULL) {
                CFRelease(set);
                set = NULL;
        if (set != NULL) {
                CFRelease(set);
                set = NULL;
@@ -384,29 +452,32 @@ notify_configure(MyType *myInstance)
                CFRelease(prefs);
                prefs = NULL;
        }
                CFRelease(prefs);
                prefs = NULL;
        }
-       
-        if (authorization != NULL) {
-                AuthorizationFree(authorization, kAuthorizationFlagDefaults);
-               //              AuthorizationFree(authorization, kAuthorizationFlagDestroyRights);
-                authorization = NULL;
-        }
-       
-       CFRelease(myInstance->userInterfaces);
-       myInstance->userInterfaces = NULL;
-       
+
+       if (authorization != NULL) {
+               AuthorizationFree(authorization, kAuthorizationFlagDefaults);
+//              AuthorizationFree(authorization, kAuthorizationFlagDestroyRights);
+               authorization = NULL;
+       }
+
+       CFRelease(myInstance->interfaces_configure);
+       myInstance->interfaces_configure = NULL;
+
        return;
 }
 
 
        return;
 }
 
 
+#pragma mark -
+
+
 static void
 static void
-updateInterfaceList(SCDynamicStoreRef store, CFArrayRef changes, void * arg)
+updateInterfaceList(MyType *myInstance)
 {
 {
+       Boolean                 changed         = FALSE;
        CFIndex                 i;
        CFArrayRef              interfaces;
        CFIndex                 i;
        CFArrayRef              interfaces;
-       MyType                  *myInstance     = (MyType *)arg;
+       CFMutableSetRef         interfaces_old  = NULL;
        CFIndex                 n;
        SCPreferencesRef        prefs;
        CFIndex                 n;
        SCPreferencesRef        prefs;
-       CFMutableSetRef         previouslyKnown = NULL;
        SCNetworkSetRef         set             = NULL;
 
        prefs = SCPreferencesCreate(NULL, CFSTR("SCMonitor"), NULL);
        SCNetworkSetRef         set             = NULL;
 
        prefs = SCPreferencesCreate(NULL, CFSTR("SCMonitor"), NULL);
@@ -422,139 +493,150 @@ updateInterfaceList(SCDynamicStoreRef store, CFArrayRef changes, void * arg)
                }
        }
 
                }
        }
 
-       previouslyKnown = CFSetCreateMutableCopy(NULL, 0, myInstance->knownInterfaces);
+       interfaces_old = CFSetCreateMutableCopy(NULL, 0, myInstance->interfaces_known);
 
        interfaces = SCNetworkInterfaceCopyAll();
        if (interfaces != NULL) {
 
        interfaces = SCNetworkInterfaceCopyAll();
        if (interfaces != NULL) {
-
                n = CFArrayGetCount(interfaces);
                for (i = 0; i < n; i++) {
                n = CFArrayGetCount(interfaces);
                for (i = 0; i < n; i++) {
-                       CFStringRef             bsdName;
                        SCNetworkInterfaceRef   interface;
                        Boolean                 ok;
 
                        interface = CFArrayGetValueAtIndex(interfaces, i);
                        SCNetworkInterfaceRef   interface;
                        Boolean                 ok;
 
                        interface = CFArrayGetValueAtIndex(interfaces, i);
-                       bsdName = SCNetworkInterfaceGetBSDName(interface);
-                       if (bsdName == NULL) {
-                               // if no BSD name
+
+                       if (_SCNetworkInterfaceIsBuiltin(interface)) {
+                               // skip built-in interfaces
                                continue;
                        }
 
                                continue;
                        }
 
-                       CFSetRemoveValue(previouslyKnown, bsdName);
-
-                       if (CFSetContainsValue(myInstance->knownInterfaces, bsdName)) {
-                               // if known interface
+                       // track new vs. old (removed) interfaces
+                       CFSetRemoveValue(interfaces_old, interface);
+                       if (CFSetContainsValue(myInstance->interfaces_known, interface)) {
+                               // if we already know about this interface
                                continue;
                        }
                                continue;
                        }
-
-                       CFSetAddValue(myInstance->knownInterfaces, bsdName);
+                       CFSetAddValue(myInstance->interfaces_known, interface);
+                       changed = TRUE;
 
                        ok = SCNetworkSetEstablishDefaultInterfaceConfiguration(set, interface);
                        if (ok) {
 
                        ok = SCNetworkSetEstablishDefaultInterfaceConfiguration(set, interface);
                        if (ok) {
+                               CFStringRef             action;
+
                                // this is a *new* interface
                                // this is a *new* interface
-                               if (myInstance->userInterfaces == NULL) {
-                                       myInstance->userInterfaces = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+
+                               action = _SCNetworkInterfaceGetConfigurationAction(interface);
+                               if (action == NULL) {
+                                       // if no per-interface action, use [global] default
+                                       action = myInstance->configuration_action;
+                               }
+                               if ((action == NULL) ||
+                                   (!CFEqual(action, kSCNetworkInterfaceConfigurationActionValueNone) &&
+                                    !CFEqual(action, kSCNetworkInterfaceConfigurationActionValueConfigure))) {
+                                       action = kSCNetworkInterfaceConfigurationActionValuePrompt;
+                               }
+
+                               if (CFEqual(action, kSCNetworkInterfaceConfigurationActionValueNone)) {
+                                       continue;
+                               } else if (CFEqual(action, kSCNetworkInterfaceConfigurationActionValueConfigure)) {
+                                       // configure automatically (without user intervention)
+                                       if (myInstance->interfaces_configure == NULL) {
+                                               myInstance->interfaces_configure = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+                                       }
+                                       CFArrayAppendValue(myInstance->interfaces_configure, interface);
+                               } else {
+                                       // notify user
+                                       if (myInstance->interfaces_prompt == NULL) {
+                                               myInstance->interfaces_prompt = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+                                       }
+                                       CFArrayAppendValue(myInstance->interfaces_prompt, interface);
                                }
                                }
-                               CFArrayAppendValue(myInstance->userInterfaces, interface);
                        }
                }
 
                CFRelease(interfaces);
        }
 
                        }
                }
 
                CFRelease(interfaces);
        }
 
-       n = CFSetGetCount(previouslyKnown);
+       // remove any posted notifications for network interfaces that have been removed
+       n = CFSetGetCount(interfaces_old);
        if (n > 0) {
        if (n > 0) {
-               const void *    names_q[32];
-               const void **   names                 = names_q;
+               const void *    paths_q[32];
+               const void **   paths                 = paths_q;
 
 
-               if (n > (CFIndex)(sizeof(names_q) / sizeof(CFTypeRef)))
-                       names = CFAllocatorAllocate(NULL, n * sizeof(CFTypeRef), 0);
-               CFSetGetValues(previouslyKnown, names);
+               if (n > (CFIndex)(sizeof(paths_q) / sizeof(CFTypeRef)))
+                       paths = CFAllocatorAllocate(NULL, n * sizeof(CFTypeRef), 0);
+               CFSetGetValues(interfaces_old, paths);
                for (i = 0; i < n; i++) {
                for (i = 0; i < n; i++) {
-                       if (myInstance->userInterfaces != NULL) {
+                       if (myInstance->interfaces_prompt != NULL) {
                                CFIndex j;
 
                                CFIndex j;
 
-                               j = CFArrayGetCount(myInstance->userInterfaces);
-                               while (--j >= 0) {
-                                       CFStringRef             bsdName;
+                               j = CFArrayGetCount(myInstance->interfaces_prompt);
+                               while (j > 0) {
                                        SCNetworkInterfaceRef   interface;
 
                                        SCNetworkInterfaceRef   interface;
 
-                                       interface = CFArrayGetValueAtIndex(myInstance->userInterfaces, j);
-                                       bsdName = SCNetworkInterfaceGetBSDName(interface);
-                                       if (CFEqual(bsdName, names[i])) {
+                                       j--;
+                                       interface = CFArrayGetValueAtIndex(myInstance->interfaces_prompt, j);
+                                       if (CFEqual(interface, paths[i])) {
                                                // if we have previously posted a notification
                                                // for this no-longer-present interface
                                                // if we have previously posted a notification
                                                // for this no-longer-present interface
-                                               CFArrayRemoveValueAtIndex(myInstance->userInterfaces, j);
+                                               CFArrayRemoveValueAtIndex(myInstance->interfaces_prompt, j);
+                                               changed = TRUE;
                                        }
                                }
                        }
 
                                        }
                                }
                        }
 
-                       CFSetRemoveValue(myInstance->knownInterfaces, names[i]);
+                       CFSetRemoveValue(myInstance->interfaces_known, paths[i]);
                }
                }
-               if (names != names_q)       CFAllocatorDeallocate(NULL, names);
+               if (paths != paths_q)       CFAllocatorDeallocate(NULL, paths);
        }
 
     done :
 
        }
 
     done :
 
-       if (myInstance->userInterfaces != NULL) {
-               if (myInstance->no_user_intervention) {
-                       // add network services for new interfaces
+       if (changed) {
+               if (myInstance->interfaces_configure != NULL) {
+                       // if we have network services to configure automatically
                        notify_configure(myInstance);
                        notify_configure(myInstance);
-               } else {
-                       // post notification
+               }
+
+               if (myInstance->interfaces_prompt != NULL) {
+                       // if we have network services that require user intervention
+                       // post notification for new interfaces
                        notify_add(myInstance);
                }
        }
 
                        notify_add(myInstance);
                }
        }
 
+       if (interfaces_old != NULL) CFRelease(interfaces_old);
        if (set != NULL) CFRelease(set);
        CFRelease(prefs);
        return;
 }
 
 
        if (set != NULL) CFRelease(set);
        CFRelease(prefs);
        return;
 }
 
 
+#pragma mark -
+#pragma mark Watch for new [network] interfaces
+
+
 static void
 static void
-watcher_remove(MyType *myInstance)
+update_lan(SCDynamicStoreRef store, CFArrayRef changes, void * arg)
 {
 {
-       if (myInstance->monitorRls != NULL) {
-               CFRunLoopSourceInvalidate(myInstance->monitorRls);
-               CFRelease(myInstance->monitorRls);
-               myInstance->monitorRls = NULL;
-       }
-
-       if (myInstance->knownInterfaces != NULL) {
-               CFRelease(myInstance->knownInterfaces);
-               myInstance->knownInterfaces = NULL;
-       }
+       MyType  *myInstance     = (MyType *)arg;
 
 
+       updateInterfaceList(myInstance);
        return;
 }
 
 
 static void
        return;
 }
 
 
 static void
-watcher_add(MyType *myInstance)
+watcher_add_lan(MyType *myInstance)
 {
 {
-       CFBundleRef             bundle;
        SCDynamicStoreContext   context = { 0, (void *)myInstance, NULL, NULL, NULL };
        CFDictionaryRef         dict;
        CFStringRef             key;
        CFArrayRef              keys;
        SCDynamicStoreRef       store;
 
        SCDynamicStoreContext   context = { 0, (void *)myInstance, NULL, NULL, NULL };
        CFDictionaryRef         dict;
        CFStringRef             key;
        CFArrayRef              keys;
        SCDynamicStoreRef       store;
 
-       bundle = CFBundleGetBundleWithIdentifier(MY_BUNDLE_ID);
-       if (bundle != NULL) {
-               CFDictionaryRef info;
-               CFBooleanRef    user_intervention;
-               
-               info = CFBundleGetInfoDictionary(bundle);
-               user_intervention = CFDictionaryGetValue(info, CFSTR("User Intervention"));
-               if (isA_CFBoolean(user_intervention)) {
-                       myInstance->no_user_intervention = !CFBooleanGetValue(user_intervention);
-               }
-       }
-
-       store = SCDynamicStoreCreate(NULL, CFSTR("SCMonitor"), updateInterfaceList, &context);
+       store = SCDynamicStoreCreate(NULL, CFSTR("SCMonitor"), update_lan, &context);
        if (store == NULL) {
        if (store == NULL) {
-               SCLog(TRUE, LOG_ERR,
+               SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR,
                      CFSTR("SCMonitor: SCDynamicStoreCreate() failed: %s"),
                      SCErrorString(SCError()));
                return;
                      CFSTR("SCMonitor: SCDynamicStoreCreate() failed: %s"),
                      SCErrorString(SCError()));
                return;
@@ -572,7 +654,7 @@ watcher_add(MyType *myInstance)
                           kCFRunLoopDefaultMode);
 
        // initialize the list of known interfaces
                           kCFRunLoopDefaultMode);
 
        // initialize the list of known interfaces
-       myInstance->knownInterfaces = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
+       myInstance->interfaces_known = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
        dict = SCDynamicStoreCopyValue(store, key);
        if (dict != NULL) {
                if (isA_CFDictionary(dict)) {
        dict = SCDynamicStoreCopyValue(store, key);
        if (dict != NULL) {
                if (isA_CFDictionary(dict)) {
@@ -587,7 +669,13 @@ watcher_add(MyType *myInstance)
 
                                bsdName = CFArrayGetValueAtIndex(interfaces, i);
                                if (isA_CFString(bsdName)) {
 
                                bsdName = CFArrayGetValueAtIndex(interfaces, i);
                                if (isA_CFString(bsdName)) {
-                                       CFSetAddValue(myInstance->knownInterfaces, bsdName);
+                                       SCNetworkInterfaceRef   interface;
+
+                                       interface = _SCNetworkInterfaceCreateWithBSDName(NULL, bsdName, kIncludeNoVirtualInterfaces);
+                                       if (interface != NULL) {
+                                               CFSetAddValue(myInstance->interfaces_known, interface);
+                                               CFRelease(interface);
+                                       }
                                }
                        }
                }
                                }
                        }
                }
@@ -601,6 +689,360 @@ watcher_add(MyType *myInstance)
 }
 
 
 }
 
 
+static void
+watcher_remove_lan(MyType *myInstance)
+{
+       if (myInstance->monitorRls != NULL) {
+               CFRunLoopSourceInvalidate(myInstance->monitorRls);
+               CFRelease(myInstance->monitorRls);
+               myInstance->monitorRls = NULL;
+       }
+
+       if (myInstance->interfaces_known != NULL) {
+               CFRelease(myInstance->interfaces_known);
+               myInstance->interfaces_known = NULL;
+       }
+
+       return;
+}
+
+
+#pragma mark -
+
+
+typedef struct {
+       io_registry_entry_t     interface;
+       MyType                  *myInstance;
+       io_object_t             notification;
+} MyNode;
+
+
+static void
+add_node_watcher(MyType *myInstance, io_registry_entry_t node, io_registry_entry_t interface);
+
+
+static void
+update_node(void *refCon, io_service_t service, natural_t messageType, void *messageArgument)
+{
+       CFIndex         i;
+       CFDataRef       myData          = (CFDataRef)refCon;
+       MyType          *myInstance;
+       MyNode          *myNode;
+
+       myNode     = (MyNode *)CFDataGetBytePtr(myData);
+       myInstance = myNode->myInstance;
+
+       switch (messageType) {
+               case kIOMessageServicePropertyChange : {
+                       Boolean                 initializing    = FALSE;
+                       SCNetworkInterfaceRef   interface;
+                       CFTypeRef               val;
+
+                       if (myNode->interface == MACH_PORT_NULL) {
+                               // if we are not watching the "Initializing" property
+                               return;
+                       }
+
+                       val = IORegistryEntryCreateCFProperty(service, CFSTR("Initializing"), NULL, 0);
+                       if (val != NULL) {
+                               initializing = (isA_CFBoolean(val) && CFBooleanGetValue(val));
+                               CFRelease(val);
+                               if (initializing) {
+                                       // if initialization not complete, keep watching
+                                       return;
+                               }
+                       }
+
+                       // node is ready
+                       interface = _SCNetworkInterfaceCreateWithIONetworkInterfaceObject(myNode->interface);
+                       if (interface != NULL) {
+                               CFRelease(interface);
+
+                               // watch interface (to see when/if it's removed)
+                               add_node_watcher(myInstance, myNode->interface, MACH_PORT_NULL);
+                       }
+                       break;
+               }
+
+               case kIOMessageServiceIsTerminated :
+                       break;
+
+               default :
+                       return;
+       }
+
+       // remove no-longer-needed notification
+       if (myNode->interface != MACH_PORT_NULL) {
+               IOObjectRelease(myNode->interface);
+               myNode->interface = MACH_PORT_NULL;
+       }
+       IOObjectRelease(myNode->notification);
+       i = CFArrayGetFirstIndexOfValue(myInstance->notifyNodes,
+                                       CFRangeMake(0, CFArrayGetCount(myInstance->notifyNodes)),
+                                       myData);
+       if (i != kCFNotFound) {
+               CFArrayRemoveValueAtIndex(myInstance->notifyNodes, i);
+               if (CFArrayGetCount(myInstance->notifyNodes) == 0) {
+                       CFRelease(myInstance->notifyNodes);
+                       myInstance->notifyNodes = NULL;
+               }
+       }
+
+       updateInterfaceList(myInstance);
+       return;
+}
+
+
+static void
+add_node_watcher(MyType *myInstance, io_registry_entry_t node, io_registry_entry_t interface)
+{
+       kern_return_t           kr;
+       CFMutableDataRef        myData;
+       MyNode                  *myNode;
+
+       // wait for initialization to complete
+       myData = CFDataCreateMutable(NULL, sizeof(MyNode));
+       CFDataSetLength(myData, sizeof(MyNode));
+       myNode = (MyNode *)CFDataGetBytePtr(myData);
+       bzero(myNode, sizeof(MyNode));
+       if (interface != MACH_PORT_NULL) {
+               IOObjectRetain(interface);
+       }
+       myNode->interface    = interface;
+       myNode->myInstance   = myInstance;
+       myNode->notification = MACH_PORT_NULL;
+
+       kr = IOServiceAddInterestNotification(myInstance->notifyPort,   // IONotificationPortRef
+                                             node,                     // io_service_t
+                                             kIOGeneralInterest,       // interestType
+                                             update_node,              // IOServiceInterestCallback
+                                             (void *)myData,           // refCon
+                                             &myNode->notification);   // notification
+       if (kr == KERN_SUCCESS) {
+               if (myInstance->notifyNodes == NULL) {
+                       myInstance->notifyNodes = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+               }
+               CFArrayAppendValue(myInstance->notifyNodes, myData);
+       } else {
+               SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR,
+                     CFSTR("add_init_watcher IOServiceAddInterestNotification() failed, kr =  0x%x"), kr);
+       }
+       CFRelease(myData);
+}
+
+
+static void
+add_init_watcher(MyType *myInstance, io_registry_entry_t interface)
+{
+       kern_return_t           kr;
+       io_registry_entry_t     node            = interface;
+       CFTypeRef               val             = NULL;
+
+       while (node != MACH_PORT_NULL) {
+               io_registry_entry_t     parent;
+
+               val = IORegistryEntryCreateCFProperty(node, CFSTR("HiddenPort"), NULL, 0);
+               if (val != NULL) {
+                       CFRelease(val);
+                       val = NULL;
+                       break;
+               }
+
+               val = IORegistryEntryCreateCFProperty(node, CFSTR("Initializing"), NULL, 0);
+               if (val != NULL) {
+                       break;
+               }
+
+               parent = MACH_PORT_NULL;
+               kr = IORegistryEntryGetParentEntry(node, kIOServicePlane, &parent);
+               switch (kr) {
+                       case kIOReturnSuccess  :        // if we have a parent node
+                       case kIOReturnNoDevice :        // if we have hit the root node
+                               break;
+                       default :
+                               SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR, CFSTR("add_init_watcher IORegistryEntryGetParentEntry() failed, kr = 0x%x"), kr);
+                               break;
+               }
+               if (node != interface) {
+                       IOObjectRelease(node);
+               }
+               node = parent;
+       }
+
+       if (val != NULL) {
+               if (isA_CFBoolean(val) && CFBooleanGetValue(val)) {
+                       // watch the "Initializing" node
+                       add_node_watcher(myInstance, node, interface);
+               }
+
+               CFRelease(val);
+       }
+
+       if ((node != MACH_PORT_NULL) && (node != interface)) {
+               IOObjectRelease(node);
+       }
+
+       return;
+}
+
+
+static void
+update_serial(void *refcon, io_iterator_t iter)
+{
+       MyType                  *myInstance     = (MyType *)refcon;
+       io_registry_entry_t     obj;
+
+       while ((obj = IOIteratorNext(iter)) != MACH_PORT_NULL) {
+               SCNetworkInterfaceRef   interface;
+
+               interface = _SCNetworkInterfaceCreateWithIONetworkInterfaceObject(obj);
+               if (interface != NULL) {
+                       CFRelease(interface);
+
+                       // watch interface (to see when/if it's removed)
+                       add_node_watcher(myInstance, obj, MACH_PORT_NULL);
+               } else {
+                       // check interface, watch if initializing
+                       add_init_watcher(myInstance, obj);
+               }
+
+               IOObjectRelease(obj);
+       }
+
+       updateInterfaceList(myInstance);
+       return;
+}
+
+
+static void
+watcher_add_serial(MyType *myInstance)
+{
+       kern_return_t   kr;
+
+       myInstance->notifyPort = IONotificationPortCreate(kIOMasterPortDefault);
+       if (myInstance->notifyPort == NULL) {
+               SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR,
+                     CFSTR("SCMonitor: IONotificationPortCreate failed"));
+               return;
+       }
+
+       // watch for the introduction of new network serial devices
+       kr = IOServiceAddMatchingNotification(myInstance->notifyPort,
+                                             kIOFirstMatchNotification,
+                                             IOServiceMatching("IOSerialBSDClient"),
+                                             &update_serial,
+                                             (void *)myInstance,               // refCon
+                                             &myInstance->notifyIterator);     // notification
+       if (kr != KERN_SUCCESS) {
+               SCLOG(NULL, myInstance->log_msg, ASL_LEVEL_ERR,
+                     CFSTR("SCMonitor : IOServiceAddMatchingNotification returned 0x%x"),
+                     kr);
+               return;
+       }
+
+       myInstance->notifyNodes = NULL;
+
+       // Get the current list of matches and arm the notification for
+       // future interface arrivals.
+       update_serial((void *)myInstance, myInstance->notifyIterator);
+
+       // and keep watching
+       CFRunLoopAddSource(CFRunLoopGetCurrent(),
+                          IONotificationPortGetRunLoopSource(myInstance->notifyPort),
+                          kCFRunLoopDefaultMode);
+       return;
+}
+
+
+static void
+watcher_remove_serial(MyType *myInstance)
+{
+       if (myInstance->notifyNodes != NULL) {
+               CFIndex i;
+               CFIndex n       = CFArrayGetCount(myInstance->notifyNodes);
+
+               for (i = 0; i < n; i++) {
+                       CFDataRef       myData;
+                       MyNode          *myNode;
+
+                       myData = CFArrayGetValueAtIndex(myInstance->notifyNodes, i);
+                       myNode = (MyNode *)CFDataGetBytePtr(myData);
+                       if (myNode->interface != MACH_PORT_NULL) {
+                               IOObjectRelease(myNode->interface);
+                       }
+                       IOObjectRelease(myNode->notification);
+               }
+
+               CFRelease(myInstance->notifyNodes);
+               myInstance->notifyNodes = NULL;
+       }
+
+       if (myInstance->notifyIterator != MACH_PORT_NULL) {
+               IOObjectRelease(myInstance->notifyIterator);
+               myInstance->notifyIterator = MACH_PORT_NULL;
+       }
+
+       if (myInstance->notifyPort != MACH_PORT_NULL) {
+               IONotificationPortDestroy(myInstance->notifyPort);
+               myInstance->notifyPort = NULL;
+       }
+
+       return;
+}
+
+
+#pragma mark -
+
+
+static void
+watcher_add(MyType *myInstance)
+{
+       CFBundleRef     bundle;
+
+       if (myInstance->log_msg == NULL) {
+               myInstance->log_msg = asl_new(ASL_TYPE_MSG);
+               asl_set(myInstance->log_msg, ASL_KEY_FACILITY, MY_BUNDLE_ID);
+       }
+
+       bundle = CFBundleGetBundleWithIdentifier(CFSTR(MY_BUNDLE_ID));
+       if (bundle != NULL) {
+               CFStringRef     action;
+               CFDictionaryRef info;
+
+               info = CFBundleGetInfoDictionary(bundle);
+               action = CFDictionaryGetValue(info, kSCNetworkInterfaceConfigurationActionKey);
+               action = isA_CFString(action);
+
+               if (action != NULL) {
+                       myInstance->configuration_action = action;
+               } else {
+                       CFBooleanRef    user_intervention;
+
+                       user_intervention = CFDictionaryGetValue(info, CFSTR("User Intervention"));
+                       if (isA_CFBoolean(user_intervention) && !CFBooleanGetValue(user_intervention)) {
+                               myInstance->configuration_action = kSCNetworkInterfaceConfigurationActionValueConfigure;
+                       }
+               }
+       }
+
+       watcher_add_lan(myInstance);
+       watcher_add_serial(myInstance);
+       return;
+}
+
+
+static void
+watcher_remove(MyType *myInstance)
+{
+       watcher_remove_lan(myInstance);
+       watcher_remove_serial(myInstance);
+
+       asl_free(myInstance->log_msg);
+       myInstance->log_msg = NULL;
+       return;
+}
+
+
 #pragma mark -
 #pragma mark UserEventAgent stubs
 
 #pragma mark -
 #pragma mark UserEventAgent stubs
 
index bc5ed686b68a2f93cb16888a8136092e29cea6bf..7746e7a0dc6b2cc5804fc41c14681236f1e2d44d 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -40,8 +40,6 @@
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 
-#include <SystemConfiguration/BondConfiguration.h>
-
 #include <ifaddrs.h>
 #include <pthread.h>
 #include <unistd.h>
 #include <ifaddrs.h>
 #include <pthread.h>
 #include <unistd.h>
@@ -731,16 +729,18 @@ SCBondInterfaceGetOptions(SCBondInterfaceRef bond)
 static Boolean
 _SCBondInterfaceSetMemberInterfaces(SCBondInterfaceRef bond, CFArrayRef members)
 {
 static Boolean
 _SCBondInterfaceSetMemberInterfaces(SCBondInterfaceRef bond, CFArrayRef members)
 {
+       CFIndex                         i;
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)bond;
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)bond;
+       CFIndex                         n;
+       CFMutableArrayRef               newMembers;
        Boolean                         ok                      = TRUE;
 
        Boolean                         ok                      = TRUE;
 
+       n = (members != NULL) ? CFArrayGetCount(members) : 0;
+
        // set member interfaces in the stored preferences
        if (interfacePrivate->prefs != NULL) {
                CFDictionaryRef         dict;
        // set member interfaces in the stored preferences
        if (interfacePrivate->prefs != NULL) {
                CFDictionaryRef         dict;
-               CFIndex                 i;
-               CFIndex                 n;
                CFMutableDictionaryRef  newDict;
                CFMutableDictionaryRef  newDict;
-               CFMutableArrayRef       newMembers;
                CFStringRef             path;
 
                path = CFStringCreateWithFormat(NULL,
                CFStringRef             path;
 
                path = CFStringCreateWithFormat(NULL,
@@ -758,7 +758,6 @@ _SCBondInterfaceSetMemberInterfaces(SCBondInterfaceRef bond, CFArrayRef members)
                }
 
                newMembers = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
                }
 
                newMembers = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-               n = (members != NULL) ? CFArrayGetCount(members) : 0;
                for (i = 0; i < n; i++) {
                        SCNetworkInterfaceRef   interface;
                        CFStringRef             memberName;
                for (i = 0; i < n; i++) {
                        SCNetworkInterfaceRef   interface;
                        CFStringRef             memberName;
@@ -778,12 +777,21 @@ _SCBondInterfaceSetMemberInterfaces(SCBondInterfaceRef bond, CFArrayRef members)
        }
 
        if (ok) {
        }
 
        if (ok) {
-               CFRelease(interfacePrivate->bond.interfaces);
-               if (members == NULL) {
-                       interfacePrivate->bond.interfaces = CFArrayCreate(NULL, NULL, 0, &kCFTypeArrayCallBacks);
-               } else {
-                       interfacePrivate->bond.interfaces = CFArrayCreateCopy(NULL, members);
+               newMembers = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+               for (i = 0; i < n; i++) {
+                       SCNetworkInterfaceRef           member;
+                       SCNetworkInterfacePrivateRef    newMember;
+
+                       member = CFArrayGetValueAtIndex(members, i);
+                       newMember = __SCNetworkInterfaceCreateCopy(NULL,
+                                                                  member,
+                                                                  interfacePrivate->prefs,
+                                                                  interfacePrivate->serviceID);
+                       CFArrayAppendValue(newMembers, newMember);
+                       CFRelease(newMember);
                }
                }
+               CFRelease(interfacePrivate->bond.interfaces);
+               interfacePrivate->bond.interfaces = newMembers;
        }
 
        return ok;
        }
 
        return ok;
@@ -1876,1563 +1884,3 @@ _SCBondInterfaceUpdateConfiguration(SCPreferencesRef prefs)
 
        return ok;
 }
 
        return ok;
 }
-
-
-#pragma mark -
-#pragma mark Deprecated SPIs (remove when no longer referenced)
-
-
-/* ---------- Bond "device" ---------- */
-
-Boolean
-IsBondSupported(CFStringRef device)
-{
-       SCNetworkInterfaceRef           interface;
-       SCNetworkInterfacePrivateRef    interfacePrivate;
-       Boolean                         isBond          = FALSE;
-
-       interface = _SCNetworkInterfaceCreateWithBSDName(NULL, device,
-                                                        kIncludeNoVirtualInterfaces);
-       interfacePrivate = (SCNetworkInterfacePrivateRef)interface;
-       isBond = interfacePrivate->supportsBond;
-       CFRelease(interface);
-
-       return isBond;
-}
-
-/* ---------- BondInterface ---------- */
-
-typedef struct {
-
-       /* base CFType information */
-       CFRuntimeBase                   cfBase;
-
-       /* bond interface configuration */
-       CFStringRef                     ifname;         // e.g. bond0, bond1, ...
-       CFArrayRef                      devices;        // e.g. en0, en1, ...
-       CFDictionaryRef                 options;        // e.g. UserDefinedName
-
-} BondInterfacePrivate, * BondInterfacePrivateRef;
-
-
-static CFStringRef     __BondInterfaceCopyDescription  (CFTypeRef cf);
-static void            __BondInterfaceDeallocate       (CFTypeRef cf);
-static Boolean         __BondInterfaceEqual            (CFTypeRef cf1, CFTypeRef cf2);
-
-
-static const CFRuntimeClass __BondInterfaceClass = {
-       0,                                      // version
-       "BondInterface",                        // className
-       NULL,                                   // init
-       NULL,                                   // copy
-       __BondInterfaceDeallocate,              // dealloc
-       __BondInterfaceEqual,                   // equal
-       NULL,                                   // hash
-       NULL,                                   // copyFormattingDesc
-       __BondInterfaceCopyDescription          // copyDebugDesc
-};
-
-
-static CFTypeID                __kBondInterfaceTypeID  = _kCFRuntimeNotATypeID;
-
-
-static pthread_once_t  bondInterface_init      = PTHREAD_ONCE_INIT;
-
-
-static CFStringRef
-__BondInterfaceCopyDescription(CFTypeRef cf)
-{
-       CFAllocatorRef          allocator       = CFGetAllocator(cf);
-       CFMutableStringRef      result;
-       BondInterfacePrivateRef bondPrivate     = (BondInterfacePrivateRef)cf;
-
-       result = CFStringCreateMutable(allocator, 0);
-       CFStringAppendFormat(result, NULL, CFSTR("<BondInterface %p [%p]> {"), cf, allocator);
-       CFStringAppendFormat(result, NULL, CFSTR("if = %@"), bondPrivate->ifname);
-       if (bondPrivate->devices != NULL) {
-               CFIndex i;
-               CFIndex n;
-
-               CFStringAppendFormat(result, NULL, CFSTR(", devices ="));
-
-               n = CFArrayGetCount(bondPrivate->devices);
-               for (i = 0; i < n; i++) {
-                       CFStringAppendFormat(result,
-                                            NULL,
-                                            CFSTR(" %@"),
-                                            CFArrayGetValueAtIndex(bondPrivate->devices, i));
-               }
-       }
-       if (bondPrivate->options != NULL) {
-               CFStringAppendFormat(result, NULL, CFSTR(", options = %@"), bondPrivate->options);
-       }
-       CFStringAppendFormat(result, NULL, CFSTR("}"));
-
-       return result;
-}
-
-
-static void
-__BondInterfaceDeallocate(CFTypeRef cf)
-{
-       BondInterfacePrivateRef bondPrivate     = (BondInterfacePrivateRef)cf;
-
-       /* release resources */
-
-       CFRelease(bondPrivate->ifname);
-       if (bondPrivate->devices)       CFRelease(bondPrivate->devices);
-       if (bondPrivate->options)       CFRelease(bondPrivate->options);
-
-       return;
-}
-
-
-static Boolean
-__BondInterfaceEquiv(CFTypeRef cf1, CFTypeRef cf2)
-{
-       BondInterfacePrivateRef bond1   = (BondInterfacePrivateRef)cf1;
-       BondInterfacePrivateRef bond2   = (BondInterfacePrivateRef)cf2;
-
-       if (bond1 == bond2)
-               return TRUE;
-
-       if (!CFEqual(bond1->ifname, bond2->ifname))
-               return FALSE;   // if not the same interface
-
-       if (!CFEqual(bond1->devices, bond2->devices))
-               return FALSE;   // if not the same device
-
-       return TRUE;
-}
-
-
-static Boolean
-__BondInterfaceEqual(CFTypeRef cf1, CFTypeRef cf2)
-{
-       BondInterfacePrivateRef bond1   = (BondInterfacePrivateRef)cf1;
-       BondInterfacePrivateRef bond2   = (BondInterfacePrivateRef)cf2;
-
-       if (!__BondInterfaceEquiv(bond1, bond2))
-               return FALSE;   // if not the same Bond interface/devices
-
-       if (bond1->options != bond2->options) {
-               // if the options may differ
-               if ((bond1->options != NULL) && (bond2->options != NULL)) {
-                       // if both Bonds have options
-                       if (!CFEqual(bond1->options, bond2->options)) {
-                               // if the options are not equal
-                               return FALSE;
-                       }
-               } else {
-                       // if only one Bond has options
-                       return FALSE;
-               }
-       }
-
-       return TRUE;
-}
-
-
-static void
-__BondInterfaceInitialize(void)
-{
-       __kBondInterfaceTypeID = _CFRuntimeRegisterClass(&__BondInterfaceClass);
-       return;
-}
-
-
-static __inline__ CFTypeRef
-isA_BondInterface(CFTypeRef obj)
-{
-       return (isA_CFType(obj, BondInterfaceGetTypeID()));
-}
-
-
-CFTypeID
-BondInterfaceGetTypeID(void)
-{
-       pthread_once(&bondInterface_init, __BondInterfaceInitialize);   /* initialize runtime */
-       return __kBondInterfaceTypeID;
-}
-
-
-static BondInterfaceRef
-__BondInterfaceCreatePrivate(CFAllocatorRef    allocator,
-                            CFStringRef        ifname)
-{
-       BondInterfacePrivateRef         bondPrivate;
-       uint32_t                        size;
-
-       /* initialize runtime */
-       pthread_once(&bondInterface_init, __BondInterfaceInitialize);
-
-       /* allocate bond */
-       size        = sizeof(BondInterfacePrivate) - sizeof(CFRuntimeBase);
-       bondPrivate = (BondInterfacePrivateRef)_CFRuntimeCreateInstance(allocator,
-                                                                       __kBondInterfaceTypeID,
-                                                                       size,
-                                                                       NULL);
-       if (bondPrivate == NULL) {
-               return NULL;
-       }
-
-       /* establish the bond */
-
-       bondPrivate->ifname  = CFStringCreateCopy(allocator, ifname);
-       bondPrivate->devices = NULL;
-       bondPrivate->options = NULL;
-
-       return (BondInterfaceRef)bondPrivate;
-}
-
-
-CFStringRef
-BondInterfaceGetInterface(BondInterfaceRef bond)
-{
-       BondInterfacePrivateRef bondPrivate     = (BondInterfacePrivateRef)bond;
-       CFStringRef             bond_if         = NULL;
-
-       if (isA_BondInterface(bond)) {
-               bond_if = bondPrivate->ifname;
-       }
-
-       return bond_if;
-}
-
-
-CFArrayRef
-BondInterfaceGetDevices(BondInterfaceRef bond)
-{
-       BondInterfacePrivateRef bondPrivate     = (BondInterfacePrivateRef)bond;
-       CFArrayRef              bond_devices    = NULL;
-
-       if (isA_BondInterface(bond)) {
-               bond_devices = bondPrivate->devices;
-       }
-
-       return bond_devices;
-}
-
-
-CFDictionaryRef
-BondInterfaceGetOptions(BondInterfaceRef bond)
-{
-       BondInterfacePrivateRef bondPrivate     = (BondInterfacePrivateRef)bond;
-       CFDictionaryRef         bond_options    = NULL;
-
-       if (isA_BondInterface(bond)) {
-               bond_options = bondPrivate->options;
-       }
-
-       return bond_options;
-}
-
-
-static void
-BondInterfaceSetDevices(BondInterfaceRef bond, CFArrayRef newDevices)
-{
-       BondInterfacePrivateRef bondPrivate     = (BondInterfacePrivateRef)bond;
-
-       if (isA_BondInterface(bond)) {
-               CFAllocatorRef  allocator       = CFGetAllocator(bond);
-
-               if (bondPrivate->devices != NULL)       CFRelease(bondPrivate->devices);
-               if ((newDevices != NULL) && (CFArrayGetCount(newDevices) > 0)) {
-                       bondPrivate->devices = CFArrayCreateCopy(allocator, newDevices);
-               } else {
-                       bondPrivate->devices = NULL;
-               }
-       }
-
-       return;
-}
-
-
-static void
-BondInterfaceSetOptions(BondInterfaceRef bond, CFDictionaryRef newOptions)
-{
-       BondInterfacePrivateRef bondPrivate     = (BondInterfacePrivateRef)bond;
-
-       if (isA_BondInterface(bond)) {
-               CFAllocatorRef  allocator       = CFGetAllocator(bond);
-
-               if (bondPrivate->options)       CFRelease(bondPrivate->options);
-               if (newOptions != NULL) {
-                       bondPrivate->options = CFDictionaryCreateCopy(allocator, newOptions);
-               } else {
-                       bondPrivate->options = NULL;
-               }
-       }
-
-       return;
-}
-
-
-/* ---------- BondPreferences ---------- */
-
-typedef struct {
-
-       /* base CFType information */
-       CFRuntimeBase                   cfBase;
-
-       /* lock */
-       pthread_mutex_t                 lock;
-
-       /* underlying preferences */
-       SCPreferencesRef                prefs;
-
-       /* base Bonds (before any commits) */
-       CFArrayRef                      bBase;
-
-} BondPreferencesPrivate, * BondPreferencesPrivateRef;
-
-
-static CFStringRef     __BondPreferencesCopyDescription        (CFTypeRef cf);
-static void            __BondPreferencesDeallocate             (CFTypeRef cf);
-
-
-static const CFRuntimeClass __BondPreferencesClass = {
-       0,                                      // version
-       "BondPreferences",                      // className
-       NULL,                                   // init
-       NULL,                                   // copy
-       __BondPreferencesDeallocate,            // dealloc
-       NULL,                                   // equal
-       NULL,                                   // hash
-       NULL,                                   // copyFormattingDesc
-       __BondPreferencesCopyDescription        // copyDebugDesc
-};
-
-
-static CFTypeID                __kBondPreferencesTypeID        = _kCFRuntimeNotATypeID;
-
-
-static pthread_once_t  bondPreferences_init            = PTHREAD_ONCE_INIT;
-
-
-static CFStringRef
-__BondPreferencesCopyDescription(CFTypeRef cf)
-{
-       CFAllocatorRef                  allocator       = CFGetAllocator(cf);
-       CFIndex                         i;
-       CFArrayRef                      keys;
-       CFIndex                         n;
-       BondPreferencesPrivateRef       prefsPrivate    = (BondPreferencesPrivateRef)cf;
-       CFMutableStringRef              result;
-
-       result = CFStringCreateMutable(allocator, 0);
-       CFStringAppendFormat(result, NULL, CFSTR("<BondPreferences %p [%p]> {"), cf, allocator);
-
-       keys = SCPreferencesCopyKeyList(prefsPrivate->prefs);
-       n = CFArrayGetCount(keys);
-       for (i = 0; i < n; i++) {
-               CFStringRef             key;
-               CFPropertyListRef       val;
-
-               key = CFArrayGetValueAtIndex(keys, i);
-               val = SCPreferencesGetValue(prefsPrivate->prefs, key);
-
-               CFStringAppendFormat(result, NULL, CFSTR("%@ : %@"), key, val);
-       }
-       CFRelease(keys);
-
-       CFStringAppendFormat(result, NULL, CFSTR(" }"));
-
-       return result;
-}
-
-
-static void
-__BondPreferencesDeallocate(CFTypeRef cf)
-{
-       BondPreferencesPrivateRef       prefsPrivate    = (BondPreferencesPrivateRef)cf;
-
-       /* release resources */
-
-       pthread_mutex_destroy(&prefsPrivate->lock);
-
-       if (prefsPrivate->prefs)        CFRelease(prefsPrivate->prefs);
-       if (prefsPrivate->bBase)        CFRelease(prefsPrivate->bBase);
-
-       return;
-}
-
-
-static void
-__BondPreferencesInitialize(void)
-{
-       __kBondPreferencesTypeID = _CFRuntimeRegisterClass(&__BondPreferencesClass);
-       return;
-}
-
-
-static __inline__ CFTypeRef
-isA_BondPreferences(CFTypeRef obj)
-{
-       return (isA_CFType(obj, BondPreferencesGetTypeID()));
-}
-
-
-CFArrayRef
-_BondPreferencesCopyActiveInterfaces()
-{
-       CFArrayCallBacks        callbacks;
-       struct ifaddrs          *ifap;
-       struct ifaddrs          *ifp;
-       int                     s;
-       CFMutableArrayRef       bonds   = NULL;
-
-       if (getifaddrs(&ifap) == -1) {
-               _SCErrorSet(errno);
-               SCLog(TRUE, LOG_ERR, CFSTR("getifaddrs() failed: %s"), strerror(errno));
-               return NULL;
-       }
-
-       s = inet_dgram_socket();
-       if (s == -1) {
-               _SCErrorSet(errno);
-               goto done;
-       }
-
-       callbacks = kCFTypeArrayCallBacks;
-       callbacks.equal = __BondInterfaceEquiv;
-       bonds = CFArrayCreateMutable(NULL, 0, &callbacks);
-
-       for (ifp = ifap; ifp != NULL; ifp = ifp->ifa_next) {
-               BondInterfaceRef                bond;
-               CFStringRef                     bond_if;
-               CFMutableArrayRef               devices = NULL;
-               struct if_bond_status_req       *ibsr_p;
-               struct if_data                  *if_data;
-
-               if_data = (struct if_data *)ifp->ifa_data;
-               if (if_data == NULL
-                   || ifp->ifa_addr->sa_family != AF_LINK
-                   || if_data->ifi_type != IFT_IEEE8023ADLAG) {
-                       continue;
-               }
-               ibsr_p = if_bond_status_req_copy(s, ifp->ifa_name);
-               if (ibsr_p == NULL) {
-                       if (errno == EBUSY) {
-                               continue;
-                       }
-
-                       _SCErrorSet(errno);
-                       SCLog(TRUE, LOG_ERR,
-                             CFSTR("if_bond_status_req_copy(%s) failed: %s"),
-                             ifp->ifa_name,
-                             strerror(errno));
-                       CFRelease(bonds);
-                       bonds = NULL;
-                       goto done;
-               }
-               if (ibsr_p->ibsr_total > 0) {
-                       int                     i;
-                       struct if_bond_status * ibs_p;
-                       devices = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-
-                       // iterate over each member device
-                       ibs_p = (struct if_bond_status *)ibsr_p->ibsr_buffer;
-                       for (i = 0; i < ibsr_p->ibsr_total; i++) {
-                               CFStringRef     device;
-                               char            if_name[IFNAMSIZ + 1];
-
-                               bzero(&if_name, sizeof(if_name));
-                               bcopy(ibs_p[i].ibs_if_name, if_name, IFNAMSIZ);
-                               device = CFStringCreateWithCString(NULL, if_name, kCFStringEncodingASCII);
-                               CFArrayAppendValue(devices, device);
-                               CFRelease(device);
-                       }
-               }
-               free(ibsr_p);
-               bond_if = CFStringCreateWithCString(NULL, ifp->ifa_name, kCFStringEncodingASCII);
-               bond    = __BondInterfaceCreatePrivate(NULL, bond_if);
-               CFRelease(bond_if);
-
-               if (devices != NULL) {
-                       BondInterfaceSetDevices(bond, devices);
-                       CFRelease(devices);
-               }
-               CFArrayAppendValue(bonds, bond);
-               CFRelease(bond);
-       }
-
-    done :
-
-       (void) close(s);
-       freeifaddrs(ifap);
-       return bonds;
-}
-
-
-static CFIndex
-findBond(CFArrayRef bonds, CFStringRef interface)
-{
-       CFIndex found   = kCFNotFound;
-       CFIndex i;
-       CFIndex n;
-
-       n = isA_CFArray(bonds) ? CFArrayGetCount(bonds) : 0;
-       for (i = 0; i < n; i++) {
-               CFDictionaryRef bond_dict;
-               CFStringRef     bond_if;
-
-               bond_dict = CFArrayGetValueAtIndex(bonds, i);
-               if (!isA_CFDictionary(bond_dict)) {
-                       break;  // if the prefs are confused
-               }
-
-               bond_if = CFDictionaryGetValue(bond_dict, __kBondInterface_interface);
-               if (!isA_CFString(bond_if)) {
-                       break;  // if the prefs are confused
-               }
-
-               if (!CFEqual(bond_if, interface)) {
-                       continue;       // if not a match
-               }
-
-               // if we have found a match
-               found = i;
-               break;
-       }
-
-       return found;
-}
-
-
-static void
-setConfigurationChanged(BondPreferencesRef prefs)
-{
-       BondPreferencesPrivateRef       prefsPrivate    = (BondPreferencesPrivateRef)prefs;
-
-       /*
-        * to facilitate device configuration we will take
-        * a snapshot of the Bond preferences before any
-        * changes are made.  Then, when the changes are
-        * applied we can compare what we had to what we
-        * want and configured the system accordingly.
-        */
-       if (prefsPrivate->bBase == NULL) {
-               prefsPrivate->bBase = BondPreferencesCopyInterfaces(prefs);
-       }
-
-       return;
-}
-
-
-CFTypeID
-BondPreferencesGetTypeID(void)
-{
-       pthread_once(&bondPreferences_init, __BondPreferencesInitialize);       /* initialize runtime */
-       return __kBondPreferencesTypeID;
-}
-
-
-BondPreferencesRef
-BondPreferencesCreate(CFAllocatorRef allocator)
-{
-       CFBundleRef                     bundle;
-       CFStringRef                     bundleID        = NULL;
-       CFStringRef                     name            = CFSTR("BondConfiguration");
-       BondPreferencesPrivateRef       prefsPrivate;
-       uint32_t                        size;
-
-       /* initialize runtime */
-       pthread_once(&bondPreferences_init, __BondPreferencesInitialize);
-
-       /* allocate preferences */
-       size         = sizeof(BondPreferencesPrivate) - sizeof(CFRuntimeBase);
-       prefsPrivate = (BondPreferencesPrivateRef)_CFRuntimeCreateInstance(allocator,
-                                                                          __kBondPreferencesTypeID,
-                                                                          size,
-                                                                          NULL);
-       if (prefsPrivate == NULL) {
-               return NULL;
-       }
-
-       /* establish the prefs */
-
-       pthread_mutex_init(&prefsPrivate->lock, NULL);
-
-       bundle = CFBundleGetMainBundle();
-       if (bundle) {
-               bundleID = CFBundleGetIdentifier(bundle);
-               if (bundleID) {
-                       CFRetain(bundleID);
-               } else {
-                       CFURLRef        url;
-
-                       url = CFBundleCopyExecutableURL(bundle);
-                       if (url) {
-                               bundleID = CFURLCopyPath(url);
-                               CFRelease(url);
-                       }
-               }
-       }
-
-       if (bundleID) {
-               CFStringRef     fullName;
-
-               if (CFEqual(bundleID, CFSTR("/"))) {
-                       CFRelease(bundleID);
-                       bundleID = CFStringCreateWithFormat(allocator, NULL, CFSTR("(%d)"), getpid());
-               }
-
-               fullName = CFStringCreateWithFormat(allocator, NULL, CFSTR("%@:%@"), bundleID, name);
-               name = fullName;
-               CFRelease(bundleID);
-       } else {
-               CFRetain(name);
-       }
-
-       prefsPrivate->prefs = SCPreferencesCreate(allocator, name, BOND_PREFERENCES_ID);
-       CFRelease(name);
-
-       prefsPrivate->bBase = NULL;
-
-       return (BondPreferencesRef)prefsPrivate;
-}
-
-
-CFArrayRef
-BondPreferencesCopyInterfaces(BondPreferencesRef prefs)
-{
-       CFAllocatorRef                  allocator;
-       CFArrayCallBacks                callbacks;
-       CFIndex                         i;
-       CFIndex                         n;
-       BondPreferencesPrivateRef       prefsPrivate    = (BondPreferencesPrivateRef)prefs;
-       CFMutableArrayRef               result;
-       CFArrayRef                      bonds;
-
-       if (!isA_BondPreferences(prefs)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return NULL;
-       }
-
-       allocator = CFGetAllocator(prefs);
-       callbacks = kCFTypeArrayCallBacks;
-       callbacks.equal = __BondInterfaceEquiv;
-       result = CFArrayCreateMutable(allocator, 0, &callbacks);
-
-       bonds = SCPreferencesGetValue(prefsPrivate->prefs, BOND_PREFERENCES_BONDS);
-       if ((bonds != NULL) && !isA_CFArray(bonds)) {
-               goto error;     // if the prefs are confused
-       }
-
-       n = (bonds != NULL) ? CFArrayGetCount(bonds) : 0;
-       for (i = 0; i < n; i++) {
-               BondInterfaceRef        bond;
-               CFDictionaryRef         bond_dict;
-               CFStringRef             bond_if;
-               CFArrayRef              devices;
-               CFDictionaryRef         options;
-
-               bond_dict = CFArrayGetValueAtIndex(bonds, i);
-               if (!isA_CFDictionary(bond_dict)) {
-                       goto error;     // if the prefs are confused
-               }
-
-               bond_if = CFDictionaryGetValue(bond_dict, __kBondInterface_interface);
-               if (!isA_CFString(bond_if)) {
-                       goto error;     // if the prefs are confused
-               }
-
-
-               devices = CFDictionaryGetValue(bond_dict, __kBondInterface_devices);
-               if ((devices != NULL) && !isA_CFArray(devices)) {
-                       goto error;     // if the prefs are confused
-               }
-
-               options = CFDictionaryGetValue(bond_dict, __kBondInterface_options);
-               if ((options != NULL) && !isA_CFDictionary(options)) {
-                       goto error;     // if the prefs are confused
-               }
-
-               bond = __BondInterfaceCreatePrivate(allocator, bond_if);
-               BondInterfaceSetDevices(bond, devices);
-               BondInterfaceSetOptions(bond, options);
-               CFArrayAppendValue(result, bond);
-               CFRelease(bond);
-       }
-
-       return result;
-
-    error :
-
-       _SCErrorSet(kSCStatusFailed);
-       CFRelease(result);
-       return NULL;
-}
-
-
-BondInterfaceRef
-BondPreferencesCreateInterface(BondPreferencesRef      prefs)
-{
-       CFArrayRef                      active_bonds    = NULL;
-       CFAllocatorRef                  allocator;
-       CFArrayRef                      config_bonds;
-       CFIndex                         i;
-       CFIndex                         nActive;
-       CFIndex                         nConfig;
-       BondInterfaceRef                newBond         = NULL;
-       BondPreferencesPrivateRef       prefsPrivate    = (BondPreferencesPrivateRef)prefs;
-
-       if (!isA_BondPreferences(prefs)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return NULL;
-       }
-
-       pthread_mutex_lock(&prefsPrivate->lock);
-
-       /* get "configured" Bonds (and check to ensure the device is available) */
-       config_bonds = SCPreferencesGetValue(prefsPrivate->prefs, BOND_PREFERENCES_BONDS);
-       if ((config_bonds != NULL) && !isA_CFArray(config_bonds)) {
-               // if the prefs are confused
-               _SCErrorSet(kSCStatusFailed);
-               goto done;
-       }
-
-       nConfig = (config_bonds != NULL) ? CFArrayGetCount(config_bonds) : 0;
-
-       /* get "active" Bonds */
-       active_bonds = _BondPreferencesCopyActiveInterfaces();
-       nActive      = isA_CFArray(active_bonds) ? CFArrayGetCount(active_bonds) : 0;
-
-       /* create a new bond using an unused interface name */
-       allocator = CFGetAllocator(prefs);
-
-       for (i = 0; newBond == NULL; i++) {
-               CFIndex                 j;
-               CFMutableDictionaryRef  newDict;
-               CFMutableArrayRef       newBonds;
-               CFStringRef             bond_if;
-
-               bond_if = CFStringCreateWithFormat(allocator, NULL, CFSTR("bond%d"), i);
-
-               for (j = 0; j < nActive; j++) {
-                       CFStringRef             active_if;
-                       BondInterfaceRef        active_bond;
-
-                       active_bond = CFArrayGetValueAtIndex(active_bonds, j);
-                       active_if   = BondInterfaceGetInterface(active_bond);
-
-                       if (CFEqual(bond_if, active_if)) {
-                               goto next_if;   // if bond interface name not available
-                       }
-               }
-
-               for (j = 0; j < nConfig; j++) {
-                       CFDictionaryRef config;
-                       CFStringRef     config_if;
-
-                       config = CFArrayGetValueAtIndex(config_bonds, j);
-                       if (!isA_CFDictionary(config)) {
-                               // if the prefs are confused
-                               _SCErrorSet(kSCStatusFailed);
-                               CFRelease(bond_if);
-                               goto done;
-                       }
-
-                       config_if = CFDictionaryGetValue(config, __kBondInterface_interface);
-                       if (!isA_CFString(config_if)) {
-                               // if the prefs are confused
-                               _SCErrorSet(kSCStatusFailed);
-                               CFRelease(bond_if);
-                               goto done;
-                       }
-
-                       if (CFEqual(bond_if, config_if)) {
-                               goto next_if;   // if bond interface name not available
-                       }
-               }
-
-               /* create the bond */
-
-               newDict = CFDictionaryCreateMutable(allocator,
-                                                   0,
-                                                   &kCFTypeDictionaryKeyCallBacks,
-                                                   &kCFTypeDictionaryValueCallBacks);
-               CFDictionaryAddValue(newDict, __kBondInterface_interface, bond_if);
-
-               /* create the accessor handle to be returned */
-
-               newBond = __BondInterfaceCreatePrivate(allocator, bond_if);
-
-               /* save in the prefs */
-
-               if (nConfig > 0) {
-                       newBonds = CFArrayCreateMutableCopy(allocator, 0, config_bonds);
-               } else {
-                       newBonds = CFArrayCreateMutable(allocator, 0, &kCFTypeArrayCallBacks);
-               }
-               CFArrayAppendValue(newBonds, newDict);
-               CFRelease(newDict);
-
-               /* yes, we're going to be changing the configuration */
-               setConfigurationChanged(prefs);
-
-               (void) SCPreferencesSetValue(prefsPrivate->prefs, BOND_PREFERENCES_BONDS, newBonds);
-               CFRelease(newBonds);
-
-           next_if :
-               CFRelease(bond_if);
-       }
-
-    done :
-
-       if (active_bonds != NULL)       CFRelease(active_bonds);
-
-       pthread_mutex_unlock(&prefsPrivate->lock);
-
-       return (BondInterfaceRef) newBond;
-}
-
-
-static Boolean
-_BondPreferencesUpdate(BondPreferencesRef prefs, BondInterfaceRef bond)
-{
-       CFAllocatorRef                  allocator;
-       CFIndex                         bond_index;
-       CFArrayRef                      devices;
-       CFStringRef                     interface;
-       CFMutableDictionaryRef          newDict;
-       CFMutableArrayRef               newBonds;
-       CFDictionaryRef                 options;
-       BondPreferencesPrivateRef       prefsPrivate    = (BondPreferencesPrivateRef)prefs;
-       CFArrayRef                      bonds;
-
-       bonds = SCPreferencesGetValue(prefsPrivate->prefs, BOND_PREFERENCES_BONDS);
-       if ((bonds != NULL) && !isA_CFArray(bonds)) {
-               // if the prefs are confused
-               _SCErrorSet(kSCStatusFailed);
-               return FALSE;
-       }
-
-       interface = BondInterfaceGetInterface(bond);
-       bond_index = findBond(bonds, interface);
-       if (bond_index == kCFNotFound) {
-               _SCErrorSet(kSCStatusNoKey);
-               return FALSE;
-       }
-
-       /* create the bond dictionary */
-
-       allocator = CFGetAllocator(prefs);
-       newDict = CFDictionaryCreateMutable(allocator,
-                                           0,
-                                           &kCFTypeDictionaryKeyCallBacks,
-                                           &kCFTypeDictionaryValueCallBacks);
-       CFDictionaryAddValue(newDict, __kBondInterface_interface, interface);
-
-       devices = BondInterfaceGetDevices(bond);
-       if (devices != NULL) {
-               CFDictionaryAddValue(newDict, __kBondInterface_devices, devices);
-       }
-
-       options = BondInterfaceGetOptions(bond);
-       if (options != NULL) {
-               CFDictionaryAddValue(newDict, __kBondInterface_options, options);
-       }
-
-       /* yes, we're going to be changing the configuration */
-       setConfigurationChanged(prefs);
-
-       /* update the prefs */
-
-       newBonds = CFArrayCreateMutableCopy(allocator, 0, bonds);
-       CFArraySetValueAtIndex(newBonds, bond_index, newDict);
-       CFRelease(newDict);
-       (void) SCPreferencesSetValue(prefsPrivate->prefs, BOND_PREFERENCES_BONDS, newBonds);
-       CFRelease(newBonds);
-
-       return TRUE;
-}
-
-
-Boolean
-BondPreferencesAddDevice(BondPreferencesRef    prefs,
-                        BondInterfaceRef       bond,
-                        CFStringRef            device)
-{
-       CFArrayRef                      config_bonds;
-       CFIndex                         i;
-       CFIndex                         nConfig;
-       Boolean                         ok              = TRUE;
-       BondPreferencesPrivateRef       prefsPrivate    = (BondPreferencesPrivateRef)prefs;
-
-       if (!isA_BondPreferences(prefs)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       if (!isA_BondInterface(bond)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       if (!isA_CFString(device)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       if (!IsBondSupported(device)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       pthread_mutex_lock(&prefsPrivate->lock);
-
-       /* get "configured" bonds */
-       config_bonds = SCPreferencesGetValue(prefsPrivate->prefs, BOND_PREFERENCES_BONDS);
-       if ((config_bonds != NULL) && !isA_CFArray(config_bonds)) {
-               _SCErrorSet(kSCStatusFailed);
-               ok = FALSE;
-               goto done;
-       }
-
-       nConfig = (config_bonds != NULL) ? CFArrayGetCount(config_bonds) : 0;
-
-       /* check to ensure the requested device is available */
-       for (i = 0; ok && (i < nConfig); i++) {
-               CFDictionaryRef config_bond;
-               CFArrayRef      devices;
-
-               config_bond = CFArrayGetValueAtIndex(config_bonds, i);
-               if (!isA_CFDictionary(config_bond)) {
-                       ok = FALSE;     // if the prefs are confused
-                       break;
-               }
-
-               devices = CFDictionaryGetValue(config_bond, __kBondInterface_devices);
-               if ((devices != NULL) && !isA_CFArray(devices)) {
-                       ok = FALSE;     // if the prefs are confused
-                       break;
-               }
-
-               if (devices == NULL) {
-                       continue;       // if no devices
-               }
-
-               ok = !CFArrayContainsValue(devices,
-                                          CFRangeMake(0, CFArrayGetCount(devices)),
-                                          device);
-       }
-
-       if (ok) {
-               CFArrayRef              devices;
-               CFMutableArrayRef       newDevices;
-
-               devices = BondInterfaceGetDevices(bond);
-               if (devices != NULL) {
-                       devices = CFArrayCreateCopy(NULL, devices);
-                       newDevices = CFArrayCreateMutableCopy(NULL, 0, devices);
-               } else {
-                       newDevices = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
-               }
-               CFArrayAppendValue(newDevices, device);
-               BondInterfaceSetDevices(bond, newDevices);
-               CFRelease(newDevices);
-
-               ok = _BondPreferencesUpdate(prefs, bond);
-               if (!ok) {
-                       BondInterfaceSetDevices(bond, devices);
-               }
-
-               if (devices != NULL) {
-                       CFRelease(devices);
-               }
-       } else {
-               _SCErrorSet(kSCStatusKeyExists);
-       }
-
-    done :
-
-       pthread_mutex_unlock(&prefsPrivate->lock);
-
-       return ok;
-}
-
-
-Boolean
-BondPreferencesRemoveDevice(BondPreferencesRef prefs,
-                           BondInterfaceRef    bond,
-                           CFStringRef         device)
-{
-       CFIndex                         bond_index;
-       CFArrayRef                      devices;
-       Boolean                         ok              = FALSE;
-       BondPreferencesPrivateRef       prefsPrivate    = (BondPreferencesPrivateRef)prefs;
-
-       if (!isA_BondPreferences(prefs)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       if (!isA_BondInterface(bond)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       if (!isA_CFString(device)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       pthread_mutex_lock(&prefsPrivate->lock);
-
-       devices = BondInterfaceGetDevices(bond);
-       if (devices != NULL) {
-               bond_index = CFArrayGetFirstIndexOfValue(devices,
-                                                        CFRangeMake(0, CFArrayGetCount(devices)),
-                                                        device);
-               if (bond_index != kCFNotFound) {
-                       CFMutableArrayRef       newDevices;
-
-                       devices = CFArrayCreateCopy(NULL, devices);
-                       newDevices = CFArrayCreateMutableCopy(NULL, 0, devices);
-                       CFArrayRemoveValueAtIndex(newDevices, bond_index);
-                       BondInterfaceSetDevices(bond, newDevices);
-                       CFRelease(newDevices);
-
-                       ok = _BondPreferencesUpdate(prefs, bond);
-                       if (!ok) {
-                               BondInterfaceSetDevices(bond, devices);
-                       }
-
-                       CFRelease(devices);
-               } else {
-                       _SCErrorSet(kSCStatusNoKey);
-               }
-       }
-
-       pthread_mutex_unlock(&prefsPrivate->lock);
-
-       return ok;
-}
-
-
-Boolean
-BondPreferencesSetOptions(BondPreferencesRef prefs, BondInterfaceRef bond, CFDictionaryRef newOptions)
-{
-       Boolean                         ok              = FALSE;
-       CFDictionaryRef                 options;
-       BondPreferencesPrivateRef       prefsPrivate    = (BondPreferencesPrivateRef)prefs;
-
-       if (!isA_BondPreferences(prefs)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       if (!isA_BondInterface(bond)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       pthread_mutex_lock(&prefsPrivate->lock);
-
-       options = BondInterfaceGetOptions(bond);
-       if (options != NULL) {
-               options = CFDictionaryCreateCopy(NULL, options);
-       }
-
-       BondInterfaceSetOptions(bond, newOptions);
-       ok = _BondPreferencesUpdate(prefs, bond);
-       if (!ok) {
-               BondInterfaceSetOptions(bond, options);
-       }
-
-       if (options != NULL) {
-               CFRelease(options);
-       }
-
-       pthread_mutex_unlock(&prefsPrivate->lock);
-
-       return ok;
-}
-
-
-Boolean
-BondPreferencesRemoveInterface(BondPreferencesRef      prefs,
-                              BondInterfaceRef         bond)
-{
-       CFIndex                         bond_index;
-       Boolean                         ok              = FALSE;
-       BondPreferencesPrivateRef       prefsPrivate    = (BondPreferencesPrivateRef)prefs;
-       CFArrayRef                      bonds;
-
-       if (!isA_BondPreferences(prefs)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       if (!isA_BondInterface(bond)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       pthread_mutex_lock(&prefsPrivate->lock);
-
-       bonds = SCPreferencesGetValue(prefsPrivate->prefs, BOND_PREFERENCES_BONDS);
-       if (!isA_CFArray(bonds)) {
-               // if the prefs are confused
-               _SCErrorSet(kSCStatusFailed);
-               goto done;
-       }
-
-       bond_index = findBond(bonds, BondInterfaceGetInterface(bond));
-       if (bond_index == kCFNotFound) {
-               _SCErrorSet(kSCStatusNoKey);
-               goto done;
-       }
-
-       /* yes, we're going to be changing the configuration */
-       setConfigurationChanged(prefs);
-
-       /* remove the bond */
-
-       if (CFArrayGetCount(bonds) > 1) {
-               CFAllocatorRef          allocator;
-               CFMutableArrayRef       newBonds;
-
-               allocator = CFGetAllocator(prefs);
-               newBonds = CFArrayCreateMutableCopy(allocator, 0, bonds);
-               CFArrayRemoveValueAtIndex(newBonds, bond_index);
-               (void) SCPreferencesSetValue(prefsPrivate->prefs, BOND_PREFERENCES_BONDS, newBonds);
-               CFRelease(newBonds);
-       } else {
-               (void) SCPreferencesRemoveValue(prefsPrivate->prefs, BOND_PREFERENCES_BONDS);
-       }
-
-       ok = TRUE;
-
-    done :
-
-       pthread_mutex_unlock(&prefsPrivate->lock);
-
-       return ok;
-}
-
-
-Boolean
-BondPreferencesCommitChanges(BondPreferencesRef        prefs)
-{
-       Boolean                         ok              = FALSE;
-       BondPreferencesPrivateRef       prefsPrivate    = (BondPreferencesPrivateRef)prefs;
-
-       if (!isA_BondPreferences(prefs)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       ok = SCPreferencesCommitChanges(prefsPrivate->prefs);
-       if (!ok) {
-               return ok;
-       }
-
-       if (prefsPrivate->bBase != NULL)  {
-               CFRelease(prefsPrivate->bBase);
-               prefsPrivate->bBase = NULL;
-       }
-
-       return TRUE;
-}
-
-
-Boolean
-_BondPreferencesUpdateConfiguration(BondPreferencesRef prefs)
-{
-       return TRUE;
-}
-
-
-Boolean
-BondPreferencesApplyChanges(BondPreferencesRef prefs)
-{
-       SCPreferencesRef                defaultPrefs;
-       Boolean                         ok              = FALSE;
-       BondPreferencesPrivateRef       prefsPrivate    = (BondPreferencesPrivateRef)prefs;
-
-       if (!isA_BondPreferences(prefs)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       pthread_mutex_lock(&prefsPrivate->lock);
-
-       /* apply the preferences */
-       ok = SCPreferencesApplyChanges(prefsPrivate->prefs);
-       if (!ok) {
-               goto done;
-       }
-
-       /* apply the Bond configuration */
-       defaultPrefs = SCPreferencesCreate(NULL, CFSTR("BondPreferencesApplyChanges"), NULL);
-       {
-               /*
-                * Note: In an ideal world, we'd simply call SCPreferencesApplyChanges()
-                *       Unfortunately, it's possible that the caller (e.g NetworkCfgTool)
-                *       is holding the lock on the default prefs and since "Apply" attempts
-                *       to grab the lock we could end up in a deadlock situation.
-                */
-#include "SCPreferencesInternal.h"
-               SCPreferencesPrivateRef         defaultPrefsPrivate;
-
-               defaultPrefsPrivate = (SCPreferencesPrivateRef)defaultPrefs;
-
-               pthread_mutex_lock(&defaultPrefsPrivate->lock);
-               if (defaultPrefsPrivate->session == NULL) {
-                       __SCPreferencesAddSession(defaultPrefs);
-               }
-               pthread_mutex_unlock(&defaultPrefsPrivate->lock);
-
-               ok = SCDynamicStoreNotifyValue(defaultPrefsPrivate->session, defaultPrefsPrivate->sessionKeyApply);
-       }
-       CFRelease(defaultPrefs);
-       if (!ok) {
-               goto done;
-       }
-
-    done :
-
-       pthread_mutex_unlock(&prefsPrivate->lock);
-
-       return ok;
-}
-
-
-/* ---------- BondStatus ---------- */
-
-typedef struct {
-
-       /* base CFType information */
-       CFRuntimeBase                   cfBase;
-
-       /* bond interface */
-       BondInterfaceRef                bond;
-
-       /* bond status */
-       CFDictionaryRef                 status_interface;       // interface status
-       CFArrayRef                      devices;                // per-device status
-       CFDictionaryRef                 status_devices;
-
-} BondStatusPrivate, * BondStatusPrivateRef;
-
-
-static CFStringRef     __BondStatusCopyDescription     (CFTypeRef cf);
-static void            __BondStatusDeallocate          (CFTypeRef cf);
-static Boolean         __BondStatusEqual               (CFTypeRef cf1, CFTypeRef cf2);
-
-
-static const CFRuntimeClass __BondStatusClass = {
-       0,                              // version
-       "BondStatus",                   // className
-       NULL,                           // init
-       NULL,                           // copy
-       __BondStatusDeallocate,         // dealloc
-       __BondStatusEqual,              // equal
-       NULL,                           // hash
-       NULL,                           // copyFormattingDesc
-       __BondStatusCopyDescription     // copyDebugDesc
-};
-
-
-static CFTypeID                __kBondStatusTypeID     = _kCFRuntimeNotATypeID;
-
-
-static pthread_once_t  bondStatus_init_X       = PTHREAD_ONCE_INIT;
-
-
-static CFStringRef
-__BondStatusCopyDescription(CFTypeRef cf)
-{
-       CFAllocatorRef          allocator       = CFGetAllocator(cf);
-       CFMutableStringRef      result;
-       BondStatusPrivateRef    statusPrivate   = (BondStatusPrivateRef)cf;
-
-       result = CFStringCreateMutable(allocator, 0);
-       CFStringAppendFormat(result, NULL, CFSTR("<BondStatus %p [%p]> {"), cf, allocator);
-       CFStringAppendFormat(result, NULL, CFSTR(" bond = %@"), statusPrivate->bond);
-       CFStringAppendFormat(result, NULL, CFSTR(" interface = %@"), statusPrivate->status_interface);
-       CFStringAppendFormat(result, NULL, CFSTR(" devices = %@"),   statusPrivate->status_devices);
-       CFStringAppendFormat(result, NULL, CFSTR(" }"));
-
-       return result;
-}
-
-
-static void
-__BondStatusDeallocate(CFTypeRef cf)
-{
-       BondStatusPrivateRef    statusPrivate   = (BondStatusPrivateRef)cf;
-
-       /* release resources */
-
-       CFRelease(statusPrivate->bond);
-       CFRelease(statusPrivate->status_interface);
-       if (statusPrivate->devices != NULL) CFRelease(statusPrivate->devices);
-       CFRelease(statusPrivate->status_devices);
-       return;
-}
-
-
-static Boolean
-__BondStatusEqual(CFTypeRef cf1, CFTypeRef cf2)
-{
-       BondStatusPrivateRef    status1 = (BondStatusPrivateRef)cf1;
-       BondStatusPrivateRef    status2 = (BondStatusPrivateRef)cf2;
-
-       if (status1 == status2)
-               return TRUE;
-
-       if (!CFEqual(status1->bond, status2->bond))
-               return FALSE;   // if not the same bond
-
-       if (!CFEqual(status1->status_interface, status2->status_interface))
-               return FALSE;   // if not the same interface status
-
-       if (!CFEqual(status1->status_devices, status2->status_devices))
-               return FALSE;   // if not the same device status
-
-       return TRUE;
-}
-
-
-static void
-__BondStatusInitialize(void)
-{
-       __kBondStatusTypeID = _CFRuntimeRegisterClass(&__BondStatusClass);
-       return;
-}
-
-
-static __inline__ CFTypeRef
-isA_BondStatus(CFTypeRef obj)
-{
-       return (isA_CFType(obj, BondStatusGetTypeID()));
-}
-
-
-CFTypeID
-BondStatusGetTypeID(void)
-{
-       pthread_once(&bondStatus_init_X, __BondStatusInitialize);       /* initialize runtime */
-       return __kBondStatusTypeID;
-}
-
-
-static BondStatusRef
-__BondStatusCreatePrivate(CFAllocatorRef       allocator,
-                         BondInterfaceRef      bond,
-                         CFDictionaryRef       status_interface,
-                         CFDictionaryRef       status_devices)
-{
-       BondStatusPrivateRef    statusPrivate;
-       uint32_t                size;
-
-       /* initialize runtime */
-       pthread_once(&bondStatus_init_X, __BondStatusInitialize);
-
-       /* allocate bond */
-       size          = sizeof(BondStatusPrivate) - sizeof(CFRuntimeBase);
-       statusPrivate = (BondStatusPrivateRef)_CFRuntimeCreateInstance(allocator,
-                                                                      __kBondStatusTypeID,
-                                                                      size,
-                                                                      NULL);
-       if (statusPrivate == NULL) {
-               return NULL;
-       }
-
-       /* establish the bond status */
-
-       statusPrivate->bond             = CFRetain(bond);
-       statusPrivate->status_interface = CFDictionaryCreateCopy(allocator, status_interface);
-       statusPrivate->devices          = NULL;
-       statusPrivate->status_devices   = CFDictionaryCreateCopy(allocator, status_devices);
-
-       return (BondStatusRef)statusPrivate;
-}
-
-
-BondStatusRef
-BondInterfaceCopyStatus(BondInterfaceRef bond)
-{
-       BondInterfacePrivateRef bondPrivate     = (BondInterfacePrivateRef)bond;
-       int                     bond_if_active;
-       int                     bond_if_status;
-       CFIndex                 i;
-       struct if_bond_status_req *ibsr_p = NULL;
-       char                    if_name[IFNAMSIZ + 1];
-       CFIndex                 n;
-       CFNumberRef             num;
-       int                     s;
-       struct if_bond_status * scan_p;
-       BondStatusRef           status          = NULL;
-       CFMutableDictionaryRef  status_devices;
-       CFMutableDictionaryRef  status_interface;
-
-       if (!isA_BondInterface(bond)) {
-               return NULL;
-       }
-
-       s = inet_dgram_socket();
-       if (s == -1) {
-               _SCErrorSet(errno);
-               goto done;
-       }
-       _SC_cfstring_to_cstring(bondPrivate->ifname, if_name,
-                               sizeof(if_name), kCFStringEncodingASCII);
-       (void)siocgifmedia(s, if_name, &bond_if_status, &bond_if_active);
-       ibsr_p = if_bond_status_req_copy(s, if_name);
-       if (ibsr_p == NULL) {
-               _SCErrorSet(errno);
-               goto done;
-       }
-       status_interface = CFDictionaryCreateMutable(NULL,
-                                                    0,
-                                                    &kCFTypeDictionaryKeyCallBacks,
-                                                    &kCFTypeDictionaryValueCallBacks);
-
-       status_devices = CFDictionaryCreateMutable(NULL,
-                                                  0,
-                                                  &kCFTypeDictionaryKeyCallBacks,
-                                                  &kCFTypeDictionaryValueCallBacks);
-       n = ibsr_p->ibsr_total;
-       for (i = 0, scan_p = (struct if_bond_status *)ibsr_p->ibsr_buffer; i < n; i++, scan_p++) {
-               CFStringRef                     bond_if;
-               int                             collecting = 0;
-               int                             distributing = 0;
-               struct if_bond_partner_state *  ps;
-               CFMutableDictionaryRef          status_device;
-               int                             status_val;
-
-               ps = &scan_p->ibs_partner_state;
-
-               status_device = CFDictionaryCreateMutable(NULL,
-                                                         0,
-                                                         &kCFTypeDictionaryKeyCallBacks,
-                                                         &kCFTypeDictionaryValueCallBacks);
-               if (lacp_actor_partner_state_in_sync(scan_p->ibs_state)) {
-                       /* we're in-sync */
-                       status_val = kSCBondStatusOK;
-                       if (lacp_actor_partner_state_in_sync(ps->ibps_state)) {
-                               /* partner is also in-sync */
-                               if (lacp_actor_partner_state_collecting(scan_p->ibs_state)
-                                   && lacp_actor_partner_state_distributing(ps->ibps_state)) {
-                                       /* we're able to collect (receive) frames */
-                                       collecting = 1;
-                               }
-                               if (lacp_actor_partner_state_distributing(scan_p->ibs_state)
-                                   && lacp_actor_partner_state_collecting(ps->ibps_state)) {
-                                       /* we're able to distribute (transmit) frames */
-                                       distributing = 1;
-                               }
-                       }
-               }
-               else {
-                       int                     active = 0;
-                       int                     status = 0;
-                       static lacp_system      zeroes = {{0,0,0,0,0,0}};
-
-                       (void)siocgifmedia(s, scan_p->ibs_if_name, &status, &active);
-                       if ((status & IFM_AVALID) == 0 || (status & IFM_ACTIVE) == 0
-                           || (active & IFM_FDX) == 0) {
-                               /* link down or not full-duplex */
-                               status_val = kSCBondStatusLinkInvalid;
-                       }
-                       else if (ps->ibps_system_priority == 0
-                                && bcmp(&zeroes, &ps->ibps_system, sizeof(zeroes)) == 0) {
-                               /* no one on the other end of the link */
-                               status_val = kSCBondStatusNoPartner;
-                       }
-                       else if (active != bond_if_active) {
-                               /* the link speed was different */
-                               status_val = kSCBondStatusLinkInvalid;
-                       }
-                       else {
-                               /* partner is not in the active group */
-                               status_val = kSCBondStatusNotInActiveGroup;
-                       }
-               }
-               num = CFNumberCreate(NULL, kCFNumberIntType, &status_val);
-               CFDictionarySetValue(status_device, kSCBondStatusDeviceAggregationStatus, num);
-               CFRelease(num);
-               num = CFNumberCreate(NULL, kCFNumberIntType, &collecting);
-               CFDictionarySetValue(status_device, kSCBondStatusDeviceCollecting, num);
-               CFRelease(num);
-               num = CFNumberCreate(NULL, kCFNumberIntType, &distributing);
-               CFDictionarySetValue(status_device, kSCBondStatusDeviceDistributing, num);
-               CFRelease(num);
-               bond_if = CFArrayGetValueAtIndex(bondPrivate->devices, i);
-               CFDictionarySetValue(status_devices, bond_if, status_device);
-               CFRelease(status_device);
-       }
-
-       status = __BondStatusCreatePrivate(NULL, bond, status_interface, status_devices);
-
-       CFRelease(status_interface);
-       CFRelease(status_devices);
- done:
-       if (s != -1) {
-               close(s);
-       }
-       if (ibsr_p != NULL) {
-               free(ibsr_p);
-       }
-       return status;
-}
-
-
-CFArrayRef
-BondStatusGetDevices(BondStatusRef bondStatus)
-{
-       BondStatusPrivateRef    statusPrivate   = (BondStatusPrivateRef)bondStatus;
-
-       if (!isA_BondStatus(bondStatus)) {
-               return NULL;
-       }
-
-       if (statusPrivate->devices == NULL) {
-               const void *    keys_q[N_QUICK];
-               const void **   keys    = keys_q;
-               CFIndex         n;
-
-               n = CFDictionaryGetCount(statusPrivate->status_devices);
-               if (n > (CFIndex)(sizeof(keys_q) / sizeof(CFTypeRef))) {
-                       keys = CFAllocatorAllocate(NULL, n * sizeof(CFTypeRef), 0);
-               }
-               CFDictionaryGetKeysAndValues(statusPrivate->status_devices, keys, NULL);
-               statusPrivate->devices = CFArrayCreate(NULL, keys, n, &kCFTypeArrayCallBacks);
-               if (keys != keys_q) {
-                       CFAllocatorDeallocate(NULL, keys);
-               }
-       }
-
-       return statusPrivate->devices;
-}
-
-
-CFDictionaryRef
-BondStatusGetInterfaceStatus(BondStatusRef bondStatus)
-{
-       BondStatusPrivateRef    statusPrivate   = (BondStatusPrivateRef)bondStatus;
-
-       if (!isA_BondStatus(bondStatus)) {
-               return NULL;
-       }
-
-       return statusPrivate->status_interface;
-}
-
-
-CFDictionaryRef
-BondStatusGetDeviceStatus(BondStatusRef bondStatus, CFStringRef device)
-{
-       BondStatusPrivateRef    statusPrivate   = (BondStatusPrivateRef)bondStatus;
-
-       if (!isA_BondStatus(bondStatus)) {
-               return NULL;
-       }
-
-       return CFDictionaryGetValue(statusPrivate->status_devices, device);
-}
diff --git a/SystemConfiguration.fproj/BondConfiguration.h b/SystemConfiguration.fproj/BondConfiguration.h
deleted file mode 100644 (file)
index bcf06b1..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-#ifndef _BONDCONFIGURATION_H
-#define _BONDCONFIGURATION_H
-
-/*!
-       @header BONDCONFIGURATION
-*/
-
-#include <AvailabilityMacros.h>
-#include <sys/cdefs.h>
-#include <CoreFoundation/CoreFoundation.h>
-#include <SystemConfiguration/SCNetworkConfiguration.h>
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-
-typedef const struct __BondInterface *         BondInterfaceRef;
-
-typedef const struct __BondPreferences *       BondPreferencesRef;
-
-typedef const struct __BondStatus *            BondStatusRef;
-
-
-__BEGIN_DECLS
-
-// ----------
-
-Boolean
-IsBondSupported                                (CFStringRef            device)                 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // e.g. "en0", "en1", ...
-
-// ----------
-
-CFTypeID
-BondInterfaceGetTypeID                 (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-CFStringRef
-BondInterfaceGetInterface              (BondInterfaceRef       bond)                   AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // returns "bond0", "bond1", ...
-
-CFArrayRef /* of CFStringRef's */
-BondInterfaceGetDevices                        (BondInterfaceRef       bond)                   AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-CFDictionaryRef
-BondInterfaceGetOptions                        (BondInterfaceRef       bond)                   AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // e.g. UserDefinedName, ...
-
-// ----------
-
-CFTypeID
-BondPreferencesGetTypeID               (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-BondPreferencesRef
-BondPreferencesCreate                  (CFAllocatorRef         allocator)              AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-CFArrayRef /* of BondInterfaceRef's */
-BondPreferencesCopyInterfaces          (BondPreferencesRef     prefs)                  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-BondInterfaceRef
-BondPreferencesCreateInterface         (BondPreferencesRef     prefs)                  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-Boolean
-BondPreferencesRemoveInterface         (BondPreferencesRef     prefs,
-                                        BondInterfaceRef       bond)                   AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-Boolean
-BondPreferencesAddDevice               (BondPreferencesRef     prefs,
-                                        BondInterfaceRef       bond,
-                                        CFStringRef            device)                 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // e.g. "en0", "en1", ...
-
-Boolean
-BondPreferencesRemoveDevice            (BondPreferencesRef     prefs,
-                                        BondInterfaceRef       bond,
-                                        CFStringRef            device)                 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // e.g. "en0", "en1", ...
-
-Boolean
-BondPreferencesSetOptions              (BondPreferencesRef     prefs,
-                                        BondInterfaceRef       bond,
-                                        CFDictionaryRef        newOptions)             AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-Boolean
-BondPreferencesCommitChanges           (BondPreferencesRef     prefs)                  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-Boolean
-BondPreferencesApplyChanges            (BondPreferencesRef     prefs)                  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-// ----------
-
-CFTypeID
-BondStatusGetTypeID                    (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-BondStatusRef
-BondInterfaceCopyStatus                        (BondInterfaceRef       bond)                   AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-CFArrayRef
-BondStatusGetDevices                   (BondStatusRef          bondStatus)             AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-CFDictionaryRef
-BondStatusGetInterfaceStatus           (BondStatusRef          bondStatus)             AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-CFDictionaryRef
-BondStatusGetDeviceStatus              (BondStatusRef          bondStatus,
-                                        CFStringRef            device)                 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-__END_DECLS
-
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */
-
-#endif /* _BONDCONFIGURATION_H */
diff --git a/SystemConfiguration.fproj/BondConfigurationPrivate.h b/SystemConfiguration.fproj/BondConfigurationPrivate.h
deleted file mode 100644 (file)
index 1eb7419..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-#ifndef _BONDCONFIGURATIONPRIVATE_H
-#define _BONDCONFIGURATIONPRIVATE_H
-
-#include <AvailabilityMacros.h>
-#include <sys/cdefs.h>
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-
-/*!
-       @header BONDConfigurationPrivate
- */
-
-__BEGIN_DECLS
-
-__END_DECLS
-
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */
-
-#endif /* _BONDCONFIGURATIONPRIVATE_H */
index 9f2e4ba0ded9723973d5a70c5bf9880e02beb724..cac5fb2667a9eaf1a452e8d8892bded441eb93a9 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2001, 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2001, 2004, 2005, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  */
 
 #ifndef _DHCPCLIENTPREFERENCES_H
  */
 
 #ifndef _DHCPCLIENTPREFERENCES_H
+#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS
+#include <SystemConfiguration/_DHCPClientPreferences.h>
+#else  /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
 #define _DHCPCLIENTPREFERENCES_H
 
 #define _DHCPCLIENTPREFERENCES_H
 
+#include <Availability.h>
 #include <sys/cdefs.h>
 #include <CoreFoundation/CFString.h>
 
 #include <sys/cdefs.h>
 #include <CoreFoundation/CFString.h>
 
@@ -50,9 +54,9 @@ __BEGIN_DECLS
  */
 
 Boolean
  */
 
 Boolean
-DHCPClientPreferencesSetApplicationOptions(CFStringRef applicationID,
-                                          UInt8 * options,
-                                          CFIndex count);
+DHCPClientPreferencesSetApplicationOptions     (CFStringRef    applicationID,
+                                                UInt8          *options,
+                                                CFIndex        count)          __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function DHCPClientPreferencesCopyApplicationOptions
 
 /*!
        @function DHCPClientPreferencesCopyApplicationOptions
@@ -68,9 +72,10 @@ DHCPClientPreferencesSetApplicationOptions(CFStringRef applicationID,
  */
 
 UInt8 *
  */
 
 UInt8 *
-DHCPClientPreferencesCopyApplicationOptions(CFStringRef applicationID,
-                                           CFIndex * count);
+DHCPClientPreferencesCopyApplicationOptions    (CFStringRef    applicationID,
+                                                CFIndex        *count)         __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 __END_DECLS
 
 
 __END_DECLS
 
-#endif /* _DHCPCLIENTPREFERENCES_H */
+#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
+#endif /* _DHCPCLIENTPREFERENCES_H */
index 480aa330d86b1d15cde96089e4fb6ab42c83f077..87406e7c67fcbda09260e06507699978b6c1a778 100644 (file)
Binary files a/SystemConfiguration.fproj/English.lproj/Localizable.strings and b/SystemConfiguration.fproj/English.lproj/Localizable.strings differ
index a297a9afed60a20ef619d1582ebee14edad70932..9a0d08b25dbffbaa46661467018aeb5b155c6402 100644 (file)
Binary files a/SystemConfiguration.fproj/English.lproj/NetworkInterface.strings and b/SystemConfiguration.fproj/English.lproj/NetworkInterface.strings differ
diff --git a/SystemConfiguration.fproj/Info-Embedded.plist b/SystemConfiguration.fproj/Info-Embedded.plist
new file mode 100644 (file)
index 0000000..8714e9f
--- /dev/null
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>CFBundleDevelopmentRegion</key>
+       <string>English</string>
+       <key>CFBundleExecutable</key>
+       <string>SystemConfiguration</string>
+       <key>CFBundleGetInfoString</key>
+       <string>1.10</string>
+       <key>CFBundleIdentifier</key>
+       <string>com.apple.SystemConfiguration</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>6.0</string>
+       <key>CFBundleName</key>
+       <string>SystemConfiguration</string>
+       <key>CFBundlePackageType</key>
+       <string>FMWK</string>
+       <key>CFBundleShortVersionString</key>
+       <string>1.10</string>
+       <key>CFBundleSignature</key>
+       <string>????</string>
+       <key>CFBundleVersion</key>
+       <string>1.10</string>
+</dict>
+</plist>
index fb43f610c2a1c68a905e8a59e5a4f3eb291bca01..8714e9f28ad96b60b06e7856040848578e8ba7b9 100644 (file)
@@ -7,7 +7,7 @@
        <key>CFBundleExecutable</key>
        <string>SystemConfiguration</string>
        <key>CFBundleGetInfoString</key>
        <key>CFBundleExecutable</key>
        <string>SystemConfiguration</string>
        <key>CFBundleGetInfoString</key>
-       <string>1.9.2</string>
+       <string>1.10</string>
        <key>CFBundleIdentifier</key>
        <string>com.apple.SystemConfiguration</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <key>CFBundleIdentifier</key>
        <string>com.apple.SystemConfiguration</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <key>CFBundlePackageType</key>
        <string>FMWK</string>
        <key>CFBundleShortVersionString</key>
        <key>CFBundlePackageType</key>
        <string>FMWK</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.9.2</string>
+       <string>1.10</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
-       <string>1.9.2</string>
+       <string>1.10</string>
 </dict>
 </plist>
 </dict>
 </plist>
index 95e9ef9a1f10c5b6f302b08b1c2f081d7f5a3814..6a6c53f6e2543d866085f07aff7a9f97a28fcebe 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002, 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002, 2004, 2006, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -25,6 +25,7 @@
 #ifndef _LINKCONFIGURATION_H
 #define _LINKCONFIGURATION_H
 
 #ifndef _LINKCONFIGURATION_H
 #define _LINKCONFIGURATION_H
 
+#include <Availability.h>
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 
@@ -62,7 +63,7 @@ NetworkInterfaceCopyMediaOptions(
                                 CFDictionaryRef        *active,
                                 CFArrayRef             *available,
                                 Boolean                filter
                                 CFDictionaryRef        *active,
                                 CFArrayRef             *available,
                                 Boolean                filter
-                                )              AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
+                                )              __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA);
 
 /*!
        @function NetworkInterfaceCopyMediaSubTypes
 
 /*!
        @function NetworkInterfaceCopyMediaSubTypes
@@ -76,7 +77,7 @@ NetworkInterfaceCopyMediaOptions(
 CFArrayRef
 NetworkInterfaceCopyMediaSubTypes(
                                  CFArrayRef            available
 CFArrayRef
 NetworkInterfaceCopyMediaSubTypes(
                                  CFArrayRef            available
-                                 )             AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
+                                 )             __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA);
 
 /*!
        @function NetworkInterfaceCopyMediaSubTypeOptions
 
 /*!
        @function NetworkInterfaceCopyMediaSubTypeOptions
@@ -93,7 +94,7 @@ CFArrayRef
 NetworkInterfaceCopyMediaSubTypeOptions(
                                        CFArrayRef              available,
                                        CFStringRef             subType
 NetworkInterfaceCopyMediaSubTypeOptions(
                                        CFArrayRef              available,
                                        CFStringRef             subType
-                                       )       AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
+                                       )       __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA);
 
 /*!
        @function NetworkInterfaceCopyMTU
 
 /*!
        @function NetworkInterfaceCopyMTU
@@ -116,7 +117,7 @@ NetworkInterfaceCopyMTU(
                        int             *mtu_cur,
                        int             *mtu_min,
                        int             *mtu_max
                        int             *mtu_cur,
                        int             *mtu_min,
                        int             *mtu_max
-                       )                       AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
+                       )                       __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA);
 
 
 __END_DECLS
 
 
 __END_DECLS
index 3fb9a4c1fc0c9cd50179c72c8de1bdb31a110a32..de4cf22338189949e76f2191500d5019983b550e 100644 (file)
@@ -9,15 +9,15 @@
                <key>Bluetooth</key>
                <dict>
                        <key>ConnectionPersonality</key>
                <key>Bluetooth</key>
                <dict>
                        <key>ConnectionPersonality</key>
-                       <string>v.34 Personality</string>
+                       <string>Default Personality</string>
                        <key>ConnectionScript</key>
                        <key>ConnectionScript</key>
-                       <string>/Library/Modem Scripts/Apple Modems.ccl</string>
+                       <string>/Library/Modem Scripts/Generic Dialup.ccl</string>
                        <key>DataCompression</key>
                        <integer>1</integer>
                        <key>DeviceModel</key>
                        <key>DataCompression</key>
                        <integer>1</integer>
                        <key>DeviceModel</key>
-                       <string>Apple Modem (v.34)</string>
+                       <string>Dialup Device</string>
                        <key>DeviceVendor</key>
                        <key>DeviceVendor</key>
-                       <string>Apple</string>
+                       <string>Generic</string>
                        <key>DialMode</key>
                        <string>WaitForDialTone</string>
                        <key>ErrorCorrection</key>
                        <key>DialMode</key>
                        <string>WaitForDialTone</string>
                        <key>ErrorCorrection</key>
@@ -38,6 +38,8 @@
                        <key>JoinMode</key>
                        <string>Automatic</string>
                </dict>
                        <key>JoinMode</key>
                        <string>Automatic</string>
                </dict>
+               <key>IPSec-IPv4</key>
+               <dict/>
                <key>IrDA</key>
                <dict/>
                <key>L2TP-IPv4</key>
                <key>IrDA</key>
                <dict/>
                <key>L2TP-IPv4</key>
                <key>Modem</key>
                <dict>
                        <key>ConnectionPersonality</key>
                <key>Modem</key>
                <dict>
                        <key>ConnectionPersonality</key>
-                       <string>v.34 Personality</string>
+                       <string>Default Personality</string>
                        <key>ConnectionScript</key>
                        <key>ConnectionScript</key>
-                       <string>/Library/Modem Scripts/Apple Modems.ccl</string>
+                       <string>/Library/Modem Scripts/Generic Dialup.ccl</string>
                        <key>DataCompression</key>
                        <integer>1</integer>
                        <key>DeviceModel</key>
                        <key>DataCompression</key>
                        <integer>1</integer>
                        <key>DeviceModel</key>
-                       <string>Apple Modem (v.34)</string>
+                       <string>Dialup Device</string>
                        <key>DeviceVendor</key>
                        <key>DeviceVendor</key>
-                       <string>Apple</string>
+                       <string>Generic</string>
                        <key>DialMode</key>
                        <string>WaitForDialTone</string>
                        <key>ErrorCorrection</key>
                        <key>DialMode</key>
                        <string>WaitForDialTone</string>
                        <key>ErrorCorrection</key>
                <key>WWAN</key>
                <dict>
                        <key>ConnectionScript</key>
                <key>WWAN</key>
                <dict>
                        <key>ConnectionScript</key>
-                       <string>/Library/Modem Scripts/WWAN Support</string>
+                       <string>/Library/Modem Scripts/WWAN.ccl</string>
                        <key>DataCompression</key>
                        <integer>1</integer>
                        <key>DialMode</key>
                        <key>DataCompression</key>
                        <integer>1</integer>
                        <key>DialMode</key>
                </dict>
                <key>Ethernet</key>
                <dict>
                </dict>
                <key>Ethernet</key>
                <dict>
-                       <key>AppleTalk</key>
-                       <dict>
-                               <key>ConfigMethod</key>
-                               <string>Node</string>
-                               <key>__INACTIVE__</key>
-                               <true/>
-                       </dict>
                        <key>DNS</key>
                        <dict/>
                        <key>IPv4</key>
                        <key>DNS</key>
                        <dict/>
                        <key>IPv4</key>
                </dict>
                <key>IEEE80211</key>
                <dict>
                </dict>
                <key>IEEE80211</key>
                <dict>
-                       <key>AppleTalk</key>
-                       <dict>
-                               <key>ConfigMethod</key>
-                               <string>Node</string>
-                               <key>__INACTIVE__</key>
-                               <true/>
-                       </dict>
                        <key>DNS</key>
                        <dict/>
                        <key>IPv4</key>
                        <key>DNS</key>
                        <dict/>
                        <key>IPv4</key>
                                <integer>1</integer>
                        </dict>
                </dict>
                                <integer>1</integer>
                        </dict>
                </dict>
+               <key>IPSec-IPv4</key>
+               <dict>
+                       <key>DNS</key>
+                       <dict/>
+                       <key>IPv4</key>
+                       <dict>
+                               <key>ConfigMethod</key>
+                               <string>Automatic</string>
+                       </dict>
+                       <key>Proxies</key>
+                       <dict>
+                               <key>ExceptionList</key>
+                               <array>
+                                       <string>*.local</string>
+                                       <string>169.254/16</string>
+                               </array>
+                               <key>FTPPassive</key>
+                               <integer>1</integer>
+                       </dict>
+               </dict>
+               <key>L2TP-IPv4</key>
+               <dict/>
                <key>PPP-Bluetooth</key>
                <dict>
                        <key>DNS</key>
                <key>PPP-Bluetooth</key>
                <dict>
                        <key>DNS</key>
                </dict>
                <key>PPTP-IPv4</key>
                <dict/>
                </dict>
                <key>PPTP-IPv4</key>
                <dict/>
-               <key>PPTP-L2TP</key>
-               <dict/>
                <key>VLAN</key>
                <dict>
                        <key>DNS</key>
                <key>VLAN</key>
                <dict>
                        <key>DNS</key>
index 797571d2b14acd69a89246dcc1d542e9e21b2301..070ff01943f6b0db675a898a43b578eb97d62faf 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include "SCDynamicStoreInternal.h"
 #include "config.h"            /* MiG generated file */
 
 #include "SCDynamicStoreInternal.h"
 #include "config.h"            /* MiG generated file */
 
+
 /* framework variables */
 /* framework variables */
-Boolean        _sc_debug       = FALSE;        /* TRUE if debugging enabled */
-Boolean        _sc_verbose     = FALSE;        /* TRUE if verbose logging enabled */
-Boolean        _sc_log         = TRUE;         /* TRUE if SCLog() output goes to syslog */
+int    _sc_debug       = FALSE;        /* non-zero if debugging enabled */
+int    _sc_verbose     = FALSE;        /* non-zero if verbose logging enabled */
+int    _sc_log         = TRUE;         /* 0 if SC messages should be written to stdout/stderr,
+                                          1 if SC messages should be logged w/asl(3),
+                                          2 if SC messages should be written to stdout/stderr AND logged */
 
 
-static const struct sc_errmsg {
-       int     status;
-       char    *message;
-} sc_errmsgs[] = {
-       { kSCStatusAccessError,         "Permission denied" },
-       { kSCStatusFailed,              "Failed!" },
-       { kSCStatusInvalidArgument,     "Invalid argument" },
-       { kSCStatusKeyExists,           "Key already defined" },
-       { kSCStatusLocked,              "Lock already held" },
-       { kSCStatusMaxLink,             "Maximum link count exceeded" },
-       { kSCStatusNeedLock,            "Lock required for this operation" },
-       { kSCStatusNoStoreServer,       "Configuration daemon not (no longer) available" },
-       { kSCStatusNoStoreSession,      "Configuration daemon session not active" },
-       { kSCStatusNoConfigFile,        "Configuration file not found" },
-       { kSCStatusNoKey,               "No such key" },
-       { kSCStatusNoLink,              "No such link" },
-       { kSCStatusNoPrefsSession,      "Preference session not active" },
-       { kSCStatusNotifierActive,      "Notifier is currently active" },
-       { kSCStatusOK,                  "Success!" },
-       { kSCStatusPrefsBusy,           "Preferences update currently in progress" },
-       { kSCStatusReachabilityUnknown, "Network reachability cannot be determined" },
-       { kSCStatusStale,               "Write attempted on stale version of object" },
-};
-#define nSC_ERRMSGS (sizeof(sc_errmsgs)/sizeof(struct sc_errmsg))
 
 
+#pragma mark -
+#pragma mark Thread specific data
 
 
-#define        USE_SCCOPYDESCRIPTION
-#ifdef USE_SCCOPYDESCRIPTION
 
 
-// from <CoreFoundation/CFVeryPrivate.h>
-extern CFStringRef _CFStringCreateWithFormatAndArgumentsAux(CFAllocatorRef alloc, CFStringRef (*copyDescFunc)(void *, CFDictionaryRef), CFDictionaryRef formatOptions, CFStringRef format, va_list arguments);
+typedef struct {
+       aslclient       _asl;
+       int             _sc_error;
+} __SCThreadSpecificData, *__SCThreadSpecificDataRef;
+
+
+static pthread_once_t  tsKeyInitialized        = PTHREAD_ONCE_INIT;
+static pthread_key_t   tsDataKey;
 
 
-#define        N_QUICK 32
 
 
-static CFStringRef
-_SCCopyDescription(void *info, CFDictionaryRef formatOptions)
+static void
+__SCThreadSpecificDataFinalize(void *arg)
 {
 {
+       __SCThreadSpecificDataRef       tsd = (__SCThreadSpecificDataRef)arg;
+
+       if (tsd != NULL) {
+               if (tsd->_asl    != NULL) asl_close(tsd->_asl);
+               CFAllocatorDeallocate(kCFAllocatorSystemDefault, tsd);
+       }
+       return;
+}
+
+
+static void
+__SCThreadSpecificKeyInitialize()
+{
+       pthread_key_create(&tsDataKey, __SCThreadSpecificDataFinalize);
+       return;
+}
+
+
+static __SCThreadSpecificDataRef
+__SCGetThreadSpecificData()
+{
+       __SCThreadSpecificDataRef       tsd;
+
+       pthread_once(&tsKeyInitialized, __SCThreadSpecificKeyInitialize);
+
+       tsd = pthread_getspecific(tsDataKey);
+       if (tsd == NULL) {
+               tsd = CFAllocatorAllocate(kCFAllocatorSystemDefault, sizeof(__SCThreadSpecificData), 0);
+               tsd->_asl = asl_open(NULL, NULL, 0);
+               asl_set_filter(tsd->_asl, ASL_FILTER_MASK_UPTO(ASL_LEVEL_DEBUG));
+               tsd->_sc_error = kSCStatusOK;
+               pthread_setspecific(tsDataKey, tsd);
+       }
+
+       return tsd;
+}
+
+
+#pragma mark -
+#pragma mark Logging
+
+
+#define        ENABLE_SC_FORMATTING
+#ifdef ENABLE_SC_FORMATTING
+// from <CoreFoundation/ForFoundationOnly.h>
+extern CFStringRef _CFStringCreateWithFormatAndArgumentsAux(CFAllocatorRef alloc, CFStringRef (*copyDescFunc)(CFTypeRef, CFDictionaryRef), CFDictionaryRef formatOptions, CFStringRef format, va_list arguments);
+#endif /* ENABLE_SC_FORMATTING */
+
+
+CFStringRef
+_SCCopyDescription(CFTypeRef cf, CFDictionaryRef formatOptions)
+{
+#ifdef ENABLE_SC_FORMATTING
        CFMutableDictionaryRef  nFormatOptions;
        CFStringRef             prefix1;
        CFStringRef             prefix2;
        CFMutableDictionaryRef  nFormatOptions;
        CFStringRef             prefix1;
        CFStringRef             prefix2;
-       CFTypeID                type    = CFGetTypeID(info);
+       CFTypeID                type    = CFGetTypeID(cf);
 
        if (!formatOptions ||
            !CFDictionaryGetValueIfPresent(formatOptions, CFSTR("PREFIX1"), (const void **)&prefix1)) {
 
        if (!formatOptions ||
            !CFDictionaryGetValueIfPresent(formatOptions, CFSTR("PREFIX1"), (const void **)&prefix1)) {
@@ -99,7 +136,7 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions)
                                                formatOptions,
                                                CFSTR("%@%@"),
                                                prefix1,
                                                formatOptions,
                                                CFSTR("%@%@"),
                                                prefix1,
-                                               info);
+                                               cf);
        }
 
        if (type == CFBooleanGetTypeID()) {
        }
 
        if (type == CFBooleanGetTypeID()) {
@@ -107,7 +144,7 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions)
                                                formatOptions,
                                                CFSTR("%@%s"),
                                                prefix1,
                                                formatOptions,
                                                CFSTR("%@%s"),
                                                prefix1,
-                                               CFBooleanGetValue(info) ? "TRUE" : "FALSE");
+                                               CFBooleanGetValue(cf) ? "TRUE" : "FALSE");
        }
 
        if (type == CFDataGetTypeID()) {
        }
 
        if (type == CFDataGetTypeID()) {
@@ -119,8 +156,8 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions)
                str = CFStringCreateMutable(NULL, 0);
                CFStringAppendFormat(str, formatOptions, CFSTR("%@<data> 0x"), prefix1);
 
                str = CFStringCreateMutable(NULL, 0);
                CFStringAppendFormat(str, formatOptions, CFSTR("%@<data> 0x"), prefix1);
 
-               data    = CFDataGetBytePtr(info);
-               dataLen = CFDataGetLength(info);
+               data    = CFDataGetBytePtr(cf);
+               dataLen = CFDataGetLength(cf);
                for (i = 0; i < dataLen; i++) {
                        CFStringAppendFormat(str, NULL, CFSTR("%02x"), data[i]);
                }
                for (i = 0; i < dataLen; i++) {
                        CFStringAppendFormat(str, NULL, CFSTR("%02x"), data[i]);
                }
@@ -133,7 +170,7 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions)
                                                formatOptions,
                                                CFSTR("%@%@"),
                                                prefix1,
                                                formatOptions,
                                                CFSTR("%@%@"),
                                                prefix1,
-                                               info);
+                                               cf);
        }
 
        if (type == CFDateGetTypeID()) {
        }
 
        if (type == CFDateGetTypeID()) {
@@ -142,7 +179,7 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions)
                CFTimeZoneRef   tZone;
 
                tZone = CFTimeZoneCopySystem();
                CFTimeZoneRef   tZone;
 
                tZone = CFTimeZoneCopySystem();
-               gDate = CFAbsoluteTimeGetGregorianDate(CFDateGetAbsoluteTime(info), tZone);
+               gDate = CFAbsoluteTimeGetGregorianDate(CFDateGetAbsoluteTime(cf), tZone);
                str   = CFStringCreateWithFormat(NULL,
                                                formatOptions,
                                                CFSTR("%@%02d/%02d/%04d %02d:%02d:%02.0f %@"),
                str   = CFStringCreateWithFormat(NULL,
                                                formatOptions,
                                                CFSTR("%@%02d/%02d/%04d %02d:%02d:%02.0f %@"),
@@ -160,7 +197,7 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions)
 
        if (!formatOptions ||
            !CFDictionaryGetValueIfPresent(formatOptions, CFSTR("PREFIX2"), (const void **)&prefix2)) {
 
        if (!formatOptions ||
            !CFDictionaryGetValueIfPresent(formatOptions, CFSTR("PREFIX2"), (const void **)&prefix2)) {
-               prefix2 = CFStringCreateCopy(NULL, prefix1);
+               prefix2 = prefix1;
        }
 
        if (formatOptions) {
        }
 
        if (formatOptions) {
@@ -172,8 +209,10 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions)
                                                           &kCFTypeDictionaryValueCallBacks);
        }
 
                                                           &kCFTypeDictionaryValueCallBacks);
        }
 
+#define        N_QUICK 32
+
        if (type == CFArrayGetTypeID()) {
        if (type == CFArrayGetTypeID()) {
-               const void *            elements_q[32];
+               const void *            elements_q[N_QUICK];
                const void **           elements        = elements_q;
                CFIndex                 i;
                CFIndex                 nElements;
                const void **           elements        = elements_q;
                CFIndex                 i;
                CFIndex                 nElements;
@@ -182,11 +221,11 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions)
                str = CFStringCreateMutable(NULL, 0);
                CFStringAppendFormat(str, formatOptions, CFSTR("%@<array> {"), prefix1);
 
                str = CFStringCreateMutable(NULL, 0);
                CFStringAppendFormat(str, formatOptions, CFSTR("%@<array> {"), prefix1);
 
-               nElements = CFArrayGetCount(info);
+               nElements = CFArrayGetCount(cf);
                if (nElements > 0) {
                        if (nElements > (CFIndex)(sizeof(elements_q)/sizeof(CFTypeRef)))
                                elements  = CFAllocatorAllocate(NULL, nElements * sizeof(CFTypeRef), 0);
                if (nElements > 0) {
                        if (nElements > (CFIndex)(sizeof(elements_q)/sizeof(CFTypeRef)))
                                elements  = CFAllocatorAllocate(NULL, nElements * sizeof(CFTypeRef), 0);
-                       CFArrayGetValues(info, CFRangeMake(0, nElements), elements);
+                       CFArrayGetValues(cf, CFRangeMake(0, nElements), elements);
                        for (i = 0; i < nElements; i++) {
                                CFMutableStringRef      nPrefix1;
                                CFMutableStringRef      nPrefix2;
                        for (i = 0; i < nElements; i++) {
                                CFMutableStringRef      nPrefix1;
                                CFMutableStringRef      nPrefix2;
@@ -213,7 +252,7 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions)
                                CFRelease(nPrefix2);
                                CFRelease(nStr);
 
                                CFRelease(nPrefix2);
                                CFRelease(nStr);
 
-                               vStr = _SCCopyDescription((void *)elements[i], nFormatOptions);
+                               vStr = _SCCopyDescription((CFTypeRef)elements[i], nFormatOptions);
                                CFStringAppendFormat(str,
                                                     formatOptions,
                                                     CFSTR("\n%@"),
                                CFStringAppendFormat(str,
                                                     formatOptions,
                                                     CFSTR("\n%@"),
@@ -242,18 +281,18 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions)
                str = CFStringCreateMutable(NULL, 0);
                CFStringAppendFormat(str, formatOptions, CFSTR("%@<dictionary> {"), prefix1);
 
                str = CFStringCreateMutable(NULL, 0);
                CFStringAppendFormat(str, formatOptions, CFSTR("%@<dictionary> {"), prefix1);
 
-               nElements = CFDictionaryGetCount(info);
+               nElements = CFDictionaryGetCount(cf);
                if (nElements > 0) {
                        if (nElements > (CFIndex)(sizeof(keys_q) / sizeof(CFTypeRef))) {
                                keys   = CFAllocatorAllocate(NULL, nElements * sizeof(CFTypeRef), 0);
                                values = CFAllocatorAllocate(NULL, nElements * sizeof(CFTypeRef), 0);
                        }
                if (nElements > 0) {
                        if (nElements > (CFIndex)(sizeof(keys_q) / sizeof(CFTypeRef))) {
                                keys   = CFAllocatorAllocate(NULL, nElements * sizeof(CFTypeRef), 0);
                                values = CFAllocatorAllocate(NULL, nElements * sizeof(CFTypeRef), 0);
                        }
-                       CFDictionaryGetKeysAndValues(info, keys, values);
+                       CFDictionaryGetKeysAndValues(cf, keys, values);
                        for (i = 0; i < nElements; i++) {
                                CFStringRef             kStr;
                                CFStringRef             vStr;
 
                        for (i = 0; i < nElements; i++) {
                                CFStringRef             kStr;
                                CFStringRef             vStr;
 
-                               kStr = _SCCopyDescription((void *)keys[i], NULL);
+                               kStr = _SCCopyDescription((CFTypeRef)keys[i], NULL);
 
                                nPrefix1 = CFStringCreateMutable(NULL, 0);
                                CFStringAppendFormat(nPrefix1,
 
                                nPrefix1 = CFStringCreateMutable(NULL, 0);
                                CFStringAppendFormat(nPrefix1,
@@ -273,7 +312,7 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions)
                                CFRelease(nPrefix2);
                                CFRelease(kStr);
 
                                CFRelease(nPrefix2);
                                CFRelease(kStr);
 
-                               vStr = _SCCopyDescription((void *)values[i], nFormatOptions);
+                               vStr = _SCCopyDescription((CFTypeRef)values[i], nFormatOptions);
                                CFStringAppendFormat(str,
                                                     formatOptions,
                                                     CFSTR("\n%@"),
                                CFStringAppendFormat(str,
                                                     formatOptions,
                                                     CFSTR("\n%@"),
@@ -292,70 +331,75 @@ _SCCopyDescription(void *info, CFDictionaryRef formatOptions)
        }
 
        CFRelease(nFormatOptions);
        }
 
        CFRelease(nFormatOptions);
+#endif /* ENABLE_SC_FORMATTING */
 
 
-       {
-               CFStringRef     cfStr;
-               CFStringRef     str;
-
-               cfStr = CFCopyDescription(info);
-               str = CFStringCreateWithFormat(NULL,
-                                              formatOptions,
-                                              CFSTR("%@%@"),
-                                              prefix1,
-                                              cfStr);
-               CFRelease(cfStr);
-               return str;
-       }
+       return CFStringCreateWithFormat(NULL,
+                                       formatOptions,
+                                       CFSTR("%@%@"),
+                                       prefix1,
+                                       cf);
 }
 
 }
 
-#endif /* USE_SCCOPYDESCRIPTION */
-
 
 static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
 
 
 static void
 
 static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
 
 
 static void
-__SCLog(int level, CFStringRef formatString, va_list formatArguments)
+__SCLog(aslclient asl, aslmsg msg, int level, CFStringRef formatString, va_list formatArguments)
 {
 {
+       CFDataRef       line;
        CFArrayRef      lines;
        CFStringRef     str;
 
        CFArrayRef      lines;
        CFStringRef     str;
 
-#ifdef USE_SCCOPYDESCRIPTION
+       if (asl == NULL) {
+               __SCThreadSpecificDataRef       tsd;
+
+               tsd = __SCGetThreadSpecificData();
+               asl = tsd->_asl;
+       }
+
+#ifdef ENABLE_SC_FORMATTING
        str = _CFStringCreateWithFormatAndArgumentsAux(NULL,
                                                       _SCCopyDescription,
                                                       NULL,
                                                       formatString,
                                                       formatArguments);
        str = _CFStringCreateWithFormatAndArgumentsAux(NULL,
                                                       _SCCopyDescription,
                                                       NULL,
                                                       formatString,
                                                       formatArguments);
-#else  /* USE_SCCOPYDESCRIPTION */
+#else  /* ENABLE_SC_FORMATTING */
        str =  CFStringCreateWithFormatAndArguments   (NULL,
                                                       NULL,
                                                       formatString,
                                                       formatArguments);
        str =  CFStringCreateWithFormatAndArguments   (NULL,
                                                       NULL,
                                                       formatString,
                                                       formatArguments);
-#endif /* !USE_SCCOPYDESCRIPTION */
-
-       lines = CFStringCreateArrayBySeparatingStrings(NULL, str, CFSTR("\n"));
-       CFRelease(str);
-
-       if (lines) {
-               int     i;
-               int     n       = CFArrayGetCount(lines);
-
-               pthread_mutex_lock(&lock);
-               for (i = 0; i < n; i++) {
-                       CFDataRef       line;
-
-                       line = CFStringCreateExternalRepresentation(NULL,
-                                                                   CFArrayGetValueAtIndex(lines, i),
-                                                                   kCFStringEncodingUTF8,
-                                                                   (UInt8)'?');
-                       if (line) {
-                               syslog (level, "%.*s", (int)CFDataGetLength(line), CFDataGetBytePtr(line));
-                               CFRelease(line);
+#endif /* !ENABLE_SC_FORMATTING */
+
+       if (level >= 0) {
+               lines = CFStringCreateArrayBySeparatingStrings(NULL, str, CFSTR("\n"));
+               if (lines != NULL) {
+                       int     i;
+                       int     n       = CFArrayGetCount(lines);
+
+                       for (i = 0; i < n; i++) {
+                               line = CFStringCreateExternalRepresentation(NULL,
+                                                                           CFArrayGetValueAtIndex(lines, i),
+                                                                           kCFStringEncodingUTF8,
+                                                                           (UInt8)'?');
+                               if (line) {
+                                       asl_log(asl, msg, level, "%.*s", (int)CFDataGetLength(line), CFDataGetBytePtr(line));
+                                       CFRelease(line);
+                               }
                        }
                        }
+                       CFRelease(lines);
+               }
+       } else {
+               line = CFStringCreateExternalRepresentation(NULL,
+                                                           str,
+                                                           kCFStringEncodingUTF8,
+                                                           (UInt8)'?');
+               if (line) {
+                       asl_log(asl, msg, ~level, "%.*s", (int)CFDataGetLength(line), CFDataGetBytePtr(line));
+                       CFRelease(line);
                }
                }
-               pthread_mutex_unlock(&lock);
-               CFRelease(lines);
        }
        }
+       CFRelease(str);
 
        return;
 }
 
        return;
 }
@@ -367,18 +411,18 @@ __SCPrint(FILE *stream, CFStringRef formatString, va_list formatArguments, Boole
        CFDataRef       line;
        CFStringRef     str;
 
        CFDataRef       line;
        CFStringRef     str;
 
-#ifdef USE_SCCOPYDESCRIPTION
+#ifdef ENABLE_SC_FORMATTING
        str = _CFStringCreateWithFormatAndArgumentsAux(NULL,
                                                       _SCCopyDescription,
                                                       NULL,
                                                       formatString,
                                                       formatArguments);
        str = _CFStringCreateWithFormatAndArgumentsAux(NULL,
                                                       _SCCopyDescription,
                                                       NULL,
                                                       formatString,
                                                       formatArguments);
-#else  /* USE_SCCOPYDESCRIPTION */
+#else  /* ENABLE_SC_FORMATTING */
        str =  CFStringCreateWithFormatAndArguments   (NULL,
                                                       NULL,
                                                       formatString,
                                                       formatArguments);
        str =  CFStringCreateWithFormatAndArguments   (NULL,
                                                       NULL,
                                                       formatString,
                                                       formatArguments);
-#endif /* !USE_SCCOPYDESCRIPTION */
+#endif /* !ENABLE_SC_FORMATTING */
 
        line = CFStringCreateExternalRepresentation(NULL,
                                                    str,
 
        line = CFStringCreateExternalRepresentation(NULL,
                                                    str,
@@ -422,7 +466,7 @@ SCLog(Boolean condition, int level, CFStringRef formatString, ...)
 
        va_start(formatArguments, formatString);
        if (_sc_log > 0) {
 
        va_start(formatArguments, formatString);
        if (_sc_log > 0) {
-               __SCLog(level, formatString, formatArguments);
+               __SCLog(NULL, NULL, level, formatString, formatArguments);
        }
        if (_sc_log != 1) {
                __SCPrint((LOG_PRI(level) > LOG_NOTICE) ? stderr : stdout,
        }
        if (_sc_log != 1) {
                __SCPrint((LOG_PRI(level) > LOG_NOTICE) ? stderr : stdout,
@@ -437,6 +481,31 @@ SCLog(Boolean condition, int level, CFStringRef formatString, ...)
 }
 
 
 }
 
 
+void
+SCLOG(aslclient asl, aslmsg msg, int level, CFStringRef formatString, ...)
+{
+       va_list         formatArguments;
+
+       va_start(formatArguments, formatString);
+       if (_sc_log > 0) {
+               __SCLog(asl, msg, level, formatString, formatArguments);
+       }
+       if (_sc_log != 1) {
+               if (level < 0) {
+                       level = ~level;
+               }
+               __SCPrint((level > ASL_LEVEL_NOTICE) ? stderr : stdout,
+                         formatString,
+                         formatArguments,
+                         (_sc_log > 0),        // trace
+                         TRUE);                // add newline
+       }
+       va_end(formatArguments);
+
+       return;
+}
+
+
 void
 SCPrint(Boolean condition, FILE *stream, CFStringRef formatString, ...)
 {
 void
 SCPrint(Boolean condition, FILE *stream, CFStringRef formatString, ...)
 {
@@ -471,36 +540,38 @@ SCTrace(Boolean condition, FILE *stream, CFStringRef formatString, ...)
 }
 
 
 }
 
 
-typedef struct {
-       int     _sc_error;
-} __SCThreadSpecificData, *__SCThreadSpecificDataRef;
-
-
-static pthread_once_t  tsKeyInitialized        = PTHREAD_ONCE_INIT;
-static pthread_key_t   tsDataKey;
+#pragma mark -
+#pragma mark SC error handling / logging
 
 
 
 
-static void
-__SCThreadSpecificDataFinalize(void *arg)
-{
-       __SCThreadSpecificDataRef       tsd = (__SCThreadSpecificDataRef)arg;
-
-       if (!tsd) return;
-
-       CFAllocatorDeallocate(kCFAllocatorSystemDefault, tsd);
-       return;
-}
-
-
-static void
-__SCThreadSpecificKeyInitialize()
-{
-       pthread_key_create(&tsDataKey, __SCThreadSpecificDataFinalize);
-       return;
-}
+const CFStringRef kCFErrorDomainSystemConfiguration    = CFSTR("com.apple.SystemConfiguration");
 
 
 
 
-const CFStringRef kCFErrorDomainSystemConfiguration    = CFSTR("com.apple.SystemConfiguration");
+static const struct sc_errmsg {
+       int     status;
+       char    *message;
+} sc_errmsgs[] = {
+       { kSCStatusAccessError,         "Permission denied" },
+       { kSCStatusConnectionNoService, "Network service for connection not available" },
+       { kSCStatusFailed,              "Failed!" },
+       { kSCStatusInvalidArgument,     "Invalid argument" },
+       { kSCStatusKeyExists,           "Key already defined" },
+       { kSCStatusLocked,              "Lock already held" },
+       { kSCStatusMaxLink,             "Maximum link count exceeded" },
+       { kSCStatusNeedLock,            "Lock required for this operation" },
+       { kSCStatusNoStoreServer,       "Configuration daemon not (no longer) available" },
+       { kSCStatusNoStoreSession,      "Configuration daemon session not active" },
+       { kSCStatusNoConfigFile,        "Configuration file not found" },
+       { kSCStatusNoKey,               "No such key" },
+       { kSCStatusNoLink,              "No such link" },
+       { kSCStatusNoPrefsSession,      "Preference session not active" },
+       { kSCStatusNotifierActive,      "Notifier is currently active" },
+       { kSCStatusOK,                  "Success!" },
+       { kSCStatusPrefsBusy,           "Preferences update currently in progress" },
+       { kSCStatusReachabilityUnknown, "Network reachability cannot be determined" },
+       { kSCStatusStale,               "Write attempted on stale version of object" },
+};
+#define nSC_ERRMSGS (sizeof(sc_errmsgs)/sizeof(struct sc_errmsg))
 
 
 void
 
 
 void
@@ -508,15 +579,7 @@ _SCErrorSet(int error)
 {
        __SCThreadSpecificDataRef       tsd;
 
 {
        __SCThreadSpecificDataRef       tsd;
 
-       pthread_once(&tsKeyInitialized, __SCThreadSpecificKeyInitialize);
-
-       tsd = pthread_getspecific(tsDataKey);
-       if (!tsd) {
-               tsd = CFAllocatorAllocate(kCFAllocatorSystemDefault, sizeof(__SCThreadSpecificData), 0);
-               bzero(tsd, sizeof(__SCThreadSpecificData));
-               pthread_setspecific(tsDataKey, tsd);
-       }
-
+       tsd = __SCGetThreadSpecificData();
        tsd->_sc_error = error;
        return;
 }
        tsd->_sc_error = error;
        return;
 }
@@ -532,10 +595,8 @@ SCCopyLastError(void)
        __SCThreadSpecificDataRef       tsd;
        CFMutableDictionaryRef          userInfo        = NULL;
 
        __SCThreadSpecificDataRef       tsd;
        CFMutableDictionaryRef          userInfo        = NULL;
 
-       pthread_once(&tsKeyInitialized, __SCThreadSpecificKeyInitialize);
-
-       tsd = pthread_getspecific(tsDataKey);
-       code = tsd ? tsd->_sc_error : kSCStatusOK;
+       tsd = __SCGetThreadSpecificData();
+       code =tsd->_sc_error;
 
        for (i = 0; i < (int)nSC_ERRMSGS; i++) {
                if (sc_errmsgs[i].status == code) {
 
        for (i = 0; i < (int)nSC_ERRMSGS; i++) {
                if (sc_errmsgs[i].status == code) {
@@ -563,7 +624,7 @@ SCCopyLastError(void)
        domain = kCFErrorDomainMach;
 
     done :
        domain = kCFErrorDomainMach;
 
     done :
-    
+
        error = CFErrorCreate(NULL, domain, code, userInfo);
        if (userInfo != NULL) CFRelease(userInfo);
        return error;
        error = CFErrorCreate(NULL, domain, code, userInfo);
        if (userInfo != NULL) CFRelease(userInfo);
        return error;
@@ -575,10 +636,8 @@ SCError(void)
 {
        __SCThreadSpecificDataRef       tsd;
 
 {
        __SCThreadSpecificDataRef       tsd;
 
-       pthread_once(&tsKeyInitialized, __SCThreadSpecificKeyInitialize);
-
-       tsd = pthread_getspecific(tsDataKey);
-       return tsd ? tsd->_sc_error : kSCStatusOK;
+       tsd = __SCGetThreadSpecificData();
+       return tsd->_sc_error;
 }
 
 
 }
 
 
index 16b464fd9892ff1b1a6d76ea3a9c59f86c506891..e22424a2f96ba97ade428342672d21c556546702 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -56,6 +56,7 @@ SCDynamicStoreAddTemporaryValue(SCDynamicStoreRef store, CFStringRef key, CFProp
        if (store == NULL) {
                /* sorry, you must provide a session */
                _SCErrorSet(kSCStatusNoStoreSession);
        if (store == NULL) {
                /* sorry, you must provide a session */
                _SCErrorSet(kSCStatusNoStoreSession);
+               return FALSE;
        }
 
        if (storePrivate->server == MACH_PORT_NULL) {
        }
 
        if (storePrivate->server == MACH_PORT_NULL) {
@@ -91,11 +92,13 @@ SCDynamicStoreAddTemporaryValue(SCDynamicStoreRef store, CFStringRef key, CFProp
        CFRelease(xmlData);
 
        if (status != KERN_SUCCESS) {
        CFRelease(xmlData);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreAddTemporaryValue configadd_s(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreAddTemporaryValue configadd_s(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
@@ -162,11 +165,13 @@ SCDynamicStoreAddValue(SCDynamicStoreRef store, CFStringRef key, CFPropertyListR
        CFRelease(xmlData);
 
        if (status != KERN_SUCCESS) {
        CFRelease(xmlData);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreAddValue configadd(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreAddValue configadd(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
index b114d132a2ca4b5491e59709aeeb865d885ad952..0504412e4d68013441cda23cdee524c053d77c9b 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -202,7 +202,7 @@ SCDynamicStoreSetConsoleInformation(SCDynamicStoreRef       store,
        CFStringRef             consoleUser;
        CFMutableDictionaryRef  dict            = NULL;
        CFStringRef             key             = SCDynamicStoreKeyCreateConsoleUser(NULL);
        CFStringRef             consoleUser;
        CFMutableDictionaryRef  dict            = NULL;
        CFStringRef             key             = SCDynamicStoreKeyCreateConsoleUser(NULL);
-       Boolean                 ok              = TRUE;
+       Boolean                 ok              = FALSE;
        Boolean                 tempSession     = FALSE;
 
        if (store == NULL) {
        Boolean                 tempSession     = FALSE;
 
        if (store == NULL) {
@@ -211,13 +211,13 @@ SCDynamicStoreSetConsoleInformation(SCDynamicStoreRef     store,
                                             NULL,
                                             NULL);
                if (store == NULL) {
                                             NULL,
                                             NULL);
                if (store == NULL) {
-                       return FALSE;
+                       goto done;
                }
                tempSession = TRUE;
        }
 
        if ((user == NULL) && (sessions == NULL)) {
                }
                tempSession = TRUE;
        }
 
        if ((user == NULL) && (sessions == NULL)) {
-               (void) SCDynamicStoreRemoveValue(store, key);
+               ok = SCDynamicStoreRemoveValue(store, key);
                goto done;
        }
 
                goto done;
        }
 
@@ -267,7 +267,7 @@ SCDynamicStoreSetConsoleUser(SCDynamicStoreRef      store,
        CFMutableDictionaryRef  dict            = NULL;
        CFStringRef             key             = SCDynamicStoreKeyCreateConsoleUser(NULL);
        CFNumberRef             num;
        CFMutableDictionaryRef  dict            = NULL;
        CFStringRef             key             = SCDynamicStoreKeyCreateConsoleUser(NULL);
        CFNumberRef             num;
-       Boolean                 ok              = TRUE;
+       Boolean                 ok              = FALSE;
        Boolean                 tempSession     = FALSE;
 
        if (store == NULL) {
        Boolean                 tempSession     = FALSE;
 
        if (store == NULL) {
@@ -276,13 +276,13 @@ SCDynamicStoreSetConsoleUser(SCDynamicStoreRef    store,
                                             NULL,
                                             NULL);
                if (store == NULL) {
                                             NULL,
                                             NULL);
                if (store == NULL) {
-                       return FALSE;
+                       goto done;
                }
                tempSession = TRUE;
        }
 
        if (user == NULL) {
                }
                tempSession = TRUE;
        }
 
        if (user == NULL) {
-               (void) SCDynamicStoreRemoveValue(store, key);
+               ok = SCDynamicStoreRemoveValue(store, key);
                goto done;
        }
 
                goto done;
        }
 
index b71e64542c967ce2c2987977816f5889b78c08f2..ba8673404c61b0989157006e2028d4c3ff4d981b 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -102,24 +102,20 @@ SCDynamicStoreCopyMultiple(SCDynamicStoreRef      store,
        if (xmlPatterns)        CFRelease(xmlPatterns);
 
        if (status != KERN_SUCCESS) {
        if (xmlPatterns)        CFRelease(xmlPatterns);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreCopyMultiple configget_m(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreCopyMultiple configget_m(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return NULL;
        }
 
        if (sc_status != kSCStatusOK) {
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return NULL;
        }
 
        if (sc_status != kSCStatusOK) {
-               status = vm_deallocate(mach_task_self(), (vm_address_t)xmlDictRef, xmlDictLen);
-#ifdef DEBUG
-               if (status != KERN_SUCCESS) {
-                       SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreCopyMultiple vm_deallocate(): %s"), mach_error_string(status));
-                       /* non-fatal???, proceed */
-               }
-#endif /* DEBUG */
+               (void) vm_deallocate(mach_task_self(), (vm_address_t)xmlDictRef, xmlDictLen);
                _SCErrorSet(sc_status);
                return NULL;
        }
                _SCErrorSet(sc_status);
                return NULL;
        }
@@ -181,24 +177,20 @@ SCDynamicStoreCopyValue(SCDynamicStoreRef store, CFStringRef key)
        CFRelease(utfKey);
 
        if (status != KERN_SUCCESS) {
        CFRelease(utfKey);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreCopyValue configget(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreCopyValue configget(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return NULL;
        }
 
        if (sc_status != kSCStatusOK) {
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return NULL;
        }
 
        if (sc_status != kSCStatusOK) {
-               status = vm_deallocate(mach_task_self(), (vm_address_t)xmlDataRef, xmlDataLen);
-#ifdef DEBUG
-               if (status != KERN_SUCCESS) {
-                       SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreCopyValue vm_deallocate(): %s"), mach_error_string(status));
-                       /* non-fatal???, proceed */
-               }
-#endif /* DEBUG */
+               (void) vm_deallocate(mach_task_self(), (vm_address_t)xmlDataRef, xmlDataLen);
                _SCErrorSet(sc_status);
                return NULL;
        }
                _SCErrorSet(sc_status);
                return NULL;
        }
index 112b43267ad77dc646b01be07ffd5ef133dcb574..3a0e61f714c4bd8b7411a94a0d18a0ac5610e961 100644 (file)
@@ -482,12 +482,14 @@ _SC_stringIsValidDNSName(const char *name)
                } else if (isalnum(ch) == 0) {
                        switch (ch) {
                                case '.':
                } else if (isalnum(ch) == 0) {
                        switch (ch) {
                                case '.':
-                               case '-':
-                                       if (prev == '.' || prev == '-') {
-                                               /* a label cannot begin or end with a hyphen */
+                                       if (prev == '.') {
+                                               /* no empty labels */
                                                return FALSE;
                                        }
                                        break;
                                                return FALSE;
                                        }
                                        break;
+                               case '-':
+                                       /* hyphens are OK within a label */
+                                       break;
                                default:
                                        /* an invalid character */
                                        return FALSE;
                                default:
                                        /* an invalid character */
                                        return FALSE;
index f193b7c2dbd91d4b0933ba2890e45cf9bdb5b9da..7659c0f244a08e28a2ef23b80d435f1335b01026 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -82,24 +82,20 @@ SCDynamicStoreCopyKeyList(SCDynamicStoreRef store, CFStringRef pattern)
        CFRelease(utfPattern);
 
        if (status != KERN_SUCCESS) {
        CFRelease(utfPattern);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreCopyKeyList configlist(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreCopyKeyList configlist(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return NULL;
        }
 
        if (sc_status != kSCStatusOK) {
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return NULL;
        }
 
        if (sc_status != kSCStatusOK) {
-               status = vm_deallocate(mach_task_self(), (vm_address_t)xmlDataRef, xmlDataLen);
-#ifdef DEBUG
-               if (status != KERN_SUCCESS) {
-                       SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreCopyKeyList vm_deallocate(): %s"), mach_error_string(status));
-                       /* non-fatal???, proceed */
-               }
-#endif /* DEBUG */
+               (void) vm_deallocate(mach_task_self(), (vm_address_t)xmlDataRef, xmlDataLen);
                _SCErrorSet(sc_status);
                return NULL;
        }
                _SCErrorSet(sc_status);
                return NULL;
        }
index c3f5d2222e0812ebba85cc2027ecac07f1b961b3..291cb3289471fcbeedd7619ff11b1da7007ae8c5 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -62,11 +62,13 @@ SCDynamicStoreLock(SCDynamicStoreRef store)
        status = configlock(storePrivate->server, (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
        status = configlock(storePrivate->server, (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreLock configlock(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreLock configlock(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
index 063ef9db622f2ded12448f7f4669bd7b5edadc6f..7e587212fec455f4fcbe22ba2b8adb6e12374ab9 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -78,11 +78,13 @@ SCDynamicStoreAddWatchedKey(SCDynamicStoreRef store, CFStringRef key, Boolean is
        CFRelease(utfKey);
 
        if (status != KERN_SUCCESS) {
        CFRelease(utfKey);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreAddWatchedKey notifyadd(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreAddWatchedKey notifyadd(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
index 450f1b997cbe2ded76829804d125764df1474a97..fa290e92ad968050d05bdcbc5db9d814d223bc6c 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2008, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -67,17 +67,22 @@ SCDynamicStoreNotifyCancel(SCDynamicStoreRef store)
                        return TRUE;
                case Using_NotifierInformViaCallback :
                        /* invalidate and release the run loop source */
                        return TRUE;
                case Using_NotifierInformViaCallback :
                        /* invalidate and release the run loop source */
-                       CFRunLoopSourceInvalidate(storePrivate->callbackRLS);
-                       CFRelease(storePrivate->callbackRLS);
-                       storePrivate->callbackRLS = NULL;
+                       if (storePrivate->callbackRLS != NULL) {
+                               CFRunLoopSourceInvalidate(storePrivate->callbackRLS);
+                               CFRelease(storePrivate->callbackRLS);
+                               storePrivate->callbackRLS = NULL;
+                       }
 
                        /* invalidate and release the callback mach port */
 
                        /* invalidate and release the callback mach port */
-                       CFMachPortInvalidate(storePrivate->callbackPort);
-                       CFRelease(storePrivate->callbackPort);
-                       storePrivate->callbackPort              = NULL;
+                       if (storePrivate->callbackPort != NULL) {
+                               __MACH_PORT_DEBUG(TRUE, "*** SCDynamicStoreNotifyCancel", CFMachPortGetPort(storePrivate->callbackPort));
+                               CFMachPortInvalidate(storePrivate->callbackPort);
+                               CFRelease(storePrivate->callbackPort);
+                               storePrivate->callbackPort = NULL;
+                       }
 
 
-                       storePrivate->callbackArgument          = NULL;
-                       storePrivate->callbackFunction          = NULL;
+                       storePrivate->callbackArgument  = NULL;
+                       storePrivate->callbackFunction  = NULL;
                        break;
                default :
                        break;
                        break;
                default :
                        break;
@@ -89,11 +94,13 @@ SCDynamicStoreNotifyCancel(SCDynamicStoreRef store)
        storePrivate->notifyStatus = NotifierNotRegistered;
 
        if (status != KERN_SUCCESS) {
        storePrivate->notifyStatus = NotifierNotRegistered;
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyCancel notifycancel(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyCancel notifycancel(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
index 04dc9b554868e96ccfd075fc62d3791011d22a21..a30209199f69596fba0ec1e807c9ceeeaf451b07 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2003-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -67,24 +67,20 @@ SCDynamicStoreCopyNotifiedKeys(SCDynamicStoreRef store)
                               (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
                               (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreCopyNotifiedKeys notifychanges(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreCopyNotifiedKeys notifychanges(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return NULL;
        }
 
        if (sc_status != kSCStatusOK) {
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return NULL;
        }
 
        if (sc_status != kSCStatusOK) {
-               status = vm_deallocate(mach_task_self(), (vm_address_t)xmlDataRef, xmlDataLen);
-#ifdef DEBUG
-               if (status != KERN_SUCCESS) {
-                       SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreCopyNotifiedKeys vm_deallocate(): %s"), mach_error_string(status));
-                       /* non-fatal???, proceed */
-               }
-#endif /* DEBUG */
+               (void) vm_deallocate(mach_task_self(), (vm_address_t)xmlDataRef, xmlDataLen);
                _SCErrorSet(sc_status);
                return NULL;
        }
                _SCErrorSet(sc_status);
                return NULL;
        }
index aa1faefa97065fa6a71402c35444781108d359a1..3e22cc407c8df528fea93b9a51c535d077388d27 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2008, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  * - initial revision
  */
 
  * - initial revision
  */
 
+#include <Availability.h>
+#include <TargetConditionals.h>
+#include <sys/cdefs.h>
+#if    !TARGET_OS_IPHONE
+#include <dispatch/dispatch.h>
+#endif // !TARGET_OS_IPHONE
 #include <mach/mach.h>
 #include <mach/mach_error.h>
 
 #include <mach/mach.h>
 #include <mach/mach_error.h>
 
@@ -39,6 +45,7 @@
 #include "SCDynamicStoreInternal.h"
 #include "config.h"            /* MiG generated file */
 
 #include "SCDynamicStoreInternal.h"
 #include "config.h"            /* MiG generated file */
 
+
 static void
 informCallback(CFMachPortRef port, void *msg, CFIndex size, void *info)
 {
 static void
 informCallback(CFMachPortRef port, void *msg, CFIndex size, void *info)
 {
@@ -82,19 +89,24 @@ informCallback(CFMachPortRef port, void *msg, CFIndex size, void *info)
 #endif /* DEBUG */
 
        /* invalidate the run loop source */
 #endif /* DEBUG */
 
        /* invalidate the run loop source */
-       CFRunLoopSourceInvalidate(storePrivate->callbackRLS);
-       CFRelease(storePrivate->callbackRLS);
-       storePrivate->callbackRLS = NULL;
+       if (storePrivate->callbackRLS != NULL) {
+               CFRunLoopSourceInvalidate(storePrivate->callbackRLS);
+               CFRelease(storePrivate->callbackRLS);
+               storePrivate->callbackRLS = NULL;
+       }
 
        /* invalidate port */
 
        /* invalidate port */
-       CFMachPortInvalidate(storePrivate->callbackPort);
-       CFRelease(storePrivate->callbackPort);
-       storePrivate->callbackPort              = NULL;
+       if (storePrivate->callbackPort != NULL) {
+               __MACH_PORT_DEBUG(TRUE, "*** informCallback", CFMachPortGetPort(storePrivate->callbackPort));
+               CFMachPortInvalidate(storePrivate->callbackPort);
+               CFRelease(storePrivate->callbackPort);
+               storePrivate->callbackPort = NULL;
+       }
 
        /* disable notifier */
 
        /* disable notifier */
-       storePrivate->notifyStatus              = NotifierNotRegistered;
-       storePrivate->callbackArgument          = NULL;
-       storePrivate->callbackFunction          = NULL;
+       storePrivate->notifyStatus      = NotifierNotRegistered;
+       storePrivate->callbackArgument  = NULL;
+       storePrivate->callbackFunction  = NULL;
 
        return;
 }
 
        return;
 }
@@ -149,13 +161,29 @@ SCDynamicStoreNotifyCallback(SCDynamicStoreRef            store,
        }
 
        /* Allocating port (for server response) */
        }
 
        /* Allocating port (for server response) */
-       storePrivate->callbackPort = CFMachPortCreate(NULL,
-                                                     informCallback,
-                                                     &context,
-                                                     NULL);
+       status = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &port);
+       if (status != KERN_SUCCESS) {
+               SCLog(TRUE, LOG_ERR, CFSTR("mach_port_allocate(): %s"), mach_error_string(status));
+               _SCErrorSet(status);
+               return FALSE;
+       }
+
+       status = mach_port_insert_right(mach_task_self(),
+                                       port,
+                                       port,
+                                       MACH_MSG_TYPE_MAKE_SEND);
+       if (status != KERN_SUCCESS) {
+               /*
+                * We can't insert a send right into our own port!  This should
+                * only happen if someone stomped on OUR port (so let's leave
+                * the port alone).
+                */
+               SCLog(TRUE, LOG_ERR, CFSTR("mach_port_insert_right(): %s"), mach_error_string(status));
+               _SCErrorSet(status);
+               return FALSE;
+       }
 
        /* Request a notification when/if the server dies */
 
        /* Request a notification when/if the server dies */
-       port = CFMachPortGetPort(storePrivate->callbackPort);
        status = mach_port_request_notification(mach_task_self(),
                                                port,
                                                MACH_NOTIFY_NO_SENDERS,
        status = mach_port_request_notification(mach_task_self(),
                                                port,
                                                MACH_NOTIFY_NO_SENDERS,
@@ -164,18 +192,19 @@ SCDynamicStoreNotifyCallback(SCDynamicStoreRef            store,
                                                MACH_MSG_TYPE_MAKE_SEND_ONCE,
                                                &oldNotify);
        if (status != KERN_SUCCESS) {
                                                MACH_MSG_TYPE_MAKE_SEND_ONCE,
                                                &oldNotify);
        if (status != KERN_SUCCESS) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyCallback mach_port_request_notification(): %s"), mach_error_string(status));
-               CFMachPortInvalidate(storePrivate->callbackPort);
-               CFRelease(storePrivate->callbackPort);
+               /*
+                * We can't request a notification for our own port!  This should
+                * only happen if someone stomped on OUR port (so let's leave
+                * the port alone).
+                */
+               SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyCallback mach_port_request_notification(): %s"), mach_error_string(status));
                _SCErrorSet(status);
                return FALSE;
        }
 
                _SCErrorSet(status);
                return FALSE;
        }
 
-#ifdef DEBUG
        if (oldNotify != MACH_PORT_NULL) {
        if (oldNotify != MACH_PORT_NULL) {
-               SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyCallback(): why is oldNotify != MACH_PORT_NULL?"));
+               SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyCallback(): oldNotify != MACH_PORT_NULL"));
        }
        }
-#endif /* DEBUG */
 
        /* Requesting notification via mach port */
        status = notifyviaport(storePrivate->server,
 
        /* Requesting notification via mach port */
        status = notifyviaport(storePrivate->server,
@@ -184,14 +213,22 @@ SCDynamicStoreNotifyCallback(SCDynamicStoreRef            store,
                               (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
                               (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyCallback notifyviaport(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               CFMachPortInvalidate(storePrivate->callbackPort);
-               CFRelease(storePrivate->callbackPort);
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyCallback notifyviaport(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                storePrivate->server = MACH_PORT_NULL;
+
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* remove the send right that we tried (but failed) to pass to the server */
+                       (void) mach_port_deallocate(mach_task_self(), port);
+               }
+
+               /* remove our receive right  */
+               (void) mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, -1);
                _SCErrorSet(status);
                return FALSE;
        }
                _SCErrorSet(status);
                return FALSE;
        }
@@ -202,11 +239,13 @@ SCDynamicStoreNotifyCallback(SCDynamicStoreRef            store,
        }
 
        /* set notifier active */
        }
 
        /* set notifier active */
-       storePrivate->notifyStatus              = Using_NotifierInformViaCallback;
+       storePrivate->notifyStatus      = Using_NotifierInformViaCallback;
 
        /* Creating/adding a run loop source for the port */
 
        /* Creating/adding a run loop source for the port */
+       __MACH_PORT_DEBUG(TRUE, "*** SCDynamicStoreNotifyCallback", port);
        storePrivate->callbackArgument  = arg;
        storePrivate->callbackFunction  = func;
        storePrivate->callbackArgument  = arg;
        storePrivate->callbackFunction  = func;
+       storePrivate->callbackPort      = CFMachPortCreateWithPort(NULL, port, informCallback, &context, NULL);
        storePrivate->callbackRLS       = CFMachPortCreateRunLoopSource(NULL, storePrivate->callbackPort, 0);
        CFRunLoopAddSource(runLoop, storePrivate->callbackRLS, kCFRunLoopDefaultMode);
 
        storePrivate->callbackRLS       = CFMachPortCreateRunLoopSource(NULL, storePrivate->callbackPort, 0);
        CFRunLoopAddSource(runLoop, storePrivate->callbackRLS, kCFRunLoopDefaultMode);
 
@@ -235,33 +274,38 @@ rlsCallback(CFMachPortRef port, void *msg, CFIndex size, void *info)
 #endif /* DEBUG */
 
                /* invalidate the run loop source(s) */
 #endif /* DEBUG */
 
                /* invalidate the run loop source(s) */
-               CFRunLoopSourceInvalidate(storePrivate->callbackRLS);
-               CFRelease(storePrivate->callbackRLS);
-               storePrivate->callbackRLS = NULL;
+               if (storePrivate->callbackRLS != NULL) {
+                       CFRunLoopSourceInvalidate(storePrivate->callbackRLS);
+                       CFRelease(storePrivate->callbackRLS);
+                       storePrivate->callbackRLS = NULL;
+               }
 
                /* invalidate port */
 
                /* invalidate port */
-               CFMachPortInvalidate(storePrivate->callbackPort);
-               CFRelease(storePrivate->callbackPort);
-               storePrivate->callbackPort = NULL;
+               if (storePrivate->callbackPort != NULL) {
+                       __MACH_PORT_DEBUG(TRUE, "*** rlsCallback w/MACH_NOTIFY_NO_SENDERS", CFMachPortGetPort(storePrivate->callbackPort));
+                       CFMachPortInvalidate(storePrivate->callbackPort);
+                       CFRelease(storePrivate->callbackPort);
+                       storePrivate->callbackPort = NULL;
+               }
 
                return;
        }
 
        /* signal the real runloop source */
 
                return;
        }
 
        /* signal the real runloop source */
-       CFRunLoopSourceSignal(storePrivate->rls);
+       if (storePrivate->rls != NULL) {
+               CFRunLoopSourceSignal(storePrivate->rls);
+       }
        return;
 }
 
 
 static void
        return;
 }
 
 
 static void
-rlsPortInvalidate(CFMachPortRef mp, void *info) {
-       mach_port_t     port    = CFMachPortGetPort(mp);
+portInvalidate(CFMachPortRef port, void *info) {
+       mach_port_t     mp      = CFMachPortGetPort(port);
 
 
-       // A simple deallocate won't get rid of all the references we've accumulated
-#ifdef DEBUG
-       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("  invalidate = %d"), port);
-#endif /* DEBUG */
-       (void)mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, -1);
+       __MACH_PORT_DEBUG(TRUE, "*** portInvalidate", mp);
+       /* remove our receive right  */
+       (void)mach_port_mod_refs(mach_task_self(), mp, MACH_PORT_RIGHT_RECEIVE, -1);
 }
 
 
 }
 
 
@@ -272,7 +316,9 @@ rlsSchedule(void *info, CFRunLoopRef rl, CFStringRef mode)
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
 
 #ifdef DEBUG
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
 
 #ifdef DEBUG
-       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("schedule notifications for mode %@"), mode);
+       SCLog(_sc_verbose, LOG_DEBUG,
+             CFSTR("schedule notifications for mode %@"),
+             (rl != NULL) ? mode : CFSTR("libdispatch"));
 #endif /* DEBUG */
 
        if (storePrivate->rlsRefs++ == 0) {
 #endif /* DEBUG */
 
        if (storePrivate->rlsRefs++ == 0) {
@@ -294,7 +340,7 @@ rlsSchedule(void *info, CFRunLoopRef rl, CFStringRef mode)
                /* Allocating port (for server response) */
                status = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &port);
                if (status != KERN_SUCCESS) {
                /* Allocating port (for server response) */
                status = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &port);
                if (status != KERN_SUCCESS) {
-                       SCLog(TRUE, LOG_DEBUG, CFSTR("mach_port_allocate(): %s"), mach_error_string(status));
+                       SCLog(TRUE, LOG_ERR, CFSTR("rlsSchedule mach_port_allocate(): %s"), mach_error_string(status));
                        return;
                }
 
                        return;
                }
 
@@ -303,8 +349,12 @@ rlsSchedule(void *info, CFRunLoopRef rl, CFStringRef mode)
                                                port,
                                                MACH_MSG_TYPE_MAKE_SEND);
                if (status != KERN_SUCCESS) {
                                                port,
                                                MACH_MSG_TYPE_MAKE_SEND);
                if (status != KERN_SUCCESS) {
-                       SCLog(TRUE, LOG_DEBUG, CFSTR("mach_port_insert_right(): %s"), mach_error_string(status));
-                       (void) mach_port_destroy(mach_task_self(), port);
+                       /*
+                        * We can't insert a send right into our own port!  This should
+                        * only happen if someone stomped on OUR port (so let's leave
+                        * the port alone).
+                        */
+                       SCLog(TRUE, LOG_ERR, CFSTR("rlsSchedule mach_port_insert_right(): %s"), mach_error_string(status));
                        return;
                }
 
                        return;
                }
 
@@ -317,37 +367,63 @@ rlsSchedule(void *info, CFRunLoopRef rl, CFStringRef mode)
                                                        MACH_MSG_TYPE_MAKE_SEND_ONCE,
                                                        &oldNotify);
                if (status != KERN_SUCCESS) {
                                                        MACH_MSG_TYPE_MAKE_SEND_ONCE,
                                                        &oldNotify);
                if (status != KERN_SUCCESS) {
-                       SCLog(TRUE, LOG_DEBUG, CFSTR("mach_port_request_notification(): %s"), mach_error_string(status));
-                       (void) mach_port_destroy(mach_task_self(), port);
+                       /*
+                        * We can't request a notification for our own port!  This should
+                        * only happen if someone stomped on OUR port (so let's leave
+                        * the port alone).
+                        */
+                       SCLog(TRUE, LOG_ERR, CFSTR("rlsSchedule mach_port_request_notification(): %s"), mach_error_string(status));
                        return;
                }
 
                        return;
                }
 
-#ifdef DEBUG
                if (oldNotify != MACH_PORT_NULL) {
                if (oldNotify != MACH_PORT_NULL) {
-                       SCLog(TRUE, LOG_ERR, CFSTR("rlsSchedule(): why is oldNotify != MACH_PORT_NULL?"));
+                       SCLog(TRUE, LOG_ERR, CFSTR("rlsSchedule(): oldNotify != MACH_PORT_NULL"));
                }
                }
-#endif /* DEBUG */
 
 
+               __MACH_PORT_DEBUG(TRUE, "*** rlsSchedule", port);
                status = notifyviaport(storePrivate->server, port, 0, (int *)&sc_status);
                if (status != KERN_SUCCESS) {
                status = notifyviaport(storePrivate->server, port, 0, (int *)&sc_status);
                if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-                       if (status != MACH_SEND_INVALID_DEST)
-                               SCLog(_sc_verbose, LOG_DEBUG, CFSTR("notifyviaport(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-                       (void) mach_port_destroy(mach_task_self(), port);
-                       port = MACH_PORT_NULL;
-                       (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+                       if (status == MACH_SEND_INVALID_DEST) {
+                               /* the server's gone and our session port's dead, remove the dead name right */
+                               (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+                       } else {
+                               /* we got an unexpected error, leave the [session] port alone */
+                               SCLog(TRUE, LOG_ERR, CFSTR("rlsSchedule notifyviaport(): %s"), mach_error_string(status));
+                       }
                        storePrivate->server = MACH_PORT_NULL;
                        storePrivate->server = MACH_PORT_NULL;
+
+                       if (status == MACH_SEND_INVALID_DEST) {
+                               /* remove the send right that we tried (but failed) to pass to the server */
+                               (void) mach_port_deallocate(mach_task_self(), port);
+                       }
+
+                       /* remove our receive right  */
+                       (void) mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, -1);
                        return;
                }
 
                        return;
                }
 
+               __MACH_PORT_DEBUG(TRUE, "*** rlsSchedule (after notifyviaport)", port);
                storePrivate->callbackPort = CFMachPortCreateWithPort(NULL, port, rlsCallback, &context, NULL);
                storePrivate->callbackPort = CFMachPortCreateWithPort(NULL, port, rlsCallback, &context, NULL);
-               CFMachPortSetInvalidationCallBack(storePrivate->callbackPort, rlsPortInvalidate);
+               if (storePrivate->callbackPort == NULL) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("*** CFMachPortCreateWithPort returned NULL while attempting to schedule"));
+                       SCLog(TRUE, LOG_ERR, CFSTR("*** a SCDynamicStore notification.  Did this process call \"fork\" without"));
+                       SCLog(TRUE, LOG_ERR, CFSTR("*** calling \"exec\""));
+
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+                       storePrivate->server = MACH_PORT_NULL;
+
+                       /* remove our receive right  */
+                       (void) mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, -1);
+                       return;
+               }
+               CFMachPortSetInvalidationCallBack(storePrivate->callbackPort, portInvalidate);
                storePrivate->callbackRLS = CFMachPortCreateRunLoopSource(NULL, storePrivate->callbackPort, 0);
        }
 
                storePrivate->callbackRLS = CFMachPortCreateRunLoopSource(NULL, storePrivate->callbackPort, 0);
        }
 
-       if (storePrivate->callbackRLS != NULL) {
+       if ((rl != NULL) && (storePrivate->callbackRLS != NULL)) {
                CFRunLoopAddSource(rl, storePrivate->callbackRLS, mode);
                CFRunLoopAddSource(rl, storePrivate->callbackRLS, mode);
+               __MACH_PORT_DEBUG(TRUE, "*** rlsSchedule (after CFRunLoopAddSource)", CFMachPortGetPort(storePrivate->callbackPort));
        }
 
        return;
        }
 
        return;
@@ -361,10 +437,12 @@ rlsCancel(void *info, CFRunLoopRef rl, CFStringRef mode)
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
 
 #ifdef DEBUG
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
 
 #ifdef DEBUG
-       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("cancel notifications for mode %@"), mode);
+       SCLog(_sc_verbose, LOG_DEBUG,
+             CFSTR("cancel notifications for mode %@"),
+             (rl != NULL) ? mode : CFSTR("libdispatch"));
 #endif /* DEBUG */
 
 #endif /* DEBUG */
 
-       if (storePrivate->callbackRLS != NULL) {
+       if ((rl != NULL) && (storePrivate->callbackRLS != NULL)) {
                CFRunLoopRemoveSource(rl, storePrivate->callbackRLS, mode);
        }
 
                CFRunLoopRemoveSource(rl, storePrivate->callbackRLS, mode);
        }
 
@@ -375,6 +453,9 @@ rlsCancel(void *info, CFRunLoopRef rl, CFStringRef mode)
 #ifdef DEBUG
                SCLog(_sc_verbose, LOG_DEBUG, CFSTR("  cancel callback runloop source"));
 #endif /* DEBUG */
 #ifdef DEBUG
                SCLog(_sc_verbose, LOG_DEBUG, CFSTR("  cancel callback runloop source"));
 #endif /* DEBUG */
+               __MACH_PORT_DEBUG((storePrivate->callbackPort != NULL),
+                                 "*** rlsCancel",
+                                 CFMachPortGetPort(storePrivate->callbackPort));
 
                if (storePrivate->callbackRLS != NULL) {
                        /* invalidate & remove the run loop source */
 
                if (storePrivate->callbackRLS != NULL) {
                        /* invalidate & remove the run loop source */
@@ -385,6 +466,9 @@ rlsCancel(void *info, CFRunLoopRef rl, CFStringRef mode)
 
                if (storePrivate->callbackPort != NULL) {
                        /* invalidate port */
 
                if (storePrivate->callbackPort != NULL) {
                        /* invalidate port */
+                       __MACH_PORT_DEBUG((storePrivate->callbackPort != NULL),
+                                         "*** rlsCancel (before invalidating CFMachPort)",
+                                         CFMachPortGetPort(storePrivate->callbackPort));
                        CFMachPortInvalidate(storePrivate->callbackPort);
                        CFRelease(storePrivate->callbackPort);
                        storePrivate->callbackPort = NULL;
                        CFMachPortInvalidate(storePrivate->callbackPort);
                        CFRelease(storePrivate->callbackPort);
                        storePrivate->callbackPort = NULL;
@@ -393,16 +477,19 @@ rlsCancel(void *info, CFRunLoopRef rl, CFStringRef mode)
                if (storePrivate->server != MACH_PORT_NULL) {
                        status = notifycancel(storePrivate->server, (int *)&sc_status);
                        if (status != KERN_SUCCESS) {
                if (storePrivate->server != MACH_PORT_NULL) {
                        status = notifycancel(storePrivate->server, (int *)&sc_status);
                        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-                               if (status != MACH_SEND_INVALID_DEST)
-                                       SCLog(_sc_verbose, LOG_INFO, CFSTR("notifycancel(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-                               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+                               if (status == MACH_SEND_INVALID_DEST) {
+                                       /* the server's gone and our session port's dead, remove the dead name right */
+                                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+                               } else {
+                                       /* we got an unexpected error, leave the [session] port alone */
+                                       SCLog(TRUE, LOG_ERR, CFSTR("rlsCancel notifycancel(): %s"), mach_error_string(status));
+                               }
                                storePrivate->server = MACH_PORT_NULL;
                                return;
                        }
                }
        }
                                storePrivate->server = MACH_PORT_NULL;
                                return;
                        }
                }
        }
+
        return;
 }
 
        return;
 }
 
@@ -433,7 +520,7 @@ rlsPerform(void *info)
 
        rlsFunction = storePrivate->rlsFunction;
 
 
        rlsFunction = storePrivate->rlsFunction;
 
-       if (NULL != storePrivate->rlsContext.retain) {
+       if (storePrivate->rlsContext.retain != NULL) {
                context_info    = (void *)storePrivate->rlsContext.retain(storePrivate->rlsContext.info);
                context_release = storePrivate->rlsContext.release;
        } else {
                context_info    = (void *)storePrivate->rlsContext.retain(storePrivate->rlsContext.info);
                context_release = storePrivate->rlsContext.release;
        } else {
@@ -489,8 +576,8 @@ rlsRelease(CFTypeRef cf)
 static CFStringRef
 rlsCopyDescription(const void *info)
 {
 static CFStringRef
 rlsCopyDescription(const void *info)
 {
-       CFMutableStringRef      result;
-       SCDynamicStoreRef       store           = (SCDynamicStoreRef)info;
+       CFMutableStringRef              result;
+       SCDynamicStoreRef               store           = (SCDynamicStoreRef)info;
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
 
        result = CFStringCreateMutable(NULL, 0);
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
 
        result = CFStringCreateMutable(NULL, 0);
@@ -568,12 +655,145 @@ SCDynamicStoreCreateRunLoopSource(CFAllocatorRef allocator,
                                                  };
 
                storePrivate->rls = CFRunLoopSourceCreate(allocator, order, &context);
                                                  };
 
                storePrivate->rls = CFRunLoopSourceCreate(allocator, order, &context);
+               if (storePrivate->rls == NULL) {
+                       _SCErrorSet(kSCStatusFailed);
+               }
        }
 
        }
 
-       if (storePrivate->rls == NULL) {
-               _SCErrorSet(kSCStatusFailed);
-               return NULL;
+       return storePrivate->rls;
+}
+
+
+#if    !TARGET_OS_IPHONE
+static boolean_t
+SCDynamicStoreNotifyMIGCallback(mach_msg_header_t *message, mach_msg_header_t *reply)
+{
+       SCDynamicStorePrivateRef        storePrivate;
+
+       storePrivate = dispatch_get_context(dispatch_get_current_queue());
+       if (storePrivate != NULL) {
+               CFRetain(storePrivate);
+               dispatch_async(storePrivate->dispatchQueue, ^{
+                       rlsPerform(storePrivate);
+                       CFRelease(storePrivate);
+               });
        }
        }
+       reply->msgh_remote_port = MACH_PORT_NULL;
+       return false;
+}
 
 
-       return storePrivate->rls;
+
+Boolean
+SCDynamicStoreSetDispatchQueue(SCDynamicStoreRef store, dispatch_queue_t queue)
+{
+       Boolean                         ok              = FALSE;
+       SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
+
+       if (store == NULL) {
+               /* sorry, you must provide a session */
+               _SCErrorSet(kSCStatusNoStoreSession);
+               return FALSE;
+       }
+
+       if (storePrivate->server == MACH_PORT_NULL) {
+               /* sorry, you must have an open session to play */
+               _SCErrorSet(kSCStatusNoStoreServer);
+               return FALSE;
+       }
+
+       if (queue != NULL) {
+               dispatch_queue_attr_t   attr;
+               mach_port_t             mp;
+               long                    res;
+
+               if ((storePrivate->dispatchQueue != NULL) || (storePrivate->rls != NULL)) {
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return FALSE;
+               }
+
+               if (storePrivate->notifyStatus != NotifierNotRegistered) {
+                       /* sorry, you can only have one notification registered at once... */
+                       _SCErrorSet(kSCStatusNotifierActive);
+                       return FALSE;
+               }
+
+               /*
+                * mark our using of the SCDynamicStore notifications, create and schedule
+                * the notification port (storePrivate->callbackPort), and a bunch of other
+                * "setup"
+                */
+               storePrivate->notifyStatus = Using_NotifierInformViaDispatch;
+               rlsSchedule((void*)store, NULL, NULL);
+               storePrivate->dispatchQueue = queue;
+               dispatch_retain(storePrivate->dispatchQueue);
+
+               /*
+                * create a queue for the mig source, we'll use this queue's context
+                * to carry the store pointer for the callback code.
+                */
+               attr = dispatch_queue_attr_create();
+               res = dispatch_queue_attr_set_finalizer(attr,
+                                                       ^(dispatch_queue_t dq) {
+                                                               SCDynamicStoreRef       store;
+
+                                                               store = (SCDynamicStoreRef)dispatch_get_context(dq);
+                                                               CFRelease(store);
+                                                       });
+               if (res != 0) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStore dispatch_queue_attr_set_finalizer() failed"));
+                       dispatch_release(attr);
+                       _SCErrorSet(kSCStatusFailed);
+                       goto cleanup;
+               }
+               storePrivate->callbackQueue = dispatch_queue_create("com.apple.SCDynamicStore.notifications", attr);
+               dispatch_release(attr);
+               if (storePrivate->callbackQueue == NULL){
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStore dispatch_queue_create() failed"));
+                       _SCErrorSet(kSCStatusFailed);
+                       goto cleanup;
+               }
+               CFRetain(store);        // Note: will be released when the dispatch queue is released
+               dispatch_set_context(storePrivate->callbackQueue, (void *)store);
+
+               dispatch_suspend(storePrivate->callbackQueue);
+               mp = CFMachPortGetPort(storePrivate->callbackPort);
+               storePrivate->callbackSource = dispatch_source_mig_create(mp, sizeof(mach_msg_header_t), NULL, storePrivate->callbackQueue, SCDynamicStoreNotifyMIGCallback);
+               if (storePrivate->callbackSource == NULL) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStore dispatch_source_mig_create() failed"));
+                       _SCErrorSet(kSCStatusFailed);
+                       goto cleanup;
+               }
+               dispatch_resume(storePrivate->callbackQueue);
+
+               ok = TRUE;
+               goto done;
+       } else {
+               if (storePrivate->dispatchQueue == NULL) {
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return FALSE;
+               }
+
+               ok = TRUE;
+       }
+
+    cleanup :
+
+       if (storePrivate->callbackSource != NULL) {
+               dispatch_cancel(storePrivate->callbackSource);
+               dispatch_release(storePrivate->callbackSource);
+               storePrivate->callbackSource = NULL;
+       }
+       if (storePrivate->callbackQueue != NULL) {
+               dispatch_release(storePrivate->callbackQueue);
+               storePrivate->callbackQueue = NULL;
+       }
+       dispatch_release(storePrivate->dispatchQueue);
+       storePrivate->dispatchQueue = NULL;
+       rlsCancel((void*)store, NULL, NULL);
+       storePrivate->notifyStatus = NotifierNotRegistered;
+
+    done :
+
+       return ok;
 }
 }
+#endif // !TARGET_OS_IPHONE
index 54fac507e3a601e4af1c45227810f61dc6e14ad4..221181cb97add1cb3f33c25c7b79c58916962e33 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005, 2008, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -50,11 +50,13 @@ SCDynamicStoreNotifyFileDescriptor(SCDynamicStoreRef        store,
                                   int32_t              identifier,
                                   int                  *fd)
 {
                                   int32_t              identifier,
                                   int                  *fd)
 {
+       size_t                          n;
+       int                             sc_status;
+       int                             sock;
        SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
        kern_return_t                   status;
        SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
        kern_return_t                   status;
-       int                             sc_status;
+       char                            tmpdir[PATH_MAX];
        struct sockaddr_un              un;
        struct sockaddr_un              un;
-       int                             sock;
 
        if (store == NULL) {
                /* sorry, you must provide a session */
 
        if (store == NULL) {
                /* sorry, you must provide a session */
@@ -81,18 +83,29 @@ SCDynamicStoreNotifyFileDescriptor(SCDynamicStoreRef        store,
        }
 
        /* establish a UNIX domain socket for server->client notification */
        }
 
        /* establish a UNIX domain socket for server->client notification */
+
+       n = confstr(_CS_DARWIN_USER_TEMP_DIR, tmpdir, sizeof(tmpdir));
+       if ((n <= 0) || (n >= sizeof(tmpdir))) {
+               (void) strlcpy(tmpdir, _PATH_TMP, sizeof(tmpdir));
+       }
+
        bzero(&un, sizeof(un));
        un.sun_family = AF_UNIX;
        snprintf(un.sun_path,
                 sizeof(un.sun_path)-1,
        bzero(&un, sizeof(un));
        un.sun_family = AF_UNIX;
        snprintf(un.sun_path,
                 sizeof(un.sun_path)-1,
-                "%s%s-%d",
-                _PATH_VARTMP,
+                "%s%s-%d-%d",
+                tmpdir,
                 "SCDynamicStoreNotifyFileDescriptor",
                 "SCDynamicStoreNotifyFileDescriptor",
+                getpid(),
                 storePrivate->server);
 
                 storePrivate->server);
 
+       /* ensure that the path does not already exist */
+       (void) unlink(un.sun_path);
+
        if (bind(sock, (struct sockaddr *)&un, sizeof(un)) == -1) {
                _SCErrorSet(errno);
                SCLog(TRUE, LOG_NOTICE, CFSTR("SCDynamicStoreNotifyFileDescriptor bind(): %s"), strerror(errno));
        if (bind(sock, (struct sockaddr *)&un, sizeof(un)) == -1) {
                _SCErrorSet(errno);
                SCLog(TRUE, LOG_NOTICE, CFSTR("SCDynamicStoreNotifyFileDescriptor bind(): %s"), strerror(errno));
+               (void) unlink(un.sun_path);
                (void) close(sock);
                return FALSE;
        }
                (void) close(sock);
                return FALSE;
        }
@@ -100,6 +113,7 @@ SCDynamicStoreNotifyFileDescriptor(SCDynamicStoreRef        store,
        if (listen(sock, 0) == -1) {
                _SCErrorSet(errno);
                SCLog(TRUE, LOG_NOTICE, CFSTR("SCDynamicStoreNotifyFileDescriptor listen(): %s"), strerror(errno));
        if (listen(sock, 0) == -1) {
                _SCErrorSet(errno);
                SCLog(TRUE, LOG_NOTICE, CFSTR("SCDynamicStoreNotifyFileDescriptor listen(): %s"), strerror(errno));
+               (void) unlink(un.sun_path);
                (void) close(sock);
                return FALSE;
        }
                (void) close(sock);
                return FALSE;
        }
@@ -111,16 +125,29 @@ SCDynamicStoreNotifyFileDescriptor(SCDynamicStoreRef      store,
                             (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
                             (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyFileDescriptor notifyviafd(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyFileDescriptor notifyviafd(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
        }
 
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
        }
 
+       (void) unlink(un.sun_path);
+
+       if (sc_status != kSCStatusOK) {
+               _SCErrorSet(sc_status);
+               SCLog(TRUE, LOG_NOTICE,
+                     CFSTR("SCDynamicStoreNotifyFileDescriptor server error: %s"),
+                     SCErrorString(sc_status));
+               (void) close(sock);
+               return FALSE;
+       }
+
        *fd = accept(sock, 0, 0);
        if (*fd == -1) {
                _SCErrorSet(errno);
        *fd = accept(sock, 0, 0);
        if (*fd == -1) {
                _SCErrorSet(errno);
index ded7a256a4269dd2314affe68ec239b0b81c8d19..9e6a5320da114e733d5a2374f9d24c37ccbe204b 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005, 2009 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -68,7 +68,7 @@ SCDynamicStoreNotifyMachPort(SCDynamicStoreRef store, mach_msg_id_t identifier,
        /* Allocating port (for server response) */
        status = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, port);
        if (status != KERN_SUCCESS) {
        /* Allocating port (for server response) */
        status = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, port);
        if (status != KERN_SUCCESS) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyMachPort mach_port_allocate(): %s"), mach_error_string(status));
+               SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyMachPort mach_port_allocate(): %s"), mach_error_string(status));
                _SCErrorSet(status);
                return FALSE;
        }
                _SCErrorSet(status);
                return FALSE;
        }
@@ -78,8 +78,12 @@ SCDynamicStoreNotifyMachPort(SCDynamicStoreRef store, mach_msg_id_t identifier,
                                        *port,
                                        MACH_MSG_TYPE_MAKE_SEND);
        if (status != KERN_SUCCESS) {
                                        *port,
                                        MACH_MSG_TYPE_MAKE_SEND);
        if (status != KERN_SUCCESS) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyMachPort mach_port_insert_right(): %s"), mach_error_string(status));
-               (void) mach_port_destroy(mach_task_self(), *port);
+               /*
+                * We can't insert a send right into our own port!  This should
+                * only happen if someone stomped on OUR port (so let's leave
+                * the port alone).
+                */
+               SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyMachPort mach_port_insert_right(): %s"), mach_error_string(status));
                *port = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
                *port = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
@@ -94,18 +98,20 @@ SCDynamicStoreNotifyMachPort(SCDynamicStoreRef store, mach_msg_id_t identifier,
                                                MACH_MSG_TYPE_MAKE_SEND_ONCE,
                                                &oldNotify);
        if (status != KERN_SUCCESS) {
                                                MACH_MSG_TYPE_MAKE_SEND_ONCE,
                                                &oldNotify);
        if (status != KERN_SUCCESS) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyMachPort mach_port_request_notification(): %s"), mach_error_string(status));
-               (void) mach_port_destroy(mach_task_self(), *port);
+               /*
+                * We can't request a notification for our own port!  This should
+                * only happen if someone stomped on OUR port (so let's leave
+                * the port alone).
+                */
+               SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyMachPort mach_port_request_notification(): %s"), mach_error_string(status));
                *port = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
        }
 
                *port = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
        }
 
-#ifdef DEBUG
        if (oldNotify != MACH_PORT_NULL) {
        if (oldNotify != MACH_PORT_NULL) {
-               SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyMachPort(): why is oldNotify != MACH_PORT_NULL?"));
+               SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyMachPort(): oldNotify != MACH_PORT_NULL"));
        }
        }
-#endif /* DEBUG */
 
        status = notifyviaport(storePrivate->server,
                               *port,
 
        status = notifyviaport(storePrivate->server,
                               *port,
@@ -113,19 +119,29 @@ SCDynamicStoreNotifyMachPort(SCDynamicStoreRef store, mach_msg_id_t identifier,
                               (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
                               (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyMachPort notifyviaport(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), *port);
-               *port = MACH_PORT_NULL;
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyMachPort notifyviaport(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                storePrivate->server = MACH_PORT_NULL;
+
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* remove the send right that we tried (but failed) to pass to the server */
+                       (void) mach_port_deallocate(mach_task_self(), *port);
+               }
+
+               /* remove our receive right  */
+               (void) mach_port_mod_refs(mach_task_self(), *port, MACH_PORT_RIGHT_RECEIVE, -1);
+               *port = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
        }
 
        /* set notifier active */
                _SCErrorSet(status);
                return FALSE;
        }
 
        /* set notifier active */
+       __MACH_PORT_DEBUG(TRUE, "*** SCDynamicStoreNotifyMachPort", *port);
        storePrivate->notifyStatus = Using_NotifierInformViaMachPort;
 
        return TRUE;
        storePrivate->notifyStatus = Using_NotifierInformViaMachPort;
 
        return TRUE;
index 22986dcd815e5a593865edb2b54ca36ef66eaf49..495d79b7116911296e91bd78d0a62c1b0fe57e1f 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -75,11 +75,13 @@ SCDynamicStoreNotifySignal(SCDynamicStoreRef store, pid_t pid, int sig)
        status = notifyviasignal(storePrivate->server, task, sig, (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
        status = notifyviasignal(storePrivate->server, task, sig, (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreNotifySignal notifyviasignal(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifySignal notifyviasignal(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
index c392f44ee0a6af2d261cb79a220bc0bcb46b2a84..42e3cd37426ed8b0ead1add536e6f873dd9e740a 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -78,11 +78,13 @@ SCDynamicStoreRemoveWatchedKey(SCDynamicStoreRef store, CFStringRef key, Boolean
        CFRelease(utfKey);
 
        if (status != KERN_SUCCESS) {
        CFRelease(utfKey);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreRemoveWatchedKey notifyremove(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreRemoveWatchedKey notifyremove(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
index 9ff03ff843cd3b9224618d3e8684c36eb6c12333..9343c99f454330c9f49fce87ce4681b48a2568ac 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2003-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -93,11 +93,13 @@ SCDynamicStoreSetNotificationKeys(SCDynamicStoreRef store,
        if (xmlPatterns)        CFRelease(xmlPatterns);
 
        if (status != KERN_SUCCESS) {
        if (xmlPatterns)        CFRelease(xmlPatterns);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreSetNotificationKeys notifyset(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreSetNotificationKeys notifyset(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
index 98ad13ddee2411eadef00c3fb6014c8cd362502b..8b654a2a36bdead98eae5e98f2d602937588c891 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2006, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -95,7 +95,7 @@ SCDynamicStoreNotifyWait(SCDynamicStoreRef store)
        /* Allocating port (for server response) */
        status = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &port);
        if (status != KERN_SUCCESS) {
        /* Allocating port (for server response) */
        status = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &port);
        if (status != KERN_SUCCESS) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyWait mach_port_allocate(): %s"), mach_error_string(status));
+               SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyWait mach_port_allocate(): %s"), mach_error_string(status));
                _SCErrorSet(status);
                return FALSE;
        }
                _SCErrorSet(status);
                return FALSE;
        }
@@ -105,8 +105,12 @@ SCDynamicStoreNotifyWait(SCDynamicStoreRef store)
                                        port,
                                        MACH_MSG_TYPE_MAKE_SEND);
        if (status != KERN_SUCCESS) {
                                        port,
                                        MACH_MSG_TYPE_MAKE_SEND);
        if (status != KERN_SUCCESS) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyWait mach_port_insert_right(): %s"), mach_error_string(status));
-               (void) mach_port_destroy(mach_task_self(), port);
+               /*
+                * We can't insert a send right into our own port!  This should
+                * only happen if someone stomped on OUR port (so let's leave
+                * the port alone).
+                */
+               SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyWait mach_port_insert_right(): %s"), mach_error_string(status));
                _SCErrorSet(status);
                return FALSE;
        }
                _SCErrorSet(status);
                return FALSE;
        }
@@ -120,17 +124,19 @@ SCDynamicStoreNotifyWait(SCDynamicStoreRef store)
                                                MACH_MSG_TYPE_MAKE_SEND_ONCE,
                                                &oldNotify);
        if (status != KERN_SUCCESS) {
                                                MACH_MSG_TYPE_MAKE_SEND_ONCE,
                                                &oldNotify);
        if (status != KERN_SUCCESS) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyWait mach_port_request_notification(): %s"), mach_error_string(status));
-               (void) mach_port_destroy(mach_task_self(), port);
+               /*
+                * We can't request a notification for our own port!  This should
+                * only happen if someone stomped on OUR port (so let's leave
+                * the port alone).
+                */
+               SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyWait mach_port_request_notification(): %s"), mach_error_string(status));
                _SCErrorSet(status);
                return FALSE;
        }
 
                _SCErrorSet(status);
                return FALSE;
        }
 
-#ifdef DEBUG
        if (oldNotify != MACH_PORT_NULL) {
        if (oldNotify != MACH_PORT_NULL) {
-               SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyWait(): why is oldNotify != MACH_PORT_NULL?"));
+               SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyWait(): oldNotify != MACH_PORT_NULL"));
        }
        }
-#endif /* DEBUG */
 
        status = notifyviaport(storePrivate->server,
                               port,
 
        status = notifyviaport(storePrivate->server,
                               port,
@@ -138,12 +144,22 @@ SCDynamicStoreNotifyWait(SCDynamicStoreRef store)
                               (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
                               (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(TRUE, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyWait notifyviaport(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyWait notifyviaport(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                storePrivate->server = MACH_PORT_NULL;
+
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* remove the send right that we tried (but failed) to pass to the server */
+                       (void) mach_port_deallocate(mach_task_self(), port);
+               }
+
+               /* remove our receive right  */
+               (void) mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, -1);
                _SCErrorSet(status);
                return FALSE;
        }
                _SCErrorSet(status);
                return FALSE;
        }
@@ -175,7 +191,7 @@ SCDynamicStoreNotifyWait(SCDynamicStoreRef store)
 #ifdef DEBUG
                SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyWait communication with server failed, destroying port %d"), port);
 #endif /* DEBUG */
 #ifdef DEBUG
                SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyWait communication with server failed, destroying port %d"), port);
 #endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), port);
+               (void) mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE , -1);
                _SCErrorSet(kSCStatusNoStoreServer);
                return FALSE;
        }
                _SCErrorSet(kSCStatusNoStoreServer);
                return FALSE;
        }
@@ -185,17 +201,22 @@ SCDynamicStoreNotifyWait(SCDynamicStoreRef store)
                              (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
                              (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyWait notifycancel(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyWait notifycancel(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                storePrivate->server = MACH_PORT_NULL;
+
+               /* remove our receive right  */
+               (void) mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE , -1);
                _SCErrorSet(status);
                return FALSE;
        }
 
                _SCErrorSet(status);
                return FALSE;
        }
 
-       (void) mach_port_destroy(mach_task_self(), port);
+       (void) mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE , -1);
 
        return TRUE;
 }
 
        return TRUE;
 }
index 14520e176344ebbc7bfe6ea05a3bd98dd8eaff6e..72f23b93b7568f36a36b67aa6a8e23b5403dd549 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2003-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -75,11 +75,13 @@ SCDynamicStoreNotifyValue(SCDynamicStoreRef store,
        CFRelease(utfKey);
 
        if (status != KERN_SUCCESS) {
        CFRelease(utfKey);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreNotifyValue confignotify(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreNotifyValue confignotify(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
index 8b2379fa967a047e8debed12055935a49b3b7fd9..77db1bb00fcedc5ffbfb3d1dbae1fbebbd927b8d 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2006, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -44,7 +44,6 @@
 #include "config.h"            /* MiG generated file */
 
 
 #include "config.h"            /* MiG generated file */
 
 
-static int             _sc_active      = 0;
 static CFStringRef     _sc_bundleID    = NULL;
 static pthread_mutex_t _sc_lock        = PTHREAD_MUTEX_INITIALIZER;
 static mach_port_t     _sc_server      = MACH_PORT_NULL;
 static CFStringRef     _sc_bundleID    = NULL;
 static pthread_mutex_t _sc_lock        = PTHREAD_MUTEX_INITIALIZER;
 static mach_port_t     _sc_server      = MACH_PORT_NULL;
@@ -113,7 +112,6 @@ __SCDynamicStoreDeallocate(CFTypeRef cf)
 {
        int                             oldThreadState;
        int                             sc_status;
 {
        int                             oldThreadState;
        int                             sc_status;
-       kern_return_t                   status;
        SCDynamicStoreRef               store           = (SCDynamicStoreRef)cf;
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
 
        SCDynamicStoreRef               store           = (SCDynamicStoreRef)cf;
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
 
@@ -127,15 +125,19 @@ __SCDynamicStoreDeallocate(CFTypeRef cf)
        }
 
        if (storePrivate->server != MACH_PORT_NULL) {
        }
 
        if (storePrivate->server != MACH_PORT_NULL) {
-               status = configclose(storePrivate->server, (int *)&sc_status);
-#ifdef DEBUG
-               if (status != KERN_SUCCESS) {
-                       if (status != MACH_SEND_INVALID_DEST)
-                               SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCDynamicStoreDeallocate configclose(): %s"), mach_error_string(status));
-               }
-#endif /* DEBUG */
-
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               __MACH_PORT_DEBUG(TRUE, "*** __SCDynamicStoreDeallocate", storePrivate->server);
+               (void) configclose(storePrivate->server, (int *)&sc_status);
+               __MACH_PORT_DEBUG(TRUE, "*** __SCDynamicStoreDeallocate (after configclose)", storePrivate->server);
+
+               /*
+                * the above call to configclose() should result in the SCDynamicStore
+                * server code deallocating it's receive right.  That, in turn, should
+                * result in our send becoming a dead name.  We could explicitly remove
+                * the dead name right with a call to mach_port_mod_refs() but, to be
+                * sure, we use mach_port_deallocate() since that will get rid of a
+                * send, send_once, or dead name right.
+                */
+               (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
                storePrivate->server = MACH_PORT_NULL;
        }
 
                storePrivate->server = MACH_PORT_NULL;
        }
 
@@ -151,16 +153,6 @@ __SCDynamicStoreDeallocate(CFTypeRef cf)
        CFRelease(storePrivate->keys);
        CFRelease(storePrivate->patterns);
 
        CFRelease(storePrivate->keys);
        CFRelease(storePrivate->patterns);
 
-       /* cleanup */
-       pthread_mutex_lock(&_sc_lock);
-       _sc_active--;                   /* drop the number of active dynamic store sessions */
-       if ((_sc_active == 0) && (_sc_server != MACH_PORT_NULL)) {
-               /* release the [last] reference to the server */
-               (void)mach_port_deallocate(mach_task_self(), _sc_server);
-               _sc_server = MACH_PORT_NULL;
-       }
-       pthread_mutex_unlock(&_sc_lock);
-
        return;
 }
 
        return;
 }
 
@@ -186,9 +178,7 @@ childForkHandler()
 {
        /* the process has forked (and we are the child process) */
 
 {
        /* the process has forked (and we are the child process) */
 
-       _sc_active = 0;
        _sc_server = MACH_PORT_NULL;
        _sc_server = MACH_PORT_NULL;
-
        return;
 }
 
        return;
 }
 
@@ -196,7 +186,8 @@ childForkHandler()
 static pthread_once_t initialized      = PTHREAD_ONCE_INIT;
 
 static void
 static pthread_once_t initialized      = PTHREAD_ONCE_INIT;
 
 static void
-__SCDynamicStoreInitialize(void) {
+__SCDynamicStoreInitialize(void)
+{
        CFBundleRef     bundle;
 
        /* register with CoreFoundation */
        CFBundleRef     bundle;
 
        /* register with CoreFoundation */
@@ -233,6 +224,38 @@ __SCDynamicStoreInitialize(void) {
 }
 
 
 }
 
 
+static mach_port_t
+__SCDynamicStoreServerPort(kern_return_t *status)
+{
+       mach_port_t     server  = MACH_PORT_NULL;
+       char            *server_name;
+
+       server_name = getenv("SCD_SERVER");
+       if (!server_name) {
+               server_name = SCD_SERVER;
+       }
+
+       *status = bootstrap_look_up(bootstrap_port, server_name, &server);
+       switch (*status) {
+               case BOOTSTRAP_SUCCESS :
+                       /* service currently registered, "a good thing" (tm) */
+                       return server;
+               case BOOTSTRAP_UNKNOWN_SERVICE :
+                       /* service not currently registered, try again later */
+                       break;
+               default :
+#ifdef DEBUG
+                       SCLog(_sc_verbose, LOG_DEBUG,
+                             CFSTR("SCDynamicStoreCreate[WithOptions] bootstrap_look_up() failed: status=%s"),
+                             bootstrap_strerror(*status));
+#endif /* DEBUG */
+                       break;
+       }
+
+       return MACH_PORT_NULL;
+}
+
+
 SCDynamicStorePrivateRef
 __SCDynamicStoreCreatePrivate(CFAllocatorRef           allocator,
                             const CFStringRef          name,
 SCDynamicStorePrivateRef
 __SCDynamicStoreCreatePrivate(CFAllocatorRef           allocator,
                             const CFStringRef          name,
@@ -305,45 +328,6 @@ __SCDynamicStoreCreatePrivate(CFAllocatorRef               allocator,
        storePrivate->notifySignal                      = 0;
        storePrivate->notifySignalTask                  = TASK_NULL;
 
        storePrivate->notifySignal                      = 0;
        storePrivate->notifySignalTask                  = TASK_NULL;
 
-       /* initialize global state */
-
-       pthread_mutex_lock(&_sc_lock);
-
-       /* get the server port */
-       if (_sc_server == MACH_PORT_NULL) {
-               char            *server_name;
-               kern_return_t   status;
-
-               server_name = getenv("SCD_SERVER");
-               if (!server_name) {
-                       server_name = SCD_SERVER;
-               }
-
-               status = bootstrap_look_up(bootstrap_port, server_name, &_sc_server);
-               switch (status) {
-                       case BOOTSTRAP_SUCCESS :
-                               /* service currently registered, "a good thing" (tm) */
-                               break;
-                       case BOOTSTRAP_UNKNOWN_SERVICE :
-                               /* service not currently registered, try again later */
-                               sc_status = status;
-                               goto done;
-                       default :
-#ifdef DEBUG
-                               SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreCreate[WithOptions] bootstrap_look_up() failed: status=%d"), status);
-#endif /* DEBUG */
-                               sc_status = status;
-                               goto done;
-               }
-       }
-
-       /* bump the number of active dynamic store sessions */
-       _sc_active++;
-
-    done :
-
-       pthread_mutex_unlock(&_sc_lock);
-
        if (sc_status != kSCStatusOK) {
                _SCErrorSet(sc_status);
                CFRelease(storePrivate);
        if (sc_status != kSCStatusOK) {
                _SCErrorSet(sc_status);
                CFRelease(storePrivate);
@@ -364,15 +348,16 @@ SCDynamicStoreCreateWithOptions(CFAllocatorRef            allocator,
                                SCDynamicStoreCallBack  callout,
                                SCDynamicStoreContext   *context)
 {
                                SCDynamicStoreCallBack  callout,
                                SCDynamicStoreContext   *context)
 {
+       int                             sc_status       = kSCStatusFailed;
+       mach_port_t                     server;
+       kern_return_t                   status          = KERN_SUCCESS;
        SCDynamicStorePrivateRef        storePrivate;
        SCDynamicStorePrivateRef        storePrivate;
-       kern_return_t                   status;
        CFDataRef                       utfName;                /* serialized name */
        xmlData_t                       myNameRef;
        CFIndex                         myNameLen;
        CFDataRef                       xmlOptions      = NULL; /* serialized options */
        xmlData_t                       myOptionsRef    = NULL;
        CFIndex                         myOptionsLen    = 0;
        CFDataRef                       utfName;                /* serialized name */
        xmlData_t                       myNameRef;
        CFIndex                         myNameLen;
        CFDataRef                       xmlOptions      = NULL; /* serialized options */
        xmlData_t                       myOptionsRef    = NULL;
        CFIndex                         myOptionsLen    = 0;
-       int                             sc_status       = kSCStatusFailed;
 
        /*
         * allocate and initialize a new session
 
        /*
         * allocate and initialize a new session
@@ -406,30 +391,61 @@ SCDynamicStoreCreateWithOptions(CFAllocatorRef            allocator,
        }
 
        /* open a new session with the server */
        }
 
        /* open a new session with the server */
-       status = configopen(_sc_server,
-                           myNameRef,
-                           myNameLen,
-                           myOptionsRef,
-                           myOptionsLen,
-                           &storePrivate->server,
-                           (int *)&sc_status);
+       server = _sc_server;
+       while (TRUE) {
+               if (server != MACH_PORT_NULL) {
+                       status = configopen(server,
+                                           myNameRef,
+                                           myNameLen,
+                                           myOptionsRef,
+                                           myOptionsLen,
+                                           &storePrivate->server,
+                                           (int *)&sc_status);
+                       if (status == KERN_SUCCESS) {
+                               break;
+                       }
+
+                       // our [cached] server port is not valid
+                       if (status != MACH_SEND_INVALID_DEST) {
+                               // if we got an unexpected error, don't retry
+                               sc_status = status;
+                               break;
+                       }
+               }
+
+               pthread_mutex_lock(&_sc_lock);
+               if (_sc_server != MACH_PORT_NULL) {
+                       if (server == _sc_server) {
+                               // if the server we tried returned the error
+                               (void)mach_port_deallocate(mach_task_self(), _sc_server);
+                               _sc_server = __SCDynamicStoreServerPort(&sc_status);
+                       } else {
+                               // another thread has refreshed the SCDynamicStore server port
+                       }
+               } else {
+                       _sc_server = __SCDynamicStoreServerPort(&sc_status);
+               }
+               server = _sc_server;
+               pthread_mutex_unlock(&_sc_lock);
+
+               if (server == MACH_PORT_NULL) {
+                       // if SCDynamicStore server not available
+                       break;
+               }
+       }
+       __MACH_PORT_DEBUG(TRUE, "*** SCDynamicStoreCreate[WithOptions]", storePrivate->server);
 
        /* clean up */
        CFRelease(utfName);
        if (xmlOptions) CFRelease(xmlOptions);
 
 
        /* clean up */
        CFRelease(utfName);
        if (xmlOptions) CFRelease(xmlOptions);
 
-       if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreCreate[WithOptions] configopen(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               sc_status = status;
-               goto done;
-       }
-
     done :
 
        if (sc_status != kSCStatusOK) {
     done :
 
        if (sc_status != kSCStatusOK) {
+               SCLog(TRUE,
+                     (status == KERN_SUCCESS) ? LOG_DEBUG : LOG_ERR,
+                     CFSTR("SCDynamicStoreCreate[WithOptions] configopen(): %s"),
+                     SCErrorString(sc_status));
                _SCErrorSet(sc_status);
                CFRelease(storePrivate);
                storePrivate = NULL;
                _SCErrorSet(sc_status);
                CFRelease(storePrivate);
                storePrivate = NULL;
index 368814980a8a280f507693ee03b53412209400d5..d41332b4f1622c88a69f0e4ca3ce547ec9fcd48c 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #include <mach/mach_error.h>
 #include <pthread.h>
 
 #include <mach/mach_error.h>
 #include <pthread.h>
 
+#include <execinfo.h>
+#include <libproc.h>
+#include <unistd.h>
+
 #define        N_QUICK 32
 
 
 #define        N_QUICK 32
 
 
@@ -60,7 +64,12 @@ _SC_cfstring_to_cstring(CFStringRef cfstr, char *buf, CFIndex bufLen, CFStringEn
 {
        CFIndex converted;
        CFIndex last    = 0;
 {
        CFIndex converted;
        CFIndex last    = 0;
-       CFIndex len     = CFStringGetLength(cfstr);
+       CFIndex len;
+
+       if (cfstr == NULL) {
+               cfstr = CFSTR("");
+       }
+       len = CFStringGetLength(cfstr);
 
        /* how much buffer space will we really need? */
        converted = CFStringGetBytes(cfstr,
 
        /* how much buffer space will we really need? */
        converted = CFStringGetBytes(cfstr,
@@ -326,7 +335,7 @@ _SCSerializeString(CFStringRef str, CFDataRef *data, void **dataRef, CFIndex *da
                *dataLen = CFDataGetLength(myData);
                status = vm_read(mach_task_self(),
                                 (vm_address_t)CFDataGetBytePtr(myData),        // address
                *dataLen = CFDataGetLength(myData);
                status = vm_read(mach_task_self(),
                                 (vm_address_t)CFDataGetBytePtr(myData),        // address
-                                (vm_size_t)   CFDataGetLength(myData),         // size
+                                *dataLen,                                      // size
                                 (void *)dataRef,
                                 &len);
                if (status != KERN_SUCCESS) {
                                 (void *)dataRef,
                                 &len);
                if (status != KERN_SUCCESS) {
@@ -387,7 +396,7 @@ _SCSerializeData(CFDataRef data, void **dataRef, CFIndex *dataLen)
        *dataLen = CFDataGetLength(data);
        status = vm_read(mach_task_self(),
                         (vm_address_t)CFDataGetBytePtr(data),  // address
        *dataLen = CFDataGetLength(data);
        status = vm_read(mach_task_self(),
                         (vm_address_t)CFDataGetBytePtr(data),  // address
-                        CFDataGetLength(data),                 // size
+                        *dataLen,                              // size
                         (void *)dataRef,
                         &len);
        if (status != KERN_SUCCESS) {
                         (void *)dataRef,
                         &len);
        if (status != KERN_SUCCESS) {
@@ -825,6 +834,7 @@ _SC_CFBundleCopyNonLocalizedString(CFBundleRef bundle, CFStringRef key, CFString
 #pragma mark DOS encoding/codepage
 
 
 #pragma mark DOS encoding/codepage
 
 
+#if    !TARGET_OS_IPHONE
 void
 _SC_dos_encoding_and_codepage(CFStringEncoding macEncoding,
                              UInt32            macRegion,
 void
 _SC_dos_encoding_and_codepage(CFStringEncoding macEncoding,
                              UInt32            macRegion,
@@ -911,209 +921,224 @@ _SC_dos_encoding_and_codepage(CFStringEncoding  macEncoding,
        *dosCodepage = CFStringConvertEncodingToWindowsCodepage(*dosEncoding);
        return;
 }
        *dosCodepage = CFStringConvertEncodingToWindowsCodepage(*dosEncoding);
        return;
 }
-
-
-#include <unicode/uset.h>
-#include <unicode/ucnv.h>
-
-
-CFDataRef
-_SC_dos_copy_string(CFStringRef str, CFStringEncoding dosEncoding, UInt32 dosCodepage)
-{
-       USet                    *charSet        = NULL;
-       UConverter              *conv           = NULL;
-       UErrorCode              ec              = U_ZERO_ERROR;
-       char                    ianaName[16];
-       CFDataRef               line            = NULL;
-       CFMutableStringRef      newStr          = NULL;
-       CFStringRef             set             = NULL;
-       int32_t                 setSize;
-       UChar                   *setChars;
-       CFStringRef             transform;
-
-       /*
-        * using ICU, convert the target character set into the
-        * set of Unicode characters that can be converted to
-        * that character set.
-        *
-        * Note: a full list of character set identifiers accepted
-        *       by ICU can be found at :
-        *
-        *       http://dev.icu-project.org/cgi-bin/viewcvs.cgi/icu/source/data/mappings/convrtrs.txt?view=co
-        */
-       snprintf(ianaName, sizeof(ianaName), "cp%d", (int)dosCodepage);
-       charSet = uset_open(0, 0);
-       //ec = U_ZERO_ERROR;
-       conv = ucnv_open(ianaName, &ec);
-       if (U_FAILURE(ec)) {
-               SCPrint(TRUE, stderr, CFSTR("ucnv_open() failed, ec = %s\n"), u_errorName(ec));
-               goto done;
-       }
-       //ec = U_ZERO_ERROR;
-       ucnv_getUnicodeSet(conv, charSet, UCNV_ROUNDTRIP_SET, &ec);
-       if (U_FAILURE(ec)) {
-               SCPrint(TRUE, stderr, CFSTR("ucnv_getUnicodeSet() failed, ec = %s\n"), u_errorName(ec));
-               goto done;
-       }
-
-       /*
-        * Next, we create a transform pattern that will transform *only*
-        * the characters that are not in the target charset.
-        */
-       //ec = U_ZERO_ERROR;
-       setSize = uset_toPattern(charSet, NULL, 0, FALSE, &ec);
-       if (U_FAILURE(ec)  && (ec != U_BUFFER_OVERFLOW_ERROR)) {
-               SCPrint(TRUE, stderr, CFSTR("uset_toPattern() failed, ec = %s\n"), u_errorName(ec));
-               goto done;
-       }
-       setChars = (UChar *)calloc(setSize, sizeof(UChar));
-       ec = U_ZERO_ERROR;
-       (void)uset_toPattern(charSet, setChars, setSize, FALSE, &ec);
-       set = CFStringCreateWithCharacters(NULL, setChars, setSize);
-       free(setChars);
-
-       /*
-        * Now make a transform pattern that will:
-        * 1. Only affect characters *not* in the target character set
-        * 2. Convert curly quotes, etc. to ASCII equivalents
-        * 3. Convert any non-Latin characters to Latin
-        * 4. Decompose any combining marks if possible
-        * 5. Remove anything that's not ASCII
-        *
-        * ... and transform the string
-        */
-       transform = CFStringCreateWithFormat(NULL, NULL,
-                                            CFSTR("[^%@]; Publishing-Any; Any-Latin; NFKD; [:^ASCII:] Remove"),
-                                            set);
-       newStr = CFStringCreateMutableCopy(NULL, 0, str);
-       CFStringNormalize(newStr, kCFStringNormalizationFormC);
-       if (!CFStringTransform(newStr, NULL, transform, FALSE)) {
-               CFRelease(newStr);
-               newStr = NULL;
-       }
-       CFRelease(transform);
-
-    done :
-
-       if (newStr != NULL) {
-               line = CFStringCreateExternalRepresentation(NULL, newStr, dosEncoding, 0);
-               CFRelease(newStr);
-       }
-
-       if (charSet != NULL)    uset_close(charSet);
-       if (conv != NULL)       ucnv_close(conv);
-       if (set != NULL)        CFRelease(set);
-
-       return line;
-}
+#endif // !TARGET_OS_IPHONE
 
 
 #pragma mark -
 #pragma mark Debugging
 
 
 
 
 #pragma mark -
 #pragma mark Debugging
 
 
+/*
+ * print status of in-use mach ports
+ */
 void
 void
-__showMachPortStatus(void)
+_SC_logMachPortStatus(void)
 {
 {
-#ifdef DEBUG
-       /* print status of in-use mach ports */
-       if (_sc_debug) {
-               kern_return_t           status;
-               mach_port_name_array_t  ports;
-               mach_port_type_array_t  types;
-               int                     pi, pn, tn;
-               CFMutableStringRef      str;
-
-               SCLog(_sc_verbose, LOG_DEBUG, CFSTR("----------"));
-
-               /* report on ALL mach ports associated with this task */
-               status = mach_port_names(mach_task_self(), &ports, &pn, &types, &tn);
-               if (status == MACH_MSG_SUCCESS) {
-                       str = CFStringCreateMutable(NULL, 0);
-                       for (pi = 0; pi < pn; pi++) {
-                               char    rights[16], *rp = &rights[0];
-
-                               if (types[pi] != MACH_PORT_TYPE_NONE) {
-                                       *rp++ = ' ';
-                                       *rp++ = '(';
-                                       if (types[pi] & MACH_PORT_TYPE_SEND)
-                                               *rp++ = 'S';
-                                       if (types[pi] & MACH_PORT_TYPE_RECEIVE)
-                                               *rp++ = 'R';
-                                       if (types[pi] & MACH_PORT_TYPE_SEND_ONCE)
-                                               *rp++ = 'O';
-                                       if (types[pi] & MACH_PORT_TYPE_PORT_SET)
-                                               *rp++ = 'P';
-                                       if (types[pi] & MACH_PORT_TYPE_DEAD_NAME)
-                                               *rp++ = 'D';
-                                       *rp++ = ')';
-                               }
-                               *rp = '\0';
-                               CFStringAppendFormat(str, NULL, CFSTR(" %d%s"), ports[pi], rights);
+       kern_return_t           status;
+       mach_port_name_array_t  ports;
+       mach_port_type_array_t  types;
+       mach_msg_type_number_t  pi, pn, tn;
+       CFMutableStringRef      str;
+
+       SCLog(TRUE, LOG_DEBUG, CFSTR("----------"));
+
+       /* report on ALL mach ports associated with this task */
+       status = mach_port_names(mach_task_self(), &ports, &pn, &types, &tn);
+       if (status == MACH_MSG_SUCCESS) {
+               str = CFStringCreateMutable(NULL, 0);
+               for (pi = 0; pi < pn; pi++) {
+                       char    rights[16], *rp = &rights[0];
+
+                       if (types[pi] != MACH_PORT_TYPE_NONE) {
+                               *rp++ = ' ';
+                               *rp++ = '(';
+                               if (types[pi] & MACH_PORT_TYPE_SEND)
+                                       *rp++ = 'S';
+                               if (types[pi] & MACH_PORT_TYPE_RECEIVE)
+                                       *rp++ = 'R';
+                               if (types[pi] & MACH_PORT_TYPE_SEND_ONCE)
+                                       *rp++ = 'O';
+                               if (types[pi] & MACH_PORT_TYPE_PORT_SET)
+                                       *rp++ = 'P';
+                               if (types[pi] & MACH_PORT_TYPE_DEAD_NAME)
+                                       *rp++ = 'D';
+                               *rp++ = ')';
                        }
                        }
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("Task ports (n=%d):%@"), pn, str);
-                       CFRelease(str);
-               } else {
-                       /* log (but ignore) errors */
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("mach_port_names(): %s"), mach_error_string(status));
+                       *rp = '\0';
+                       CFStringAppendFormat(str, NULL, CFSTR(" %d%s"), ports[pi], rights);
                }
                }
+               SCLog(TRUE, LOG_DEBUG, CFSTR("Task ports (n=%d):%@"), pn, str);
+               CFRelease(str);
        }
        }
-#endif /* DEBUG */
+
        return;
 }
 
 
 void
        return;
 }
 
 
 void
-__showMachPortReferences(mach_port_t port)
+_SC_logMachPortReferences(const char *str, mach_port_t port)
 {
 {
-#ifdef DEBUG
-       kern_return_t           status;
+       const char              *blanks         = "                                                            ";
+       char                    buf[60];
+       mach_port_type_t        pt;
+       mach_port_status_t      recv_status     = { 0 };
        mach_port_urefs_t       refs_send       = 0;
        mach_port_urefs_t       refs_recv       = 0;
        mach_port_urefs_t       refs_once       = 0;
        mach_port_urefs_t       refs_pset       = 0;
        mach_port_urefs_t       refs_dead       = 0;
        mach_port_urefs_t       refs_send       = 0;
        mach_port_urefs_t       refs_recv       = 0;
        mach_port_urefs_t       refs_once       = 0;
        mach_port_urefs_t       refs_pset       = 0;
        mach_port_urefs_t       refs_dead       = 0;
+       kern_return_t           status;
 
 
-       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("user references for mach port %d"), port);
+       buf[0] = '\0';
+       if (str != NULL) {
+               static int      is_configd      = -1;
 
 
-       status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_SEND,      &refs_send);
-       if (status != KERN_SUCCESS) {
-               SCLog(_sc_verbose, LOG_DEBUG, CFSTR("  mach_port_get_refs(MACH_PORT_RIGHT_SEND): %s"), mach_error_string(status));
-               return;
+               if (is_configd == -1) {
+                       char    name[64]        = "";
+
+                       (void) proc_name(getpid(), name, sizeof(name));
+                       is_configd = (strncmp(name, "configd", sizeof(name)) == 0);
+               }
+               if (is_configd == 1) {
+                       // if "configd", add indication if this is the M[ain] or [P]lugin thread
+                       strlcpy(buf,
+                               (CFRunLoopGetMain() == CFRunLoopGetCurrent()) ? "M " : "P ",
+                               sizeof(buf));
+               }
+
+               // add provided string
+               strlcat(buf, str, sizeof(buf));
+
+               // fill
+               strlcat(buf, blanks, sizeof(buf));
+               if (strcmp(&buf[sizeof(buf) - 3], "  ") == 0) {
+                       buf[sizeof(buf) - 3] = ':';
+               }
        }
 
        }
 
-       status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE,   &refs_recv);
+       status = mach_port_type(mach_task_self(), port, &pt);
        if (status != KERN_SUCCESS) {
        if (status != KERN_SUCCESS) {
-               SCLog(_sc_verbose, LOG_DEBUG, CFSTR("  mach_port_get_refs(MACH_PORT_RIGHT_RECEIVE): %s"), mach_error_string(status));
-               return;
+               SCLog(TRUE, LOG_DEBUG,
+                     CFSTR("%smach_port_get_refs(..., %d, MACH_PORT_RIGHT_SEND): %s"),
+                     buf,
+                     port,
+                     mach_error_string(status));
        }
 
        }
 
-       status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_SEND_ONCE, &refs_once);
-       if (status != KERN_SUCCESS) {
-               SCLog(_sc_verbose, LOG_DEBUG, CFSTR("  mach_port_get_refs(MACH_PORT_RIGHT_SEND_ONCE): %s"), mach_error_string(status));
-               return;
+       if ((pt & MACH_PORT_TYPE_SEND) != 0) {
+               status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_SEND,      &refs_send);
+               if (status != KERN_SUCCESS) {
+                       SCLog(TRUE, LOG_DEBUG,
+                             CFSTR("%smach_port_get_refs(..., %d, MACH_PORT_RIGHT_SEND): %s"),
+                             buf,
+                             port,
+                             mach_error_string(status));
+               }
        }
 
        }
 
-       status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_PORT_SET,  &refs_pset);
-       if (status != KERN_SUCCESS) {
-               SCLog(_sc_verbose, LOG_DEBUG, CFSTR("  mach_port_get_refs(MACH_PORT_RIGHT_PORT_SET): %s"), mach_error_string(status));
-               return;
+       if ((pt & MACH_PORT_TYPE_RECEIVE) != 0) {
+               mach_msg_type_number_t  count;
+
+               status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE,   &refs_recv);
+               if (status != KERN_SUCCESS) {
+                       SCLog(TRUE, LOG_DEBUG,
+                             CFSTR("%smach_port_get_refs(..., %d, MACH_PORT_RIGHT_RECEIVE): %s"),
+                             buf,
+                             port,
+                             mach_error_string(status));
+               }
+
+               count = MACH_PORT_RECEIVE_STATUS_COUNT;
+               status = mach_port_get_attributes(mach_task_self(),
+                                              port,
+                                              MACH_PORT_RECEIVE_STATUS,
+                                              (mach_port_info_t)&recv_status,
+                                              &count);
+               if (status != KERN_SUCCESS) {
+                       SCLog(TRUE, LOG_DEBUG,
+                             CFSTR("%mach_port_get_attributes(..., %d, MACH_PORT_RECEIVE_STATUS): %s"),
+                             buf,
+                             port,
+                             mach_error_string(status));
+               }
        }
 
        }
 
-       status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_DEAD_NAME, &refs_dead);
-       if (status != KERN_SUCCESS) {
-               SCLog(_sc_verbose, LOG_DEBUG, CFSTR("  mach_port_get_refs(MACH_PORT_RIGHT_DEAD_NAME): %s"), mach_error_string(status));
-               return;
+       if ((pt & MACH_PORT_TYPE_SEND_ONCE) != 0) {
+               status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_SEND_ONCE, &refs_once);
+               if (status != KERN_SUCCESS) {
+                       SCLog(TRUE, LOG_DEBUG,
+                             CFSTR("%smach_port_get_refs(..., %d, MACH_PORT_RIGHT_SEND_ONCE): %s"),
+                             buf,
+                             port,
+                             mach_error_string(status));
+               }
        }
 
        }
 
-       SCLog(_sc_verbose, LOG_DEBUG,
-              CFSTR("  send = %d, receive = %d, send once = %d, port set = %d, dead name = %d"),
-              refs_send,
-              refs_recv,
-              refs_once,
-              refs_pset,
-              refs_dead);
+       if ((pt & MACH_PORT_TYPE_PORT_SET) != 0) {
+               status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_PORT_SET,  &refs_pset);
+               if (status != KERN_SUCCESS) {
+                       SCLog(TRUE, LOG_DEBUG,
+                             CFSTR("%smach_port_get_refs(..., %d, MACH_PORT_RIGHT_PORT_SET): %s"),
+                             buf,
+                             port,
+                             mach_error_string(status));
+               }
+       }
+
+       if ((pt & MACH_PORT_TYPE_DEAD_NAME) != 0) {
+               status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_DEAD_NAME, &refs_dead);
+               if (status != KERN_SUCCESS) {
+                       SCLog(TRUE, LOG_DEBUG,
+                             CFSTR("%smach_port_get_refs(..., %d, MACH_PORT_RIGHT_DEAD_NAME): %s"),
+                             buf,
+                             port,
+                             mach_error_string(status));
+               }
+       }
+
+       SCLog(TRUE, LOG_DEBUG,
+             CFSTR("%smach port 0x%x (%d): send=%d, receive=%d, send once=%d, port set=%d, dead name=%d%s%s"),
+             buf,
+             port,
+             port,
+             refs_send,
+             refs_recv,
+             refs_once,
+             refs_pset,
+             refs_dead,
+             recv_status.mps_nsrequest ? ", no more senders"   : "",
+             ((pt & MACH_PORT_TYPE_DEAD_NAME) != 0) ? ", dead name request" : "");
 
 
-#endif /* DEBUG */
        return;
 }
        return;
 }
+
+
+CFStringRef
+_SC_copyBacktrace()
+{
+       int                     n;
+       void                    *stack[64];
+       char                    **symbols;
+       CFMutableStringRef      trace;
+
+       n = backtrace(stack, sizeof(stack)/sizeof(stack[0]));
+       if (n == -1) {
+               SCLog(TRUE, LOG_ERR, CFSTR("backtrace() failed: %s"), strerror(errno));
+               return NULL;
+       }
+
+       trace = CFStringCreateMutable(NULL, 0);
+
+       symbols = backtrace_symbols(stack, n);
+       if (symbols != NULL) {
+               int     i;
+
+               for (i = 0; i < n; i++) {
+                       CFStringAppendFormat(trace, NULL, CFSTR("%s\n"), symbols[i]);
+               }
+
+               free(symbols);
+       }
+
+       return trace;
+}
index fa6ef00e5c7dbbcefe9486d41534bc61cba4fcbd..1b95ae3242a1425a379bdee4bfa99fe5be7359e6 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -77,11 +77,13 @@ SCDynamicStoreRemoveValue(SCDynamicStoreRef store, CFStringRef key)
        CFRelease(utfKey);
 
        if (status != KERN_SUCCESS) {
        CFRelease(utfKey);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreRemoveValue configremove(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreRemoveValue configremove(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
index baa3cb99c906fa24d97dab359ec46fbf31d90643..4504855833a055c4189430c484f6cec3ab208648 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2006, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -124,11 +124,13 @@ SCDynamicStoreSetMultiple(SCDynamicStoreRef       store,
        if (xmlNotify != NULL)  CFRelease(xmlNotify);
 
        if (status != KERN_SUCCESS) {
        if (xmlNotify != NULL)  CFRelease(xmlNotify);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreSetMultiple configset_m(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreSetMultiple configset_m(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
@@ -196,11 +198,13 @@ SCDynamicStoreSetValue(SCDynamicStoreRef store, CFStringRef key, CFPropertyListR
        CFRelease(xmlData);
 
        if (status != KERN_SUCCESS) {
        CFRelease(xmlData);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreSetValue configset(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreSetValue configset(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
index 9af36f0fe1cf0514d7c30c0681822b00c7de64d9..d869d382c4621863bc88fd49d32a2b8f59be3068 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -61,11 +61,13 @@ SCDynamicStoreSnapshot(SCDynamicStoreRef store)
        status = snapshot(storePrivate->server, (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
        status = snapshot(storePrivate->server, (int *)&sc_status);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreSnapshot snapshot(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreSnapshot snapshot(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
index 1b96735cd49704f270941f488d0111a2f42c76c2..f1a7027f6771afdb3fa59bf8bc529c8e7451eb92 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -77,11 +77,13 @@ SCDynamicStoreTouchValue(SCDynamicStoreRef store, CFStringRef key)
        CFRelease(utfKey);
 
        if (status != KERN_SUCCESS) {
        CFRelease(utfKey);
 
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreTouchValue configtouch(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreTouchValue configtouch(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
index 462f446e9230c1471b1679f24257d88193e5744c..994d57a9a5c76cf53b31f88f9b7dac0e8af6375b 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -61,11 +61,13 @@ SCDynamicStoreUnlock(SCDynamicStoreRef store)
        /* (attempt to) release the servers lock */
        status = configunlock(storePrivate->server, (int *)&sc_status);
        if (status != KERN_SUCCESS) {
        /* (attempt to) release the servers lock */
        status = configunlock(storePrivate->server, (int *)&sc_status);
        if (status != KERN_SUCCESS) {
-#ifdef DEBUG
-               if (status != MACH_SEND_INVALID_DEST)
-                       SCLog(_sc_verbose, LOG_DEBUG, CFSTR("SCDynamicStoreUnlock configunlock(): %s"), mach_error_string(status));
-#endif /* DEBUG */
-               (void) mach_port_destroy(mach_task_self(), storePrivate->server);
+               if (status == MACH_SEND_INVALID_DEST) {
+                       /* the server's gone and our session port's dead, remove the dead name right */
+                       (void) mach_port_deallocate(mach_task_self(), storePrivate->server);
+               } else {
+                       /* we got an unexpected error, leave the [session] port alone */
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreUnlock configunlock(): %s"), mach_error_string(status));
+               }
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
                storePrivate->server = MACH_PORT_NULL;
                _SCErrorSet(status);
                return FALSE;
index 6331e9253eb3f20af85e762564d87006b9568d44..716d5dcc9ad5de40c5710ea9b2ebc11f5514bbf4 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2003-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2008, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  */
 
 #ifndef _SCDYNAMICSTORE_H
  */
 
 #ifndef _SCDYNAMICSTORE_H
+#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS
+#include <SystemConfiguration/_SCDynamicStore.h>
+#else  /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
 #define _SCDYNAMICSTORE_H
 
 #define _SCDYNAMICSTORE_H
 
-#include <AvailabilityMacros.h>
+#include <Availability.h>
+#include <TargetConditionals.h>
 #include <sys/cdefs.h>
 #include <sys/cdefs.h>
+#if    !TARGET_OS_IPHONE
+#include <dispatch/dispatch.h>
+#endif // !TARGET_OS_IPHONE
 #include <CoreFoundation/CoreFoundation.h>
 
 #include <CoreFoundation/CoreFoundation.h>
 
+
 /*!
        @header SCDynamicStore
        @discussion The SCDynamicStore API provides access to the key-value
 /*!
        @header SCDynamicStore
        @discussion The SCDynamicStore API provides access to the key-value
@@ -103,7 +111,7 @@ __BEGIN_DECLS
        @discussion Returns the type identifier of all SCDynamicStore instances.
  */
 CFTypeID
        @discussion Returns the type identifier of all SCDynamicStore instances.
  */
 CFTypeID
-SCDynamicStoreGetTypeID                        (void);
+SCDynamicStoreGetTypeID                        (void)                          __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 
 /*!
 
 
 /*!
@@ -131,9 +139,7 @@ SCDynamicStoreCreate                        (
                                        CFStringRef                     name,
                                        SCDynamicStoreCallBack          callout,
                                        SCDynamicStoreContext           *context
                                        CFStringRef                     name,
                                        SCDynamicStoreCallBack          callout,
                                        SCDynamicStoreContext           *context
-                                       );
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
+                                       )                               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreCreateWithOptions
 
 /*!
        @function SCDynamicStoreCreateWithOptions
@@ -179,11 +185,9 @@ SCDynamicStoreCreateWithOptions            (
                                        CFDictionaryRef                 storeOptions,
                                        SCDynamicStoreCallBack          callout,
                                        SCDynamicStoreContext           *context
                                        CFDictionaryRef                 storeOptions,
                                        SCDynamicStoreCallBack          callout,
                                        SCDynamicStoreContext           *context
-                                       )                               AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                       )                               __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 
-extern const CFStringRef       kSCDynamicStoreUseSessionKeys           AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;      /* CFBoolean */
-
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */
+extern const CFStringRef       kSCDynamicStoreUseSessionKeys           __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);       /* CFBoolean */
 
 /*!
        @function SCDynamicStoreCreateRunLoopSource
 
 /*!
        @function SCDynamicStoreCreateRunLoopSource
@@ -213,7 +217,25 @@ SCDynamicStoreCreateRunLoopSource  (
                                        CFAllocatorRef                  allocator,
                                        SCDynamicStoreRef               store,
                                        CFIndex                         order
                                        CFAllocatorRef                  allocator,
                                        SCDynamicStoreRef               store,
                                        CFIndex                         order
-                                       );
+                                       )                               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
+
+#if    !TARGET_OS_IPHONE
+/*!
+       @function SCDynamicStoreSetDispatchQueue
+       @discussion Initiates notifications for the Notification
+               Keys in store to the callback contained in store.
+       @param store A reference to the dynamic store session.
+       @param queue The dispatch queue to run the callback function on.
+               Pass NULL to disable notifications, and release the queue.
+       @result Returns TRUE on success, FALSE on failure.
+
+ */
+Boolean
+SCDynamicStoreSetDispatchQueue         (
+                                       SCDynamicStoreRef               store,
+                                       dispatch_queue_t                queue
+                                       )                               __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA);
+#endif // !TARGET_OS_IPHONE
 
 /*!
        @function SCDynamicStoreCopyKeyList
 
 /*!
        @function SCDynamicStoreCopyKeyList
@@ -230,7 +252,7 @@ CFArrayRef
 SCDynamicStoreCopyKeyList              (
                                        SCDynamicStoreRef               store,
                                        CFStringRef                     pattern
 SCDynamicStoreCopyKeyList              (
                                        SCDynamicStoreRef               store,
                                        CFStringRef                     pattern
-                                       );
+                                       )                               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreAddValue
 
 /*!
        @function SCDynamicStoreAddValue
@@ -247,7 +269,7 @@ SCDynamicStoreAddValue                      (
                                        SCDynamicStoreRef               store,
                                        CFStringRef                     key,
                                        CFPropertyListRef               value
                                        SCDynamicStoreRef               store,
                                        CFStringRef                     key,
                                        CFPropertyListRef               value
-                                       );
+                                       )                               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreAddTemporaryValue
 
 /*!
        @function SCDynamicStoreAddTemporaryValue
@@ -266,7 +288,7 @@ SCDynamicStoreAddTemporaryValue             (
                                        SCDynamicStoreRef               store,
                                        CFStringRef                     key,
                                        CFPropertyListRef               value
                                        SCDynamicStoreRef               store,
                                        CFStringRef                     key,
                                        CFPropertyListRef               value
-                                       );
+                                       )                               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreCopyValue
 
 /*!
        @function SCDynamicStoreCopyValue
@@ -281,7 +303,7 @@ CFPropertyListRef
 SCDynamicStoreCopyValue                        (
                                        SCDynamicStoreRef               store,
                                        CFStringRef                     key
 SCDynamicStoreCopyValue                        (
                                        SCDynamicStoreRef               store,
                                        CFStringRef                     key
-                                       );
+                                       )                               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreCopyMultiple
 
 /*!
        @function SCDynamicStoreCopyMultiple
@@ -301,7 +323,7 @@ SCDynamicStoreCopyMultiple          (
                                        SCDynamicStoreRef               store,
                                        CFArrayRef                      keys,
                                        CFArrayRef                      patterns
                                        SCDynamicStoreRef               store,
                                        CFArrayRef                      keys,
                                        CFArrayRef                      patterns
-                                       );
+                                       )                               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreSetValue
 
 /*!
        @function SCDynamicStoreSetValue
@@ -317,7 +339,7 @@ SCDynamicStoreSetValue                      (
                                        SCDynamicStoreRef               store,
                                        CFStringRef                     key,
                                        CFPropertyListRef               value
                                        SCDynamicStoreRef               store,
                                        CFStringRef                     key,
                                        CFPropertyListRef               value
-                                       );
+                                       )                               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreSetMultiple
 
 /*!
        @function SCDynamicStoreSetMultiple
@@ -334,7 +356,7 @@ SCDynamicStoreSetMultiple           (
                                        CFDictionaryRef                 keysToSet,
                                        CFArrayRef                      keysToRemove,
                                        CFArrayRef                      keysToNotify
                                        CFDictionaryRef                 keysToSet,
                                        CFArrayRef                      keysToRemove,
                                        CFArrayRef                      keysToNotify
-                                       );
+                                       )                               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreRemoveValue
 
 /*!
        @function SCDynamicStoreRemoveValue
@@ -349,7 +371,7 @@ Boolean
 SCDynamicStoreRemoveValue              (
                                        SCDynamicStoreRef               store,
                                        CFStringRef                     key
 SCDynamicStoreRemoveValue              (
                                        SCDynamicStoreRef               store,
                                        CFStringRef                     key
-                                       );
+                                       )                               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreNotifyValue
 
 /*!
        @function SCDynamicStoreNotifyValue
@@ -365,7 +387,7 @@ Boolean
 SCDynamicStoreNotifyValue              (
                                        SCDynamicStoreRef               store,
                                        CFStringRef                     key
 SCDynamicStoreNotifyValue              (
                                        SCDynamicStoreRef               store,
                                        CFStringRef                     key
-                                       );
+                                       )                               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreSetNotificationKeys
 
 /*!
        @function SCDynamicStoreSetNotificationKeys
@@ -384,7 +406,7 @@ SCDynamicStoreSetNotificationKeys   (
                                        SCDynamicStoreRef               store,
                                        CFArrayRef                      keys,
                                        CFArrayRef                      patterns
                                        SCDynamicStoreRef               store,
                                        CFArrayRef                      keys,
                                        CFArrayRef                      patterns
-                                       );
+                                       )                               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreCopyNotifiedKeys
 
 /*!
        @function SCDynamicStoreCopyNotifiedKeys
@@ -401,8 +423,9 @@ SCDynamicStoreSetNotificationKeys   (
 CFArrayRef
 SCDynamicStoreCopyNotifiedKeys         (
                                        SCDynamicStoreRef               store
 CFArrayRef
 SCDynamicStoreCopyNotifiedKeys         (
                                        SCDynamicStoreRef               store
-                                       );
+                                       )                               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 __END_DECLS
 
 
 __END_DECLS
 
-#endif /* _SCDYNAMICSTORE_H */
+#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
+#endif /* _SCDYNAMICSTORE_H */
index 88663430eba41c71b8a6ee2c10a686e61aa3d038..db0590ad67132cd651df26326c306c7d8eefdb69 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2001, 2002, 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2001, 2002, 2004, 2005, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  */
 
 #ifndef _SCDYNAMICSTORECOPYDHCPINFO_H
  */
 
 #ifndef _SCDYNAMICSTORECOPYDHCPINFO_H
+#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS
+#include <SystemConfiguration/_SCDynamicStoreCopyDHCPInfo.h>
+#else  /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
 #define _SCDYNAMICSTORECOPYDHCPINFO_H
 
 #define _SCDYNAMICSTORECOPYDHCPINFO_H
 
+#include <Availability.h>
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCDynamicStore.h>
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCDynamicStore.h>
@@ -56,7 +60,8 @@ __BEGIN_DECLS
                A non-NULL return value must be released using CFRelease().
  */
 CFDictionaryRef
                A non-NULL return value must be released using CFRelease().
  */
 CFDictionaryRef
-SCDynamicStoreCopyDHCPInfo(SCDynamicStoreRef store, CFStringRef serviceID);
+SCDynamicStoreCopyDHCPInfo     (SCDynamicStoreRef      store,
+                                CFStringRef            serviceID)      __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function DHCPInfoGetOptionData
 
 /*!
        @function DHCPInfoGetOptionData
@@ -72,7 +77,8 @@ SCDynamicStoreCopyDHCPInfo(SCDynamicStoreRef store, CFStringRef serviceID);
                The return value must NOT be released.
  */
 CFDataRef
                The return value must NOT be released.
  */
 CFDataRef
-DHCPInfoGetOptionData(CFDictionaryRef info, UInt8 code);
+DHCPInfoGetOptionData          (CFDictionaryRef        info,
+                                UInt8                  code)           __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function DHCPInfoGetLeaseStartTime
 
 /*!
        @function DHCPInfoGetLeaseStartTime
@@ -87,8 +93,9 @@ DHCPInfoGetOptionData(CFDictionaryRef info, UInt8 code);
                The return value must NOT be released.
  */
 CFDateRef
                The return value must NOT be released.
  */
 CFDateRef
-DHCPInfoGetLeaseStartTime(CFDictionaryRef info);
+DHCPInfoGetLeaseStartTime      (CFDictionaryRef        info)           __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 __END_DECLS
 
 
 __END_DECLS
 
-#endif /* _SCDYNAMICSTORECOPYDHCPINFO_H */
+#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
+#endif /* _SCDYNAMICSTORECOPYDHCPINFO_H */
index 36f5f63b61ef1600038db255c2a40a41f65d3ba9..5b102b00a652ebbd112583c400dd2a26c7c27fd0 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  */
 
 #ifndef _SCDYNAMICSTORECOPYSPECIFIC_H
  */
 
 #ifndef _SCDYNAMICSTORECOPYSPECIFIC_H
+#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS
+#include <SystemConfiguration/_SCDynamicStoreCopySpecific.h>
+#else  /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
 #define _SCDYNAMICSTORECOPYSPECIFIC_H
 
 #define _SCDYNAMICSTORECOPYSPECIFIC_H
 
+#include <Availability.h>
 #include <sys/cdefs.h>
 #include <sys/types.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <sys/cdefs.h>
 #include <sys/types.h>
 #include <CoreFoundation/CoreFoundation.h>
@@ -58,7 +62,7 @@ CFStringRef
 SCDynamicStoreCopyComputerName         (
                                        SCDynamicStoreRef       store,
                                        CFStringEncoding        *nameEncoding
 SCDynamicStoreCopyComputerName         (
                                        SCDynamicStoreRef       store,
                                        CFStringEncoding        *nameEncoding
-                                       );
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreCopyConsoleUser
 
 /*!
        @function SCDynamicStoreCopyConsoleUser
@@ -87,7 +91,7 @@ SCDynamicStoreCopyConsoleUser         (
                                        SCDynamicStoreRef       store,
                                        uid_t                   *uid,
                                        gid_t                   *gid
                                        SCDynamicStoreRef       store,
                                        uid_t                   *uid,
                                        gid_t                   *gid
-                                       );
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
 
 /*!
        @function SCDynamicStoreCopyLocalHostName
 
 /*!
        @function SCDynamicStoreCopyLocalHostName
@@ -102,7 +106,7 @@ SCDynamicStoreCopyConsoleUser               (
 CFStringRef
 SCDynamicStoreCopyLocalHostName                (
                                        SCDynamicStoreRef       store
 CFStringRef
 SCDynamicStoreCopyLocalHostName                (
                                        SCDynamicStoreRef       store
-                                       );
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreCopyLocation
 
 /*!
        @function SCDynamicStoreCopyLocation
@@ -118,7 +122,7 @@ SCDynamicStoreCopyLocalHostName             (
 CFStringRef
 SCDynamicStoreCopyLocation             (
                                        SCDynamicStoreRef       store
 CFStringRef
 SCDynamicStoreCopyLocation             (
                                        SCDynamicStoreRef       store
-                                       );
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
 
 /*!
        @function SCDynamicStoreCopyProxies
 
 /*!
        @function SCDynamicStoreCopyProxies
@@ -203,8 +207,9 @@ SCDynamicStoreCopyLocation          (
 CFDictionaryRef
 SCDynamicStoreCopyProxies              (
                                        SCDynamicStoreRef       store
 CFDictionaryRef
 SCDynamicStoreCopyProxies              (
                                        SCDynamicStoreRef       store
-                                       );
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 __END_DECLS
 
 
 __END_DECLS
 
-#endif /* _SCDYNAMICSTORECOPYSPECIFIC_H */
+#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
+#endif /* _SCDYNAMICSTORECOPYSPECIFIC_H */
index 4cc0856a5f30812a8574d40684d10c43dee6dd9e..b3bc351498e2b3d2e405e745f4b938a6733fbf78 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2003-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003-2005, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -24,6 +24,7 @@
 #ifndef _SCDYNAMICSTORECOPYSPECIFICPRIVATE_H
 #define _SCDYNAMICSTORECOPYSPECIFICPRIVATE_H
 
 #ifndef _SCDYNAMICSTORECOPYSPECIFICPRIVATE_H
 #define _SCDYNAMICSTORECOPYSPECIFICPRIVATE_H
 
+#include <Availability.h>
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCDynamicStore.h>
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCDynamicStore.h>
@@ -41,14 +42,22 @@ __BEGIN_DECLS
 /*
  * Predefined keys for the console session dictionaries
  */
 /*
  * Predefined keys for the console session dictionaries
  */
-extern const CFStringRef kSCConsoleSessionID;                  /* value is CFNumber */
-extern const CFStringRef kSCConsoleSessionUserName;            /* value is CFString */
-extern const CFStringRef kSCConsoleSessionUID;                 /* value is CFNumber (a uid_t) */
-extern const CFStringRef kSCConsoleSessionConsoleSet;          /* value is CFNumber */
-extern const CFStringRef kSCConsoleSessionOnConsole;           /* value is CFBoolean */
-extern const CFStringRef kSCConsoleSessionLoginDone;           /* value is CFBoolean */
-extern const CFStringRef kSCConsoleSessionSystemSafeBoot;      /* value is CFBoolean */
-extern const CFStringRef kSCConsoleSessionLoginwindowSafeLogin;        /* value is CFBoolean */
+extern const CFStringRef kSCConsoleSessionID                   /* value is CFNumber */
+               __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
+extern const CFStringRef kSCConsoleSessionUserName             /* value is CFString */
+               __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
+extern const CFStringRef kSCConsoleSessionUID                  /* value is CFNumber (a uid_t) */
+               __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
+extern const CFStringRef kSCConsoleSessionConsoleSet           /* value is CFNumber */
+               __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
+extern const CFStringRef kSCConsoleSessionOnConsole            /* value is CFBoolean */
+               __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
+extern const CFStringRef kSCConsoleSessionLoginDone            /* value is CFBoolean */
+               __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
+extern const CFStringRef kSCConsoleSessionSystemSafeBoot       /* value is CFBoolean */
+               __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
+extern const CFStringRef kSCConsoleSessionLoginwindowSafeLogin /* value is CFBoolean */
+               __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
 
 /*!
        @function SCDynamicStoreCopyConsoleInformation
 
 /*!
        @function SCDynamicStoreCopyConsoleInformation
@@ -68,7 +77,7 @@ extern const CFStringRef kSCConsoleSessionLoginwindowSafeLogin;       /* value is CFBo
 CFArrayRef
 SCDynamicStoreCopyConsoleInformation   (
                                        SCDynamicStoreRef       store
 CFArrayRef
 SCDynamicStoreCopyConsoleInformation   (
                                        SCDynamicStoreRef       store
-                                       );
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
 
 
 __END_DECLS
 
 
 __END_DECLS
index c03620d1add3cfab1e9a6e8e8da05b8255bda35c..2481504a53ecc7c0234c97a6946f616e9bd100e9 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006, 2009 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #ifndef _SCDYNAMICSTOREINTERNAL_H
 #define _SCDYNAMICSTOREINTERNAL_H
 
 #ifndef _SCDYNAMICSTOREINTERNAL_H
 #define _SCDYNAMICSTOREINTERNAL_H
 
+#include <Availability.h>
+#include <TargetConditionals.h>
 #include <sys/cdefs.h>
 #include <sys/cdefs.h>
+#if    !TARGET_OS_IPHONE
+#include <dispatch/dispatch.h>
+#endif // !TARGET_OS_IPHONE
 #include <sys/types.h>
 #include <mach/mach.h>
 #include <pthread.h>
 #include <sys/types.h>
 #include <mach/mach.h>
 #include <pthread.h>
@@ -42,7 +47,8 @@ typedef enum {
        Using_NotifierInformViaMachPort,
        Using_NotifierInformViaFD,
        Using_NotifierInformViaSignal,
        Using_NotifierInformViaMachPort,
        Using_NotifierInformViaFD,
        Using_NotifierInformViaSignal,
-       Using_NotifierInformViaRunLoop
+       Using_NotifierInformViaRunLoop,
+       Using_NotifierInformViaDispatch
 } __SCDynamicStoreNotificationStatus;
 
 
 } __SCDynamicStoreNotificationStatus;
 
 
@@ -73,6 +79,13 @@ typedef struct {
        CFMachPortRef                   callbackPort;
        CFRunLoopSourceRef              callbackRLS;
 
        CFMachPortRef                   callbackPort;
        CFRunLoopSourceRef              callbackRLS;
 
+#if    !TARGET_OS_IPHONE
+       /* "client" information associated with SCDynamicStoreSetDispatchQueue() */
+       dispatch_queue_t                dispatchQueue;
+       dispatch_source_t               callbackSource;
+       dispatch_queue_t                callbackQueue;
+#endif // !TARGET_OS_IPHONE
+
        /* "server" SCDynamicStoreKeys being watched */
        CFMutableSetRef                 keys;
        CFMutableSetRef                 patterns;
        /* "server" SCDynamicStoreKeys being watched */
        CFMutableSetRef                 keys;
        CFMutableSetRef                 patterns;
@@ -100,12 +113,6 @@ __SCDynamicStoreCreatePrivate              (CFAllocatorRef                 allocator,
                                         SCDynamicStoreCallBack         callout,
                                         SCDynamicStoreContext          *context);
 
                                         SCDynamicStoreCallBack         callout,
                                         SCDynamicStoreContext          *context);
 
-void
-__showMachPortStatus                   (void);
-
-void
-__showMachPortReferences               (mach_port_t                    port);
-
 __END_DECLS
 
 #endif /* _SCDYNAMICSTOREINTERNAL_H */
 __END_DECLS
 
 #endif /* _SCDYNAMICSTOREINTERNAL_H */
index 1edb7e17405d5341fb99484deed4c17bcdd68182..7e3fbc0e57b4db172d0adbe542527ba0424de6fb 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2002, 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2002, 2004, 2005, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  */
 
 #ifndef _SCDYNAMICSTOREKEY_H
  */
 
 #ifndef _SCDYNAMICSTOREKEY_H
+#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS
+#include <SystemConfiguration/_SCDynamicStoreKey.h>
+#else  /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
 #define _SCDYNAMICSTOREKEY_H
 
 #define _SCDYNAMICSTOREKEY_H
 
+#include <Availability.h>
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 
@@ -61,7 +65,7 @@ SCDynamicStoreKeyCreate                               (
                                                CFAllocatorRef  allocator,
                                                CFStringRef     fmt,
                                                ...
                                                CFAllocatorRef  allocator,
                                                CFStringRef     fmt,
                                                ...
-                                               );
+                                               )               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreKeyCreateNetworkGlobalEntity
 
 /*!
        @function SCDynamicStoreKeyCreateNetworkGlobalEntity
@@ -86,7 +90,7 @@ SCDynamicStoreKeyCreateNetworkGlobalEntity    (
                                                CFAllocatorRef  allocator,
                                                CFStringRef     domain,
                                                CFStringRef     entity
                                                CFAllocatorRef  allocator,
                                                CFStringRef     domain,
                                                CFStringRef     entity
-                                               );
+                                               )               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreKeyCreateNetworkInterface
 
 /*!
        @function SCDynamicStoreKeyCreateNetworkInterface
@@ -108,7 +112,7 @@ CFStringRef
 SCDynamicStoreKeyCreateNetworkInterface                (
                                                CFAllocatorRef  allocator,
                                                CFStringRef     domain
 SCDynamicStoreKeyCreateNetworkInterface                (
                                                CFAllocatorRef  allocator,
                                                CFStringRef     domain
-                                               );
+                                               )               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreKeyCreateNetworkInterfaceEntity
 
 /*!
        @function SCDynamicStoreKeyCreateNetworkInterfaceEntity
@@ -136,7 +140,7 @@ SCDynamicStoreKeyCreateNetworkInterfaceEntity       (
                                                CFStringRef     domain,
                                                CFStringRef     ifname,
                                                CFStringRef     entity
                                                CFStringRef     domain,
                                                CFStringRef     ifname,
                                                CFStringRef     entity
-                                               );
+                                               )               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreKeyCreateNetworkServiceEntity
 
 /*!
        @function SCDynamicStoreKeyCreateNetworkServiceEntity
@@ -165,7 +169,7 @@ SCDynamicStoreKeyCreateNetworkServiceEntity (
                                                CFStringRef     domain,
                                                CFStringRef     serviceID,
                                                CFStringRef     entity
                                                CFStringRef     domain,
                                                CFStringRef     serviceID,
                                                CFStringRef     entity
-                                               );
+                                               )               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreKeyCreateComputerName
 
 /*!
        @function SCDynamicStoreKeyCreateComputerName
@@ -183,7 +187,7 @@ SCDynamicStoreKeyCreateNetworkServiceEntity (
 CFStringRef
 SCDynamicStoreKeyCreateComputerName            (
                                                CFAllocatorRef          allocator
 CFStringRef
 SCDynamicStoreKeyCreateComputerName            (
                                                CFAllocatorRef          allocator
-                                               );
+                                               )               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreKeyCreateConsoleUser
 
 /*!
        @function SCDynamicStoreKeyCreateConsoleUser
@@ -200,7 +204,7 @@ SCDynamicStoreKeyCreateComputerName         (
 CFStringRef
 SCDynamicStoreKeyCreateConsoleUser             (
                                                CFAllocatorRef          allocator
 CFStringRef
 SCDynamicStoreKeyCreateConsoleUser             (
                                                CFAllocatorRef          allocator
-                                               );
+                                               )               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
 
 /*!
        @function SCDynamicStoreKeyCreateHostNames
 
 /*!
        @function SCDynamicStoreKeyCreateHostNames
@@ -218,7 +222,7 @@ SCDynamicStoreKeyCreateConsoleUser          (
 CFStringRef
 SCDynamicStoreKeyCreateHostNames               (
                                                CFAllocatorRef          allocator
 CFStringRef
 SCDynamicStoreKeyCreateHostNames               (
                                                CFAllocatorRef          allocator
-                                               );
+                                               )               __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreKeyCreateLocation
 
 /*!
        @function SCDynamicStoreKeyCreateLocation
@@ -236,7 +240,7 @@ SCDynamicStoreKeyCreateHostNames            (
 CFStringRef
 SCDynamicStoreKeyCreateLocation                        (
                                                CFAllocatorRef          allocator
 CFStringRef
 SCDynamicStoreKeyCreateLocation                        (
                                                CFAllocatorRef          allocator
-                                               );
+                                               )               __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCDynamicStoreKeyCreateProxies
 
 /*!
        @function SCDynamicStoreKeyCreateProxies
@@ -254,8 +258,9 @@ SCDynamicStoreKeyCreateLocation                     (
 CFStringRef
 SCDynamicStoreKeyCreateProxies                 (
                                                CFAllocatorRef          allocator
 CFStringRef
 SCDynamicStoreKeyCreateProxies                 (
                                                CFAllocatorRef          allocator
-                                               );
+                                               )               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 __END_DECLS
 
 
 __END_DECLS
 
-#endif /* _SCDYNAMICSTOREKEY_H */
+#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
+#endif /* _SCDYNAMICSTOREKEY_H */
index f3b03eb5303fe05c11a9e909625d589764420d1e..668ae5c6da518194847db28d101de2d3904c735d 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2001, 2003-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2001, 2003-2005, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -24,6 +24,7 @@
 #ifndef _SCDYNAMICSTORESETSPECIFICPRIVATE_H
 #define _SCDYNAMICSTORESETSPECIFICPRIVATE_H
 
 #ifndef _SCDYNAMICSTORESETSPECIFICPRIVATE_H
 #define _SCDYNAMICSTORESETSPECIFICPRIVATE_H
 
+#include <Availability.h>
 #include <sys/cdefs.h>
 #include <SystemConfiguration/SCDynamicStore.h>
 
 #include <sys/cdefs.h>
 #include <SystemConfiguration/SCDynamicStore.h>
 
@@ -61,7 +62,7 @@ SCDynamicStoreSetConsoleInformation   (
                                        uid_t                   uid,
                                        gid_t                   gid,
                                        CFArrayRef              sessions
                                        uid_t                   uid,
                                        gid_t                   gid,
                                        CFArrayRef              sessions
-                                       );
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
 
 /*!
        @function SCDynamicStoreSetConsoleUser
 
 /*!
        @function SCDynamicStoreSetConsoleUser
@@ -83,7 +84,7 @@ SCDynamicStoreSetConsoleUser          (
                                        const char              *user,
                                        uid_t                   uid,
                                        gid_t                   gid
                                        const char              *user,
                                        uid_t                   uid,
                                        gid_t                   gid
-                                       );
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
 
 __END_DECLS
 
 
 __END_DECLS
 
index b512aca8b589a29beca8660bc0bcdbffc11f36d2..8e047262df6e13983e4d1806217ee21567669dbc 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2003-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -24,6 +24,7 @@
 #ifndef _SCNETWORK_H
 #define _SCNETWORK_H
 
 #ifndef _SCNETWORK_H
 #define _SCNETWORK_H
 
+#include <Availability.h>
 #include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/socket.h>
                nodename or address is reachable, whether a connection is
                required, and whether some user intervention may be required
                when establishing a connection.
                nodename or address is reachable, whether a connection is
                required, and whether some user intervention may be required
                when establishing a connection.
+
+               Note: the SCNetworkConnection flags have been deprecated
+               in favor of the newer SCNetworkReachability flags defined
+               in SCNetworkReachability.h.
        @constant kSCNetworkFlagsTransientConnection
                This flag indicates that the specified nodename or address can
                be reached via a transient connection, such as PPP.
        @constant kSCNetworkFlagsTransientConnection
                This flag indicates that the specified nodename or address can
                be reached via a transient connection, such as PPP.
@@ -104,7 +109,7 @@ enum {
        kSCNetworkFlagsConnectionAutomatic      = 1<<3,
        kSCNetworkFlagsInterventionRequired     = 1<<4,
        kSCNetworkFlagsIsLocalAddress           = 1<<16,
        kSCNetworkFlagsConnectionAutomatic      = 1<<3,
        kSCNetworkFlagsInterventionRequired     = 1<<4,
        kSCNetworkFlagsIsLocalAddress           = 1<<16,
-       kSCNetworkFlagsIsDirect                 = 1<<17
+       kSCNetworkFlagsIsDirect                 = 1<<17,
 };
 typedef        uint32_t        SCNetworkConnectionFlags;
 
 };
 typedef        uint32_t        SCNetworkConnectionFlags;
 
@@ -114,6 +119,18 @@ __BEGIN_DECLS
        @function SCNetworkCheckReachabilityByAddress
        @discussion Determines if the given network address is
                reachable using the current network configuration.
        @function SCNetworkCheckReachabilityByAddress
        @discussion Determines if the given network address is
                reachable using the current network configuration.
+
+               Note: this API has been deprecated but you can
+                     get equivalent results with :
+<pre>
+       SCNetworkReachabiltyRef   target;
+       SCNetworkReachabiltyFlags flags = 0;
+       Boolean                   ok;
+
+       target = SCNetworkReachabilityCreateWithAddress(NULL, address);
+       ok = SCNetworkReachabilityGetFlags(target, &flags);
+       CFRelease(target);
+</pre>
        @param address The network address of the desired host.
        @param addrlen The length, in bytes, of the address.
        @param flags A pointer to memory that will be filled with a
        @param address The network address of the desired host.
        @param addrlen The length, in bytes, of the address.
        @param flags A pointer to memory that will be filled with a
@@ -127,12 +144,24 @@ SCNetworkCheckReachabilityByAddress       (
                                        const struct sockaddr           *address,
                                        socklen_t                       addrlen,
                                        SCNetworkConnectionFlags        *flags
                                        const struct sockaddr           *address,
                                        socklen_t                       addrlen,
                                        SCNetworkConnectionFlags        *flags
-                                       );
+                                       )                               __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA);
 
 /*!
        @function SCNetworkCheckReachabilityByName
        @discussion Determines if the given network host or node name is
                reachable using the current network configuration.
 
 /*!
        @function SCNetworkCheckReachabilityByName
        @discussion Determines if the given network host or node name is
                reachable using the current network configuration.
+
+               Note: this API has been deprecated but you can
+                     get equivalent results with :
+<pre>
+       SCNetworkReachabiltyRef   target;
+       SCNetworkReachabiltyFlags flags = 0;
+       Boolean                   ok;
+
+       target = SCNetworkReachabilityCreateWithName(NULL, name);
+       ok = SCNetworkReachabilityGetFlags(target, &flags);
+       CFRelease(target);
+</pre>
        @param nodename The node name of the desired host. This name would
                be the same as that passed to the gethostbyname(3) or
                getaddrinfo(3) functions.
        @param nodename The node name of the desired host. This name would
                be the same as that passed to the gethostbyname(3) or
                getaddrinfo(3) functions.
@@ -146,7 +175,7 @@ Boolean
 SCNetworkCheckReachabilityByName       (
                                        const char                      *nodename,
                                        SCNetworkConnectionFlags        *flags
 SCNetworkCheckReachabilityByName       (
                                        const char                      *nodename,
                                        SCNetworkConnectionFlags        *flags
-                                       );
+                                       )                               __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA);
 
 /*!
        @function SCNetworkInterfaceRefreshConfiguration
 
 /*!
        @function SCNetworkInterfaceRefreshConfiguration
@@ -162,8 +191,8 @@ SCNetworkCheckReachabilityByName    (
  */
 Boolean
 SCNetworkInterfaceRefreshConfiguration (
  */
 Boolean
 SCNetworkInterfaceRefreshConfiguration (
-                                       CFStringRef ifName
-                                       )       DEPRECATED_IN_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                       CFStringRef                     ifName
+                                       )                               __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA);
 
 __END_DECLS
 
 
 __END_DECLS
 
index 5398682752901de9cee8693f8508c7b55de61ad5..7e20211750fb7755df88e89d27e454abbadf8782 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  */
 
 #ifndef _SCNETWORKCONFIGURATION_H
  */
 
 #ifndef _SCNETWORKCONFIGURATION_H
+#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS
+#include <SystemConfiguration/_SCNetworkConfiguration.h>
+#else  /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
 #define _SCNETWORKCONFIGURATION_H
 
 #define _SCNETWORKCONFIGURATION_H
 
-#include <AvailabilityMacros.h>
+#include <Availability.h>
+#include <TargetConditionals.h>
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-
 /*!
        @header SCNetworkConfiguration
        @discussion The SCNetworkConfiguration API provides access to the
 /*!
        @header SCNetworkConfiguration
        @discussion The SCNetworkConfiguration API provides access to the
@@ -63,89 +65,92 @@ typedef const struct __SCNetworkInterface * SCNetworkInterfaceRef;
 /*!
        @const kSCNetworkInterfaceType6to4
  */
 /*!
        @const kSCNetworkInterfaceType6to4
  */
-extern const CFStringRef kSCNetworkInterfaceType6to4                                           AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+extern const CFStringRef kSCNetworkInterfaceType6to4                                           __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @const kSCNetworkInterfaceTypeBluetooth
  */
 
 /*!
        @const kSCNetworkInterfaceTypeBluetooth
  */
-extern const CFStringRef kSCNetworkInterfaceTypeBluetooth                                      AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+extern const CFStringRef kSCNetworkInterfaceTypeBluetooth                                      __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @const kSCNetworkInterfaceTypeBond
  */
 
 /*!
        @const kSCNetworkInterfaceTypeBond
  */
-extern const CFStringRef kSCNetworkInterfaceTypeBond                                           AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+extern const CFStringRef kSCNetworkInterfaceTypeBond                                           __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
 
 /*!
        @const kSCNetworkInterfaceTypeEthernet
  */
 
 /*!
        @const kSCNetworkInterfaceTypeEthernet
  */
-extern const CFStringRef kSCNetworkInterfaceTypeEthernet                                       AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+extern const CFStringRef kSCNetworkInterfaceTypeEthernet                                       __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @const kSCNetworkInterfaceTypeFireWire
  */
 
 /*!
        @const kSCNetworkInterfaceTypeFireWire
  */
-extern const CFStringRef kSCNetworkInterfaceTypeFireWire                                       AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+extern const CFStringRef kSCNetworkInterfaceTypeFireWire                                       __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @const kSCNetworkInterfaceTypeIEEE80211
  */
 
 /*!
        @const kSCNetworkInterfaceTypeIEEE80211
  */
-extern const CFStringRef kSCNetworkInterfaceTypeIEEE80211                                      AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;      // IEEE 802.11, AirPort
+extern const CFStringRef kSCNetworkInterfaceTypeIEEE80211                                      __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);       // IEEE 802.11, AirPort
+
+/*!
+ @const kSCNetworkInterfaceTypeIPSec
+ */
+extern const CFStringRef kSCNetworkInterfaceTypeIPSec                                          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/);
 
 /*!
        @const kSCNetworkInterfaceTypeIrDA
  */
 
 /*!
        @const kSCNetworkInterfaceTypeIrDA
  */
-extern const CFStringRef kSCNetworkInterfaceTypeIrDA                                           AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+extern const CFStringRef kSCNetworkInterfaceTypeIrDA                                           __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @const kSCNetworkInterfaceTypeL2TP
  */
 
 /*!
        @const kSCNetworkInterfaceTypeL2TP
  */
-extern const CFStringRef kSCNetworkInterfaceTypeL2TP                                           AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+extern const CFStringRef kSCNetworkInterfaceTypeL2TP                                           __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @const kSCNetworkInterfaceTypeModem
  */
 
 /*!
        @const kSCNetworkInterfaceTypeModem
  */
-extern const CFStringRef kSCNetworkInterfaceTypeModem                                          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+extern const CFStringRef kSCNetworkInterfaceTypeModem                                          __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @const kSCNetworkInterfaceTypePPP
  */
 
 /*!
        @const kSCNetworkInterfaceTypePPP
  */
-extern const CFStringRef kSCNetworkInterfaceTypePPP                                            AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+extern const CFStringRef kSCNetworkInterfaceTypePPP                                            __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @const kSCNetworkInterfaceTypePPTP
  */
 
 /*!
        @const kSCNetworkInterfaceTypePPTP
  */
-extern const CFStringRef kSCNetworkInterfaceTypePPTP                                           AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+extern const CFStringRef kSCNetworkInterfaceTypePPTP                                           __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @const kSCNetworkInterfaceTypeSerial
  */
 
 /*!
        @const kSCNetworkInterfaceTypeSerial
  */
-extern const CFStringRef kSCNetworkInterfaceTypeSerial                                         AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+extern const CFStringRef kSCNetworkInterfaceTypeSerial                                         __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @const kSCNetworkInterfaceTypeVLAN
  */
 
 /*!
        @const kSCNetworkInterfaceTypeVLAN
  */
-extern const CFStringRef kSCNetworkInterfaceTypeVLAN                                           AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+extern const CFStringRef kSCNetworkInterfaceTypeVLAN                                           __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
 
 /*!
        @const kSCNetworkInterfaceTypeWWAN
  */
 
 /*!
        @const kSCNetworkInterfaceTypeWWAN
  */
-extern const CFStringRef kSCNetworkInterfaceTypeWWAN                                           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+extern const CFStringRef kSCNetworkInterfaceTypeWWAN                                           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/);
 
 /* special network interfaces (and types) */
 
 /*!
        @const kSCNetworkInterfaceTypeIPv4
  */
 
 /* special network interfaces (and types) */
 
 /*!
        @const kSCNetworkInterfaceTypeIPv4
  */
-extern const CFStringRef kSCNetworkInterfaceTypeIPv4                                           AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+extern const CFStringRef kSCNetworkInterfaceTypeIPv4                                           __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @const kSCNetworkInterfaceIPv4
        @discussion A network interface that can used for layering other
 
 /*!
        @const kSCNetworkInterfaceIPv4
        @discussion A network interface that can used for layering other
-               interfaces (e.g. 6to4, PPTP, L2TP) over an existing
+               interfaces (e.g. 6to4, IPSec, PPTP, L2TP) over an existing
                IPv4 network.
  */
                IPv4 network.
  */
-extern const SCNetworkInterfaceRef kSCNetworkInterfaceIPv4                                     AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+extern const SCNetworkInterfaceRef kSCNetworkInterfaceIPv4                                     __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @group Interface configuration (Bond)
 
 /*!
        @group Interface configuration (Bond)
@@ -167,8 +172,7 @@ typedef SCNetworkInterfaceRef SCBondInterfaceRef;
  */
 typedef const struct __SCBondStatus *          SCBondStatusRef;
 
  */
 typedef const struct __SCBondStatus *          SCBondStatusRef;
 
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
-
+#if    !TARGET_OS_IPHONE
 /*!
        @enum Ethernet Bond Aggregation Status (kSCBondStatusDeviceAggregationStatus) codes
        @discussion Returned status codes.
 /*!
        @enum Ethernet Bond Aggregation Status (kSCBondStatusDeviceAggregationStatus) codes
        @discussion Returned status codes.
@@ -185,23 +189,22 @@ enum {
        kSCBondStatusNotInActiveGroup   = 3,    /* We're talking to a partner, but the link aggregation group is different from the one that's active */
        kSCBondStatusUnknown            = 999   /* Non-specific failure */
 };
        kSCBondStatusNotInActiveGroup   = 3,    /* We're talking to a partner, but the link aggregation group is different from the one that's active */
        kSCBondStatusUnknown            = 999   /* Non-specific failure */
 };
+#endif // !TARGET_OS_IPHONE
 
 /*!
   @const kSCBondStatusDeviceAggregationStatus
  */
 
 /*!
   @const kSCBondStatusDeviceAggregationStatus
  */
-extern const CFStringRef kSCBondStatusDeviceAggregationStatus  /* CFNumber */                  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+extern const CFStringRef kSCBondStatusDeviceAggregationStatus  /* CFNumber */                  __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
 
 /*!
   @const kSCBondStatusDeviceCollecting
  */
 
 /*!
   @const kSCBondStatusDeviceCollecting
  */
-extern const CFStringRef kSCBondStatusDeviceCollecting         /* CFNumber (0 or 1) */         AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+extern const CFStringRef kSCBondStatusDeviceCollecting         /* CFNumber (0 or 1) */         __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
 
 /*!
   @const kSCBondStatusDeviceDistributing
  */
 
 /*!
   @const kSCBondStatusDeviceDistributing
  */
-extern const CFStringRef kSCBondStatusDeviceDistributing       /* CFNumber (0 or 1) */         AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+extern const CFStringRef kSCBondStatusDeviceDistributing       /* CFNumber (0 or 1) */         __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
 
 /*!
        @group Interface configuration (VLAN)
 
 /*!
        @group Interface configuration (VLAN)
@@ -216,8 +219,6 @@ extern const CFStringRef kSCBondStatusDeviceDistributing    /* CFNumber (0 or 1) */
  */
 typedef SCNetworkInterfaceRef SCVLANInterfaceRef;
 
  */
 typedef SCNetworkInterfaceRef SCVLANInterfaceRef;
 
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
-
 
 /*!
        @group Protocol configuration
 
 /*!
        @group Protocol configuration
@@ -238,37 +239,32 @@ typedef const struct __SCNetworkProtocol * SCNetworkProtocolRef;
 /*!
        @const kSCNetworkProtocolTypeAppleTalk
  */
 /*!
        @const kSCNetworkProtocolTypeAppleTalk
  */
-extern const CFStringRef kSCNetworkProtocolTypeAppleTalk                                       AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+extern const CFStringRef kSCNetworkProtocolTypeAppleTalk                                       __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4,__MAC_10_6,__IPHONE_NA,__IPHONE_NA);
 
 /*!
        @const kSCNetworkProtocolTypeDNS
  */
 
 /*!
        @const kSCNetworkProtocolTypeDNS
  */
-extern const CFStringRef kSCNetworkProtocolTypeDNS                                             AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+extern const CFStringRef kSCNetworkProtocolTypeDNS                                             __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @const kSCNetworkProtocolTypeIPv4
  */
 
 /*!
        @const kSCNetworkProtocolTypeIPv4
  */
-extern const CFStringRef kSCNetworkProtocolTypeIPv4                                            AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+extern const CFStringRef kSCNetworkProtocolTypeIPv4                                            __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @const kSCNetworkProtocolTypeIPv6
  */
 
 /*!
        @const kSCNetworkProtocolTypeIPv6
  */
-extern const CFStringRef kSCNetworkProtocolTypeIPv6                                            AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+extern const CFStringRef kSCNetworkProtocolTypeIPv6                                            __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @const kSCNetworkProtocolTypeProxies
  */
 
 /*!
        @const kSCNetworkProtocolTypeProxies
  */
-extern const CFStringRef kSCNetworkProtocolTypeProxies                                         AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+extern const CFStringRef kSCNetworkProtocolTypeProxies                                         __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @const kSCNetworkProtocolTypeSMB
  */
 
 /*!
        @const kSCNetworkProtocolTypeSMB
  */
-extern const CFStringRef kSCNetworkProtocolTypeSMB                                             AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
-
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
-
+extern const CFStringRef kSCNetworkProtocolTypeSMB                                             __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @group Service configuration
 
 /*!
        @group Service configuration
@@ -319,7 +315,7 @@ __BEGIN_DECLS
        @discussion Returns the type identifier of all SCNetworkInterface instances.
  */
 CFTypeID
        @discussion Returns the type identifier of all SCNetworkInterface instances.
  */
 CFTypeID
-SCNetworkInterfaceGetTypeID                    (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkInterfaceGetTypeID                    (void)                                          __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkInterfaceCopyAll
 
 /*!
        @function SCNetworkInterfaceCopyAll
@@ -328,7 +324,7 @@ SCNetworkInterfaceGetTypeID                 (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LA
                You must release the returned value.
  */
 CFArrayRef /* of SCNetworkInterfaceRef's */
                You must release the returned value.
  */
 CFArrayRef /* of SCNetworkInterfaceRef's */
-SCNetworkInterfaceCopyAll                      (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkInterfaceCopyAll                      (void)                                          __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkInterfaceGetSupportedInterfaceTypes
 
 /*!
        @function SCNetworkInterfaceGetSupportedInterfaceTypes
@@ -339,7 +335,7 @@ SCNetworkInterfaceCopyAll                   (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATE
                NULL if no interface types are supported.
  */
 CFArrayRef /* of kSCNetworkInterfaceTypeXXX CFStringRef's */
                NULL if no interface types are supported.
  */
 CFArrayRef /* of kSCNetworkInterfaceTypeXXX CFStringRef's */
-SCNetworkInterfaceGetSupportedInterfaceTypes   (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkInterfaceGetSupportedInterfaceTypes   (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkInterfaceGetSupportedProtocolTypes
 
 /*!
        @function SCNetworkInterfaceGetSupportedProtocolTypes
@@ -350,7 +346,7 @@ SCNetworkInterfaceGetSupportedInterfaceTypes        (SCNetworkInterfaceRef          interface)
                NULL if no protocol types are supported.
  */
 CFArrayRef /* of kSCNetworkProtocolTypeXXX CFStringRef's */
                NULL if no protocol types are supported.
  */
 CFArrayRef /* of kSCNetworkProtocolTypeXXX CFStringRef's */
-SCNetworkInterfaceGetSupportedProtocolTypes    (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkInterfaceGetSupportedProtocolTypes    (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkInterfaceCreateWithInterface
 
 /*!
        @function SCNetworkInterfaceCreateWithInterface
@@ -365,7 +361,7 @@ SCNetworkInterfaceGetSupportedProtocolTypes (SCNetworkInterfaceRef          interface)      A
  */
 SCNetworkInterfaceRef
 SCNetworkInterfaceCreateWithInterface          (SCNetworkInterfaceRef          interface,
  */
 SCNetworkInterfaceRef
 SCNetworkInterfaceCreateWithInterface          (SCNetworkInterfaceRef          interface,
-                                                CFStringRef                    interfaceType)  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                                CFStringRef                    interfaceType)  __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkInterfaceGetBSDName
 
 /*!
        @function SCNetworkInterfaceGetBSDName
@@ -376,7 +372,7 @@ SCNetworkInterfaceCreateWithInterface               (SCNetworkInterfaceRef          interface,
                NULL if no BSD name is available.
  */
 CFStringRef
                NULL if no BSD name is available.
  */
 CFStringRef
-SCNetworkInterfaceGetBSDName                   (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkInterfaceGetBSDName                   (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkInterfaceGetConfiguration
 
 /*!
        @function SCNetworkInterfaceGetConfiguration
@@ -387,9 +383,7 @@ SCNetworkInterfaceGetBSDName                        (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_
                or an error was encountered.
  */
 CFDictionaryRef
                or an error was encountered.
  */
 CFDictionaryRef
-SCNetworkInterfaceGetConfiguration             (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+SCNetworkInterfaceGetConfiguration             (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkInterfaceGetExtendedConfiguration
 
 /*!
        @function SCNetworkInterfaceGetExtendedConfiguration
@@ -402,9 +396,7 @@ SCNetworkInterfaceGetConfiguration          (SCNetworkInterfaceRef          interface)      AVAILABLE
  */
 CFDictionaryRef
 SCNetworkInterfaceGetExtendedConfiguration     (SCNetworkInterfaceRef          interface,
  */
 CFDictionaryRef
 SCNetworkInterfaceGetExtendedConfiguration     (SCNetworkInterfaceRef          interface,
-                                                CFStringRef                    extendedType)   AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
-
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
+                                                CFStringRef                    extendedType)   __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkInterfaceGetHardwareAddressString
 
 /*!
        @function SCNetworkInterfaceGetHardwareAddressString
@@ -413,7 +405,7 @@ SCNetworkInterfaceGetExtendedConfiguration  (SCNetworkInterfaceRef          interface,
        @result A string representing the hardware (MAC) address for the interface.
  */
 CFStringRef
        @result A string representing the hardware (MAC) address for the interface.
  */
 CFStringRef
-SCNetworkInterfaceGetHardwareAddressString     (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkInterfaceGetHardwareAddressString     (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkInterfaceGetInterface
 
 /*!
        @function SCNetworkInterfaceGetInterface
@@ -423,7 +415,7 @@ SCNetworkInterfaceGetHardwareAddressString  (SCNetworkInterfaceRef          interface)      AV
                NULL if this is a leaf interface.
  */
 SCNetworkInterfaceRef
                NULL if this is a leaf interface.
  */
 SCNetworkInterfaceRef
-SCNetworkInterfaceGetInterface                 (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkInterfaceGetInterface                 (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkInterfaceGetInterfaceType
 
 /*!
        @function SCNetworkInterfaceGetInterfaceType
@@ -432,7 +424,7 @@ SCNetworkInterfaceGetInterface                      (SCNetworkInterfaceRef          interface)      AVAILABLE_MA
        @result The interface type.
  */
 CFStringRef
        @result The interface type.
  */
 CFStringRef
-SCNetworkInterfaceGetInterfaceType             (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkInterfaceGetInterfaceType             (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkInterfaceGetLocalizedDisplayName
 
 /*!
        @function SCNetworkInterfaceGetLocalizedDisplayName
@@ -443,7 +435,7 @@ SCNetworkInterfaceGetInterfaceType          (SCNetworkInterfaceRef          interface)      AVAILABLE
                NULL if no name is available.
  */
 CFStringRef
                NULL if no name is available.
  */
 CFStringRef
-SCNetworkInterfaceGetLocalizedDisplayName      (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkInterfaceGetLocalizedDisplayName      (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkInterfaceSetConfiguration
 
 /*!
        @function SCNetworkInterfaceSetConfiguration
@@ -454,9 +446,7 @@ SCNetworkInterfaceGetLocalizedDisplayName   (SCNetworkInterfaceRef          interface)      AVA
  */
 Boolean
 SCNetworkInterfaceSetConfiguration             (SCNetworkInterfaceRef          interface,
  */
 Boolean
 SCNetworkInterfaceSetConfiguration             (SCNetworkInterfaceRef          interface,
-                                                CFDictionaryRef                config)         AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+                                                CFDictionaryRef                config)         __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkInterfaceSetExtendedConfiguration
 
 /*!
        @function SCNetworkInterfaceSetExtendedConfiguration
@@ -468,11 +458,7 @@ SCNetworkInterfaceSetConfiguration         (SCNetworkInterfaceRef          interface,
 Boolean
 SCNetworkInterfaceSetExtendedConfiguration     (SCNetworkInterfaceRef          interface,
                                                 CFStringRef                    extendedType,
 Boolean
 SCNetworkInterfaceSetExtendedConfiguration     (SCNetworkInterfaceRef          interface,
                                                 CFStringRef                    extendedType,
-                                                CFDictionaryRef                config)         AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
-
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+                                                CFDictionaryRef                config)         __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/);
 
 #pragma mark -
 
 
 #pragma mark -
 
@@ -501,7 +487,7 @@ SCNetworkInterfaceCopyMediaOptions          (SCNetworkInterfaceRef          interface,
                                                 CFDictionaryRef                *current,
                                                 CFDictionaryRef                *active,
                                                 CFArrayRef                     *available,
                                                 CFDictionaryRef                *current,
                                                 CFDictionaryRef                *active,
                                                 CFArrayRef                     *available,
-                                                Boolean                        filter)         AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                Boolean                        filter)         __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkInterfaceCopyMediaSubTypes
 
 /*!
        @function SCNetworkInterfaceCopyMediaSubTypes
@@ -513,7 +499,7 @@ SCNetworkInterfaceCopyMediaOptions          (SCNetworkInterfaceRef          interface,
                100baseTX, etc).  NULL if no subtypes are available.
  */
 CFArrayRef
                100baseTX, etc).  NULL if no subtypes are available.
  */
 CFArrayRef
-SCNetworkInterfaceCopyMediaSubTypes            (CFArrayRef                     available)      AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCNetworkInterfaceCopyMediaSubTypes            (CFArrayRef                     available)      __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkInterfaceCopyMediaSubTypeOptions
 
 /*!
        @function SCNetworkInterfaceCopyMediaSubTypeOptions
@@ -528,7 +514,7 @@ SCNetworkInterfaceCopyMediaSubTypes         (CFArrayRef                     available)      AVAILABLE_MAC_OS_X
  */
 CFArrayRef
 SCNetworkInterfaceCopyMediaSubTypeOptions      (CFArrayRef                     available,
  */
 CFArrayRef
 SCNetworkInterfaceCopyMediaSubTypeOptions      (CFArrayRef                     available,
-                                                CFStringRef                    subType)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                CFStringRef                    subType)        __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkInterfaceCopyMTU
 
 /*!
        @function SCNetworkInterfaceCopyMTU
@@ -550,7 +536,7 @@ Boolean
 SCNetworkInterfaceCopyMTU                      (SCNetworkInterfaceRef          interface,
                                                 int                            *mtu_cur,
                                                 int                            *mtu_min,
 SCNetworkInterfaceCopyMTU                      (SCNetworkInterfaceRef          interface,
                                                 int                            *mtu_cur,
                                                 int                            *mtu_min,
-                                                int                            *mtu_max)       AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                int                            *mtu_max)       __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkInterfaceSetMediaOptions
 
 /*!
        @function SCNetworkInterfaceSetMediaOptions
@@ -565,7 +551,7 @@ SCNetworkInterfaceCopyMTU                   (SCNetworkInterfaceRef          interface,
 Boolean
 SCNetworkInterfaceSetMediaOptions              (SCNetworkInterfaceRef          interface,
                                                 CFStringRef                    subtype,
 Boolean
 SCNetworkInterfaceSetMediaOptions              (SCNetworkInterfaceRef          interface,
                                                 CFStringRef                    subtype,
-                                                CFArrayRef                     options)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                CFArrayRef                     options)        __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkInterfaceSetMTU
 
 /*!
        @function SCNetworkInterfaceSetMTU
@@ -577,7 +563,7 @@ SCNetworkInterfaceSetMediaOptions           (SCNetworkInterfaceRef          interface,
  */
 Boolean
 SCNetworkInterfaceSetMTU                       (SCNetworkInterfaceRef          interface,
  */
 Boolean
 SCNetworkInterfaceSetMTU                       (SCNetworkInterfaceRef          interface,
-                                                int                            mtu)            AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                int                            mtu)            __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkInterfaceForceConfigurationRefresh
 
 /*!
        @function SCNetworkInterfaceForceConfigurationRefresh
@@ -589,7 +575,6 @@ SCNetworkInterfaceSetMTU                    (SCNetworkInterfaceRef          interface,
                allow the caller to give a hint to the system that the
                network infrastructure or configuration has changed.
 
                allow the caller to give a hint to the system that the
                network infrastructure or configuration has changed.
 
-
                Note: This function requires root (euid==0) privilege or,
                alternatively, you may pass an SCNetworkInterface which
                is derived from a sequence of calls to :
                Note: This function requires root (euid==0) privilege or,
                alternatively, you may pass an SCNetworkInterface which
                is derived from a sequence of calls to :
@@ -601,11 +586,7 @@ SCNetworkInterfaceSetMTU                   (SCNetworkInterfaceRef          interface,
        @result Returns TRUE if the notification was sent; FALSE otherwise.
  */
 Boolean
        @result Returns TRUE if the notification was sent; FALSE otherwise.
  */
 Boolean
-SCNetworkInterfaceForceConfigurationRefresh    (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
-
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+SCNetworkInterfaceForceConfigurationRefresh    (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/);
 
 /*!
        @group Interface configuration (Bond)
 
 /*!
        @group Interface configuration (Bond)
@@ -622,7 +603,7 @@ SCNetworkInterfaceForceConfigurationRefresh (SCNetworkInterfaceRef          interface)      A
                You must release the returned value.
  */
 CFArrayRef /* of SCBondInterfaceRef's */
                You must release the returned value.
  */
 CFArrayRef /* of SCBondInterfaceRef's */
-SCBondInterfaceCopyAll                         (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCBondInterfaceCopyAll                         (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCBondInterfaceCopyAvailableMemberInterfaces
 
 /*!
        @function SCBondInterfaceCopyAvailableMemberInterfaces
@@ -633,7 +614,7 @@ SCBondInterfaceCopyAll                              (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION_
                You must release the returned value.
  */
 CFArrayRef /* of SCNetworkInterfaceRef's */
                You must release the returned value.
  */
 CFArrayRef /* of SCNetworkInterfaceRef's */
-SCBondInterfaceCopyAvailableMemberInterfaces   (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCBondInterfaceCopyAvailableMemberInterfaces   (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCBondInterfaceCreate
 
 /*!
        @function SCBondInterfaceCreate
@@ -643,7 +624,7 @@ SCBondInterfaceCopyAvailableMemberInterfaces        (SCPreferencesRef               prefs)          AVAILABL
                You must release the returned value.
  */
 SCBondInterfaceRef
                You must release the returned value.
  */
 SCBondInterfaceRef
-SCBondInterfaceCreate                          (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCBondInterfaceCreate                          (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCBondInterfaceRemove
 
 /*!
        @function SCBondInterfaceRemove
@@ -652,7 +633,7 @@ SCBondInterfaceCreate                               (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION_1
        @result TRUE if the interface was removed; FALSE if an error was encountered.
  */
 Boolean
        @result TRUE if the interface was removed; FALSE if an error was encountered.
  */
 Boolean
-SCBondInterfaceRemove                          (SCBondInterfaceRef             bond)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCBondInterfaceRemove                          (SCBondInterfaceRef             bond)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCBondInterfaceGetMemberInterfaces
 
 /*!
        @function SCBondInterfaceGetMemberInterfaces
@@ -661,7 +642,7 @@ SCBondInterfaceRemove                               (SCBondInterfaceRef             bond)           AVAILABLE_MAC_OS_X_VERSION_
        @result The list of interfaces.
  */
 CFArrayRef /* of SCNetworkInterfaceRef's */
        @result The list of interfaces.
  */
 CFArrayRef /* of SCNetworkInterfaceRef's */
-SCBondInterfaceGetMemberInterfaces             (SCBondInterfaceRef             bond)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCBondInterfaceGetMemberInterfaces             (SCBondInterfaceRef             bond)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCBondInterfaceGetOptions
 
 /*!
        @function SCBondInterfaceGetOptions
@@ -671,7 +652,7 @@ SCBondInterfaceGetMemberInterfaces          (SCBondInterfaceRef             bond)           AVAILABLE_MAC_OS
                NULL if no changes to the default configuration have been saved.
  */
 CFDictionaryRef
                NULL if no changes to the default configuration have been saved.
  */
 CFDictionaryRef
-SCBondInterfaceGetOptions                      (SCBondInterfaceRef             bond)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCBondInterfaceGetOptions                      (SCBondInterfaceRef             bond)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCBondInterfaceSetMemberInterfaces
 
 /*!
        @function SCBondInterfaceSetMemberInterfaces
@@ -683,7 +664,7 @@ SCBondInterfaceGetOptions                   (SCBondInterfaceRef             bond)           AVAILABLE_MAC_OS_X_VERSI
 Boolean
 SCBondInterfaceSetMemberInterfaces             (SCBondInterfaceRef             bond,
                                                 CFArrayRef                     members) /* of SCNetworkInterfaceRef's */
 Boolean
 SCBondInterfaceSetMemberInterfaces             (SCBondInterfaceRef             bond,
                                                 CFArrayRef                     members) /* of SCNetworkInterfaceRef's */
-                                                                                               AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                                                               __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCBondInterfaceSetLocalizedDisplayName
 
 /*!
        @function SCBondInterfaceSetLocalizedDisplayName
@@ -694,7 +675,7 @@ SCBondInterfaceSetMemberInterfaces          (SCBondInterfaceRef             bond,
  */
 Boolean
 SCBondInterfaceSetLocalizedDisplayName         (SCBondInterfaceRef             bond,
  */
 Boolean
 SCBondInterfaceSetLocalizedDisplayName         (SCBondInterfaceRef             bond,
-                                                CFStringRef                    newName)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                CFStringRef                    newName)        __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCBondInterfaceSetOptions
 
 /*!
        @function SCBondInterfaceSetOptions
@@ -705,7 +686,7 @@ SCBondInterfaceSetLocalizedDisplayName              (SCBondInterfaceRef             bond,
  */
 Boolean
 SCBondInterfaceSetOptions                      (SCBondInterfaceRef             bond,
  */
 Boolean
 SCBondInterfaceSetOptions                      (SCBondInterfaceRef             bond,
-                                                CFDictionaryRef                newOptions)     AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                CFDictionaryRef                newOptions)     __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 #pragma mark -
 
 
 #pragma mark -
 
@@ -717,14 +698,14 @@ SCBondInterfaceSetOptions                 (SCBondInterfaceRef             bond,
                You must release the returned value.
  */
 SCBondStatusRef
                You must release the returned value.
  */
 SCBondStatusRef
-SCBondInterfaceCopyStatus                      (SCBondInterfaceRef     bond)                   AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCBondInterfaceCopyStatus                      (SCBondInterfaceRef     bond)                   __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCBondStatusGetTypeID
        @discussion Returns the type identifier of all SCBondStatus instances.
  */
 CFTypeID
 
 /*!
        @function SCBondStatusGetTypeID
        @discussion Returns the type identifier of all SCBondStatus instances.
  */
 CFTypeID
-SCBondStatusGetTypeID                          (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCBondStatusGetTypeID                          (void)                                          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCBondStatusGetMemberInterfaces
 
 /*!
        @function SCBondStatusGetMemberInterfaces
@@ -734,7 +715,7 @@ SCBondStatusGetTypeID                               (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
        @result The list of interfaces.
  */
 CFArrayRef /* of SCNetworkInterfaceRef's */
        @result The list of interfaces.
  */
 CFArrayRef /* of SCNetworkInterfaceRef's */
-SCBondStatusGetMemberInterfaces                        (SCBondStatusRef        bondStatus)             AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCBondStatusGetMemberInterfaces                        (SCBondStatusRef        bondStatus)             __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCBondStatusGetInterfaceStatus
 
 /*!
        @function SCBondStatusGetInterfaceStatus
@@ -744,10 +725,14 @@ SCBondStatusGetMemberInterfaces                   (SCBondStatusRef        bondStatus)             AVAILABLE_MAC_OS
        @param interface The specific member interface; NULL if you want the
                status of the Ethernet Bond.
        @result The interface status.
        @param interface The specific member interface; NULL if you want the
                status of the Ethernet Bond.
        @result The interface status.
+
+       Note: at present, no information about the status of the Ethernet
+             Bond is returned.  As long as one member interface is active
+             then the bond should be operational.
  */
 CFDictionaryRef
 SCBondStatusGetInterfaceStatus                 (SCBondStatusRef        bondStatus,
  */
 CFDictionaryRef
 SCBondStatusGetInterfaceStatus                 (SCBondStatusRef        bondStatus,
-                                                SCNetworkInterfaceRef  interface)              AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                SCNetworkInterfaceRef  interface)              __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @group Interface configuration (VLAN)
 
 /*!
        @group Interface configuration (VLAN)
@@ -763,7 +748,7 @@ SCBondStatusGetInterfaceStatus                      (SCBondStatusRef        bondStatus,
                You must release the returned value.
  */
 CFArrayRef /* of SCVLANInterfaceRef's */
                You must release the returned value.
  */
 CFArrayRef /* of SCVLANInterfaceRef's */
-SCVLANInterfaceCopyAll                         (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCVLANInterfaceCopyAll                         (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCVLANInterfaceCopyAvailablePhysicalInterfaces
 
 /*!
        @function SCVLANInterfaceCopyAvailablePhysicalInterfaces
@@ -773,7 +758,7 @@ SCVLANInterfaceCopyAll                              (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION_
                You must release the returned value.
  */
 CFArrayRef /* of SCNetworkInterfaceRef's */
                You must release the returned value.
  */
 CFArrayRef /* of SCNetworkInterfaceRef's */
-SCVLANInterfaceCopyAvailablePhysicalInterfaces (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCVLANInterfaceCopyAvailablePhysicalInterfaces (void)                                          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCVLANInterfaceCreate
 
 /*!
        @function SCVLANInterfaceCreate
@@ -789,7 +774,7 @@ SCVLANInterfaceCopyAvailablePhysicalInterfaces      (void)                                          AVAILABLE_MAC_OS_X_VE
 SCVLANInterfaceRef
 SCVLANInterfaceCreate                          (SCPreferencesRef               prefs,
                                                 SCNetworkInterfaceRef          physical,
 SCVLANInterfaceRef
 SCVLANInterfaceCreate                          (SCPreferencesRef               prefs,
                                                 SCNetworkInterfaceRef          physical,
-                                                CFNumberRef                    tag)            AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                CFNumberRef                    tag)            __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCVLANInterfaceRemove
 
 /*!
        @function SCVLANInterfaceRemove
@@ -798,7 +783,7 @@ SCVLANInterfaceCreate                               (SCPreferencesRef               prefs,
        @result TRUE if the interface was removed; FALSE if an error was encountered.
  */
 Boolean
        @result TRUE if the interface was removed; FALSE if an error was encountered.
  */
 Boolean
-SCVLANInterfaceRemove                          (SCVLANInterfaceRef             vlan)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCVLANInterfaceRemove                          (SCVLANInterfaceRef             vlan)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCVLANInterfaceGetPhysicalInterface
 
 /*!
        @function SCVLANInterfaceGetPhysicalInterface
@@ -807,7 +792,7 @@ SCVLANInterfaceRemove                               (SCVLANInterfaceRef             vlan)           AVAILABLE_MAC_OS_X_VERSION_
        @result The list of interfaces.
  */
 SCNetworkInterfaceRef
        @result The list of interfaces.
  */
 SCNetworkInterfaceRef
-SCVLANInterfaceGetPhysicalInterface            (SCVLANInterfaceRef             vlan)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCVLANInterfaceGetPhysicalInterface            (SCVLANInterfaceRef             vlan)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCVLANInterfaceGetTag
 
 /*!
        @function SCVLANInterfaceGetTag
@@ -816,7 +801,7 @@ SCVLANInterfaceGetPhysicalInterface         (SCVLANInterfaceRef             vlan)           AVAILABLE_MAC_O
        @result The tag.
  */
 CFNumberRef
        @result The tag.
  */
 CFNumberRef
-SCVLANInterfaceGetTag                          (SCVLANInterfaceRef             vlan)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCVLANInterfaceGetTag                          (SCVLANInterfaceRef             vlan)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCVLANInterfaceGetOptions
 
 /*!
        @function SCVLANInterfaceGetOptions
@@ -826,7 +811,7 @@ SCVLANInterfaceGetTag                               (SCVLANInterfaceRef             vlan)           AVAILABLE_MAC_OS_X_VERSION_
                NULL if no changes to the default configuration have been saved.
  */
 CFDictionaryRef
                NULL if no changes to the default configuration have been saved.
  */
 CFDictionaryRef
-SCVLANInterfaceGetOptions                      (SCVLANInterfaceRef             vlan)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCVLANInterfaceGetOptions                      (SCVLANInterfaceRef             vlan)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCVLANInterfaceSetPhysicalInterfaceAndTag
 
 /*!
        @function SCVLANInterfaceSetPhysicalInterfaceAndTag
@@ -841,7 +826,7 @@ SCVLANInterfaceGetOptions                   (SCVLANInterfaceRef             vlan)           AVAILABLE_MAC_OS_X_VERSI
 Boolean
 SCVLANInterfaceSetPhysicalInterfaceAndTag      (SCVLANInterfaceRef             vlan,
                                                 SCNetworkInterfaceRef          physical,
 Boolean
 SCVLANInterfaceSetPhysicalInterfaceAndTag      (SCVLANInterfaceRef             vlan,
                                                 SCNetworkInterfaceRef          physical,
-                                                CFNumberRef                    tag)            AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                CFNumberRef                    tag)            __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCVLANInterfaceSetLocalizedDisplayName
 
 /*!
        @function SCVLANInterfaceSetLocalizedDisplayName
@@ -852,7 +837,7 @@ SCVLANInterfaceSetPhysicalInterfaceAndTag   (SCVLANInterfaceRef             vlan,
  */
 Boolean
 SCVLANInterfaceSetLocalizedDisplayName         (SCVLANInterfaceRef             vlan,
  */
 Boolean
 SCVLANInterfaceSetLocalizedDisplayName         (SCVLANInterfaceRef             vlan,
-                                                CFStringRef                    newName)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                CFStringRef                    newName)        __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCVLANInterfaceSetOptions
 
 /*!
        @function SCVLANInterfaceSetOptions
@@ -863,9 +848,8 @@ SCVLANInterfaceSetLocalizedDisplayName              (SCVLANInterfaceRef             vlan,
  */
 Boolean
 SCVLANInterfaceSetOptions                      (SCVLANInterfaceRef             vlan,
  */
 Boolean
 SCVLANInterfaceSetOptions                      (SCVLANInterfaceRef             vlan,
-                                                CFDictionaryRef                newOptions)     AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                CFDictionaryRef                newOptions)     __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
 
 /* --------------------------------------------------------------------------------
  * PROTOCOLS
 
 /* --------------------------------------------------------------------------------
  * PROTOCOLS
@@ -883,7 +867,7 @@ SCVLANInterfaceSetOptions                   (SCVLANInterfaceRef             vlan,
        @discussion Returns the type identifier of all SCNetworkProtocol instances.
  */
 CFTypeID
        @discussion Returns the type identifier of all SCNetworkProtocol instances.
  */
 CFTypeID
-SCNetworkProtocolGetTypeID                     (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkProtocolGetTypeID                     (void)                                          __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkProtocolGetConfiguration
 
 /*!
        @function SCNetworkProtocolGetConfiguration
@@ -894,7 +878,7 @@ SCNetworkProtocolGetTypeID                  (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LAT
                or an error was encountered.
  */
 CFDictionaryRef
                or an error was encountered.
  */
 CFDictionaryRef
-SCNetworkProtocolGetConfiguration              (SCNetworkProtocolRef           protocol)       AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkProtocolGetConfiguration              (SCNetworkProtocolRef           protocol)       __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkProtocolGetEnabled
 
 /*!
        @function SCNetworkProtocolGetEnabled
@@ -903,7 +887,7 @@ SCNetworkProtocolGetConfiguration           (SCNetworkProtocolRef           protocol)       AVAILABLE_MA
        @result TRUE if the protocol is enabled.
  */
 Boolean
        @result TRUE if the protocol is enabled.
  */
 Boolean
-SCNetworkProtocolGetEnabled                    (SCNetworkProtocolRef           protocol)       AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkProtocolGetEnabled                    (SCNetworkProtocolRef           protocol)       __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkProtocolGetProtocolType
 
 /*!
        @function SCNetworkProtocolGetProtocolType
@@ -912,7 +896,7 @@ SCNetworkProtocolGetEnabled                 (SCNetworkProtocolRef           protocol)       AVAILABLE_MAC_OS_
        @result The protocol type.
  */
 CFStringRef
        @result The protocol type.
  */
 CFStringRef
-SCNetworkProtocolGetProtocolType               (SCNetworkProtocolRef           protocol)       AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkProtocolGetProtocolType               (SCNetworkProtocolRef           protocol)       __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkProtocolSetConfiguration
 
 /*!
        @function SCNetworkProtocolSetConfiguration
@@ -923,7 +907,7 @@ SCNetworkProtocolGetProtocolType            (SCNetworkProtocolRef           protocol)       AVAILABLE_MAC
  */
 Boolean
 SCNetworkProtocolSetConfiguration              (SCNetworkProtocolRef           protocol,
  */
 Boolean
 SCNetworkProtocolSetConfiguration              (SCNetworkProtocolRef           protocol,
-                                                CFDictionaryRef                config)         AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                                CFDictionaryRef                config)         __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkProtocolSetEnabled
 
 /*!
        @function SCNetworkProtocolSetEnabled
@@ -934,7 +918,7 @@ SCNetworkProtocolSetConfiguration           (SCNetworkProtocolRef           protocol,
  */
 Boolean
 SCNetworkProtocolSetEnabled                    (SCNetworkProtocolRef           protocol,
  */
 Boolean
 SCNetworkProtocolSetEnabled                    (SCNetworkProtocolRef           protocol,
-                                                Boolean                        enabled)        AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                                Boolean                        enabled)        __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /* --------------------------------------------------------------------------------
  * SERVICES
 
 /* --------------------------------------------------------------------------------
  * SERVICES
@@ -952,7 +936,7 @@ SCNetworkProtocolSetEnabled                 (SCNetworkProtocolRef           protocol,
        @discussion Returns the type identifier of all SCNetworkService instances.
  */
 CFTypeID
        @discussion Returns the type identifier of all SCNetworkService instances.
  */
 CFTypeID
-SCNetworkServiceGetTypeID                      (void);
+SCNetworkServiceGetTypeID                      (void)                                          __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkServiceAddProtocolType
 
 /*!
        @function SCNetworkServiceAddProtocolType
@@ -967,7 +951,7 @@ SCNetworkServiceGetTypeID                   (void);
  */
 Boolean
 SCNetworkServiceAddProtocolType                        (SCNetworkServiceRef            service,
  */
 Boolean
 SCNetworkServiceAddProtocolType                        (SCNetworkServiceRef            service,
-                                                CFStringRef                    protocolType)   AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                                CFStringRef                    protocolType)   __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkServiceCopyAll
 
 /*!
        @function SCNetworkServiceCopyAll
@@ -977,7 +961,7 @@ SCNetworkServiceAddProtocolType                     (SCNetworkServiceRef            service,
                You must release the returned value.
  */
 CFArrayRef /* of SCNetworkServiceRef's */
                You must release the returned value.
  */
 CFArrayRef /* of SCNetworkServiceRef's */
-SCNetworkServiceCopyAll                                (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkServiceCopyAll                                (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkServiceCopyProtocols
 
 /*!
        @function SCNetworkServiceCopyProtocols
@@ -987,7 +971,7 @@ SCNetworkServiceCopyAll                             (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION
                You must release the returned value.
  */
 CFArrayRef /* of SCNetworkProtocolRef's */
                You must release the returned value.
  */
 CFArrayRef /* of SCNetworkProtocolRef's */
-SCNetworkServiceCopyProtocols                  (SCNetworkServiceRef            service)        AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkServiceCopyProtocols                  (SCNetworkServiceRef            service)        __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkServiceCreate
 
 /*!
        @function SCNetworkServiceCreate
@@ -999,7 +983,7 @@ SCNetworkServiceCopyProtocols                       (SCNetworkServiceRef            service)        AVAILABLE_MAC_OS_
  */
 SCNetworkServiceRef
 SCNetworkServiceCreate                         (SCPreferencesRef               prefs,
  */
 SCNetworkServiceRef
 SCNetworkServiceCreate                         (SCPreferencesRef               prefs,
-                                                SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                                SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkServiceCopy
 
 /*!
        @function SCNetworkServiceCopy
@@ -1013,9 +997,7 @@ SCNetworkServiceCreate                             (SCPreferencesRef               prefs,
  */
 SCNetworkServiceRef
 SCNetworkServiceCopy                           (SCPreferencesRef               prefs,
  */
 SCNetworkServiceRef
 SCNetworkServiceCopy                           (SCPreferencesRef               prefs,
-                                                CFStringRef                    serviceID)      AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+                                                CFStringRef                    serviceID)      __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkServiceEstablishDefaultConfiguration
 
 /*!
        @function SCNetworkServiceEstablishDefaultConfiguration
@@ -1027,9 +1009,7 @@ SCNetworkServiceCopy                              (SCPreferencesRef               prefs,
        @result TRUE if the configuration was updated; FALSE if an error was encountered.
 */
 Boolean
        @result TRUE if the configuration was updated; FALSE if an error was encountered.
 */
 Boolean
-SCNetworkServiceEstablishDefaultConfiguration          (SCNetworkServiceRef            service)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
-
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
+SCNetworkServiceEstablishDefaultConfiguration  (SCNetworkServiceRef            service)        __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkServiceGetEnabled
 
 /*!
        @function SCNetworkServiceGetEnabled
@@ -1038,7 +1018,7 @@ SCNetworkServiceEstablishDefaultConfiguration             (SCNetworkServiceRef            service)        AV
        @result TRUE if the service is enabled.
  */
 Boolean
        @result TRUE if the service is enabled.
  */
 Boolean
-SCNetworkServiceGetEnabled                     (SCNetworkServiceRef            service)        AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkServiceGetEnabled                     (SCNetworkServiceRef            service)        __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkServiceGetInterface
 
 /*!
        @function SCNetworkServiceGetInterface
@@ -1048,7 +1028,7 @@ SCNetworkServiceGetEnabled                        (SCNetworkServiceRef            service)        AVAILABLE_MAC_OS_X_V
                NULL if an error was encountered.
  */
 SCNetworkInterfaceRef
                NULL if an error was encountered.
  */
 SCNetworkInterfaceRef
-SCNetworkServiceGetInterface                   (SCNetworkServiceRef            service)        AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkServiceGetInterface                   (SCNetworkServiceRef            service)        __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkServiceGetName
 
 /*!
        @function SCNetworkServiceGetName
@@ -1057,7 +1037,7 @@ SCNetworkServiceGetInterface                      (SCNetworkServiceRef            service)        AVAILABLE_MAC_OS_X
        @result The [user specified] name.
  */
 CFStringRef
        @result The [user specified] name.
  */
 CFStringRef
-SCNetworkServiceGetName                                (SCNetworkServiceRef            service)        AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkServiceGetName                                (SCNetworkServiceRef            service)        __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkServiceCopyProtocol
 
 /*!
        @function SCNetworkServiceCopyProtocol
@@ -1070,7 +1050,7 @@ SCNetworkServiceGetName                           (SCNetworkServiceRef            service)        AVAILABLE_MAC_OS_X_VER
  */
 SCNetworkProtocolRef
 SCNetworkServiceCopyProtocol                   (SCNetworkServiceRef            service,
  */
 SCNetworkProtocolRef
 SCNetworkServiceCopyProtocol                   (SCNetworkServiceRef            service,
-                                                CFStringRef                    protocolType)   AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                                CFStringRef                    protocolType)   __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkServiceGetServiceID
 
 /*!
        @function SCNetworkServiceGetServiceID
@@ -1079,7 +1059,7 @@ SCNetworkServiceCopyProtocol                      (SCNetworkServiceRef            service,
        @result The service identifier.
  */
 CFStringRef
        @result The service identifier.
  */
 CFStringRef
-SCNetworkServiceGetServiceID                   (SCNetworkServiceRef            service)        AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkServiceGetServiceID                   (SCNetworkServiceRef            service)        __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkServiceRemove
 
 /*!
        @function SCNetworkServiceRemove
@@ -1088,7 +1068,7 @@ SCNetworkServiceGetServiceID                      (SCNetworkServiceRef            service)        AVAILABLE_MAC_OS_X
        @result TRUE if the service was removed; FALSE if an error was encountered.
  */
 Boolean
        @result TRUE if the service was removed; FALSE if an error was encountered.
  */
 Boolean
-SCNetworkServiceRemove                         (SCNetworkServiceRef            service)        AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkServiceRemove                         (SCNetworkServiceRef            service)        __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkServiceRemoveProtocolType
 
 /*!
        @function SCNetworkServiceRemoveProtocolType
@@ -1100,7 +1080,7 @@ SCNetworkServiceRemove                            (SCNetworkServiceRef            service)        AVAILABLE_MAC_OS_X_VERS
  */
 Boolean
 SCNetworkServiceRemoveProtocolType             (SCNetworkServiceRef            service,
  */
 Boolean
 SCNetworkServiceRemoveProtocolType             (SCNetworkServiceRef            service,
-                                                CFStringRef                    protocolType)   AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                                CFStringRef                    protocolType)   __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkServiceSetEnabled
 
 /*!
        @function SCNetworkServiceSetEnabled
@@ -1111,7 +1091,7 @@ SCNetworkServiceRemoveProtocolType                (SCNetworkServiceRef            service,
  */
 Boolean
 SCNetworkServiceSetEnabled                     (SCNetworkServiceRef            service,
  */
 Boolean
 SCNetworkServiceSetEnabled                     (SCNetworkServiceRef            service,
-                                                Boolean                        enabled)        AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                                Boolean                        enabled)        __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkServiceSetName
 
 /*!
        @function SCNetworkServiceSetName
@@ -1127,7 +1107,7 @@ SCNetworkServiceSetEnabled                        (SCNetworkServiceRef            service,
  */
 Boolean
 SCNetworkServiceSetName                                (SCNetworkServiceRef            service,
  */
 Boolean
 SCNetworkServiceSetName                                (SCNetworkServiceRef            service,
-                                                CFStringRef                    name)           AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                                CFStringRef                    name)           __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 
 /* --------------------------------------------------------------------------------
 
 
 /* --------------------------------------------------------------------------------
@@ -1146,7 +1126,7 @@ SCNetworkServiceSetName                           (SCNetworkServiceRef            service,
        @discussion Returns the type identifier of all SCNetworkSet instances.
  */
 CFTypeID
        @discussion Returns the type identifier of all SCNetworkSet instances.
  */
 CFTypeID
-SCNetworkSetGetTypeID                          (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkSetGetTypeID                          (void)                                          __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkSetAddService
 
 /*!
        @function SCNetworkSetAddService
@@ -1163,9 +1143,7 @@ SCNetworkSetGetTypeID                             (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
  */
 Boolean
 SCNetworkSetAddService                         (SCNetworkSetRef                set,
  */
 Boolean
 SCNetworkSetAddService                         (SCNetworkSetRef                set,
-                                                SCNetworkServiceRef            service)        AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+                                                SCNetworkServiceRef            service)        __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkSetContainsInterface
 
 /*!
        @function SCNetworkSetContainsInterface
@@ -1177,9 +1155,7 @@ SCNetworkSetAddService                            (SCNetworkSetRef                set,
  */
 Boolean
 SCNetworkSetContainsInterface                  (SCNetworkSetRef                set,
  */
 Boolean
 SCNetworkSetContainsInterface                  (SCNetworkSetRef                set,
-                                                SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
-
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
+                                                SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkSetCopyAll
 
 /*!
        @function SCNetworkSetCopyAll
@@ -1189,7 +1165,7 @@ SCNetworkSetContainsInterface                     (SCNetworkSetRef                set,
                You must release the returned value.
  */
 CFArrayRef /* of SCNetworkSetRef's */
                You must release the returned value.
  */
 CFArrayRef /* of SCNetworkSetRef's */
-SCNetworkSetCopyAll                            (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkSetCopyAll                            (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkSetCopyCurrent
 
 /*!
        @function SCNetworkSetCopyCurrent
@@ -1198,7 +1174,7 @@ SCNetworkSetCopyAll                               (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION_10_
        @result The current set; NULL if no current set has been defined.
  */
 SCNetworkSetRef
        @result The current set; NULL if no current set has been defined.
  */
 SCNetworkSetRef
-SCNetworkSetCopyCurrent                                (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkSetCopyCurrent                                (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkSetCopyServices
 
 /*!
        @function SCNetworkSetCopyServices
@@ -1208,7 +1184,7 @@ SCNetworkSetCopyCurrent                           (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION
                You must release the returned value.
  */
 CFArrayRef /* of SCNetworkServiceRef's */
                You must release the returned value.
  */
 CFArrayRef /* of SCNetworkServiceRef's */
-SCNetworkSetCopyServices                       (SCNetworkSetRef                set)            AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkSetCopyServices                       (SCNetworkSetRef                set)            __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkSetCreate
 
 /*!
        @function SCNetworkSetCreate
@@ -1218,7 +1194,7 @@ SCNetworkSetCopyServices                  (SCNetworkSetRef                set)            AVAILABLE_MAC_OS_X_VERSION_10
                You must release the returned value.
  */
 SCNetworkSetRef
                You must release the returned value.
  */
 SCNetworkSetRef
-SCNetworkSetCreate                             (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkSetCreate                             (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkSetCopy
 
 /*!
        @function SCNetworkSetCopy
@@ -1232,7 +1208,7 @@ SCNetworkSetCreate                                (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION_10_4
  */
 SCNetworkSetRef
 SCNetworkSetCopy                               (SCPreferencesRef               prefs,
  */
 SCNetworkSetRef
 SCNetworkSetCopy                               (SCPreferencesRef               prefs,
-                                                CFStringRef                    setID)          AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                                CFStringRef                    setID)          __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkSetGetName
 
 /*!
        @function SCNetworkSetGetName
@@ -1241,7 +1217,7 @@ SCNetworkSetCopy                          (SCPreferencesRef               prefs,
        @result The [user specified] name.
  */
 CFStringRef
        @result The [user specified] name.
  */
 CFStringRef
-SCNetworkSetGetName                            (SCNetworkSetRef                set)            AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkSetGetName                            (SCNetworkSetRef                set)            __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkSetGetSetID
 
 /*!
        @function SCNetworkSetGetSetID
@@ -1250,7 +1226,7 @@ SCNetworkSetGetName                               (SCNetworkSetRef                set)            AVAILABLE_MAC_OS_X_VERSION_10_4_A
        @result The set identifier.
  */
 CFStringRef
        @result The set identifier.
  */
 CFStringRef
-SCNetworkSetGetSetID                           (SCNetworkSetRef                set)            AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkSetGetSetID                           (SCNetworkSetRef                set)            __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkSetGetServiceOrder
 
 /*!
        @function SCNetworkSetGetServiceOrder
@@ -1263,7 +1239,7 @@ SCNetworkSetGetSetID                              (SCNetworkSetRef                set)            AVAILABLE_MAC_OS_X_VERSION_10_4_
                was encountered.
  */
 CFArrayRef /* of serviceID CFStringRef's */
                was encountered.
  */
 CFArrayRef /* of serviceID CFStringRef's */
-SCNetworkSetGetServiceOrder                    (SCNetworkSetRef                set)            AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkSetGetServiceOrder                    (SCNetworkSetRef                set)            __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkSetRemove
 
 /*!
        @function SCNetworkSetRemove
@@ -1272,7 +1248,7 @@ SCNetworkSetGetServiceOrder                       (SCNetworkSetRef                set)            AVAILABLE_MAC_OS_X_VERSION
        @result TRUE if the set was removed; FALSE if an error was encountered.
  */
 Boolean
        @result TRUE if the set was removed; FALSE if an error was encountered.
  */
 Boolean
-SCNetworkSetRemove                             (SCNetworkSetRef                set)            AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkSetRemove                             (SCNetworkSetRef                set)            __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkSetRemoveService
 
 /*!
        @function SCNetworkSetRemoveService
@@ -1284,7 +1260,7 @@ SCNetworkSetRemove                                (SCNetworkSetRef                set)            AVAILABLE_MAC_OS_X_VERSION_10_4_AN
  */
 Boolean
 SCNetworkSetRemoveService                      (SCNetworkSetRef                set,
  */
 Boolean
 SCNetworkSetRemoveService                      (SCNetworkSetRef                set,
-                                                SCNetworkServiceRef            service)        AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                                SCNetworkServiceRef            service)        __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkSetSetCurrent
 
 /*!
        @function SCNetworkSetSetCurrent
@@ -1294,7 +1270,7 @@ SCNetworkSetRemoveService                 (SCNetworkSetRef                set,
                FALSE if an error was encountered.
  */
 Boolean
                FALSE if an error was encountered.
  */
 Boolean
-SCNetworkSetSetCurrent                         (SCNetworkSetRef                set)            AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+SCNetworkSetSetCurrent                         (SCNetworkSetRef                set)            __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkSetSetName
 
 /*!
        @function SCNetworkSetSetName
@@ -1309,7 +1285,7 @@ SCNetworkSetSetCurrent                            (SCNetworkSetRef                set)            AVAILABLE_MAC_OS_X_VERSION_10_
  */
 Boolean
 SCNetworkSetSetName                            (SCNetworkSetRef                set,
  */
 Boolean
 SCNetworkSetSetName                            (SCNetworkSetRef                set,
-                                                CFStringRef                    name)           AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                                CFStringRef                    name)           __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkSetSetServiceOrder
 
 /*!
        @function SCNetworkSetSetServiceOrder
@@ -1320,11 +1296,10 @@ SCNetworkSetSetName                             (SCNetworkSetRef                set,
  */
 Boolean
 SCNetworkSetSetServiceOrder                    (SCNetworkSetRef                set,
  */
 Boolean
 SCNetworkSetSetServiceOrder                    (SCNetworkSetRef                set,
-                                                CFArrayRef                     newOrder)       AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;      /* serviceID CFStringRef's */
+                                                CFArrayRef                     newOrder)       __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);       /* serviceID CFStringRef's */
 
 
 __END_DECLS
 
 
 
 __END_DECLS
 
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */
-
+#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
 #endif /* _SCNETWORKCONFIGURATION_H */
 #endif /* _SCNETWORKCONFIGURATION_H */
index e1792e0743c0430784dd0bb17594c533d7173716..13ba9e873f88aba231d76db6aaefd857ca95249c 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2007, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -535,3 +535,59 @@ __extract_password(SCPreferencesRef        prefs,
        return exists;
 }
 
        return exists;
 }
 
+
+__private_extern__
+Boolean
+__remove_password(SCPreferencesRef     prefs,
+                 CFDictionaryRef       config,
+                 CFStringRef           passwordKey,
+                 CFStringRef           encryptionKey,
+                 CFStringRef           encryptionKeyChainValue,
+                 CFStringRef           unique_id,
+                 CFDictionaryRef       *newConfig)
+{
+       CFStringRef             encryption      = NULL;
+       Boolean                 ok              = FALSE;
+
+       // check for keychain password
+       if (config != NULL) {
+               encryption = CFDictionaryGetValue(config, encryptionKey);
+       }
+       if ((encryption == NULL) ||
+           (isA_CFString(encryption) &&
+            CFEqual(encryption, encryptionKeyChainValue))) {
+                   // remove keychain password
+                   if (prefs != NULL) {
+                           ok = _SCPreferencesSystemKeychainPasswordItemRemove(prefs, unique_id);
+                   } else {
+                           ok = _SCSecKeychainPasswordItemRemove(NULL, unique_id);
+                   }
+           }
+
+       // as needed, check if we have an in-line password that we can remove
+       if (!ok && (encryption == NULL) && (config != NULL)) {
+               CFDataRef       inline_password;
+
+               inline_password = CFDictionaryGetValue(config, passwordKey);
+               inline_password = __copy_legacy_password(inline_password);
+               if (inline_password != NULL) {
+                       CFRelease(inline_password);
+                       ok = TRUE;
+               }
+       }
+
+       if (newConfig != NULL) {
+               if (ok && (config != NULL)) {
+                       CFMutableDictionaryRef  temp;
+
+                       temp = CFDictionaryCreateMutableCopy(NULL, 0, config);
+                       CFDictionaryRemoveValue(temp, passwordKey);
+                       CFDictionaryRemoveValue(temp, encryptionKey);
+                       *newConfig = (CFDictionaryRef)temp;
+               } else {
+                       *newConfig = NULL;
+               }
+       }
+
+       return ok;
+}
index 5203eb50435463526d6a682ffe5b52255a63c844..55305ed13070e667d501f87bbf95ccc86dd755c9 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -25,7 +25,6 @@
 #define _SCNETWORKCONFIGURATIONINTERNAL_H
 
 
 #define _SCNETWORKCONFIGURATIONINTERNAL_H
 
 
-#include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFRuntime.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFRuntime.h>
 #include <SystemConfiguration/SystemConfiguration.h>
@@ -47,6 +46,9 @@ typedef struct {
        // name
        CFStringRef             name;
 
        // name
        CFStringRef             name;
 
+       // misc
+       Boolean                 established;
+
 } SCNetworkSetPrivate, *SCNetworkSetPrivateRef;
 
 
 } SCNetworkSetPrivate, *SCNetworkSetPrivateRef;
 
 
@@ -64,6 +66,9 @@ typedef struct {
        // prefs
        SCPreferencesRef        prefs;
 
        // prefs
        SCPreferencesRef        prefs;
 
+       // store (for live SCNetworkService)
+       SCDynamicStoreRef       store;
+
        // name
        CFStringRef             name;
 
        // name
        CFStringRef             name;
 
@@ -115,6 +120,7 @@ typedef struct {
 
        // [SCPreferences] interface entity information
        CFStringRef             entity_device;          // interface device
 
        // [SCPreferences] interface entity information
        CFStringRef             entity_device;          // interface device
+       CFStringRef             entity_device_unique;   // ... UniqueIdentifier
        CFStringRef             entity_type;            // interface type
        CFStringRef             entity_subtype;         // interface subtype
 
        CFStringRef             entity_type;            // interface type
        CFStringRef             entity_subtype;         // interface subtype
 
@@ -126,19 +132,20 @@ typedef struct {
        CFDataRef               address;
        CFStringRef             addressString;
        Boolean                 builtin;
        CFDataRef               address;
        CFStringRef             addressString;
        Boolean                 builtin;
+       CFStringRef             configurationAction;
        CFStringRef             location;
        CFStringRef             path;
        CFMutableDictionaryRef  overrides;
        Boolean                 modemIsV92;
        CFStringRef             location;
        CFStringRef             path;
        CFMutableDictionaryRef  overrides;
        Boolean                 modemIsV92;
-       Boolean                 supportsBond;
-       Boolean                 supportsVLAN;
        CFNumberRef             type;
        CFNumberRef             unit;
 
        // misc
        int                     sort_order;             // sort order for this interface
 
        CFNumberRef             type;
        CFNumberRef             unit;
 
        // misc
        int                     sort_order;             // sort order for this interface
 
+#if    !TARGET_OS_IPHONE
        // for BOND interfaces
        // for BOND interfaces
+       Boolean                 supportsBond;
        struct {
                CFArrayRef              interfaces;
                CFDictionaryRef         options;
        struct {
                CFArrayRef              interfaces;
                CFDictionaryRef         options;
@@ -146,11 +153,13 @@ typedef struct {
        } bond;
 
        // for VLAN interfaces
        } bond;
 
        // for VLAN interfaces
+       Boolean                 supportsVLAN;
        struct {
                SCNetworkInterfaceRef   interface;
                CFNumberRef             tag;            // e.g. 1 <= tag <= 4094
                CFDictionaryRef         options;
        } vlan;
        struct {
                SCNetworkInterfaceRef   interface;
                CFNumberRef             tag;            // e.g. 1 <= tag <= 4094
                CFDictionaryRef         options;
        } vlan;
+#endif // !TARGET_OS_IPHONE
 
 } SCNetworkInterfacePrivate, *SCNetworkInterfacePrivateRef;
 
 
 } SCNetworkInterfacePrivate, *SCNetworkInterfacePrivateRef;
 
@@ -178,6 +187,7 @@ __SCNetworkInterfaceCreatePrivate           (CFAllocatorRef         allocator,
                                                 CFStringRef            serviceID,
                                                 io_string_t            path);
 
                                                 CFStringRef            serviceID,
                                                 io_string_t            path);
 
+#if    !TARGET_OS_IPHONE
 SCNetworkInterfacePrivateRef
 _SCBondInterfaceCreatePrivate                  (CFAllocatorRef         allocator,
                                                 CFStringRef            bond_if);
 SCNetworkInterfacePrivateRef
 _SCBondInterfaceCreatePrivate                  (CFAllocatorRef         allocator,
                                                 CFStringRef            bond_if);
@@ -185,12 +195,20 @@ _SCBondInterfaceCreatePrivate                     (CFAllocatorRef         allocator,
 SCNetworkInterfacePrivateRef
 _SCVLANInterfaceCreatePrivate                  (CFAllocatorRef         allocator,
                                                 CFStringRef            vlan_if);
 SCNetworkInterfacePrivateRef
 _SCVLANInterfaceCreatePrivate                  (CFAllocatorRef         allocator,
                                                 CFStringRef            vlan_if);
+#endif // !TARGET_OS_IPHONE
 
 CFDictionaryRef
 __SCNetworkInterfaceCopyInterfaceEntity                (SCNetworkInterfaceRef  interface);
 
 CFArrayRef
 
 CFDictionaryRef
 __SCNetworkInterfaceCopyInterfaceEntity                (SCNetworkInterfaceRef  interface);
 
 CFArrayRef
-__SCNetworkInterfaceCopyDeepConfiguration       (SCNetworkInterfaceRef  interface);
+__SCNetworkInterfaceCopyDeepConfiguration       (SCNetworkSetRef       set,
+                                                SCNetworkInterfaceRef  interface);
+
+CFStringRef
+__SCNetworkInterfaceCopyXLocalizedDisplayName  (SCNetworkInterfaceRef  interface);
+
+CFStringRef
+__SCNetworkInterfaceCopyXNonLocalizedDisplayName(SCNetworkInterfaceRef interface);
 
 CFStringRef
 __SCNetworkInterfaceGetDefaultConfigurationType        (SCNetworkInterfaceRef  interface);
 
 CFStringRef
 __SCNetworkInterfaceGetDefaultConfigurationType        (SCNetworkInterfaceRef  interface);
@@ -218,15 +236,18 @@ __SCNetworkInterfaceSetConfiguration              (SCNetworkInterfaceRef  interface,
                                                 Boolean                okToHold);
 
 void
                                                 Boolean                okToHold);
 
 void
-__SCNetworkInterfaceSetDeepConfiguration       (SCNetworkInterfaceRef  interface,
+__SCNetworkInterfaceSetDeepConfiguration       (SCNetworkSetRef        set,
+                                                SCNetworkInterfaceRef  interface,
                                                 CFArrayRef             configs);
 
                                                 CFArrayRef             configs);
 
+#if    !TARGET_OS_IPHONE
 Boolean
 __SCNetworkInterfaceSupportsVLAN               (CFStringRef            bsd_if);
 
 void
 __SCBondInterfaceListCopyMembers               (CFArrayRef             interfaces,
                                                 CFMutableSetRef        set);
 Boolean
 __SCNetworkInterfaceSupportsVLAN               (CFStringRef            bsd_if);
 
 void
 __SCBondInterfaceListCopyMembers               (CFArrayRef             interfaces,
                                                 CFMutableSetRef        set);
+#endif // !TARGET_OS_IPHONE
 
 #pragma mark -
 #pragma mark SCNetworkProtocol configuration (internal)
 
 #pragma mark -
 #pragma mark SCNetworkProtocol configuration (internal)
@@ -310,6 +331,15 @@ __extract_password                         (SCPreferencesRef       prefs,
                                                 CFStringRef            unique_id,
                                                 CFDataRef              *password);
 
                                                 CFStringRef            unique_id,
                                                 CFDataRef              *password);
 
+Boolean
+__remove_password                              (SCPreferencesRef       prefs,
+                                                CFDictionaryRef        config,
+                                                CFStringRef            passwordKey,
+                                                CFStringRef            encryptionKey,
+                                                CFStringRef            encryptionKeyChainValue,
+                                                CFStringRef            unique_id,
+                                                CFDictionaryRef        *newConfig);
+
 __END_DECLS
 
 #endif /* _SCNETWORKCONFIGURATIONINTERNAL_H */
 __END_DECLS
 
 #endif /* _SCNETWORKCONFIGURATIONINTERNAL_H */
index 9d00ed522fd7c703ded5edfc0ed778271d0c613c..ec41e4cd11715ae64dd2865688f0f1868eedb96f 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2005-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #ifndef _SCNETWORKCONFIGURATIONPRIVATE_H
 #define _SCNETWORKCONFIGURATIONPRIVATE_H
 
 #ifndef _SCNETWORKCONFIGURATIONPRIVATE_H
 #define _SCNETWORKCONFIGURATIONPRIVATE_H
 
-#include <AvailabilityMacros.h>
+#include <Availability.h>
+#include <TargetConditionals.h>
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCValidation.h>
 #include <IOKit/IOKitLib.h>
 
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCValidation.h>
 #include <IOKit/IOKitLib.h>
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-
 /*!
        @header SCNetworkConfigurationPrivate
  */
 /*!
        @header SCNetworkConfigurationPrivate
  */
@@ -54,6 +53,7 @@ isA_SCNetworkInterface(CFTypeRef obj)
        return (isA_CFType(obj, SCNetworkInterfaceGetTypeID()));
 }
 
        return (isA_CFType(obj, SCNetworkInterfaceGetTypeID()));
 }
 
+#if    !TARGET_OS_IPHONE
 static __inline__ CFTypeRef
 isA_SCBondInterface(CFTypeRef obj)
 {
 static __inline__ CFTypeRef
 isA_SCBondInterface(CFTypeRef obj)
 {
@@ -91,6 +91,7 @@ isA_SCVLANInterface(CFTypeRef obj)
 
        return obj;
 }
 
        return obj;
 }
+#endif // !TARGET_OS_IPHONE
 
 /*!
        @function _SCNetworkInterfaceCompare
 
 /*!
        @function _SCNetworkInterfaceCompare
@@ -103,7 +104,17 @@ isA_SCVLANInterface(CFTypeRef obj)
 CFComparisonResult
 _SCNetworkInterfaceCompare                             (const void                     *val1,
                                                         const void                     *val2,
 CFComparisonResult
 _SCNetworkInterfaceCompare                             (const void                     *val1,
                                                         const void                     *val2,
-                                                        void                           *context)       AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                        void                           *context)       __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
+
+/*!
+       @function _SCNetworkInterfaceCopySlashDevPath
+       @discussion Returns the /dev pathname for the interface.
+       @param interface The network interface.
+       @result The /dev pathname associated with the interface (e.g. "/dev/modem");
+               NULL if no path is available.
+ */
+CFStringRef
+_SCNetworkInterfaceCopySlashDevPath                    (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0);
 
 #define kIncludeNoVirtualInterfaces    0x0
 #define kIncludeVLANInterfaces         0x1
 
 #define kIncludeNoVirtualInterfaces    0x0
 #define kIncludeVLANInterfaces         0x1
@@ -124,7 +135,7 @@ _SCNetworkInterfaceCompare                          (const void                     *val1,
 SCNetworkInterfaceRef
 _SCNetworkInterfaceCreateWithBSDName                   (CFAllocatorRef                 allocator,
                                                         CFStringRef                    bsdName,
 SCNetworkInterfaceRef
 _SCNetworkInterfaceCreateWithBSDName                   (CFAllocatorRef                 allocator,
                                                         CFStringRef                    bsdName,
-                                                        UInt32                         flags)          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                        UInt32                         flags)          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 /*!
        @function _SCNetworkInterfaceCreateWithEntity
 
 /*!
        @function _SCNetworkInterfaceCreateWithEntity
@@ -138,7 +149,7 @@ _SCNetworkInterfaceCreateWithBSDName                        (CFAllocatorRef                 allocator,
 SCNetworkInterfaceRef
 _SCNetworkInterfaceCreateWithEntity                    (CFAllocatorRef                 allocator,
                                                         CFDictionaryRef                interface_entity,
 SCNetworkInterfaceRef
 _SCNetworkInterfaceCreateWithEntity                    (CFAllocatorRef                 allocator,
                                                         CFDictionaryRef                interface_entity,
-                                                        SCNetworkServiceRef            service)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                        SCNetworkServiceRef            service)        __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 /*!
        @function _SCNetworkInterfaceCreateWithIONetworkInterfaceObject
 
 /*!
        @function _SCNetworkInterfaceCreateWithIONetworkInterfaceObject
@@ -149,7 +160,22 @@ _SCNetworkInterfaceCreateWithEntity                        (CFAllocatorRef                 allocator,
                You must release the returned value.
  */
 SCNetworkInterfaceRef
                You must release the returned value.
  */
 SCNetworkInterfaceRef
-_SCNetworkInterfaceCreateWithIONetworkInterfaceObject  (io_object_t                    if_obj)         AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+_SCNetworkInterfaceCreateWithIONetworkInterfaceObject  (io_object_t                    if_obj)         __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
+
+#define        kSCNetworkInterfaceConfigurationActionKey               CFSTR("New Interface Detected Action")
+#define        kSCNetworkInterfaceConfigurationActionValueNone         CFSTR("None")
+#define        kSCNetworkInterfaceConfigurationActionValuePrompt       CFSTR("Prompt")
+#define        kSCNetworkInterfaceConfigurationActionValueConfigure    CFSTR("Configure")
+
+/*!
+       @function _SCNetworkInterfaceGetConfigurationAction
+       @discussion Returns a user-notification / auto-configuration action for the interface.
+       @param interface The network interface.
+       @result The user-notification / auto-configuration action;
+               NULL if the default action should be used.
+ */
+CFStringRef
+_SCNetworkInterfaceGetConfigurationAction              (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0);
 
 /*!
        @function _SCNetworkInterfaceGetHardwareAddress
 
 /*!
        @function _SCNetworkInterfaceGetHardwareAddress
@@ -159,7 +185,7 @@ _SCNetworkInterfaceCreateWithIONetworkInterfaceObject       (io_object_t                    if_obj)         AV
                NULL if no hardware address is available.
  */
 CFDataRef
                NULL if no hardware address is available.
  */
 CFDataRef
-_SCNetworkInterfaceGetHardwareAddress                  (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+_SCNetworkInterfaceGetHardwareAddress                  (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 /*!
        @function _SCNetworkInterfaceGetIOInterfaceType
 
 /*!
        @function _SCNetworkInterfaceGetIOInterfaceType
@@ -168,7 +194,7 @@ _SCNetworkInterfaceGetHardwareAddress                       (SCNetworkInterfaceRef          interface)      AVAIL
        @result The IOInterfaceType associated with the interface
  */
 CFNumberRef
        @result The IOInterfaceType associated with the interface
  */
 CFNumberRef
-_SCNetworkInterfaceGetIOInterfaceType                  (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+_SCNetworkInterfaceGetIOInterfaceType                  (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 /*!
        @function _SCNetworkInterfaceGetIOInterfaceUnit
 
 /*!
        @function _SCNetworkInterfaceGetIOInterfaceUnit
@@ -178,7 +204,7 @@ _SCNetworkInterfaceGetIOInterfaceType                       (SCNetworkInterfaceRef          interface)      AVAIL
                NULL if no IOLocation is available.
  */
 CFNumberRef
                NULL if no IOLocation is available.
  */
 CFNumberRef
-_SCNetworkInterfaceGetIOInterfaceUnit                  (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+_SCNetworkInterfaceGetIOInterfaceUnit                  (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 /*!
        @function _SCNetworkInterfaceGetIOPath
 
 /*!
        @function _SCNetworkInterfaceGetIOPath
@@ -188,7 +214,16 @@ _SCNetworkInterfaceGetIOInterfaceUnit                      (SCNetworkInterfaceRef          interface)      AVAIL
                NULL if no IOPath is available.
  */
 CFStringRef
                NULL if no IOPath is available.
  */
 CFStringRef
-_SCNetworkInterfaceGetIOPath                           (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+_SCNetworkInterfaceGetIOPath                           (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
+
+/*!
+       @function _SCNetworkInterfaceIsBluetoothPAN
+       @discussion Identifies if a network interface is a Bluetooth PAN device.
+       @param interface The network interface.
+       @result TRUE if the interface is a Bluetooth PAN device.
+ */
+Boolean
+_SCNetworkInterfaceIsBluetoothPAN                      (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0);
 
 /*!
        @function _SCNetworkInterfaceIsBuiltin
 
 /*!
        @function _SCNetworkInterfaceIsBuiltin
@@ -197,7 +232,16 @@ _SCNetworkInterfaceGetIOPath                               (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC
        @result TRUE if the interface is "built-in".
  */
 Boolean
        @result TRUE if the interface is "built-in".
  */
 Boolean
-_SCNetworkInterfaceIsBuiltin                           (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+_SCNetworkInterfaceIsBuiltin                           (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
+
+/*!
+       @function _SCNetworkInterfaceIsTethered
+       @discussion Identifies if a network interface is an Apple tethered device (e.g. an iPhone).
+       @param interface The network interface.
+       @result TRUE if the interface is a tethered device.
+ */
+Boolean
+_SCNetworkInterfaceIsTethered                          (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0);
 
 /*!
        @function _SCNetworkInterfaceIsModemV92
 
 /*!
        @function _SCNetworkInterfaceIsModemV92
@@ -207,7 +251,7 @@ _SCNetworkInterfaceIsBuiltin                                (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC
        @result TRUE if the interface is "v.92" modem.
  */
 Boolean
        @result TRUE if the interface is "v.92" modem.
  */
 Boolean
-_SCNetworkInterfaceIsModemV92                          (SCNetworkInterfaceRef          interface)      AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+_SCNetworkInterfaceIsModemV92                          (SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 /*!
        @function _SCNetworkInterfaceForceConfigurationRefresh
 
 /*!
        @function _SCNetworkInterfaceForceConfigurationRefresh
@@ -217,7 +261,7 @@ _SCNetworkInterfaceIsModemV92                               (SCNetworkInterfaceRef          interface)      AVAILABLE_MA
        @result TRUE if the refresh was successfully posted.
  */
 Boolean
        @result TRUE if the refresh was successfully posted.
  */
 Boolean
-_SCNetworkInterfaceForceConfigurationRefresh           (CFStringRef                    ifName)         AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+_SCNetworkInterfaceForceConfigurationRefresh           (CFStringRef                    ifName)         __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 /*!
        @function _SCBondInterfaceCopyActive
 
 /*!
        @function _SCBondInterfaceCopyActive
@@ -226,7 +270,7 @@ _SCNetworkInterfaceForceConfigurationRefresh                (CFStringRef                    ifName)         AVAILABLE_
                You must release the returned value.
  */
 CFArrayRef
                You must release the returned value.
  */
 CFArrayRef
-_SCBondInterfaceCopyActive                             (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+_SCBondInterfaceCopyActive                             (void)                                          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function _SCBondInterfaceUpdateConfiguration
 
 /*!
        @function _SCBondInterfaceUpdateConfiguration
@@ -236,7 +280,7 @@ _SCBondInterfaceCopyActive                          (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LA
                an error was encountered.
  */
 Boolean
                an error was encountered.
  */
 Boolean
-_SCBondInterfaceUpdateConfiguration                    (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+_SCBondInterfaceUpdateConfiguration                    (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCBondInterfaceSetMode
 
 /*!
        @function SCBondInterfaceSetMode
@@ -247,7 +291,7 @@ _SCBondInterfaceUpdateConfiguration                 (SCPreferencesRef               prefs)          AVAILABLE_MAC_O
  */
 Boolean
 SCBondInterfaceSetMode                                 (SCBondInterfaceRef             bond,
  */
 Boolean
 SCBondInterfaceSetMode                                 (SCBondInterfaceRef             bond,
-                                                        CFNumberRef                    mode)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                        CFNumberRef                    mode)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function SCBondInterfaceSetMode
 
 /*!
        @function SCBondInterfaceSetMode
@@ -256,7 +300,7 @@ SCBondInterfaceSetMode                                      (SCBondInterfaceRef             bond,
        @result A CFNumberRef containing the mode (IF_BOND_MODE_{LACP,STATIC}).
  */
 CFNumberRef
        @result A CFNumberRef containing the mode (IF_BOND_MODE_{LACP,STATIC}).
  */
 CFNumberRef
-SCBondInterfaceGetMode                                 (SCBondInterfaceRef             bond)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCBondInterfaceGetMode                                 (SCBondInterfaceRef             bond)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function _SCVLANInterfaceCopyActive
 
 /*!
        @function _SCVLANInterfaceCopyActive
@@ -265,7 +309,7 @@ SCBondInterfaceGetMode                                      (SCBondInterfaceRef             bond)           AVAILABLE_MAC_OS_X_VERSIO
                You must release the returned value.
  */
 CFArrayRef
                You must release the returned value.
  */
 CFArrayRef
-_SCVLANInterfaceCopyActive                             (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+_SCVLANInterfaceCopyActive                             (void)                                          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 /*!
        @function _SCVLANInterfaceUpdateConfiguration
 
 /*!
        @function _SCVLANInterfaceUpdateConfiguration
@@ -275,7 +319,7 @@ _SCVLANInterfaceCopyActive                          (void)                                          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LA
                an error was encountered.
  */
 Boolean
                an error was encountered.
  */
 Boolean
-_SCVLANInterfaceUpdateConfiguration                    (SCPreferencesRef               prefs)          AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+_SCVLANInterfaceUpdateConfiguration                    (SCPreferencesRef               prefs)          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 
 
 #pragma mark -
 
 
 #pragma mark -
@@ -286,26 +330,27 @@ enum {
        kSCNetworkInterfacePasswordTypePPP              = 1,
        kSCNetworkInterfacePasswordTypeIPSecSharedSecret,
        kSCNetworkInterfacePasswordTypeEAPOL,
        kSCNetworkInterfacePasswordTypePPP              = 1,
        kSCNetworkInterfacePasswordTypeIPSecSharedSecret,
        kSCNetworkInterfacePasswordTypeEAPOL,
+       kSCNetworkInterfacePasswordTypeIPSecXAuth,
 };
 typedef uint32_t       SCNetworkInterfacePasswordType;
 
 Boolean
 SCNetworkInterfaceCheckPassword                                (SCNetworkInterfaceRef          interface,
 };
 typedef uint32_t       SCNetworkInterfacePasswordType;
 
 Boolean
 SCNetworkInterfaceCheckPassword                                (SCNetworkInterfaceRef          interface,
-                                                        SCNetworkInterfacePasswordType passwordType)   AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                        SCNetworkInterfacePasswordType passwordType)   __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 CFDataRef
 SCNetworkInterfaceCopyPassword                         (SCNetworkInterfaceRef          interface,
 
 CFDataRef
 SCNetworkInterfaceCopyPassword                         (SCNetworkInterfaceRef          interface,
-                                                        SCNetworkInterfacePasswordType passwordType)   AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                        SCNetworkInterfacePasswordType passwordType)   __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 Boolean
 SCNetworkInterfaceRemovePassword                       (SCNetworkInterfaceRef          interface,
 
 Boolean
 SCNetworkInterfaceRemovePassword                       (SCNetworkInterfaceRef          interface,
-                                                        SCNetworkInterfacePasswordType passwordType)   AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                        SCNetworkInterfacePasswordType passwordType)   __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 Boolean
 SCNetworkInterfaceSetPassword                          (SCNetworkInterfaceRef          interface,
                                                         SCNetworkInterfacePasswordType passwordType,
                                                         CFDataRef                      password,
 
 Boolean
 SCNetworkInterfaceSetPassword                          (SCNetworkInterfaceRef          interface,
                                                         SCNetworkInterfacePasswordType passwordType,
                                                         CFDataRef                      password,
-                                                        CFDictionaryRef                options)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                        CFDictionaryRef                options)        __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 
 #pragma mark -
 
 
 #pragma mark -
@@ -339,6 +384,59 @@ isA_SCNetworkService(CFTypeRef obj)
        return (isA_CFType(obj, SCNetworkServiceGetTypeID()));
 }
 
        return (isA_CFType(obj, SCNetworkServiceGetTypeID()));
 }
 
+enum {
+       kSCNetworkServicePrimaryRankDefault     = 0,
+       kSCNetworkServicePrimaryRankFirst       = 1,
+       kSCNetworkServicePrimaryRankLast        = 2,
+       kSCNetworkServicePrimaryRankNever       = 3
+};
+typedef uint32_t       SCNetworkServicePrimaryRank;
+
+/*!
+       @function _SCNetworkServiceCopyActive
+       @discussion Returns the network service with the specified identifier.
+
+       Note: The service returned by this SPI differs from the SCNetworkServiceCopy
+             API in that queries and operations interact with the "active" service
+             represented in the SCDynamicStore.  Only a limited subset of the
+             SCNetworkService APIs are supported.
+       @param prefs The dynamic store session.
+       @param serviceID The unique identifier for the service.
+       @result A reference to the SCNetworkService represented in the SCDynamicStore;
+               NULL if the serviceID does not exist in the SCDynamicStore or if an
+               error was encountered.
+               You must release the returned value.
+ */
+SCNetworkServiceRef
+_SCNetworkServiceCopyActive                            (SCDynamicStoreRef              store,
+                                                        CFStringRef                    serviceID)      __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_1);
+
+/*!
+       @function SCNetworkServiceGetPrimaryRank
+       @discussion Returns the primary service rank associated with a service.
+       @param service The network service.
+       @result The primary service rank associated with the specified application;
+               kSCNetworkServicePrimaryRankDefault if no rank is associated with the
+               application or an error was encountered.
+ */
+SCNetworkServicePrimaryRank
+SCNetworkServiceGetPrimaryRank                         (SCNetworkServiceRef            service)        __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0);
+
+/*!
+       @function SCNetworkServiceSetPrimaryRank
+       @discussion Updates the the primary service rank associated with a service.
+       @param service The network service.
+       @param newRank The new primary service rank; kSCNetworkServicePrimaryRankDefault
+               if the default service rank should be used.
+       @result TRUE if the rank was stored; FALSE if an error was encountered.
+
+       Notes : The kSCNetworkServicePrimaryRankFirst and kSCNetworkServicePrimaryRankLast
+               values can only valid as a transient setting.
+ */
+Boolean
+SCNetworkServiceSetPrimaryRank                         (SCNetworkServiceRef            service,
+                                                        SCNetworkServicePrimaryRank    newRank)        __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0);
+
 
 #pragma mark -
 #pragma mark SCNetworkSet configuration (SPI)
 
 #pragma mark -
 #pragma mark SCNetworkSet configuration (SPI)
@@ -373,7 +471,7 @@ isA_SCNetworkSet(CFTypeRef obj)
                changes were required or if an error was encountered.
 */
 Boolean
                changes were required or if an error was encountered.
 */
 Boolean
-SCNetworkSetEstablishDefaultConfiguration              (SCNetworkSetRef                set);
+SCNetworkSetEstablishDefaultConfiguration              (SCNetworkSetRef                set)            __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 /*!
        @function SCNetworkSetEstablishDefaultInterfaceConfiguration
 
 /*!
        @function SCNetworkSetEstablishDefaultInterfaceConfiguration
@@ -394,10 +492,8 @@ SCNetworkSetEstablishDefaultConfiguration          (SCNetworkSetRef                set);
  */
 Boolean
 SCNetworkSetEstablishDefaultInterfaceConfiguration     (SCNetworkSetRef                set,
  */
 Boolean
 SCNetworkSetEstablishDefaultInterfaceConfiguration     (SCNetworkSetRef                set,
-                                                        SCNetworkInterfaceRef          interface);
+                                                        SCNetworkInterfaceRef          interface)      __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 __END_DECLS
 
 
 __END_DECLS
 
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
-
 #endif /* _SCNETWORKCONFIGURATIONPRIVATE_H */
 #endif /* _SCNETWORKCONFIGURATIONPRIVATE_H */
index b63ff036f723256604a9c23de6699127a4747533..c0b8e2144d2fad499b1bdf4159a581fd238b7418 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2003-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2003-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  */
 
 
  */
 
 
+#include <Availability.h>
+#include <TargetConditionals.h>
+#include <sys/cdefs.h>
+#if    !TARGET_OS_IPHONE
+#include <dispatch/dispatch.h>
+#endif // !TARGET_OS_IPHONE
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFRuntime.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFRuntime.h>
-
-#include <Security/Security.h>
-#include "dy_framework.h"
-
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include <SystemConfiguration/SCValidation.h>
 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include <SystemConfiguration/SCValidation.h>
 
+#if    !TARGET_OS_IPHONE
+#include <Security/Security.h>
+#include "dy_framework.h"
+#endif // !TARGET_OS_IPHONE
+
 #include <servers/bootstrap.h>
 
 #include <pthread.h>
 #include <servers/bootstrap.h>
 
 #include <pthread.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
 #include <net/if.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
 #include <net/if.h>
+#include <mach/mach.h>
 
 #include <ppp/ppp_msg.h>
 
 #include <ppp/ppp_msg.h>
-#include <ppp/PPPControllerPriv.h>
 #include "pppcontroller.h"
 #include <ppp/pppcontroller_types.h>
 
 
 
 #include "pppcontroller.h"
 #include <ppp/pppcontroller_types.h>
 
 
 
+static int             debug                   = 0;
+static pthread_once_t  initialized             = PTHREAD_ONCE_INIT;
+
+
 typedef struct {
 
        /* base CFType information */
 typedef struct {
 
        /* base CFType information */
@@ -79,13 +90,17 @@ typedef struct {
        CFMachPortRef                   notify_port;
 
        /* run loop source, callout, context, rl scheduling info */
        CFMachPortRef                   notify_port;
 
        /* run loop source, callout, context, rl scheduling info */
+       Boolean                         scheduled;
        CFRunLoopSourceRef              rls;
        SCNetworkConnectionCallBack     rlsFunction;
        SCNetworkConnectionContext      rlsContext;
        CFMutableArrayRef               rlList;
 
        CFRunLoopSourceRef              rls;
        SCNetworkConnectionCallBack     rlsFunction;
        SCNetworkConnectionContext      rlsContext;
        CFMutableArrayRef               rlList;
 
-       /* misc info */
-       int                             debug;
+#if    !TARGET_OS_IPHONE
+       dispatch_queue_t                dispatchQueue;          // SCNetworkConnectionSetDispatchQueue
+       dispatch_queue_t                callbackQueue;
+       dispatch_source_t               callbackSource;
+#endif // !TARGET_OS_IPHONE
 
 } SCNetworkConnectionPrivate, *SCNetworkConnectionPrivateRef;
 
 
 } SCNetworkConnectionPrivate, *SCNetworkConnectionPrivateRef;
 
@@ -121,26 +136,31 @@ __SCNetworkConnectionDeallocate(CFTypeRef cf)
 {
        SCNetworkConnectionPrivateRef   connectionPrivate = (SCNetworkConnectionPrivateRef)cf;
 
 {
        SCNetworkConnectionPrivateRef   connectionPrivate = (SCNetworkConnectionPrivateRef)cf;
 
-       if (connectionPrivate->debug) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionDeallocate (0x%x)"), connectionPrivate);
-       }
-
        /* release resources */
        pthread_mutex_destroy(&connectionPrivate->lock);
 
        /* release resources */
        pthread_mutex_destroy(&connectionPrivate->lock);
 
-       if (connectionPrivate->rlList != NULL) {
+       if (connectionPrivate->rls != NULL) {
                CFRunLoopSourceInvalidate(connectionPrivate->rls);
                CFRelease(connectionPrivate->rls);
                CFRunLoopSourceInvalidate(connectionPrivate->rls);
                CFRelease(connectionPrivate->rls);
+       }
+
+       if (connectionPrivate->rlList != NULL) {
                CFRelease(connectionPrivate->rlList);
        }
 
        if (connectionPrivate->notify_port != NULL) {
                CFRelease(connectionPrivate->rlList);
        }
 
        if (connectionPrivate->notify_port != NULL) {
+               mach_port_t     mp      = CFMachPortGetPort(connectionPrivate->notify_port);
+
+               __MACH_PORT_DEBUG(TRUE, "*** __SCNetworkConnectionDeallocate notify_port", mp);
                CFMachPortInvalidate(connectionPrivate->notify_port);
                CFRelease(connectionPrivate->notify_port);
                CFMachPortInvalidate(connectionPrivate->notify_port);
                CFRelease(connectionPrivate->notify_port);
+               mach_port_mod_refs(mach_task_self(), mp, MACH_PORT_RIGHT_RECEIVE, -1);
        }
 
        }
 
-       if (connectionPrivate->session_port != MACH_PORT_NULL)
-               mach_port_destroy(mach_task_self(), connectionPrivate->session_port);
+       if (connectionPrivate->session_port != MACH_PORT_NULL) {
+               __MACH_PORT_DEBUG(TRUE, "*** __SCNetworkConnectionDeallocate session_port", connectionPrivate->session_port);
+               (void) mach_port_deallocate(mach_task_self(), connectionPrivate->session_port);
+       }
 
        if (connectionPrivate->rlsContext.release != NULL)
                (*connectionPrivate->rlsContext.release)(connectionPrivate->rlsContext.info);
 
        if (connectionPrivate->rlsContext.release != NULL)
                (*connectionPrivate->rlsContext.release)(connectionPrivate->rlsContext.info);
@@ -151,8 +171,6 @@ __SCNetworkConnectionDeallocate(CFTypeRef cf)
 }
 
 
 }
 
 
-static pthread_once_t initialized              = PTHREAD_ONCE_INIT;
-
 static CFTypeID __kSCNetworkConnectionTypeID   = _kCFRuntimeNotATypeID;
 
 static const CFRuntimeClass __SCNetworkConnectionClass = {
 static CFTypeID __kSCNetworkConnectionTypeID   = _kCFRuntimeNotATypeID;
 
 static const CFRuntimeClass __SCNetworkConnectionClass = {
@@ -171,41 +189,19 @@ static const CFRuntimeClass __SCNetworkConnectionClass = {
 static void
 __SCNetworkConnectionInitialize(void)
 {
 static void
 __SCNetworkConnectionInitialize(void)
 {
-       __kSCNetworkConnectionTypeID = _CFRuntimeRegisterClass(&__SCNetworkConnectionClass);
-       return;
-}
+       char    *env;
 
 
-
-static SCNetworkConnectionStatus
-__SCNetworkConnectionConvertStatus(int state)
-{
-       SCNetworkConnectionStatus       status = kSCNetworkConnectionDisconnected;
-
-       switch (state) {
-               case PPP_INITIALIZE:
-               case PPP_CONNECTLINK:
-               case PPP_ESTABLISH:
-               case PPP_AUTHENTICATE:
-               case PPP_CALLBACK:
-               case PPP_NETWORK:
-               case PPP_WAITONBUSY:
-                       status = kSCNetworkConnectionConnecting;
-                       break;
-               case PPP_TERMINATE:
-               case PPP_DISCONNECTLINK:
-                       status = kSCNetworkConnectionDisconnecting;
-                       break;
-               case PPP_RUNNING:
-               case PPP_ONHOLD:
-                       status = kSCNetworkConnectionConnected;
-                       break;
-               case PPP_IDLE:
-               case PPP_DORMANT:
-               case PPP_HOLDOFF:
-               default:
-                       status = kSCNetworkConnectionDisconnected;
+       /* get the debug environment variable */
+       env = getenv("PPPDebug");
+       if (env != NULL) {
+               if (sscanf(env, "%d", &debug) != 1) {
+                       /* PPPDebug value is not valid (or non-numeric), set debug to 1 */
+                       debug = 1;
+               }
        }
        }
-       return status;
+
+       __kSCNetworkConnectionTypeID = _CFRuntimeRegisterClass(&__SCNetworkConnectionClass);
+       return;
 }
 
 
 }
 
 
@@ -219,18 +215,17 @@ __SCNetworkConnectionCallBack(CFMachPortRef port, void * msg, CFIndex size, void
        void                            (*context_release)(const void *);
        int                             error                   = kSCStatusFailed;
        mach_msg_id_t                   msgid                   = buf->header.msgh_id;
        void                            (*context_release)(const void *);
        int                             error                   = kSCStatusFailed;
        mach_msg_id_t                   msgid                   = buf->header.msgh_id;
-       int                             phase                   = PPP_IDLE;
        SCNetworkConnectionCallBack     rlsFunction;
        SCNetworkConnectionCallBack     rlsFunction;
-       kern_return_t                   status;
-       SCNetworkConnectionStatus       scstatus;
+       SCNetworkConnectionStatus       scstatus = kSCNetworkConnectionInvalid;
 
        if (msgid == MACH_NOTIFY_NO_SENDERS) {
                SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCNetworkConnectionCallBack: PPPController server died"));
        } else {
 
        if (msgid == MACH_NOTIFY_NO_SENDERS) {
                SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCNetworkConnectionCallBack: PPPController server died"));
        } else {
-               status = pppcontroller_getstatus(connectionPrivate->session_port, &phase, &error);
+               (void) pppcontroller_getstatus(connectionPrivate->session_port, &scstatus, &error);
        }
 
        }
 
-       if (connectionPrivate->rls == NULL) {
+       if (!connectionPrivate->scheduled) {
+               // if not currently scheduled
                return;
        }
 
                return;
        }
 
@@ -247,8 +242,6 @@ __SCNetworkConnectionCallBack(CFMachPortRef port, void * msg, CFIndex size, void
                context_release = NULL;
        }
 
                context_release = NULL;
        }
 
-       scstatus = __SCNetworkConnectionConvertStatus(phase);
-
        (*rlsFunction)(connection, scstatus, context_info);
        if ((context_release != NULL) && (context_info != NULL)) {
                (*context_release)(context_info);
        (*rlsFunction)(connection, scstatus, context_info);
        if ((context_release != NULL) && (context_info != NULL)) {
                (*context_release)(context_info);
@@ -283,7 +276,6 @@ __SCNetworkConnectionCreatePrivate(CFAllocatorRef           allocator,
                                   SCNetworkConnectionContext   *context)
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = NULL;
                                   SCNetworkConnectionContext   *context)
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = NULL;
-       char                            *envdebug;
        uint32_t                        size;
 
 
        uint32_t                        size;
 
 
@@ -305,13 +297,6 @@ __SCNetworkConnectionCreatePrivate(CFAllocatorRef          allocator,
        /* save the service */
        connectionPrivate->service = CFRetain(service);
 
        /* save the service */
        connectionPrivate->service = CFRetain(service);
 
-       /* get the debug environment variable */
-       envdebug = getenv("PPPDebug");
-       if (envdebug) {
-               if (sscanf(envdebug, "%d", &connectionPrivate->debug) != 1)
-                       connectionPrivate->debug = 1; /* PPPDebug value is invalid, set debug to 1 */
-       }
-
        connectionPrivate->rlsFunction = callout;
 
        if (context) {
        connectionPrivate->rlsFunction = callout;
 
        if (context) {
@@ -321,18 +306,11 @@ __SCNetworkConnectionCreatePrivate(CFAllocatorRef         allocator,
                }
        }
 
                }
        }
 
-       if (connectionPrivate->debug) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionCreate (0x%x) succeeded for service : %@"), connectionPrivate, service);
-       }
-
        /* success, return the connection reference */
        return connectionPrivate;
 
     fail:
 
        /* success, return the connection reference */
        return connectionPrivate;
 
     fail:
 
-       if (connectionPrivate->debug)
-               SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionCreate (0x%x) failed for service : %@"), connectionPrivate, service);
-
        /* failure, clean up and leave */
        if (connectionPrivate != NULL) {
                CFRelease(connectionPrivate);
        /* failure, clean up and leave */
        if (connectionPrivate != NULL) {
                CFRelease(connectionPrivate);
@@ -351,7 +329,7 @@ __SCNetworkConnectionSessionPort(SCNetworkConnectionPrivateRef connectionPrivate
        CFDataRef       dataRef                 = NULL;
        int             error                   = kSCStatusFailed;
        mach_port_t     notify_port             = MACH_PORT_NULL;
        CFDataRef       dataRef                 = NULL;
        int             error                   = kSCStatusFailed;
        mach_port_t     notify_port             = MACH_PORT_NULL;
-       mach_port_t     port_old                = MACH_PORT_NULL;
+       mach_port_t     oldNotify               = MACH_PORT_NULL;
        mach_port_t     server                  = MACH_PORT_NULL;
        kern_return_t   status;
        mach_port_t     unpriv_bootstrap_port   = MACH_PORT_NULL;
        mach_port_t     server                  = MACH_PORT_NULL;
        kern_return_t   status;
        mach_port_t     unpriv_bootstrap_port   = MACH_PORT_NULL;
@@ -363,7 +341,7 @@ __SCNetworkConnectionSessionPort(SCNetworkConnectionPrivateRef connectionPrivate
        pthread_mutex_lock(&connectionPrivate->lock);
 
        if (bootstrap_look_up(bootstrap_port, PPPCONTROLLER_SERVER, &server) != BOOTSTRAP_SUCCESS) {
        pthread_mutex_lock(&connectionPrivate->lock);
 
        if (bootstrap_look_up(bootstrap_port, PPPCONTROLLER_SERVER, &server) != BOOTSTRAP_SUCCESS) {
-               SCLog(_sc_verbose, LOG_DEBUG, CFSTR("PPP Controller server not found"));
+               SCLog(_sc_verbose, LOG_ERR, CFSTR("PPP Controller not found"));
                goto done;
        }
 
                goto done;
        }
 
@@ -377,34 +355,73 @@ __SCNetworkConnectionSessionPort(SCNetworkConnectionPrivateRef connectionPrivate
        }
 
        if (connectionPrivate->rlsFunction != NULL) {
        }
 
        if (connectionPrivate->rlsFunction != NULL) {
-               CFMachPortContext       context = { 0
-                       , (void *)connectionPrivate
-                       , NULL
-                       , NULL
-                       , pppMPCopyDescription
-               };
-
                /* allocate port (for server response) */
                /* allocate port (for server response) */
-               connectionPrivate->notify_port = CFMachPortCreate(NULL, __SCNetworkConnectionCallBack, &context, NULL);
+               status = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &notify_port);
+               if (status != KERN_SUCCESS) {
+                       goto done;
+               }
+
+               status = mach_port_insert_right(mach_task_self(),
+                                               notify_port,
+                                               notify_port,
+                                               MACH_MSG_TYPE_MAKE_SEND);
+               if (status != KERN_SUCCESS) {
+                       /*
+                        * We can't insert a send right into our own port!  This should
+                        * only happen if someone stomped on OUR port (so let's leave
+                        * the port alone).
+                        */
+                       SCLog(TRUE, LOG_ERR, CFSTR("__SCNetworkConnectionSessionPort mach_port_insert_right(): %s"), mach_error_string(status));
+                       goto done;
+               }
 
                /* request a notification when/if the server dies */
 
                /* request a notification when/if the server dies */
-               notify_port = CFMachPortGetPort(connectionPrivate->notify_port);
                status = mach_port_request_notification(mach_task_self(),
                                                        notify_port,
                                                        MACH_NOTIFY_NO_SENDERS,
                                                        1,
                                                        notify_port,
                                                        MACH_MSG_TYPE_MAKE_SEND_ONCE,
                status = mach_port_request_notification(mach_task_self(),
                                                        notify_port,
                                                        MACH_NOTIFY_NO_SENDERS,
                                                        1,
                                                        notify_port,
                                                        MACH_MSG_TYPE_MAKE_SEND_ONCE,
-                                                       &port_old);
+                                                       &oldNotify);
                if (status != KERN_SUCCESS) {
                        goto done;
                }
                if (status != KERN_SUCCESS) {
                        goto done;
                }
+
+               if (oldNotify != MACH_PORT_NULL) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("__SCNetworkConnectionSessionPort(): oldNotify != MACH_PORT_NULL"));
+               }
+
+               __MACH_PORT_DEBUG(TRUE, "*** __SCNetworkConnectionSessionPort notify_port (before)", notify_port);
        }
 
        status = pppcontroller_attach(server, data, dataLen, unpriv_bootstrap_port, notify_port,
                                      &connectionPrivate->session_port, &error);
        if (status != KERN_SUCCESS) {
        }
 
        status = pppcontroller_attach(server, data, dataLen, unpriv_bootstrap_port, notify_port,
                                      &connectionPrivate->session_port, &error);
        if (status != KERN_SUCCESS) {
+               SCLog(TRUE, LOG_DEBUG, CFSTR("__SCNetworkConnectionSessionPort : pppcontroller_attach failed (status=0x%x)"), status);
+               if ((notify_port != MACH_PORT_NULL) && (status == MACH_SEND_INVALID_DEST)) {
+                       (void) mach_port_destroy(mach_task_self(), notify_port);
+                       notify_port = MACH_PORT_NULL;
+               }
                error = kSCStatusFailed;
                error = kSCStatusFailed;
+               goto done;
+       }
+
+       __MACH_PORT_DEBUG(connectionPrivate->session_port != MACH_PORT_NULL,
+                         "*** __SCNetworkConnectionSessionPort session_port",
+                         connectionPrivate->session_port);
+       __MACH_PORT_DEBUG(notify_port != MACH_PORT_NULL,
+                         "*** __SCNetworkConnectionSessionPort notify_port",
+                         notify_port);
+
+       if (notify_port != MACH_PORT_NULL) {
+               CFMachPortContext       context = { 0
+                                                 , (void *)connectionPrivate
+                                                 , NULL
+                                                 , NULL
+                                                 , pppMPCopyDescription
+               };
+
+               connectionPrivate->notify_port = CFMachPortCreateWithPort(NULL, notify_port, __SCNetworkConnectionCallBack, &context, NULL);
        }
 
     done :
        }
 
     done :
@@ -417,13 +434,20 @@ __SCNetworkConnectionSessionPort(SCNetworkConnectionPrivateRef connectionPrivate
 
        if (error != kSCStatusOK) {
                if (connectionPrivate->session_port != MACH_PORT_NULL) {
 
        if (error != kSCStatusOK) {
                if (connectionPrivate->session_port != MACH_PORT_NULL) {
-                       mach_port_destroy(mach_task_self(), connectionPrivate->session_port);
+                       __MACH_PORT_DEBUG(TRUE,
+                                         "*** __SCNetworkConnectionSessionPort attach failed: session_port",
+                                         connectionPrivate->session_port);
+                       mach_port_deallocate(mach_task_self(), connectionPrivate->session_port);
                        connectionPrivate->session_port = MACH_PORT_NULL;
                }
                if (connectionPrivate->notify_port != NULL) {
                        connectionPrivate->session_port = MACH_PORT_NULL;
                }
                if (connectionPrivate->notify_port != NULL) {
+                       mach_port_t     port = CFMachPortGetPort(connectionPrivate->notify_port);
+
                        CFMachPortInvalidate(connectionPrivate->notify_port);
                        CFRelease(connectionPrivate->notify_port);
                        connectionPrivate->notify_port = NULL;
                        CFMachPortInvalidate(connectionPrivate->notify_port);
                        CFRelease(connectionPrivate->notify_port);
                        connectionPrivate->notify_port = NULL;
+                       __MACH_PORT_DEBUG(TRUE, "*** __SCNetworkConnectionSessionPort attach failed: notify_port", port);
+                       mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, -1);
                }
                _SCErrorSet(error);
        }
                }
                _SCErrorSet(error);
        }
@@ -475,7 +499,8 @@ SCNetworkConnectionCopyAvailableServices(SCNetworkSetRef set)
                                service       = CFArrayGetValueAtIndex(services, i);
                                interface     = SCNetworkServiceGetInterface(service);
                                interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
                                service       = CFArrayGetValueAtIndex(services, i);
                                interface     = SCNetworkServiceGetInterface(service);
                                interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
-                               if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) {
+                               if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP) ||
+                                   CFEqual(interfaceType, kSCNetworkInterfaceTypeIPSec)) {
                                        CFArrayAppendValue(available, service);
                                }
                        }
                                        CFArrayAppendValue(available, service);
                                }
                        }
@@ -484,7 +509,9 @@ SCNetworkConnectionCopyAvailableServices(SCNetworkSetRef set)
                }
        }
 
                }
        }
 
-       if (tempSet)    CFRelease(set);
+       if (tempSet && (set != NULL)) {
+               CFRelease(set);
+       }
        return available;
 }
 
        return available;
 }
 
@@ -514,7 +541,6 @@ SCNetworkConnectionCreateWithServiceID(CFAllocatorRef                       allocator,
                                       SCNetworkConnectionContext       *context)
 {
        SCNetworkConnectionRef  connection;
                                       SCNetworkConnectionContext       *context)
 {
        SCNetworkConnectionRef  connection;
-       SCPreferencesRef        prefs;
        SCNetworkServiceRef     service;
 
        if (!isA_CFString(serviceID)) {
        SCNetworkServiceRef     service;
 
        if (!isA_CFString(serviceID)) {
@@ -522,13 +548,7 @@ SCNetworkConnectionCreateWithServiceID(CFAllocatorRef                      allocator,
                return NULL;
        }
 
                return NULL;
        }
 
-       prefs = SCPreferencesCreate(NULL, CFSTR("SCNetworkConnectionCreateWithServiceID"), NULL);
-       if (prefs == NULL) {
-               return NULL;
-       }
-
-       service = SCNetworkServiceCopy(prefs, serviceID);
-       CFRelease(prefs);
+       service = _SCNetworkServiceCopyActive(NULL, serviceID);
        if (service == NULL) {
                return NULL;
        }
        if (service == NULL) {
                return NULL;
        }
@@ -622,7 +642,6 @@ SCNetworkConnectionGetStatus(SCNetworkConnectionRef connection)
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
        int                             error                   = kSCStatusFailed;
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
        int                             error                   = kSCStatusFailed;
-       int                             phase;
        SCNetworkConnectionStatus       scstatus;
        mach_port_t                     session_port;
        kern_return_t                   status;
        SCNetworkConnectionStatus       scstatus;
        mach_port_t                     session_port;
        kern_return_t                   status;
@@ -638,12 +657,17 @@ SCNetworkConnectionGetStatus(SCNetworkConnectionRef connection)
                return kSCNetworkConnectionInvalid;
        }
 
                return kSCNetworkConnectionInvalid;
        }
 
-       status = pppcontroller_getstatus(session_port, &phase, &error);
-       if ((status != KERN_SUCCESS) || (error != kSCStatusOK)) {
-               return kSCNetworkConnectionDisconnected;
+       status = pppcontroller_getstatus(session_port, &scstatus, &error);
+       if (status != KERN_SUCCESS) {
+               _SCErrorSet(kSCStatusFailed);
+               return kSCNetworkConnectionInvalid;
+       }
+
+       if (error != kSCStatusOK) {
+               _SCErrorSet(error);
+               return kSCNetworkConnectionInvalid;
        }
 
        }
 
-       scstatus = __SCNetworkConnectionConvertStatus(phase);
        return scstatus;
 }
 
        return scstatus;
 }
 
@@ -724,7 +748,7 @@ SCNetworkConnectionStart(SCNetworkConnectionRef     connection,
                return FALSE;
        }
 
                return FALSE;
        }
 
-       if (connectionPrivate->debug) {
+       if (debug > 0) {
                CFMutableDictionaryRef  mdict = NULL;
 
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionStart (0x%x)"), connectionPrivate);
                CFMutableDictionaryRef  mdict = NULL;
 
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionStart (0x%x)"), connectionPrivate);
@@ -792,8 +816,9 @@ SCNetworkConnectionStart(SCNetworkConnectionRef     connection,
                dataref = NULL;
        }
 
                dataref = NULL;
        }
 
-       if (connectionPrivate->debug)
+       if (debug > 0) {
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionStart (0x%x), return: %d"), connectionPrivate, error);
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionStart (0x%x), return: %d"), connectionPrivate, error);
+       }
 
        if (error != kSCStatusOK) {
                goto fail;
 
        if (error != kSCStatusOK) {
                goto fail;
@@ -830,16 +855,18 @@ SCNetworkConnectionStop(SCNetworkConnectionRef    connection,
                return FALSE;
        }
 
                return FALSE;
        }
 
-       if (connectionPrivate->debug)
+       if (debug > 0) {
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionStop (0x%x)"), connectionPrivate);
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionStop (0x%x)"), connectionPrivate);
+       }
 
        status = pppcontroller_stop(session_port, forceDisconnect, &error);
        if (status != KERN_SUCCESS) {
                goto fail;
        }
 
 
        status = pppcontroller_stop(session_port, forceDisconnect, &error);
        if (status != KERN_SUCCESS) {
                goto fail;
        }
 
-       if (connectionPrivate->debug)
+       if (debug > 0) {
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionStop (0x%x), return: %d"), connectionPrivate, error);
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionStop (0x%x), return: %d"), connectionPrivate, error);
+       }
 
        if (error != kSCStatusOK) {
                goto fail;
 
        if (error != kSCStatusOK) {
                goto fail;
@@ -874,16 +901,18 @@ SCNetworkConnectionSuspend(SCNetworkConnectionRef connection)
                return FALSE;
        }
 
                return FALSE;
        }
 
-       if (connectionPrivate->debug)
+       if (debug > 0) {
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionSuspend (0x%x)"), connectionPrivate);
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionSuspend (0x%x)"), connectionPrivate);
+       }
 
        status = pppcontroller_suspend(session_port, &error);
        if (status != KERN_SUCCESS) {
                goto fail;
        }
 
 
        status = pppcontroller_suspend(session_port, &error);
        if (status != KERN_SUCCESS) {
                goto fail;
        }
 
-       if (connectionPrivate->debug)
+       if (debug > 0) {
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionSuspend (0x%x), return: %d"), connectionPrivate, error);
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionSuspend (0x%x), return: %d"), connectionPrivate, error);
+       }
 
        if (error != kSCStatusOK) {
                goto fail;
 
        if (error != kSCStatusOK) {
                goto fail;
@@ -918,16 +947,18 @@ SCNetworkConnectionResume(SCNetworkConnectionRef connection)
                return FALSE;
        }
 
                return FALSE;
        }
 
-       if (connectionPrivate->debug)
+       if (debug > 0) {
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionResume (0x%x)"), connectionPrivate);
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionResume (0x%x)"), connectionPrivate);
+       }
 
        status = pppcontroller_resume(session_port, &error);
        if (status != KERN_SUCCESS) {
                goto fail;
        }
 
 
        status = pppcontroller_resume(session_port, &error);
        if (status != KERN_SUCCESS) {
                goto fail;
        }
 
-       if (connectionPrivate->debug)
+       if (debug > 0) {
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionResume (0x%x), return: %d"), connectionPrivate, error);
                SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionResume (0x%x), return: %d"), connectionPrivate, error);
+       }
 
        if (error != kSCStatusOK) {
                goto fail;
 
        if (error != kSCStatusOK) {
                goto fail;
@@ -1000,32 +1031,53 @@ SCNetworkConnectionCopyUserOptions(SCNetworkConnectionRef connection)
 }
 
 
 }
 
 
-Boolean
-SCNetworkConnectionScheduleWithRunLoop(SCNetworkConnectionRef  connection,
-                                      CFRunLoopRef             runLoop,
-                                      CFStringRef              runLoopMode)
+#if    !TARGET_OS_IPHONE
+static boolean_t
+SCNetworkConnectionNotifyMIGCallback(mach_msg_header_t *message, mach_msg_header_t *reply)
+{
+       SCNetworkConnectionPrivateRef   connectionPrivate = dispatch_get_context(dispatch_get_current_queue());
+
+       if (connectionPrivate != NULL) {
+               CFRetain(connectionPrivate);
+               dispatch_async(connectionPrivate->dispatchQueue, ^{
+                       __SCNetworkConnectionCallBack(connectionPrivate->notify_port, message, 4096, connectionPrivate);
+                       CFRelease(connectionPrivate);
+               });
+       }
+       reply->msgh_remote_port = MACH_PORT_NULL;
+       return false;
+}
+#endif // !TARGET_OS_IPHONE
+
+
+static Boolean
+__SCNetworkConnectionScheduleWithRunLoop(SCNetworkConnectionRef        connection,
+                                        CFRunLoopRef           runLoop,
+                                        CFStringRef            runLoopMode,
+#if    !TARGET_OS_IPHONE
+                                        dispatch_queue_t       queue
+#else  // !TARGET_OS_IPHONE
+                                        void                   *queue
+#endif // !TARGET_OS_IPHONE
+                                        )
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
        int                             error                   = kSCStatusFailed;
        mach_port_t                     session_port;
        kern_return_t                   status;
 
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
        int                             error                   = kSCStatusFailed;
        mach_port_t                     session_port;
        kern_return_t                   status;
 
-       if (!isA_SCNetworkConnection(connection) || runLoop == NULL || runLoopMode == NULL) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
        if (connectionPrivate->rlsFunction == NULL) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
 
        if (connectionPrivate->rlsFunction == NULL) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
 
-       if ((connectionPrivate->rlList != NULL) &&
-           _SC_isScheduled(NULL, runLoop, runLoopMode, connectionPrivate->rlList)) {
-               /* already scheduled */
-               _SCErrorSet(kSCStatusFailed);
+#if    !TARGET_OS_IPHONE
+       if ((connectionPrivate->dispatchQueue != NULL) ||               // if we are already scheduled on a dispatch queue
+           ((queue != NULL) && connectionPrivate->scheduled)) {        // if we are already scheduled on a CFRunLoop
+               _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
                return FALSE;
        }
+#endif // !TARGET_OS_IPHONE
 
        session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
        if (session_port == MACH_PORT_NULL) {
 
        session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
        if (session_port == MACH_PORT_NULL) {
@@ -1033,45 +1085,125 @@ SCNetworkConnectionScheduleWithRunLoop(SCNetworkConnectionRef  connection,
                return FALSE;
        }
 
                return FALSE;
        }
 
-       if (connectionPrivate->rlList == NULL) {
+       if (!connectionPrivate->scheduled) {
                status = pppcontroller_notification(session_port, 1, &error);
                if ((status != KERN_SUCCESS) || (error != kSCStatusOK)) {
                        _SCErrorSet(error);
                        return FALSE;
                }
 
                status = pppcontroller_notification(session_port, 1, &error);
                if ((status != KERN_SUCCESS) || (error != kSCStatusOK)) {
                        _SCErrorSet(error);
                        return FALSE;
                }
 
-               connectionPrivate->rls = CFMachPortCreateRunLoopSource(NULL, connectionPrivate->notify_port, 0);
-               connectionPrivate->rlList = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+               if (runLoop != NULL) {
+                       connectionPrivate->rls = CFMachPortCreateRunLoopSource(NULL, connectionPrivate->notify_port, 0);
+                       connectionPrivate->rlList = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+               }
+
+               connectionPrivate->scheduled = TRUE;
        }
 
        }
 
-       CFRunLoopAddSource(runLoop, connectionPrivate->rls, runLoopMode);
-       _SC_schedule(connectionPrivate, runLoop, runLoopMode, connectionPrivate->rlList);
+#if    !TARGET_OS_IPHONE
+       if (queue != NULL) {
+               dispatch_queue_attr_t   attr;
+               mach_port_t             mp;
+               long                    res;
+
+               connectionPrivate->dispatchQueue = queue;
+               dispatch_retain(connectionPrivate->dispatchQueue);
+
+               attr = dispatch_queue_attr_create();
+               res = dispatch_queue_attr_set_finalizer(attr,
+                                                       ^(dispatch_queue_t dq) {
+                                                               SCNetworkConnectionRef  connection;
+
+                                                               connection = (SCNetworkConnectionRef)dispatch_get_context(dq);
+                                                               CFRelease(connection);
+                                                       });
+               if (res != 0) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCNetworkConnection dispatch_queue_attr_set_finalizer() failed"));
+                       dispatch_release(attr);
+                       goto fail;
+               }
+               connectionPrivate->callbackQueue = dispatch_queue_create("com.apple.SCNetworkConnection.notifications", attr);
+               dispatch_release(attr);
+               if (connectionPrivate->callbackQueue == NULL){
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCNetworkConnection dispatch_queue_create() failed"));
+                       goto fail;
+               }
+               CFRetain(connection);   // Note: will be released when the dispatch queue is released
+               dispatch_set_context(connectionPrivate->callbackQueue, connectionPrivate);
+
+               mp = CFMachPortGetPort(connectionPrivate->notify_port);
+               connectionPrivate->callbackSource = dispatch_source_mig_create(mp, sizeof(mach_msg_header_t), NULL, connectionPrivate->callbackQueue, SCNetworkConnectionNotifyMIGCallback);
+               if (connectionPrivate->callbackSource == NULL) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCNetworkConnection dispatch_source_mig_create() failed"));
+                       goto fail;
+               }
+       } else
+#endif // !TARGET_OS_IPHONE
+       {
+               if (!_SC_isScheduled(NULL, runLoop, runLoopMode, connectionPrivate->rlList)) {
+                       /*
+                        * if we do not already have notifications scheduled with
+                        * this runLoop / runLoopMode
+                        */
+                       CFRunLoopAddSource(runLoop, connectionPrivate->rls, runLoopMode);
+               }
+
+               _SC_schedule(connection, runLoop, runLoopMode, connectionPrivate->rlList);
+       }
 
        return TRUE;
 
        return TRUE;
+
+#if    !TARGET_OS_IPHONE
+    fail :
+
+       if (connectionPrivate->callbackSource != NULL) {
+               dispatch_cancel(connectionPrivate->callbackSource);
+               dispatch_release(connectionPrivate->callbackSource);
+               connectionPrivate->callbackSource = NULL;
+       }
+       if (connectionPrivate->callbackQueue != NULL) {
+               dispatch_release(connectionPrivate->callbackQueue);
+               connectionPrivate->callbackQueue = NULL;
+       }
+       if (connectionPrivate->dispatchQueue != NULL) {
+               dispatch_release(connectionPrivate->dispatchQueue);
+               connectionPrivate->dispatchQueue = NULL;
+       }
+       _SCErrorSet(kSCStatusFailed);
+       return FALSE;
+#endif // !TARGET_OS_IPHONE
 }
 
 
 }
 
 
-Boolean
-SCNetworkConnectionUnscheduleFromRunLoop(SCNetworkConnectionRef                connection,
-                                        CFRunLoopRef                   runLoop,
-                                        CFStringRef                    runLoopMode)
+static Boolean
+__SCNetworkConnectionUnscheduleFromRunLoop(SCNetworkConnectionRef      connection,
+                                          CFRunLoopRef                 runLoop,
+                                          CFStringRef                  runLoopMode,
+#if    !TARGET_OS_IPHONE
+                                          dispatch_queue_t             queue
+#else  // !TARGET_OS_IPHONE
+                                          void                         *queue
+#endif // !TARGET_OS_IPHONE
+                                          )
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
        int                             error                   = kSCStatusFailed;
 {
        SCNetworkConnectionPrivateRef   connectionPrivate       = (SCNetworkConnectionPrivateRef)connection;
        int                             error                   = kSCStatusFailed;
+       CFIndex                         n                       = 0;
        mach_port_t                     session_port;
        kern_return_t                   status;
 
        mach_port_t                     session_port;
        kern_return_t                   status;
 
-       if (!isA_SCNetworkConnection(connection) || runLoop == NULL || runLoopMode == NULL) {
+       if ((runLoop != NULL) && !connectionPrivate->scheduled) {                       // if we should be scheduled (but are not)
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
 
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
 
-       if ((connectionPrivate->rlList == NULL) ||
-           !_SC_unschedule(connectionPrivate, runLoop, runLoopMode, connectionPrivate->rlList, FALSE)) {
-               /* if not currently scheduled */
-               _SCErrorSet(kSCStatusFailed);
+#if    !TARGET_OS_IPHONE
+       if (((runLoop == NULL) && (connectionPrivate->dispatchQueue == NULL)) ||        // if we should be scheduled on a dispatch queue (but are not)
+           ((runLoop != NULL) && (connectionPrivate->dispatchQueue != NULL))) {        // if we should be scheduled on a CFRunLoop (but are scheduled on a dispatch queue)
+               _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
                return FALSE;
        }
+#endif // !TARGET_OS_IPHONE
 
        session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
        if (session_port == MACH_PORT_NULL) {
 
        session_port = __SCNetworkConnectionSessionPort(connectionPrivate);
        if (session_port == MACH_PORT_NULL) {
@@ -1079,13 +1211,46 @@ SCNetworkConnectionUnscheduleFromRunLoop(SCNetworkConnectionRef         connection,
                return FALSE;
        }
 
                return FALSE;
        }
 
-       CFRunLoopRemoveSource(runLoop, connectionPrivate->rls, runLoopMode);
+#if    !TARGET_OS_IPHONE
+       if (runLoop == NULL) {
+               dispatch_cancel(connectionPrivate->callbackSource);
+               dispatch_release(connectionPrivate->callbackSource);
+               connectionPrivate->callbackSource = NULL;
+               dispatch_release(connectionPrivate->callbackQueue);
+               connectionPrivate->callbackQueue = NULL;
+               dispatch_release(connectionPrivate->dispatchQueue);
+               connectionPrivate->dispatchQueue = NULL;
+       } else
+#endif // !TARGET_OS_IPHONE
+       {
+               if (!_SC_unschedule(connection, runLoop, runLoopMode, connectionPrivate->rlList, FALSE)) {
+                       // if not currently scheduled on this runLoop / runLoopMode
+                       _SCErrorSet(kSCStatusFailed);
+                       return FALSE;
+               }
 
 
-       if (CFArrayGetCount(connectionPrivate->rlList) == 0) {
-               CFRelease(connectionPrivate->rls);
-               connectionPrivate->rls = NULL;
-               CFRelease(connectionPrivate->rlList);
-               connectionPrivate->rlList = NULL;
+               n = CFArrayGetCount(connectionPrivate->rlList);
+               if (n == 0 || !_SC_isScheduled(NULL, runLoop, runLoopMode, connectionPrivate->rlList)) {
+                       /*
+                        * if we are no longer scheduled to receive notifications for
+                        * this runLoop / runLoopMode
+                        */
+                       CFRunLoopRemoveSource(runLoop, connectionPrivate->rls, runLoopMode);
+
+                       if (n == 0) {
+                               // if *all* notifications have been unscheduled
+                               CFRelease(connectionPrivate->rlList);
+                               connectionPrivate->rlList = NULL;
+                               CFRunLoopSourceInvalidate(connectionPrivate->rls);
+                               CFRelease(connectionPrivate->rls);
+                               connectionPrivate->rls = NULL;
+                       }
+               }
+       }
+
+       if (n == 0) {
+               // if *all* notifications have been unscheduled
+               connectionPrivate->scheduled = FALSE;
 
                status = pppcontroller_notification(session_port, 0, &error);
                if ((status != KERN_SUCCESS) || (error != kSCStatusOK)) {
 
                status = pppcontroller_notification(session_port, 0, &error);
                if ((status != KERN_SUCCESS) || (error != kSCStatusOK)) {
@@ -1098,6 +1263,57 @@ SCNetworkConnectionUnscheduleFromRunLoop(SCNetworkConnectionRef          connection,
 }
 
 
 }
 
 
+Boolean
+SCNetworkConnectionScheduleWithRunLoop(SCNetworkConnectionRef  connection,
+                                      CFRunLoopRef             runLoop,
+                                      CFStringRef              runLoopMode)
+{
+       if (!isA_SCNetworkConnection(connection) || (runLoop == NULL) || (runLoopMode == NULL)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       return __SCNetworkConnectionScheduleWithRunLoop(connection, runLoop, runLoopMode, NULL);
+}
+
+
+Boolean
+SCNetworkConnectionUnscheduleFromRunLoop(SCNetworkConnectionRef                connection,
+                                        CFRunLoopRef                   runLoop,
+                                        CFStringRef                    runLoopMode)
+{
+       if (!isA_SCNetworkConnection(connection) || (runLoop == NULL) || (runLoopMode == NULL)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       return __SCNetworkConnectionUnscheduleFromRunLoop(connection, runLoop, runLoopMode, NULL);
+}
+
+
+#if    !TARGET_OS_IPHONE
+Boolean
+SCNetworkConnectionSetDispatchQueue(SCNetworkConnectionRef     connection,
+                                   dispatch_queue_t            queue)
+{
+       Boolean ok      = FALSE;
+
+       if (!isA_SCNetworkConnection(connection)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (queue != NULL) {
+               ok = __SCNetworkConnectionScheduleWithRunLoop(connection, NULL, NULL, queue);
+       } else {
+               ok = __SCNetworkConnectionUnscheduleFromRunLoop(connection, NULL, NULL, NULL);
+       }
+
+       return ok;
+}
+#endif // !TARGET_OS_IPHONE
+
+
 #pragma mark -
 #pragma mark User level "dial" API
 
 #pragma mark -
 #pragma mark User level "dial" API
 
@@ -1118,9 +1334,12 @@ static Boolean SCNetworkConnectionPrivateCopyDefaultUserOptionsFromArray(CFArray
 static Boolean SCNetworkConnectionPrivateIsPPPService                  (SCDynamicStoreRef session, CFStringRef serviceID, CFStringRef subType1, CFStringRef subType2);
 static void addPasswordFromKeychain                                    (SCDynamicStoreRef session, CFStringRef serviceID, CFDictionaryRef *userOptions);
 static CFStringRef copyPasswordFromKeychain                            (CFStringRef uniqueID);
 static Boolean SCNetworkConnectionPrivateIsPPPService                  (SCDynamicStoreRef session, CFStringRef serviceID, CFStringRef subType1, CFStringRef subType2);
 static void addPasswordFromKeychain                                    (SCDynamicStoreRef session, CFStringRef serviceID, CFDictionaryRef *userOptions);
 static CFStringRef copyPasswordFromKeychain                            (CFStringRef uniqueID);
-static CFArrayRef copyKeychainEnumerator                               (CFStringRef uniqueIdentifier);
 
 
-static int notify_userprefs_token      = -1;
+static int             notify_userprefs_token  = -1;
+
+static CFDictionaryRef onDemand_configuration  = NULL;
+static pthread_mutex_t onDemand_notify_lock    = PTHREAD_MUTEX_INITIALIZER;
+static int             onDemand_notify_token   = -1;
 
 /*
  *     return TRUE if domain1 ends with domain2, and will check for trailing "."
 
 /*
  *     return TRUE if domain1 ends with domain2, and will check for trailing "."
@@ -1168,46 +1387,316 @@ domainEndsWithDomain(CFStringRef domain1, CFStringRef domain2)
        return ret;
 }
 
        return ret;
 }
 
+/* VPN On Demand */
+
+Boolean
+__SCNetworkConnectionCopyOnDemandInfoWithName(SCDynamicStoreRef                *storeP,
+                                             CFStringRef               hostName,
+                                             Boolean                   onDemandRetry,
+                                             CFStringRef               *connectionServiceID,
+                                             SCNetworkConnectionStatus *connectionStatus,
+                                             CFStringRef               *vpnRemoteAddress)      /*  CFDictionaryRef *info */
+{
+       int                     changed         = 1;
+       CFDictionaryRef         configuration;
+       Boolean                 ok              = FALSE;
+       int                     status;
+       SCDynamicStoreRef       store           = *storeP;
+       CFArrayRef              triggers;
+       uint64_t                triggersCount   = 0;
+       int                     triggersIndex;
+
+       pthread_mutex_lock(&onDemand_notify_lock);
+       if (onDemand_notify_token == -1) {
+               status = notify_register_check(kSCNETWORKCONNECTION_ONDEMAND_NOTIFY_KEY, &onDemand_notify_token);
+               if (status != NOTIFY_STATUS_OK) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("notify_register_check() failed, status=%lu"), status);
+                       onDemand_notify_token = -1;
+               }
+       }
+       if (onDemand_notify_token != -1) {
+               status = notify_check(onDemand_notify_token, &changed);
+               if (status != NOTIFY_STATUS_OK) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("notify_check() failed, status=%lu"), status);
+                       (void)notify_cancel(onDemand_notify_token);
+                       onDemand_notify_token = -1;
+               }
+       }
+
+       if (changed && (onDemand_notify_token != -1)) {
+               status = notify_get_state(onDemand_notify_token, &triggersCount);
+               if (status != NOTIFY_STATUS_OK) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("notify_get_state() failed, status=%lu"), status);
+                       (void)notify_cancel(onDemand_notify_token);
+                       onDemand_notify_token = -1;
+               }
+       }
+
+       if (changed) {
+               CFStringRef     key;
+
+               if (_sc_debug || (debug > 0)) {
+                       SCLog(TRUE, LOG_INFO,
+                             CFSTR("OnDemand information %s"),
+                             (onDemand_configuration == NULL) ? "fetched" : "updated");
+               }
+
+               if (onDemand_configuration != NULL) {
+                       CFRelease(onDemand_configuration);
+                       onDemand_configuration = NULL;
+               }
+
+               if (triggersCount > 0) {
+                       if (store == NULL) {
+                               store = SCDynamicStoreCreate(NULL, CFSTR("__SCNetworkConnectionCopyOnDemandInfoWithName"), NULL, NULL);
+                               if (store == NULL) {
+                                       SCLog(TRUE, LOG_ERR, CFSTR("__SCNetworkConnectionCopyOnDemandInfoWithName SCDynamicStoreCreate() failed"));
+
+                                       // force retry on next check
+                                       if (onDemand_notify_token != -1) {
+                                               (void)notify_cancel(onDemand_notify_token);
+                                               onDemand_notify_token = -1;
+                                       }
+                                       pthread_mutex_unlock(&onDemand_notify_lock);
+                                       return FALSE;
+                               }
+                               *storeP = store;
+                       }
+
+                       key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL, kSCDynamicStoreDomainState, kSCEntNetOnDemand);
+                       onDemand_configuration = SCDynamicStoreCopyValue(store, key);
+                       CFRelease(key);
+                       if ((onDemand_configuration != NULL) && !isA_CFDictionary(onDemand_configuration)) {
+                               CFRelease(onDemand_configuration);
+                               onDemand_configuration = NULL;
+                       }
+               }
+       }
+
+       configuration = (onDemand_configuration != NULL) ? CFRetain(onDemand_configuration) : NULL;
+       pthread_mutex_unlock(&onDemand_notify_lock);
+
+       if (configuration == NULL) {
+               // if no "OnDemand" configurations
+               return FALSE;
+       }
+
+       triggers = CFDictionaryGetValue(configuration, kSCNetworkConnectionOnDemandTriggers);
+       triggersCount = isA_CFArray(triggers) ? CFArrayGetCount(triggers) : 0;
+       for (triggersIndex = 0; triggersIndex < triggersCount; triggersIndex++) {
+               CFArrayRef      domains;
+               int             domainsCount;
+               int             domainsIndex;
+               CFStringRef     key;
+               CFDictionaryRef trigger;
+
+               trigger = CFArrayGetValueAtIndex(triggers, triggersIndex);
+               if (!isA_CFDictionary(trigger)) {
+                       // if not a valid "OnDemand" configuration
+                       continue;
+               }
+
+               /*
+                * If we haven't tried a resulution yet, we only want to check for a name
+                * match for domains that require to always connect.
+                */
+               key = onDemandRetry ? kSCNetworkConnectionOnDemandMatchDomainsOnRetry
+                                   : kSCNetworkConnectionOnDemandMatchDomainsAlways;
+               domains = CFDictionaryGetValue(trigger, key);
+               domainsCount = isA_CFArray(domains) ? CFArrayGetCount(domains) : 0;
+               for (domainsIndex = 0; domainsIndex < domainsCount; domainsIndex++) {
+                       CFStringRef     domain;
+
+                       domain = CFArrayGetValueAtIndex(domains, domainsIndex);
+                       if (!isA_CFString(domain)) {
+                               // if not a valid match domain
+                               continue;
+                       }
+
+                       if (domainEndsWithDomain(hostName, domain)) {
+                               CFArrayRef                      exceptions;
+                               int                             exceptionsCount;
+                               int                             exceptionsIndex;
+                               CFNumberRef                     num;
+                               SCNetworkConnectionStatus       onDemandStatus  = kSCNetworkConnectionDisconnected;
+
+                               // we have a matching domain, check against exception list
+                               exceptions = CFDictionaryGetValue(trigger, kSCNetworkConnectionOnDemandMatchDomainsNever);
+                               exceptionsCount = isA_CFArray(exceptions) ? CFArrayGetCount(exceptions) : 0;
+                               for (exceptionsIndex = 0; exceptionsIndex < exceptionsCount; exceptionsIndex++) {
+                                       CFStringRef     exception;
+
+                                       exception = CFArrayGetValueAtIndex(exceptions, exceptionsIndex);
+                                       if (!isA_CFString(exception)) {
+                                               // if not a valid match exception
+                                               continue;
+                                       }
+
+                                       if (domainEndsWithDomain(hostName, exception)) {
+                                               // found matching exception
+                                               if (_sc_debug || (debug > 0)) {
+                                                       SCLog(TRUE, LOG_INFO, CFSTR("OnDemand match exception"));
+                                               }
+                                               goto done;
+                                       }
+                               }
+
+                               // if we have a matching domain and there were no exceptions
+                               // then we pass back the OnDemand info
+
+                               if (!CFDictionaryGetValueIfPresent(trigger,
+                                                                  kSCNetworkConnectionOnDemandStatus,
+                                                                  (const void **)&num) ||
+                                   !isA_CFNumber(num) ||
+                                   !CFNumberGetValue(num, kCFNumberSInt32Type, &onDemandStatus)) {
+                                       onDemandStatus = kSCNetworkConnectionDisconnected;
+                               }
+                               if (connectionStatus != NULL) {
+                                       *connectionStatus = onDemandStatus;
+                               }
+
+                               if (connectionServiceID != NULL) {
+                                       *connectionServiceID = CFDictionaryGetValue(trigger, kSCNetworkConnectionOnDemandServiceID);
+                                       *connectionServiceID = isA_CFString(*connectionServiceID);
+                                       if (*connectionServiceID != NULL) {
+                                               CFRetain(*connectionServiceID);
+                                       }
+
+                               }
+
+                               if (vpnRemoteAddress != NULL) {
+                                       *vpnRemoteAddress = CFDictionaryGetValue(trigger, kSCNetworkConnectionOnDemandRemoteAddress);
+                                       *vpnRemoteAddress = isA_CFString(*vpnRemoteAddress);
+                                       if (*vpnRemoteAddress != NULL) {
+                                               CFRetain(*vpnRemoteAddress);
+                                       }
+                               }
+
+                               if (_sc_debug || (debug > 0)) {
+                                       SCLog(TRUE, LOG_INFO,
+                                             CFSTR("OnDemand%s match, connection status = %d"),
+                                             onDemandRetry ? " (on retry)" : "",
+                                             onDemandStatus);
+                               }
+
+                               ok = TRUE;
+                               goto done;
+                       }
+               }
+       }
+
+//     if (_sc_debug || (debug > 0)) {
+//             SCLog(TRUE, LOG_INFO, CFSTR("OnDemand domain name(s) not matched"));
+//     }
+
+    done :
+
+       if (configuration != NULL) CFRelease(configuration);
+       return ok;
+}
+
 
 Boolean
 SCNetworkConnectionCopyUserPreferences(CFDictionaryRef selectionOptions,
                                       CFStringRef      *serviceID,
                                       CFDictionaryRef  *userOptions)
 {
 
 Boolean
 SCNetworkConnectionCopyUserPreferences(CFDictionaryRef selectionOptions,
                                       CFStringRef      *serviceID,
                                       CFDictionaryRef  *userOptions)
 {
-       int                     debug           = 0;
-       char                    *envdebug;
-       int                     prefsChanged;
-       SCDynamicStoreRef       session;
+       int                     prefsChanged    = 1;
+       SCDynamicStoreRef       session         = NULL;
        Boolean                 success         = FALSE;
        int                     status;
 
 
        Boolean                 success         = FALSE;
        int                     status;
 
 
-       envdebug = getenv("PPPDebug");
-       if (envdebug) {
-               if (sscanf(envdebug, "%d", &debug) != 1)
-                       debug = 1; /* PPPDebug value is invalid, set debug to 1 */
+       /* initialize runtime */
+       pthread_once(&initialized, __SCNetworkConnectionInitialize);
+
+       /* first check for new VPN OnDemand style */
+       if (selectionOptions != NULL) {
+               CFStringRef     hostName;
+
+               hostName = CFDictionaryGetValue(selectionOptions, kSCNetworkConnectionSelectionOptionOnDemandHostName);
+               if (isA_CFString(hostName)) {
+                       CFStringRef                     connectionServiceID     = NULL;
+                       SCNetworkConnectionStatus       connectionStatus;
+                       Boolean                         onDemandRetry;
+                       CFTypeRef                       val;
+
+                       val = CFDictionaryGetValue(selectionOptions, kSCNetworkConnectionSelectionOptionOnDemandRetry);
+                       onDemandRetry = isA_CFBoolean(val) ? CFBooleanGetValue(val) : TRUE;
+
+                       success = __SCNetworkConnectionCopyOnDemandInfoWithName(&session,
+                                                                               hostName,
+                                                                               onDemandRetry,
+                                                                               &connectionServiceID,
+                                                                               &connectionStatus,
+                                                                               NULL);
+                       if (debug > 1) {
+                               SCLog(TRUE, LOG_DEBUG,
+                                     CFSTR("SCNetworkConnectionCopyUserPreferences __SCNetworkConnectionCopyOnDemandInfoWithName returns %d w/status %d"),
+                                     success,
+                                     connectionStatus);
+                       }
+
+                       if (success) {
+                               // if the hostname matches an OnDemand domain
+                               if (session != NULL) {
+                                       CFRelease(session);
+                               }
+                               if (connectionStatus == kSCNetworkConnectionConnected) {
+                                       // if we are already connected
+                                       if (connectionServiceID != NULL) {
+                                               CFRelease(connectionServiceID);
+                                       }
+                                       return FALSE;
+                               }
+
+                               *serviceID   = connectionServiceID;
+                               *userOptions = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+                               CFDictionarySetValue((CFMutableDictionaryRef)*userOptions, kSCNetworkConnectionSelectionOptionOnDemandHostName, hostName);
+                               return TRUE;
+                       } else if (!onDemandRetry) {
+                               // if the hostname does not match an OnDemand domain and we have
+                               // not yet issued an initial DNS query (i.e. it's not a query
+                               // being retried after the VPN has been established) than we're
+                               // done
+                               if (session != NULL) {
+                                       CFRelease(session);
+                               }
+                               return FALSE;
+                       }
+               }
        }
 
        if (notify_userprefs_token == -1) {
                status = notify_register_check(k_NetworkConnect_Notification, &notify_userprefs_token);
        }
 
        if (notify_userprefs_token == -1) {
                status = notify_register_check(k_NetworkConnect_Notification, &notify_userprefs_token);
-               if (status != NOTIFY_STATUS_OK)
+               if (status != NOTIFY_STATUS_OK) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("notify_register_check() failed, status=%lu"), status);
+                       (void)notify_cancel(notify_userprefs_token);
                        notify_userprefs_token = -1;
                        notify_userprefs_token = -1;
-               else
-                       // clear the flag
-                       notify_check(notify_userprefs_token, &prefsChanged);
+               } else {
+                       // clear the "something has changed" state
+                       (void) notify_check(notify_userprefs_token, &prefsChanged);
+                       prefsChanged = 1;
+               }
+       }
+       if (notify_userprefs_token != -1) {
+               status = notify_check(notify_userprefs_token, &prefsChanged);
+               if (status != NOTIFY_STATUS_OK) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("notify_check() failed, status=%lu"), status);
+                       (void)notify_cancel(notify_userprefs_token);
+                       notify_userprefs_token = -1;
+               }
        }
        }
-
-       prefsChanged = 1;
-       if (notify_userprefs_token != -1)
-               notify_check(notify_userprefs_token, &prefsChanged);
 
 
        *serviceID = NULL;
        *userOptions = NULL;
 
 
 
        *serviceID = NULL;
        *userOptions = NULL;
 
-       session = SCDynamicStoreCreate(NULL, CFSTR("SCNetworkConnection"), NULL, NULL);
        if (session == NULL) {
        if (session == NULL) {
-               fprintf(stderr, "Error,  SCNetworkConnectionCopyUserPreferences, SCDynamicStoreCreate() returned NULL!\n");
+               session = SCDynamicStoreCreate(NULL, CFSTR("SCNetworkConnection"), NULL, NULL);
+       }
+       if (session == NULL) {
+               SCLog(TRUE, LOG_ERR, CFSTR("Error,  SCNetworkConnectionCopyUserPreferences, SCDynamicStoreCreate() returned NULL!"));
                return FALSE;
        }
 
                return FALSE;
        }
 
@@ -1222,13 +1711,13 @@ SCNetworkConnectionCopyUserPreferences(CFDictionaryRef  selectionOptions,
                CFIndex         serviceIndex;
                CFIndex         servicesCount;
 
                CFIndex         serviceIndex;
                CFIndex         servicesCount;
 
-               hostName = CFDictionaryGetValue(selectionOptions, kSCPropNetPPPOnDemandHostName);
-               if (!isA_CFString(hostName))
-                       hostName = NULL;
-
-               // can't select anything
+               hostName = CFDictionaryGetValue(selectionOptions, kSCNetworkConnectionSelectionOptionOnDemandHostName);
+               if (hostName == NULL) {
+                       hostName = CFDictionaryGetValue(selectionOptions, kSCPropNetPPPOnDemandHostName);
+               }
+               hostName = isA_CFString(hostName);
                if (hostName == NULL)
                if (hostName == NULL)
-                       goto done_selection;
+                       goto done_selection;    // if no hostname for matching
 
                priority = CFDictionaryGetValue(selectionOptions, kSCPropNetPPPOnDemandPriority);
                if (!isA_CFString(priority))
 
                priority = CFDictionaryGetValue(selectionOptions, kSCPropNetPPPOnDemandPriority);
                if (!isA_CFString(priority))
@@ -1278,22 +1767,22 @@ SCNetworkConnectionCopyUserPreferences(CFDictionaryRef  selectionOptions,
 
                                CFNumberGetValue(autodial, kCFNumberIntType, &val);
                                if (val) {
 
                                CFNumberGetValue(autodial, kCFNumberIntType, &val);
                                if (val) {
-                                       CFArrayRef      autoDomains;
-                                       CFIndex         domainIndex;
+                                       CFArrayRef      domains;
                                        CFIndex         domainsCount;
                                        CFIndex         domainsCount;
+                                       CFIndex         domainsIndex;
 
                                        /* we found an conditional connection enabled configuration */
 
                                        /* check domain */
 
                                        /* we found an conditional connection enabled configuration */
 
                                        /* check domain */
-                                       autoDomains = CFDictionaryGetValue(pppConfig, kSCPropNetPPPOnDemandDomains);
-                                       if (!isA_CFArray(autoDomains))
+                                       domains = CFDictionaryGetValue(pppConfig, kSCPropNetPPPOnDemandDomains);
+                                       if (!isA_CFArray(domains))
                                                continue;
 
                                                continue;
 
-                                       domainsCount = CFArrayGetCount(autoDomains);
-                                       for (domainIndex = 0; domainIndex < domainsCount; domainIndex++) {
+                                       domainsCount = CFArrayGetCount(domains);
+                                       for (domainsIndex = 0; domainsIndex < domainsCount; domainsIndex++) {
                                                CFStringRef     domain;
 
                                                CFStringRef     domain;
 
-                                               domain = CFArrayGetValueAtIndex(autoDomains, domainIndex);
+                                               domain = CFArrayGetValueAtIndex(domains, domainsIndex);
                                                if (!isA_CFString(domain))
                                                        continue;
 
                                                if (!isA_CFString(domain))
                                                        continue;
 
@@ -1311,7 +1800,7 @@ SCNetworkConnectionCopyUserPreferences(CFDictionaryRef    selectionOptions,
                                                        *serviceID = serviceName;
                                                        CFRetain(*serviceID);
                                                        *userOptions = CFDictionaryCreateMutableCopy(NULL, 0, config);
                                                        *serviceID = serviceName;
                                                        CFRetain(*serviceID);
                                                        *userOptions = CFDictionaryCreateMutableCopy(NULL, 0, config);
-                                                       CFDictionarySetValue((CFMutableDictionaryRef)*userOptions, kSCPropNetPPPOnDemandHostName, hostName);
+                                                       CFDictionarySetValue((CFMutableDictionaryRef)*userOptions, kSCNetworkConnectionSelectionOptionOnDemandHostName, hostName);
                                                        CFDictionarySetValue((CFMutableDictionaryRef)*userOptions, kSCPropNetPPPOnDemandPriority, priority);
                                                        addPasswordFromKeychain(session, *serviceID, userOptions);
                                                        success = TRUE;
                                                        CFDictionarySetValue((CFMutableDictionaryRef)*userOptions, kSCPropNetPPPOnDemandPriority, priority);
                                                        addPasswordFromKeychain(session, *serviceID, userOptions);
                                                        success = TRUE;
@@ -1335,7 +1824,7 @@ SCNetworkConnectionCopyUserPreferences(CFDictionaryRef    selectionOptions,
                        *serviceID = serviceName;
                        CFRetain(*serviceID);
                        *userOptions = CFDictionaryCreateMutableCopy(NULL, 0, config);
                        *serviceID = serviceName;
                        CFRetain(*serviceID);
                        *userOptions = CFDictionaryCreateMutableCopy(NULL, 0, config);
-                       CFDictionarySetValue((CFMutableDictionaryRef)*userOptions, kSCPropNetPPPOnDemandHostName, hostName);
+                       CFDictionarySetValue((CFMutableDictionaryRef)*userOptions, kSCNetworkConnectionSelectionOptionOnDemandHostName, hostName);
                        CFDictionarySetValue((CFMutableDictionaryRef)*userOptions, kSCPropNetPPPOnDemandPriority, priority);
                        addPasswordFromKeychain(session, *serviceID, userOptions);
                        success = TRUE;
                        CFDictionarySetValue((CFMutableDictionaryRef)*userOptions, kSCPropNetPPPOnDemandPriority, priority);
                        addPasswordFromKeychain(session, *serviceID, userOptions);
                        success = TRUE;
@@ -1378,7 +1867,7 @@ SCNetworkConnectionCopyUserPreferences(CFDictionaryRef    selectionOptions,
                                        addPasswordFromKeychain(session, *serviceID, userOptions);
                                }
                        } else {
                                        addPasswordFromKeychain(session, *serviceID, userOptions);
                                }
                        } else {
-                               fprintf(stderr, "Error, userServices are not of type CFArray!\n");
+                               SCLog(TRUE, LOG_DEBUG, CFSTR("Error, userServices are not of type CFArray!"));
                        }
 
                        CFRelease(userServices); // this is OK because SCNetworkConnectionPrivateISExpectedCFType() checks for NULL
                        }
 
                        CFRelease(userServices); // this is OK because SCNetworkConnectionPrivateISExpectedCFType() checks for NULL
@@ -1398,8 +1887,9 @@ SCNetworkConnectionCopyUserPreferences(CFDictionaryRef    selectionOptions,
 // SCNetworkConnectionPrivateCopyDefaultServiceIDForDial
 // ----------------------------------------------------
 // Try to find the service id to connect
 // SCNetworkConnectionPrivateCopyDefaultServiceIDForDial
 // ----------------------------------------------------
 // Try to find the service id to connect
-// (1) Start by looking at the last service used in Internet Connect
-// (2) If Internet Connect has not been used, find the PPP service with the highest ordering
+// (1) Start by looking at the last service used in Network Pref / Network menu extra
+// (2) If Network Pref / Network menu extra has not been used, find the PPP service
+//     with the highest ordering
 //********************************************************************************************
 static Boolean
 SCNetworkConnectionPrivateCopyDefaultServiceIDForDial(SCDynamicStoreRef session, CFStringRef *serviceID)
 //********************************************************************************************
 static Boolean
 SCNetworkConnectionPrivateCopyDefaultServiceIDForDial(SCDynamicStoreRef session, CFStringRef *serviceID)
@@ -1671,48 +2161,7 @@ addPasswordFromKeychain(SCDynamicStoreRef session, CFStringRef serviceID, CFDict
 
 }
 
 
 }
 
-//********************************************************************************
-// copyPasswordFromKeychain
-// --------------------------------------
-// Given a uniqueID, retrieve the password from the keychain
-//********************************************************************************
-static CFStringRef
-copyPasswordFromKeychain(CFStringRef uniqueID)
-{
-       CFArrayRef      enumerator;
-       CFIndex         n;
-       CFStringRef     password = NULL;
-
-       enumerator = copyKeychainEnumerator(uniqueID);
-       if (enumerator == NULL) {
-               return NULL;            // if no keychain enumerator
-       }
-
-       n = CFArrayGetCount(enumerator);
-       if (n > 0) {
-               void                    *data   = NULL;
-               UInt32                  dataLen = 0;
-               SecKeychainItemRef      itemRef;
-               OSStatus                result;
-
-               itemRef = (SecKeychainItemRef)CFArrayGetValueAtIndex(enumerator, 0);
-               result = SecKeychainItemCopyContent(itemRef,            // itemRef
-                                                   NULL,               // itemClass
-                                                   NULL,               // attrList
-                                                   &dataLen,           // length
-                                                   (void *)&data);     // outData
-               if ((result == noErr) && (data != NULL) && (dataLen > 0)) {
-                       password = CFStringCreateWithBytes(NULL, data, dataLen, kCFStringEncodingUTF8, TRUE);
-                       (void) SecKeychainItemFreeContent(NULL, data);
-               }
-
-       }
-
-       CFRelease(enumerator);
-
-       return password;
-}
-
+#if    !TARGET_OS_IPHONE
 //********************************************************************************
 // copyKeychainEnumerator
 // --------------------------------------
 //********************************************************************************
 // copyKeychainEnumerator
 // --------------------------------------
@@ -1762,3 +2211,50 @@ copyKeychainEnumerator(CFStringRef uniqueIdentifier)
 
        return itemArray;
 }
 
        return itemArray;
 }
+#endif // !TARGET_OS_IPHONE
+
+//********************************************************************************
+// copyPasswordFromKeychain
+// --------------------------------------
+// Given a uniqueID, retrieve the password from the keychain
+//********************************************************************************
+static CFStringRef
+copyPasswordFromKeychain(CFStringRef uniqueID)
+{
+#if    !TARGET_OS_IPHONE
+       CFArrayRef      enumerator;
+       CFIndex         n;
+       CFStringRef     password = NULL;
+
+       enumerator = copyKeychainEnumerator(uniqueID);
+       if (enumerator == NULL) {
+               return NULL;            // if no keychain enumerator
+       }
+
+       n = CFArrayGetCount(enumerator);
+       if (n > 0) {
+               void                    *data   = NULL;
+               UInt32                  dataLen = 0;
+               SecKeychainItemRef      itemRef;
+               OSStatus                result;
+
+               itemRef = (SecKeychainItemRef)CFArrayGetValueAtIndex(enumerator, 0);
+               result = SecKeychainItemCopyContent(itemRef,            // itemRef
+                                                   NULL,               // itemClass
+                                                   NULL,               // attrList
+                                                   &dataLen,           // length
+                                                   (void *)&data);     // outData
+               if ((result == noErr) && (data != NULL) && (dataLen > 0)) {
+                       password = CFStringCreateWithBytes(NULL, data, dataLen, kCFStringEncodingUTF8, TRUE);
+                       (void) SecKeychainItemFreeContent(NULL, data);
+               }
+
+       }
+
+       CFRelease(enumerator);
+
+       return password;
+#else  // !TARGET_OS_IPHONE
+       return NULL;
+#endif // !TARGET_OS_IPHONE
+}
index 610919032085c3e068662fb8a0ab8ac059a34313..7282b8740c6cde01ec0a3522e731627e3b85f6ef 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2003-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003-2006, 2008, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  */
 
 #ifndef _SCNETWORKCONNECTION_H
  */
 
 #ifndef _SCNETWORKCONNECTION_H
+#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS
+#include <SystemConfiguration/_SCNetworkConnection.h>
+#else  /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
 #define _SCNETWORKCONNECTION_H
 
 #define _SCNETWORKCONNECTION_H
 
-#include <AvailabilityMacros.h>
+#include <Availability.h>
+#include <TargetConditionals.h>
 #include <sys/cdefs.h>
 #include <sys/cdefs.h>
+#if    !TARGET_OS_IPHONE
+#include <dispatch/dispatch.h>
+#endif // !TARGET_OS_IPHONE
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
 
 /*!
        @header SCNetworkConnection
 
 /*!
        @header SCNetworkConnection
@@ -202,6 +208,29 @@ typedef void (*SCNetworkConnectionCallBack)        (
 #define kSCNetworkConnectionErrorsOut          CFSTR("ErrorsOut")              /* CFNumber */
 
 
 #define kSCNetworkConnectionErrorsOut          CFSTR("ErrorsOut")              /* CFNumber */
 
 
+/*
+ Keys for the SCNetworkConnectionCopyUserPreferences() "selectionOptions"
+ dictionary
+ */
+
+/*!
+       @define kSCNetworkConnectionSelectionOptionOnDemandHostName
+       @discussion A host name that will be used to select the
+               "best" SCNetworkConnection.
+ */
+#if    (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000) || TARGET_IPHONE_SIMULATOR
+#define kSCNetworkConnectionSelectionOptionOnDemandHostName    CFSTR("OnDemandHostName")       /* CFString */
+#endif
+
+/*!
+       @define kSCNetworkConnectionSelectionOptionOnDemandRetry
+       @discussion A boolean value used to indicate whether a DNS query has
+               already been issued for the specified OnDemand host name.
+ */
+#if    (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000) || TARGET_IPHONE_SIMULATOR
+#define kSCNetworkConnectionSelectionOptionOnDemandRetry       CFSTR("OnDemandRetry")          /* CFBoolean */
+#endif
+
 __BEGIN_DECLS
 
 /*!
 __BEGIN_DECLS
 
 /*!
@@ -210,7 +239,8 @@ __BEGIN_DECLS
                instances.
  */
 CF_EXPORT
                instances.
  */
 CF_EXPORT
-CFTypeID SCNetworkConnectionGetTypeID          (void)                  AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
+CFTypeID
+SCNetworkConnectionGetTypeID                   (void)                  __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/);
 
 
 /*!
 
 
 /*!
@@ -228,11 +258,12 @@ CFTypeID SCNetworkConnectionGetTypeID             (void)                  AVAILABLE_MAC_OS_X_VERSION_10_3_
        @result Returns TRUE if there is a valid service to dial;
                FALSE if the function was unable to retrieve a service to dial.
  */
        @result Returns TRUE if there is a valid service to dial;
                FALSE if the function was unable to retrieve a service to dial.
  */
-Boolean SCNetworkConnectionCopyUserPreferences (
+Boolean
+SCNetworkConnectionCopyUserPreferences         (
                                                CFDictionaryRef                 selectionOptions,
                                                CFStringRef                     *serviceID,
                                                CFDictionaryRef                 *userOptions
                                                CFDictionaryRef                 selectionOptions,
                                                CFStringRef                     *serviceID,
                                                CFDictionaryRef                 *userOptions
-                                               )                       AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
+                                               )                       __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/);
 
 
 /*!
 
 
 /*!
@@ -262,7 +293,7 @@ SCNetworkConnectionCreateWithServiceID              (
                                                CFStringRef                     serviceID,
                                                SCNetworkConnectionCallBack     callout,
                                                SCNetworkConnectionContext      *context
                                                CFStringRef                     serviceID,
                                                SCNetworkConnectionCallBack     callout,
                                                SCNetworkConnectionContext      *context
-                                               )                       AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
+                                               )                       __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/);
 
 
 /*!
 
 
 /*!
@@ -274,7 +305,7 @@ SCNetworkConnectionCreateWithServiceID              (
 CFStringRef
 SCNetworkConnectionCopyServiceID               (
                                                SCNetworkConnectionRef          connection
 CFStringRef
 SCNetworkConnectionCopyServiceID               (
                                                SCNetworkConnectionRef          connection
-                                               )                       AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
+                                               )                       __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/);
 
 
 /*!
 
 
 /*!
@@ -297,7 +328,7 @@ SCNetworkConnectionCopyServiceID            (
 SCNetworkConnectionStatus
 SCNetworkConnectionGetStatus                   (
                                                SCNetworkConnectionRef          connection
 SCNetworkConnectionStatus
 SCNetworkConnectionGetStatus                   (
                                                SCNetworkConnectionRef          connection
-                                               )                       AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
+                                               )                       __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/);
 
 
 /*!
 
 
 /*!
@@ -325,6 +356,13 @@ SCNetworkConnectionGetStatus                       (
 &#32
        Modem : ConnectSpeed   : the speed of the modem connection
                                 in bits/second.
 &#32
        Modem : ConnectSpeed   : the speed of the modem connection
                                 in bits/second.
+&#32
+       IPSec : Status         : the IPSec-specific status of type
+                                SCNetworkConnectionIPSecStatus
+&#32
+               ConnectTime    : the time when the connection was
+                                established.
+
 @/textblock
 </pre>
                Other dictionaries could be present for PPPoE, PPTP, and L2TP.
 @/textblock
 </pre>
                Other dictionaries could be present for PPPoE, PPTP, and L2TP.
@@ -338,7 +376,7 @@ SCNetworkConnectionGetStatus                        (
 CFDictionaryRef
 SCNetworkConnectionCopyExtendedStatus          (
                                                SCNetworkConnectionRef          connection
 CFDictionaryRef
 SCNetworkConnectionCopyExtendedStatus          (
                                                SCNetworkConnectionRef          connection
-                                               )                       AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
+                                               )                       __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/);
 
 
 /*!
 
 
 /*!
@@ -380,7 +418,7 @@ SCNetworkConnectionCopyExtendedStatus               (
 CFDictionaryRef
 SCNetworkConnectionCopyStatistics              (
                                                SCNetworkConnectionRef          connection
 CFDictionaryRef
 SCNetworkConnectionCopyStatistics              (
                                                SCNetworkConnectionRef          connection
-                                               )                       AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
+                                               )                       __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/);
 
 
 /*!
 
 
 /*!
@@ -432,7 +470,7 @@ SCNetworkConnectionStart                    (
                                                SCNetworkConnectionRef          connection,
                                                CFDictionaryRef                 userOptions,
                                                Boolean                         linger
                                                SCNetworkConnectionRef          connection,
                                                CFDictionaryRef                 userOptions,
                                                Boolean                         linger
-                                               )                       AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
+                                               )                       __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/);
 
 
 /*!
 
 
 /*!
@@ -458,7 +496,7 @@ Boolean
 SCNetworkConnectionStop                                (
                                                SCNetworkConnectionRef          connection,
                                                Boolean                         forceDisconnect
 SCNetworkConnectionStop                                (
                                                SCNetworkConnectionRef          connection,
                                                Boolean                         forceDisconnect
-                                               )                       AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
+                                               )                       __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/);
 
 
 /*!
 
 
 /*!
@@ -474,7 +512,7 @@ SCNetworkConnectionStop                             (
 CFDictionaryRef
 SCNetworkConnectionCopyUserOptions             (
                                                SCNetworkConnectionRef          connection
 CFDictionaryRef
 SCNetworkConnectionCopyUserOptions             (
                                                SCNetworkConnectionRef          connection
-                                               )                       AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
+                                               )                       __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/);
 
 
 /*!
 
 
 /*!
@@ -492,7 +530,7 @@ SCNetworkConnectionScheduleWithRunLoop              (
                                                SCNetworkConnectionRef          connection,
                                                CFRunLoopRef                    runLoop,
                                                CFStringRef                     runLoopMode
                                                SCNetworkConnectionRef          connection,
                                                CFRunLoopRef                    runLoop,
                                                CFStringRef                     runLoopMode
-                                               )                       AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
+                                               )                       __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/);
 
 
 /*!
 
 
 /*!
@@ -510,10 +548,28 @@ SCNetworkConnectionUnscheduleFromRunLoop  (
                                                SCNetworkConnectionRef          connection,
                                                CFRunLoopRef                    runLoop,
                                                CFStringRef                     runLoopMode
                                                SCNetworkConnectionRef          connection,
                                                CFRunLoopRef                    runLoop,
                                                CFStringRef                     runLoopMode
-                                               )                       AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
+                                               )                       __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/);
 
 
-__END_DECLS
 
 
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */
+#if    !TARGET_OS_IPHONE
+/*!
+        @function SCNetworkConnectionSetDispatchQueue
+        @discussion Caller provides a dispatch queue on which the callback contained in connection will run.
+        @param connection The SCNetworkConnection to notify.
+        @param queue The libdispatch queue to run the callback on.
+               Pass NULL to disable notifications, and release queue.
+        @result Returns TRUE if the notifications have been enabled/disabled as desired;
+                FALSE if not.
+                The error can be retrieved using the SCError function.
+ */
+Boolean
+SCNetworkConnectionSetDispatchQueue            (
+                                                SCNetworkConnectionRef         connection,
+                                                dispatch_queue_t               queue
+                                                )                      __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA);
+#endif // !TARGET_OS_IPHONE
+
+__END_DECLS
 
 
+#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
 #endif /* _SCNETWORKCONNECTION_H */
 #endif /* _SCNETWORKCONNECTION_H */
index 56c444fb8c274dc08f3a1be9df56dbc6e8a39dc6..3d2a7f08eb835f8d4abd7186fba2b6c78bdb0ab2 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2006-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -28,7 +28,6 @@
 #include "SCNetworkConfigurationInternal.h"
 #include <notify.h>
 #include <pthread.h>
 #include "SCNetworkConfigurationInternal.h"
 #include <notify.h>
 #include <pthread.h>
-#include <ppp/PPPControllerPriv.h>
 
 
 #pragma mark -
 
 
 #pragma mark -
@@ -183,6 +182,133 @@ isA_SCUserPreferences(CFTypeRef obj)
 #define        USER_PREFERENCES_DEFAULT        CFSTR("ConnectByDefault")
 
 
 #define        USER_PREFERENCES_DEFAULT        CFSTR("ConnectByDefault")
 
 
+#define        LOG_CFPREFERENCES_CHANGES
+#ifdef LOG_CFPREFERENCES_CHANGES
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+static void
+logCFPreferencesChange(CFStringRef serviceID, CFArrayRef newPreferences)
+{
+       CFBooleanRef    bVal;
+       char            dir[256];
+       CFArrayRef      oldPreferences;
+       CFStringRef     str;
+       CFStringRef     trace;
+       struct tm       tm_now;
+       struct timeval  tv_now;
+
+       bVal = CFPreferencesCopyAppValue(CFSTR("LOG_SC_CHANGES"), USER_PREFERENCES_APPLICATION_ID);
+       if (bVal != NULL) {
+               if (!isA_CFBoolean(bVal) || !CFBooleanGetValue(bVal)) {
+                       // if debugging not enabled
+                       CFRelease(bVal);
+                       return;
+               }
+       } else {
+               // if debugging not enabled
+               return;
+       }
+
+       (void)gettimeofday(&tv_now, NULL);
+       (void)localtime_r(&tv_now.tv_sec, &tm_now);
+
+       str = CFStringCreateWithFormat(NULL, NULL,
+                                      CFSTR("/var/tmp/com.apple.networkConnect-%@-%4d%02d%02d.%02d%02d%02d.%03d"),
+                                      serviceID,
+                                      tm_now.tm_year + 1900,
+                                      tm_now.tm_mon + 1,
+                                      tm_now.tm_mday,
+                                      tm_now.tm_hour,
+                                      tm_now.tm_min,
+                                      tm_now.tm_sec,
+                                      tv_now.tv_usec / 1000);
+       _SC_cfstring_to_cstring(str, dir, sizeof(dir), kCFStringEncodingUTF8);
+       CFRelease(str);
+
+       SCLog(TRUE, LOG_ERR, CFSTR("CFPreferences being updated, old/new in \"%s\""), dir);
+
+       if (mkdir(dir, 0755) == -1) {
+               SCLog(TRUE, LOG_ERR, CFSTR("logCFPreferencesChange mkdir() failed, error = %s"), SCErrorString(errno));
+               return;
+       }
+
+       trace = _SC_copyBacktrace();
+       if (trace != NULL) {
+               FILE    *f;
+               int     fd;
+               char    path[256];
+
+               strlcpy(path, dir, sizeof(path));
+               strlcat(path, "/backtrace", sizeof(path));
+               fd = open(path, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0644);
+               if (fd == -1) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("logCFPreferencesChange fopen() failed, error = %s"), SCErrorString(errno));
+                       CFRelease(trace);
+                       return;
+               }
+               f = fdopen(fd, "w");
+               SCPrint(TRUE, f, CFSTR("%@"), trace);
+               (void) fclose(f);
+               CFRelease(trace);
+       }
+
+       oldPreferences = CFPreferencesCopyAppValue(serviceID, USER_PREFERENCES_APPLICATION_ID);
+       if (oldPreferences != NULL) {
+               int             fd;
+               CFDataRef       data;
+               char            path[256];
+
+               strlcpy(path, dir, sizeof(path));
+               strlcat(path, "/old", sizeof(path));
+               fd = open(path, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0644);
+               if (fd == -1) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("logCFPreferencesChange fopen() failed, error = %s"), SCErrorString(errno));
+                       CFRelease(oldPreferences);
+                       return;
+               }
+               data = CFPropertyListCreateXMLData(NULL, oldPreferences);
+               if (data == NULL) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("logCFPreferencesChange CFPropertyListCreateXMLData() failed"));
+                       close(fd);
+                       CFRelease(oldPreferences);
+                       return;
+               }
+               (void) write(fd, CFDataGetBytePtr(data), CFDataGetLength(data));
+               (void) close(fd);
+               CFRelease(data);
+               CFRelease(oldPreferences);
+       }
+
+       if (newPreferences != NULL) {
+               int             fd;
+               CFDataRef       data;
+               char            path[256];
+
+               strlcpy(path, dir, sizeof(path));
+               strlcat(path, "/new", sizeof(path));
+               fd = open(path, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0644);
+               if (fd == -1) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("logCFPreferencesChange fopen() failed, error = %s"), SCErrorString(errno));
+                       return;
+               }
+               data = CFPropertyListCreateXMLData(NULL, newPreferences);
+               if (data == NULL) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("logCFPreferencesChange CFPropertyListCreateXMLData() failed"));
+                       close(fd);
+                       return;
+               }
+               (void) write(fd, CFDataGetBytePtr(data), CFDataGetLength(data));
+               (void) close(fd);
+               CFRelease(data);
+       }
+
+       return;
+}
+#endif // LOG_CFPREFERENCES_CHANGES
+
+
 static CFArrayRef
 copyCFPreferencesForServiceID(CFStringRef serviceID)
 {
 static CFArrayRef
 copyCFPreferencesForServiceID(CFStringRef serviceID)
 {
@@ -211,6 +337,10 @@ setCFPreferencesForServiceID(CFStringRef serviceID, CFArrayRef newPreferences)
                return FALSE;
        }
 
                return FALSE;
        }
 
+#ifdef LOG_CFPREFERENCES_CHANGES
+       logCFPreferencesChange(serviceID, newPreferences);
+#endif // LOG_CFPREFERENCES_CHANGES
+
        CFPreferencesSetValue(serviceID,
                              newPreferences,
                              USER_PREFERENCES_APPLICATION_ID,
        CFPreferencesSetValue(serviceID,
                              newPreferences,
                              USER_PREFERENCES_APPLICATION_ID,
@@ -1013,17 +1143,6 @@ SCNetworkConnectionCreateUserPreferences(SCNetworkConnectionRef connection)
 }
 
 
 }
 
 
-#ifdef NOTNOW
-Boolean
-SCNetworkConnectionSelectService(CFDictionaryRef       selectionOptions,
-                                SCNetworkServiceRef    *service,
-                                SCUserPreferencesRef   *userPreferences)
-{
-       return FALSE;
-}
-#endif // NOTNOW
-
-
 static void
 update_PPP_entity(SCUserPreferencesRef userPreferences, CFDictionaryRef *userOptions)
 {
 static void
 update_PPP_entity(SCUserPreferencesRef userPreferences, CFDictionaryRef *userOptions)
 {
@@ -1321,6 +1440,36 @@ copyUserSharedSecretID(CFDictionaryRef config, SCUserPreferencesRef userPreferen
 }
 
 
 }
 
 
+static CFStringRef
+copyUserXAuthID(CFDictionaryRef config, SCUserPreferencesRef userPreferences)
+{
+       CFMutableStringRef      xauth_id        = NULL;
+
+       if (config != NULL) {
+               CFStringRef     encryption;
+
+               encryption = CFDictionaryGetValue(config, kSCPropNetIPSecXAuthPasswordEncryption);
+               if (isA_CFString(encryption) &&
+                   CFEqual(encryption, kSCValNetIPSecXAuthPasswordEncryptionKeychain)) {
+                       xauth_id = (CFMutableStringRef)CFDictionaryGetValue(config, kSCPropNetIPSecXAuthPassword);
+                       if (xauth_id != NULL) {
+                               CFRetain(xauth_id);
+                       }
+               }
+       }
+
+       if (xauth_id == NULL) {
+               CFStringRef     unique_id;
+
+               unique_id = getUserPasswordID(config, userPreferences);
+               xauth_id = CFStringCreateMutableCopy(NULL, 0, unique_id);
+               CFStringAppend(xauth_id, CFSTR(".XAUTH"));
+       }
+
+       return xauth_id;
+}
+
+
 static Boolean
 checkUserPreferencesPassword(SCUserPreferencesRef              userPreferences,
                             SCNetworkInterfaceRef              interface,
 static Boolean
 checkUserPreferencesPassword(SCUserPreferencesRef              userPreferences,
                             SCNetworkInterfaceRef              interface,
@@ -1376,6 +1525,17 @@ checkUserPreferencesPassword(SCUserPreferencesRef                userPreferences,
                        return FALSE;
                }
 
                        return FALSE;
                }
 
+               case kSCNetworkInterfacePasswordTypeIPSecXAuth : {
+                       CFStringRef     interfaceType;
+
+                       interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
+                       if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeIPSec)) {
+                               _SCErrorSet(kSCStatusInvalidArgument);
+                               return FALSE;
+                       }
+                       break;
+               }
+
                default :
                        break;
        }
                default :
                        break;
        }
@@ -1441,7 +1601,31 @@ SCUserPreferencesCheckInterfacePassword(SCUserPreferencesRef             userPreferences,
                                                    NULL);
 
                        if (config != NULL)     CFRelease(config);
                                                    NULL);
 
                        if (config != NULL)     CFRelease(config);
-                               CFRelease(shared_id);
+                       CFRelease(shared_id);
+                       break;
+               }
+
+               case kSCNetworkInterfacePasswordTypeIPSecXAuth : {
+                       CFDictionaryRef config;
+                       CFStringRef     xauth_id;
+
+                       // get configuration
+                       config = SCUserPreferencesCopyInterfaceConfiguration(userPreferences, interface);
+
+                       // get XAuth ID
+                       xauth_id = copyUserXAuthID(config, userPreferences);
+
+                       // check
+                       exists = __extract_password(NULL,
+                                                   config,
+                                                   kSCPropNetIPSecXAuthPassword,
+                                                   kSCPropNetIPSecXAuthPasswordEncryption,
+                                                   kSCValNetIPSecXAuthPasswordEncryptionKeychain,
+                                                   xauth_id,
+                                                   NULL);
+
+                       if (config != NULL)     CFRelease(config);
+                       CFRelease(xauth_id);
                        break;
                }
 
                        break;
                }
 
@@ -1511,7 +1695,31 @@ SCUserPreferencesCopyInterfacePassword(SCUserPreferencesRef              userPreferences,
                                                  &password);
 
                        if (config != NULL)     CFRelease(config);
                                                  &password);
 
                        if (config != NULL)     CFRelease(config);
-                               CFRelease(shared_id);
+                       CFRelease(shared_id);
+                       break;
+               }
+
+               case kSCNetworkInterfacePasswordTypeIPSecXAuth : {
+                       CFDictionaryRef config;
+                       CFStringRef     xauth_id;
+
+                       // get configuration
+                       config = SCUserPreferencesCopyInterfaceConfiguration(userPreferences, interface);
+
+                       // get XAuth ID
+                       xauth_id = copyUserXAuthID(config, userPreferences);
+
+                       // extract
+                       (void) __extract_password(NULL,
+                                                 config,
+                                                 kSCPropNetIPSecXAuthPassword,
+                                                 kSCPropNetIPSecXAuthPasswordEncryption,
+                                                 kSCValNetIPSecXAuthPasswordEncryptionKeychain,
+                                                 xauth_id,
+                                                 &password);
+
+                       if (config != NULL)     CFRelease(config);
+                       CFRelease(xauth_id);
                        break;
                }
 
                        break;
                }
 
@@ -1538,6 +1746,7 @@ SCUserPreferencesRemoveInterfacePassword(SCUserPreferencesRef             userPreferences,
        switch (passwordType) {
                case kSCNetworkInterfacePasswordTypePPP : {
                        CFDictionaryRef config;
        switch (passwordType) {
                case kSCNetworkInterfacePasswordTypePPP : {
                        CFDictionaryRef config;
+                       CFDictionaryRef newConfig       = NULL;
                        CFStringRef     unique_id;
 
                        // get configuration
                        CFStringRef     unique_id;
 
                        // get configuration
@@ -1547,25 +1756,25 @@ SCUserPreferencesRemoveInterfacePassword(SCUserPreferencesRef           userPreferences,
                        unique_id = getUserPasswordID(config, userPreferences);
 
                        // remove password
                        unique_id = getUserPasswordID(config, userPreferences);
 
                        // remove password
-                       ok = _SCSecKeychainPasswordItemRemove(NULL, unique_id);
+                       ok = __remove_password(NULL,
+                                              config,
+                                              kSCPropNetPPPAuthPassword,
+                                              kSCPropNetPPPAuthPasswordEncryption,
+                                              kSCValNetPPPAuthPasswordEncryptionKeychain,
+                                              unique_id,
+                                              &newConfig);
                        if (ok) {
                        if (ok) {
-                               CFDictionaryRef         config;
-                               CFMutableDictionaryRef  newConfig;
-
-                               config = SCUserPreferencesCopyInterfaceConfiguration(userPreferences, interface);
-                               if (config != NULL) {
-                                       newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
-                                       CFDictionaryRemoveValue(newConfig, kSCPropNetPPPAuthPassword);
-                                       CFDictionaryRemoveValue(newConfig, kSCPropNetPPPAuthPasswordEncryption);
-                                       ok = SCUserPreferencesSetInterfaceConfiguration(userPreferences, interface, newConfig);
-                                       CFRelease(newConfig);
-                               }
+                               ok = SCUserPreferencesSetInterfaceConfiguration(userPreferences, interface, newConfig);
+                               if (newConfig != NULL) CFRelease(newConfig);
                        }
                        }
+
+                       if (config != NULL) CFRelease(config);
                        break;
                }
 
                case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
                        CFDictionaryRef config;
                        break;
                }
 
                case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
                        CFDictionaryRef config;
+                       CFDictionaryRef newConfig       = NULL;
                        CFStringRef     shared_id;
 
                        // get configuration
                        CFStringRef     shared_id;
 
                        // get configuration
@@ -1577,27 +1786,55 @@ SCUserPreferencesRemoveInterfacePassword(SCUserPreferencesRef           userPreferences,
                        shared_id = copyUserSharedSecretID(config, userPreferences);
 
                        // remove password
                        shared_id = copyUserSharedSecretID(config, userPreferences);
 
                        // remove password
-                       ok = _SCSecKeychainPasswordItemRemove(NULL, shared_id);
+                       ok = __remove_password(NULL,
+                                              config,
+                                              kSCPropNetIPSecSharedSecret,
+                                              kSCPropNetIPSecSharedSecretEncryption,
+                                              kSCValNetIPSecSharedSecretEncryptionKeychain,
+                                              shared_id,
+                                              &newConfig);
                        if (ok) {
                        if (ok) {
-                               CFMutableDictionaryRef  newConfig;
-
-                               if (config != NULL) {
-                                       newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
-                                       CFDictionaryRemoveValue(newConfig, kSCPropNetIPSecSharedSecret);
-                                       CFDictionaryRemoveValue(newConfig, kSCPropNetIPSecSharedSecretEncryption);
-                                       ok = SCUserPreferencesSetExtendedInterfaceConfiguration(userPreferences,
-                                                                                               interface,
-                                                                                               kSCEntNetIPSec,
-                                                                                               newConfig);
-                                       CFRelease(newConfig);
-                               }
+                               ok = SCUserPreferencesSetExtendedInterfaceConfiguration(userPreferences,
+                                                                                       interface,
+                                                                                       kSCEntNetIPSec,
+                                                                                       newConfig);
+                               if (newConfig != NULL) CFRelease(newConfig);
                        }
 
                        }
 
-                       if (config != NULL)     CFRelease(config);
+                       if (config != NULL) CFRelease(config);
                        CFRelease(shared_id);
                        break;
                }
 
                        CFRelease(shared_id);
                        break;
                }
 
+               case kSCNetworkInterfacePasswordTypeIPSecXAuth : {
+                       CFDictionaryRef config;
+                       CFDictionaryRef newConfig       = NULL;
+                       CFStringRef     xauth_id;
+
+                       // get configuration
+                       config = SCUserPreferencesCopyInterfaceConfiguration(userPreferences, interface);
+
+                       // get XAuth ID
+                       xauth_id = copyUserXAuthID(config, userPreferences);
+
+                       // remove password
+                       ok = __remove_password(NULL,
+                                              config,
+                                              kSCPropNetIPSecXAuthPassword,
+                                              kSCPropNetIPSecXAuthPasswordEncryption,
+                                              kSCValNetIPSecXAuthPasswordEncryptionKeychain,
+                                              xauth_id,
+                                              &newConfig);
+                       if (ok) {
+                               ok = SCUserPreferencesSetInterfaceConfiguration(userPreferences, interface, newConfig);
+                               if (newConfig != NULL) CFRelease(newConfig);
+                       }
+
+                       if (config != NULL) CFRelease(config);
+                       CFRelease(xauth_id);
+                       break;
+               }
+
                default :
                        _SCErrorSet(kSCStatusInvalidArgument);
                        return FALSE;
                default :
                        _SCErrorSet(kSCStatusInvalidArgument);
                        return FALSE;
@@ -1648,7 +1885,7 @@ SCUserPreferencesSetInterfacePassword(SCUserPreferencesRef                userPreferences,
                        // "PPP Password" --> keychain "Kind"
                        if (bundle != NULL) {
                                description = CFBundleCopyLocalizedString(bundle,
                        // "PPP Password" --> keychain "Kind"
                        if (bundle != NULL) {
                                description = CFBundleCopyLocalizedString(bundle,
-                                                                         CFSTR("KEYCHAIN_PPP_PASSWORD"),
+                                                                         CFSTR("KEYCHAIN_KIND_PPP_PASSWORD"),
                                                                          CFSTR("PPP Password"),
                                                                          NULL);
                        }
                                                                          CFSTR("PPP Password"),
                                                                          NULL);
                        }
@@ -1656,7 +1893,7 @@ SCUserPreferencesSetInterfacePassword(SCUserPreferencesRef                userPreferences,
                        // store password
                        ok = _SCSecKeychainPasswordItemSet(NULL,
                                                           unique_id,
                        // store password
                        ok = _SCSecKeychainPasswordItemSet(NULL,
                                                           unique_id,
-                                                          (label != NULL)       ? label       : CFSTR("PPP"),
+                                                          (label != NULL)       ? label       : CFSTR("Network Connection"),
                                                           (description != NULL) ? description : CFSTR("PPP Password"),
                                                           account,
                                                           password,
                                                           (description != NULL) ? description : CFSTR("PPP Password"),
                                                           account,
                                                           password,
@@ -1705,7 +1942,7 @@ SCUserPreferencesSetInterfacePassword(SCUserPreferencesRef                userPreferences,
                        // "IPSec Shared Secret" --> keychain "Kind"
                        if (bundle != NULL) {
                                description = CFBundleCopyLocalizedString(bundle,
                        // "IPSec Shared Secret" --> keychain "Kind"
                        if (bundle != NULL) {
                                description = CFBundleCopyLocalizedString(bundle,
-                                                                         CFSTR("KEYCHAIN_IPSEC_SHARED_SECRET"),
+                                                                         CFSTR("KEYCHAIN_KIND_IPSEC_SHARED_SECRET"),
                                                                          CFSTR("IPSec Shared Secret"),
                                                                          NULL);
                        }
                                                                          CFSTR("IPSec Shared Secret"),
                                                                          NULL);
                        }
@@ -1713,7 +1950,7 @@ SCUserPreferencesSetInterfacePassword(SCUserPreferencesRef                userPreferences,
                        // set password
                        ok = _SCSecKeychainPasswordItemSet(NULL,
                                                           shared_id,
                        // set password
                        ok = _SCSecKeychainPasswordItemSet(NULL,
                                                           shared_id,
-                                                          (label != NULL)       ? label       : CFSTR("PPP"),
+                                                          (label != NULL)       ? label       : CFSTR("VPN Connection"),
                                                           (description != NULL) ? description : CFSTR("IPSec Shared Secret"),
                                                           NULL,
                                                           password,
                                                           (description != NULL) ? description : CFSTR("IPSec Shared Secret"),
                                                           NULL,
                                                           password,
@@ -1749,6 +1986,67 @@ SCUserPreferencesSetInterfacePassword(SCUserPreferencesRef               userPreferences,
                        break;
                }
 
                        break;
                }
 
+               case kSCNetworkInterfacePasswordTypeIPSecXAuth : {
+                       CFStringRef     xauth_id;
+
+                       // get configuration
+                       config = SCUserPreferencesCopyInterfaceConfiguration(userPreferences, interface);
+
+                       // get XAuth ID
+                       xauth_id = copyUserXAuthID(config, userPreferences);
+
+                       // User prefs XAuth name --> keychain "Account"
+                       if (config != NULL) {
+                               account = CFDictionaryGetValue(config, kSCPropNetIPSecXAuthName);
+                       }
+
+                       // User prefs "name" --> keychain "Name"
+                       label = SCUserPreferencesCopyName(userPreferences);
+
+                       // "IPSec XAuth Password" --> keychain "Kind"
+                       if (bundle != NULL) {
+                               description = CFBundleCopyLocalizedString(bundle,
+                                                                         CFSTR("KEYCHAIN_KIND_IPSEC_XAUTH_PASSWORD"),
+                                                                         CFSTR("IPSec XAuth Password"),
+                                                                         NULL);
+                       }
+
+                       // store password
+                       ok = _SCSecKeychainPasswordItemSet(NULL,
+                                                          xauth_id,
+                                                          (label != NULL)       ? label       : CFSTR("VPN Connection"),
+                                                          (description != NULL) ? description : CFSTR("IPSec XAuth Password"),
+                                                          account,
+                                                          password,
+                                                          options);
+                       if (ok) {
+                               CFMutableDictionaryRef  newConfig;
+
+                               if (config != NULL) {
+                                       newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
+                               } else {
+                                       newConfig = CFDictionaryCreateMutable(NULL,
+                                                                             0,
+                                                                             &kCFTypeDictionaryKeyCallBacks,
+                                                                             &kCFTypeDictionaryValueCallBacks);
+                               }
+                               CFDictionarySetValue(newConfig,
+                                                    kSCPropNetIPSecXAuthPassword,
+                                                    xauth_id);
+                               CFDictionarySetValue(newConfig,
+                                                    kSCPropNetIPSecXAuthPasswordEncryption,
+                                                    kSCValNetIPSecXAuthPasswordEncryptionKeychain);
+                               ok = SCUserPreferencesSetInterfaceConfiguration(userPreferences, interface, newConfig);
+                               CFRelease(newConfig);
+                       }
+
+                       if (config      != NULL) CFRelease(config);
+                       if (description != NULL) CFRelease(description);
+                       if (label       != NULL) CFRelease(label);
+                       CFRelease(xauth_id);
+                       break;
+               }
+
                default :
                        _SCErrorSet(kSCStatusInvalidArgument);
                        return FALSE;
                default :
                        _SCErrorSet(kSCStatusInvalidArgument);
                        return FALSE;
index 0618c99e7f1b5b738fcbff18a6ee1f46faf0ecb3..fe178739eebab372e85161f4a8b0d2dced316896 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2006, 2008, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #ifndef _SCNETWORKCONNECTIONPRIVATE_H
 #define _SCNETWORKCONNECTIONPRIVATE_H
 
 #ifndef _SCNETWORKCONNECTIONPRIVATE_H
 #define _SCNETWORKCONNECTIONPRIVATE_H
 
-#include <AvailabilityMacros.h>
+#include <Availability.h>
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCNetworkConfigurationPrivate.h>
 
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCNetworkConfigurationPrivate.h>
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-
 
 typedef const struct __SCUserPreferencesRef * SCUserPreferencesRef;
 
 
 typedef const struct __SCUserPreferencesRef * SCUserPreferencesRef;
 
@@ -44,25 +42,103 @@ __BEGIN_DECLS
 
 
 CFArrayRef /* of SCNetworkServiceRef's */
 
 
 CFArrayRef /* of SCNetworkServiceRef's */
-SCNetworkConnectionCopyAvailableServices       (SCNetworkSetRef                set)                    AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCNetworkConnectionCopyAvailableServices       (SCNetworkSetRef                set)                    __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 SCNetworkConnectionRef
 SCNetworkConnectionCreateWithService           (CFAllocatorRef                 allocator,
                                                 SCNetworkServiceRef            service,
                                                 SCNetworkConnectionCallBack    callout,
 
 SCNetworkConnectionRef
 SCNetworkConnectionCreateWithService           (CFAllocatorRef                 allocator,
                                                 SCNetworkServiceRef            service,
                                                 SCNetworkConnectionCallBack    callout,
-                                                SCNetworkConnectionContext     *context)               AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                SCNetworkConnectionContext     *context)               __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 SCNetworkServiceRef
 
 SCNetworkServiceRef
-SCNetworkConnectionGetService                  (SCNetworkConnectionRef         connection)             AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCNetworkConnectionGetService                  (SCNetworkConnectionRef         connection)             __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 CFArrayRef /* of SCUserPreferencesRef's */
 
 CFArrayRef /* of SCUserPreferencesRef's */
-SCNetworkConnectionCopyAllUserPreferences      (SCNetworkConnectionRef         connection)             AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCNetworkConnectionCopyAllUserPreferences      (SCNetworkConnectionRef         connection)             __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 SCUserPreferencesRef
 
 SCUserPreferencesRef
-SCNetworkConnectionCopyCurrentUserPreferences  (SCNetworkConnectionRef         connection)             AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCNetworkConnectionCopyCurrentUserPreferences  (SCNetworkConnectionRef         connection)             __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 SCUserPreferencesRef
 
 SCUserPreferencesRef
-SCNetworkConnectionCreateUserPreferences       (SCNetworkConnectionRef         connection)             AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCNetworkConnectionCreateUserPreferences       (SCNetworkConnectionRef         connection)             __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
+
+
+#pragma mark -
+#pragma mark SCNetworkConnection "VPN on Demand" SPIs
+
+
+/* VPN On Demand
+ *
+ * in the SCDynamicStore we will have :
+ *
+ *   <key>State:/Network/Global/OnDemand</key>
+ *   <dict>
+ *     <key>Triggers</key>
+ *     <array>
+ *       <dict>
+ *         <key>ServiceID</key>
+ *         <string>A740678C-1983-492B-BF64-B825AAE7101E</string>
+ *         <key>Status</key>
+ *         <integer>8</integer>
+ *         <key>RemoteAddress</key>
+ *         <string>vpn.mycompany.com</string>
+ *         <key>OnDemandMatchDomainsAlways</key>
+ *         <array>
+ *           <string>internal.mycompany.com</string>
+ *         </array>
+ *         <key>OnDemandMatchDomainsOnRetry</key>
+ *         <array>
+ *           <string>mycompany.com</string>
+ *         </array>
+ *         <key>kSCNetworkConnectionOnDemandMatchDomainsNever</key>
+ *         <array>
+ *           <string>external.mycompany.com</string>
+ *         </array>
+ *       </dict>
+ *     </array>
+ *   </dict>
+ */
+
+// notify(3) key
+#define kSCNETWORKCONNECTION_ONDEMAND_NOTIFY_KEY               "com.apple.system.SCNetworkConnectionOnDemand"
+
+// a CFArray[CFDictionary] of VPN on Demand "trigger" configurations
+#define kSCNetworkConnectionOnDemandTriggers                   CFSTR("Triggers")
+
+// VPN service ID
+#define kSCNetworkConnectionOnDemandServiceID                  CFSTR("ServiceID")
+
+// VPN service status (idle, connecting, connected, disconnecting)
+#define kSCNetworkConnectionOnDemandStatus                     CFSTR("Status")
+
+// VPN server address
+#define kSCNetworkConnectionOnDemandRemoteAddress              CFSTR("RemoteAddress")
+
+// a CFArray[CFString] representing those domain (or host) names that, if
+// matched to a target hostname, should result in our first establishing
+// the VPN connection before any DNS queries are issued.
+#define kSCNetworkConnectionOnDemandMatchDomainsAlways         CFSTR("OnDemandMatchDomainsAlways")
+
+// a CFArray[CFString] representing those domain (or host) names that, if
+// matched to a target hostname, should result in a DNS query regardless of
+// whether the VPN connection has been established.  If the DNS query returns
+// an [EAI_NONAME] error then we should establish the VPN connection and
+// re-issue / retry the query.
+#define kSCNetworkConnectionOnDemandMatchDomainsOnRetry                CFSTR("OnDemandMatchDomainsOnRetry")
+
+// a CFArray[CFString] representing those domain (or host) names that should
+// be excluded from those that would be used to establish tje VPN connection.
+#define kSCNetworkConnectionOnDemandMatchDomainsNever          CFSTR("OnDemandMatchDomainsNever")
+
+
+__private_extern__
+Boolean
+__SCNetworkConnectionCopyOnDemandInfoWithName  (SCDynamicStoreRef              *storeP,
+                                                CFStringRef                    nodeName,
+                                                Boolean                        onDemandRetry,
+                                                CFStringRef                    *connectionServiceID,
+                                                SCNetworkConnectionStatus      *connectionStatus,
+                                                CFStringRef                    *vpnRemoteAddress)      __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0);
 
 
 #pragma mark -
 
 
 #pragma mark -
@@ -70,58 +146,53 @@ SCNetworkConnectionCreateUserPreferences   (SCNetworkConnectionRef         connection)             A
 
 
 Boolean
 
 
 Boolean
-SCUserPreferencesRemove                                (SCUserPreferencesRef           userPreferences)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCUserPreferencesRemove                                (SCUserPreferencesRef           userPreferences)        __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 Boolean
 
 Boolean
-SCUserPreferencesSetCurrent                    (SCUserPreferencesRef           userPreferences)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCUserPreferencesSetCurrent                    (SCUserPreferencesRef           userPreferences)        __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 CFStringRef
 
 CFStringRef
-SCUserPreferencesCopyName                      (SCUserPreferencesRef           userPreferences)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCUserPreferencesCopyName                      (SCUserPreferencesRef           userPreferences)        __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 CFTypeID
 
 CFTypeID
-SCUserPreferencesGetTypeID                     (void)                                                  AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCUserPreferencesGetTypeID                     (void)                                                  __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 CFStringRef
 
 CFStringRef
-SCUserPreferencesGetUniqueID                   (SCUserPreferencesRef           userPreferences)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCUserPreferencesGetUniqueID                   (SCUserPreferencesRef           userPreferences)        __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 Boolean
 
 Boolean
-SCUserPreferencesIsForced                      (SCUserPreferencesRef           userPreferences)        AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+SCUserPreferencesIsForced                      (SCUserPreferencesRef           userPreferences)        __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 Boolean
 SCUserPreferencesSetName                       (SCUserPreferencesRef           userPreferences,
 
 Boolean
 SCUserPreferencesSetName                       (SCUserPreferencesRef           userPreferences,
-                                                CFStringRef                    newName)                AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
-
-Boolean
-SCNetworkConnectionSelectService               (CFDictionaryRef                selectionOptions,
-                                                SCNetworkServiceRef            *service,
-                                                SCUserPreferencesRef           *userPreferences)       AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                CFStringRef                    newName)                __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 Boolean
 SCNetworkConnectionStartWithUserPreferences    (SCNetworkConnectionRef         connection,
                                                 SCUserPreferencesRef           userPreferences,
 
 Boolean
 SCNetworkConnectionStartWithUserPreferences    (SCNetworkConnectionRef         connection,
                                                 SCUserPreferencesRef           userPreferences,
-                                                Boolean                        linger)                 AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                Boolean                        linger)                 __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 CFDictionaryRef
 SCUserPreferencesCopyInterfaceConfiguration    (SCUserPreferencesRef           userPreferences,
 
 CFDictionaryRef
 SCUserPreferencesCopyInterfaceConfiguration    (SCUserPreferencesRef           userPreferences,
-                                                SCNetworkInterfaceRef          interface)              AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                SCNetworkInterfaceRef          interface)              __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 Boolean
 SCUserPreferencesSetInterfaceConfiguration     (SCUserPreferencesRef           userPreferences,
                                                 SCNetworkInterfaceRef          interface,
 
 Boolean
 SCUserPreferencesSetInterfaceConfiguration     (SCUserPreferencesRef           userPreferences,
                                                 SCNetworkInterfaceRef          interface,
-                                                CFDictionaryRef                newOptions)             AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                CFDictionaryRef                newOptions)             __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 CFDictionaryRef
 SCUserPreferencesCopyExtendedInterfaceConfiguration
                                                (SCUserPreferencesRef           userPreferences,
                                                 SCNetworkInterfaceRef          interface,
 
 CFDictionaryRef
 SCUserPreferencesCopyExtendedInterfaceConfiguration
                                                (SCUserPreferencesRef           userPreferences,
                                                 SCNetworkInterfaceRef          interface,
-                                                CFStringRef                    extendedType)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                CFStringRef                    extendedType)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 Boolean
 SCUserPreferencesSetExtendedInterfaceConfiguration
                                                (SCUserPreferencesRef           userPreferences,
                                                 SCNetworkInterfaceRef          interface,
                                                 CFStringRef                    extendedType,
 
 Boolean
 SCUserPreferencesSetExtendedInterfaceConfiguration
                                                (SCUserPreferencesRef           userPreferences,
                                                 SCNetworkInterfaceRef          interface,
                                                 CFStringRef                    extendedType,
-                                                CFDictionaryRef                newOptions)             AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                CFDictionaryRef                newOptions)             __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 
 #pragma mark -
 
 
 #pragma mark -
@@ -131,27 +202,25 @@ SCUserPreferencesSetExtendedInterfaceConfiguration
 Boolean
 SCUserPreferencesCheckInterfacePassword                (SCUserPreferencesRef           userPreferences,
                                                 SCNetworkInterfaceRef          interface,
 Boolean
 SCUserPreferencesCheckInterfacePassword                (SCUserPreferencesRef           userPreferences,
                                                 SCNetworkInterfaceRef          interface,
-                                                SCNetworkInterfacePasswordType passwordType)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                SCNetworkInterfacePasswordType passwordType)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 CFDataRef
 SCUserPreferencesCopyInterfacePassword         (SCUserPreferencesRef           userPreferences,
                                                 SCNetworkInterfaceRef          interface,
 
 CFDataRef
 SCUserPreferencesCopyInterfacePassword         (SCUserPreferencesRef           userPreferences,
                                                 SCNetworkInterfaceRef          interface,
-                                                SCNetworkInterfacePasswordType passwordType)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                SCNetworkInterfacePasswordType passwordType)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 Boolean
 SCUserPreferencesRemoveInterfacePassword       (SCUserPreferencesRef           userPreferences,
                                                 SCNetworkInterfaceRef          interface,
 
 Boolean
 SCUserPreferencesRemoveInterfacePassword       (SCUserPreferencesRef           userPreferences,
                                                 SCNetworkInterfaceRef          interface,
-                                                SCNetworkInterfacePasswordType passwordType)           AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                SCNetworkInterfacePasswordType passwordType)           __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 Boolean
 SCUserPreferencesSetInterfacePassword          (SCUserPreferencesRef           userPreferences,
                                                 SCNetworkInterfaceRef          interface,
                                                 SCNetworkInterfacePasswordType passwordType,
                                                 CFDataRef                      password,
 
 Boolean
 SCUserPreferencesSetInterfacePassword          (SCUserPreferencesRef           userPreferences,
                                                 SCNetworkInterfaceRef          interface,
                                                 SCNetworkInterfacePasswordType passwordType,
                                                 CFDataRef                      password,
-                                                CFDictionaryRef                options)                AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+                                                CFDictionaryRef                options)                __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 __END_DECLS
 
 
 __END_DECLS
 
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
-
 #endif /* _SCNETWORKCONNECTIONPRIVATE_H */
 #endif /* _SCNETWORKCONNECTIONPRIVATE_H */
index dd834531076681503fd5a3f17676e885753e3383..4424aaa05e6132db43e07eb8c7be122884638004 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  */
 
 
  */
 
 
+#include <Availability.h>
+#include <TargetConditionals.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFRuntime.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include "SCNetworkConfigurationInternal.h"
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFRuntime.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include "SCNetworkConfigurationInternal.h"
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
-#include <SystemConfiguration/BondConfiguration.h>
-#include <SystemConfiguration/VLANConfiguration.h>
 #include "SCPreferencesInternal.h"
 #include "SCHelper_client.h"
 
 #include "SCPreferencesInternal.h"
 #include "SCHelper_client.h"
 
+#if    !TARGET_OS_IPHONE
 #include <EAP8021X/EAPClientProperties.h>
 #include <EAP8021X/EAPClientProperties.h>
+#else  // !TARGET_OS_IPHONE
+#ifndef        kEAPClientPropUserName
+#define kEAPClientPropUserName CFSTR("UserName")
+#endif
+#ifndef        kEAPClientPropUserPasswordKeychainItemID
+#define kEAPClientPropUserPasswordKeychainItemID CFSTR("UserPasswordKeychainItemID")
+#endif
+#endif // !TARGET_OS_IPHONE
 
 #include <IOKit/IOKitLib.h>
 #include <IOKit/IOCFBundle.h>
 
 #include <IOKit/IOKitLib.h>
 #include <IOKit/IOCFBundle.h>
 #include <IOKit/network/IOEthernetInterface.h> // for kIOEthernetInterfaceClass
 #include <IOKit/serial/IOSerialKeys.h>
 #include <IOKit/storage/IOStorageDeviceCharacteristics.h>
 #include <IOKit/network/IOEthernetInterface.h> // for kIOEthernetInterfaceClass
 #include <IOKit/serial/IOSerialKeys.h>
 #include <IOKit/storage/IOStorageDeviceCharacteristics.h>
+#include <IOKit/usb/USB.h>
+
 #include "dy_framework.h"
 
 #ifndef        kIODeviceSupportsHoldKey
 #define        kIODeviceSupportsHoldKey        "V92Modem"
 #endif
 
 #include "dy_framework.h"
 
 #ifndef        kIODeviceSupportsHoldKey
 #define        kIODeviceSupportsHoldKey        "V92Modem"
 #endif
 
+#ifndef        kUSBProductString
+#define kUSBProductString              "USB Product Name"
+#endif
+
 #include <string.h>
 #include <mach/mach.h>
 #include <net/if.h>
 #include <string.h>
 #include <mach/mach.h>
 #include <net/if.h>
 #include <NSSystemDirectories.h>
 
 
 #include <NSSystemDirectories.h>
 
 
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1040
-#error MAC_OS_X_VERSION_MIN_REQUIRED < 1040, Check MACOSX_DEPLOYMENT_TARGET
-#endif
-
-
 static CFStringRef     copy_interface_string                   (CFBundleRef bundle, CFStringRef key, Boolean localized);
 static CFStringRef     __SCNetworkInterfaceCopyDescription     (CFTypeRef cf);
 static void            __SCNetworkInterfaceDeallocate          (CFTypeRef cf);
 static CFStringRef     copy_interface_string                   (CFBundleRef bundle, CFStringRef key, Boolean localized);
 static CFStringRef     __SCNetworkInterfaceCopyDescription     (CFTypeRef cf);
 static void            __SCNetworkInterfaceDeallocate          (CFTypeRef cf);
@@ -94,30 +104,41 @@ enum {
        kSortIrDA,
        kSortSerialPort,
        kSortWWAN,
        kSortIrDA,
        kSortSerialPort,
        kSortWWAN,
+       kSortEthernetPPP,
+       kSortAirportPPP,
        kSortEthernet,
        kSortFireWire,
        kSortAirPort,
        kSortOtherWireless,
        kSortEthernet,
        kSortFireWire,
        kSortAirPort,
        kSortOtherWireless,
+       kSortTethered,
+       kSortWWANEthernet,
        kSortBluetoothPAN,
        kSortBluetoothPAN,
+#if    !TARGET_OS_IPHONE
        kSortBond,
        kSortVLAN,
        kSortBond,
        kSortVLAN,
+#endif // !TARGET_OS_IPHONE
        kSortUnknown
 };
 
 
 const CFStringRef kSCNetworkInterfaceType6to4          = CFSTR("6to4");
 const CFStringRef kSCNetworkInterfaceTypeBluetooth     = CFSTR("Bluetooth");
        kSortUnknown
 };
 
 
 const CFStringRef kSCNetworkInterfaceType6to4          = CFSTR("6to4");
 const CFStringRef kSCNetworkInterfaceTypeBluetooth     = CFSTR("Bluetooth");
+#if    !TARGET_OS_IPHONE
 const CFStringRef kSCNetworkInterfaceTypeBond          = CFSTR("Bond");
 const CFStringRef kSCNetworkInterfaceTypeBond          = CFSTR("Bond");
+#endif // !TARGET_OS_IPHONE
 const CFStringRef kSCNetworkInterfaceTypeEthernet      = CFSTR("Ethernet");
 const CFStringRef kSCNetworkInterfaceTypeFireWire      = CFSTR("FireWire");
 const CFStringRef kSCNetworkInterfaceTypeIEEE80211     = CFSTR("IEEE80211");   // IEEE 802.11, AirPort
 const CFStringRef kSCNetworkInterfaceTypeEthernet      = CFSTR("Ethernet");
 const CFStringRef kSCNetworkInterfaceTypeFireWire      = CFSTR("FireWire");
 const CFStringRef kSCNetworkInterfaceTypeIEEE80211     = CFSTR("IEEE80211");   // IEEE 802.11, AirPort
+const CFStringRef kSCNetworkInterfaceTypeIPSec         = CFSTR("IPSec");
 const CFStringRef kSCNetworkInterfaceTypeIrDA          = CFSTR("IrDA");
 const CFStringRef kSCNetworkInterfaceTypeL2TP          = CFSTR("L2TP");
 const CFStringRef kSCNetworkInterfaceTypeModem         = CFSTR("Modem");
 const CFStringRef kSCNetworkInterfaceTypePPP           = CFSTR("PPP");
 const CFStringRef kSCNetworkInterfaceTypePPTP          = CFSTR("PPTP");
 const CFStringRef kSCNetworkInterfaceTypeSerial                = CFSTR("Serial");
 const CFStringRef kSCNetworkInterfaceTypeIrDA          = CFSTR("IrDA");
 const CFStringRef kSCNetworkInterfaceTypeL2TP          = CFSTR("L2TP");
 const CFStringRef kSCNetworkInterfaceTypeModem         = CFSTR("Modem");
 const CFStringRef kSCNetworkInterfaceTypePPP           = CFSTR("PPP");
 const CFStringRef kSCNetworkInterfaceTypePPTP          = CFSTR("PPTP");
 const CFStringRef kSCNetworkInterfaceTypeSerial                = CFSTR("Serial");
+#if    !TARGET_OS_IPHONE
 const CFStringRef kSCNetworkInterfaceTypeVLAN          = CFSTR("VLAN");
 const CFStringRef kSCNetworkInterfaceTypeVLAN          = CFSTR("VLAN");
+#endif // !TARGET_OS_IPHONE
 const CFStringRef kSCNetworkInterfaceTypeWWAN          = CFSTR("WWAN");
 
 const CFStringRef kSCNetworkInterfaceTypeIPv4          = CFSTR("IPv4");
 const CFStringRef kSCNetworkInterfaceTypeWWAN          = CFSTR("WWAN");
 
 const CFStringRef kSCNetworkInterfaceTypeIPv4          = CFSTR("IPv4");
@@ -135,6 +156,7 @@ static SCNetworkInterfacePrivate __kSCNetworkInterfaceIPv4      = {
        NULL,                                   // serviceID
        NULL,                                   // unsaved
        NULL,                                   // entity_device
        NULL,                                   // serviceID
        NULL,                                   // unsaved
        NULL,                                   // entity_device
+       NULL,                                   // entity_device_unique
        NULL,                                   // entity_type
        NULL,                                   // entity_subtype
        NULL,                                   // supported_interface_types
        NULL,                                   // entity_type
        NULL,                                   // entity_subtype
        NULL,                                   // supported_interface_types
@@ -142,17 +164,20 @@ static SCNetworkInterfacePrivate __kSCNetworkInterfaceIPv4      = {
        NULL,                                   // address
        NULL,                                   // addressString
        FALSE,                                  // builtin
        NULL,                                   // address
        NULL,                                   // addressString
        FALSE,                                  // builtin
+       NULL,                                   // configurationAction
        NULL,                                   // location
        NULL,                                   // path
        NULL,                                   // overrides
        FALSE,                                  // modemIsV92
        NULL,                                   // location
        NULL,                                   // path
        NULL,                                   // overrides
        FALSE,                                  // modemIsV92
-       FALSE,                                  // supportsBond
-       FALSE,                                  // supportsVLAN
        NULL,                                   // type
        NULL,                                   // unit
        kSortUnknown,                           // sort_order
        NULL,                                   // type
        NULL,                                   // unit
        kSortUnknown,                           // sort_order
+#if    !TARGET_OS_IPHONE
+       FALSE,                                  // supportsBond
        { NULL, NULL},                          // bond { interfaces, options }
        { NULL, NULL},                          // bond { interfaces, options }
+       FALSE,                                  // supportsVLAN
        { NULL, NULL, NULL }                    // vlan { interface, tag, options }
        { NULL, NULL, NULL }                    // vlan { interface, tag, options }
+#endif // !TARGET_OS_IPHONE
 };
 
 const SCNetworkInterfaceRef kSCNetworkInterfaceIPv4     = (SCNetworkInterfaceRef)&__kSCNetworkInterfaceIPv4;
 };
 
 const SCNetworkInterfaceRef kSCNetworkInterfaceIPv4     = (SCNetworkInterfaceRef)&__kSCNetworkInterfaceIPv4;
@@ -166,13 +191,23 @@ const SCNetworkInterfaceRef kSCNetworkInterfaceIPv4     = (SCNetworkInterfaceRef
 #define doL2TP         1<<1
 #define doPPP          1<<2
 #define doPPTP         1<<3
 #define doL2TP         1<<1
 #define doPPP          1<<2
 #define doPPTP         1<<3
+#define doIPSec                1<<4
+#define doOverIP       do6to4|doL2TP|doPPTP|doIPSec
 
 
+#if    !TARGET_OS_IPHONE
 #define doAppleTalk     1<<0
 #define doAppleTalk     1<<0
+#else  // !TARGET_OS_IPHONE
+#define doAppleTalk     0
+#endif // !TARGET_OS_IPHONE
 #define doDNS          1<<1
 #define doIPv4         1<<2
 #define doIPv6         1<<3
 #define doProxies       1<<4
 #define doDNS          1<<1
 #define doIPv4         1<<2
 #define doIPv6         1<<3
 #define doProxies       1<<4
+#if    !TARGET_OS_IPHONE
 #define doSMB          1<<5
 #define doSMB          1<<5
+#else  // !TARGET_OS_IPHONE
+#define doSMB          0
+#endif // !TARGET_OS_IPHONE
 
 static const struct {
        const CFStringRef       *interface_type;
 
 static const struct {
        const CFStringRef       *interface_type;
@@ -182,24 +217,29 @@ static const struct {
        const CFStringRef       *ppp_subtype;
        uint32_t                supported_protocols;
 } configurations[] = {
        const CFStringRef       *ppp_subtype;
        uint32_t                supported_protocols;
 } configurations[] = {
-       // interface type                         entity_hardware    if config? interface types         PPP sub-type                            interface protocols
-       // =====================================  =================  ========== ======================= ======================================= =========================================
-       { &kSCNetworkInterfaceType6to4          , &kSCEntNet6to4    , FALSE,    doNone,                 NULL,                                   doIPv6                                          },
-       { &kSCNetworkInterfaceTypeBluetooth     , &kSCEntNetModem   , FALSE,    doPPP,                  &kSCValNetInterfaceSubTypePPPSerial,    doNone                                          },
-       { &kSCNetworkInterfaceTypeBond          , &kSCEntNetEthernet, TRUE ,    doNone,                 NULL,                                   doAppleTalk|doDNS|doIPv4|doIPv6|doProxies|doSMB },
-       { &kSCNetworkInterfaceTypeEthernet      , &kSCEntNetEthernet, TRUE ,    doPPP,                  &kSCValNetInterfaceSubTypePPPoE,        doAppleTalk|doDNS|doIPv4|doIPv6|doProxies|doSMB },
-       { &kSCNetworkInterfaceTypeFireWire      , &kSCEntNetFireWire, TRUE ,    doNone,                 NULL,                                   doDNS|doIPv4|doIPv6|doProxies|doSMB             },
-       { &kSCNetworkInterfaceTypeIEEE80211     , &kSCEntNetAirPort , TRUE ,    doPPP,                  &kSCValNetInterfaceSubTypePPPoE,        doAppleTalk|doDNS|doIPv4|doIPv6|doProxies|doSMB },
-       { &kSCNetworkInterfaceTypeIrDA          , &kSCEntNetModem   , FALSE,    doPPP,                  &kSCValNetInterfaceSubTypePPPSerial,    doNone                                          },
-       { &kSCNetworkInterfaceTypeL2TP          , NULL              , FALSE,    doPPP,                  &kSCValNetInterfaceSubTypeL2TP,         doNone                                          },
-       { &kSCNetworkInterfaceTypeModem         , &kSCEntNetModem   , FALSE,    doPPP,                  &kSCValNetInterfaceSubTypePPPSerial,    doNone                                          },
-       { &kSCNetworkInterfaceTypePPP           , &kSCEntNetPPP     , FALSE,    doNone,                 NULL,                                   doDNS|doIPv4|doIPv6|doProxies|doSMB             },
-       { &kSCNetworkInterfaceTypePPTP          , NULL              , FALSE,    doPPP,                  &kSCValNetInterfaceSubTypePPTP,         doNone                                          },
-       { &kSCNetworkInterfaceTypeSerial        , &kSCEntNetModem   , FALSE,    doPPP,                  &kSCValNetInterfaceSubTypePPPSerial,    doNone                                          },
-       { &kSCNetworkInterfaceTypeVLAN          , &kSCEntNetEthernet, TRUE ,    doNone,                 NULL,                                   doAppleTalk|doDNS|doIPv4|doIPv6|doProxies|doSMB },
-       { &kSCNetworkInterfaceTypeWWAN          , &kSCEntNetModem   , FALSE,    doPPP,                  &kSCValNetInterfaceSubTypePPPSerial,    doNone                                          },
-       // =====================================  =================  ========== ======================= ======================================= =========================================
-       { &kSCNetworkInterfaceTypeIPv4          , NULL              , FALSE,    do6to4|doL2TP|doPPTP,   NULL,                                   doNone                                          }
+       // interface type                         entity_hardware    if config? interface types PPP sub-type                            interface protocols
+       // =====================================  =================  ========== =============== ======================================= =========================================
+       { &kSCNetworkInterfaceType6to4          , &kSCEntNet6to4    , FALSE,    doNone,         NULL,                                   doIPv6                                          },
+       { &kSCNetworkInterfaceTypeBluetooth     , &kSCEntNetModem   , FALSE,    doPPP,          &kSCValNetInterfaceSubTypePPPSerial,    doNone                                          },
+#if    !TARGET_OS_IPHONE
+       { &kSCNetworkInterfaceTypeBond          , &kSCEntNetEthernet, TRUE ,    doNone,         NULL,                                   doAppleTalk|doDNS|doIPv4|doIPv6|doProxies|doSMB },
+#endif // !TARGET_OS_IPHONE
+       { &kSCNetworkInterfaceTypeEthernet      , &kSCEntNetEthernet, TRUE ,    doPPP,          &kSCValNetInterfaceSubTypePPPoE,        doAppleTalk|doDNS|doIPv4|doIPv6|doProxies|doSMB },
+       { &kSCNetworkInterfaceTypeFireWire      , &kSCEntNetFireWire, TRUE ,    doNone,         NULL,                                   doDNS|doIPv4|doIPv6|doProxies|doSMB             },
+       { &kSCNetworkInterfaceTypeIEEE80211     , &kSCEntNetAirPort , TRUE ,    doPPP,          &kSCValNetInterfaceSubTypePPPoE,        doAppleTalk|doDNS|doIPv4|doIPv6|doProxies|doSMB },
+       { &kSCNetworkInterfaceTypeIPSec         , &kSCEntNetIPSec   , FALSE,    doNone,         NULL,                                   doDNS|doIPv4|doIPv6|doProxies|doSMB             },
+       { &kSCNetworkInterfaceTypeIrDA          , &kSCEntNetModem   , FALSE,    doPPP,          &kSCValNetInterfaceSubTypePPPSerial,    doNone                                          },
+       { &kSCNetworkInterfaceTypeL2TP          , NULL              , FALSE,    doPPP,          &kSCValNetInterfaceSubTypeL2TP,         doNone                                          },
+       { &kSCNetworkInterfaceTypeModem         , &kSCEntNetModem   , FALSE,    doPPP,          &kSCValNetInterfaceSubTypePPPSerial,    doNone                                          },
+       { &kSCNetworkInterfaceTypePPP           , &kSCEntNetPPP     , FALSE,    doNone,         NULL,                                   doDNS|doIPv4|doIPv6|doProxies|doSMB             },
+       { &kSCNetworkInterfaceTypePPTP          , NULL              , FALSE,    doPPP,          &kSCValNetInterfaceSubTypePPTP,         doNone                                          },
+       { &kSCNetworkInterfaceTypeSerial        , &kSCEntNetModem   , FALSE,    doPPP,          &kSCValNetInterfaceSubTypePPPSerial,    doNone                                          },
+#if    !TARGET_OS_IPHONE
+       { &kSCNetworkInterfaceTypeVLAN          , &kSCEntNetEthernet, TRUE ,    doNone,         NULL,                                   doAppleTalk|doDNS|doIPv4|doIPv6|doProxies|doSMB },
+#endif // !TARGET_OS_IPHONE
+       { &kSCNetworkInterfaceTypeWWAN          , &kSCEntNetModem   , FALSE,    doPPP,          &kSCValNetInterfaceSubTypePPPSerial,    doNone                                          },
+       // =====================================  =================  ========== =============== ======================================= =========================================
+       { &kSCNetworkInterfaceTypeIPv4          , NULL              , FALSE,    doOverIP,       NULL,                                   doNone                                          }
 };
 
 
 };
 
 
@@ -241,6 +281,9 @@ __SCNetworkInterfaceCopyDescription(CFTypeRef cf)
        CFStringAppendFormat(result, NULL, CFSTR("<SCNetworkInterface %p [%p]> {"), cf, allocator);
        CFStringAppendFormat(result, NULL, CFSTR("type = %@"), interfacePrivate->interface_type);
        CFStringAppendFormat(result, NULL, CFSTR(", entity_device = %@"), interfacePrivate->entity_device);
        CFStringAppendFormat(result, NULL, CFSTR("<SCNetworkInterface %p [%p]> {"), cf, allocator);
        CFStringAppendFormat(result, NULL, CFSTR("type = %@"), interfacePrivate->interface_type);
        CFStringAppendFormat(result, NULL, CFSTR(", entity_device = %@"), interfacePrivate->entity_device);
+       if (interfacePrivate->entity_device_unique != NULL) {
+               CFStringAppendFormat(result, NULL, CFSTR("+%@"), interfacePrivate->entity_device_unique);
+       }
        CFStringAppendFormat(result, NULL, CFSTR(", entity_type = %@"), interfacePrivate->entity_type);
        if (interfacePrivate->entity_subtype != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(" / %@"), interfacePrivate->entity_subtype);
        CFStringAppendFormat(result, NULL, CFSTR(", entity_type = %@"), interfacePrivate->entity_type);
        if (interfacePrivate->entity_subtype != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(" / %@"), interfacePrivate->entity_subtype);
@@ -290,6 +333,9 @@ __SCNetworkInterfaceCopyDescription(CFTypeRef cf)
        if (interfacePrivate->path != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(", path = %@"), interfacePrivate->path);
        }
        if (interfacePrivate->path != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(", path = %@"), interfacePrivate->path);
        }
+       if (interfacePrivate->configurationAction != NULL) {
+               CFStringAppendFormat(result, NULL, CFSTR(", action = %@"), interfacePrivate->configurationAction);
+       }
        if (interfacePrivate->overrides != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(", overrides = %p"), interfacePrivate->overrides);
        }
        if (interfacePrivate->overrides != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(", overrides = %p"), interfacePrivate->overrides);
        }
@@ -306,6 +352,7 @@ __SCNetworkInterfaceCopyDescription(CFTypeRef cf)
        if (interfacePrivate->unsaved != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(", unsaved = %@"), interfacePrivate->unsaved);
        }
        if (interfacePrivate->unsaved != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(", unsaved = %@"), interfacePrivate->unsaved);
        }
+#if    !TARGET_OS_IPHONE
        if (interfacePrivate->bond.interfaces != NULL) {
                CFIndex i;
                CFIndex n;
        if (interfacePrivate->bond.interfaces != NULL) {
                CFIndex i;
                CFIndex n;
@@ -341,6 +388,7 @@ __SCNetworkInterfaceCopyDescription(CFTypeRef cf)
        if (interfacePrivate->vlan.options != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(", options = %@"), interfacePrivate->vlan.options);
        }
        if (interfacePrivate->vlan.options != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(", options = %@"), interfacePrivate->vlan.options);
        }
+#endif // !TARGET_OS_IPHONE
        CFStringAppendFormat(result, NULL, CFSTR("}"));
 
        return result;
        CFStringAppendFormat(result, NULL, CFSTR("}"));
 
        return result;
@@ -381,6 +429,9 @@ __SCNetworkInterfaceDeallocate(CFTypeRef cf)
        if (interfacePrivate->entity_device != NULL)
                CFRelease(interfacePrivate->entity_device);
 
        if (interfacePrivate->entity_device != NULL)
                CFRelease(interfacePrivate->entity_device);
 
+       if (interfacePrivate->entity_device_unique != NULL)
+               CFRelease(interfacePrivate->entity_device_unique);
+
        if (interfacePrivate->supported_interface_types != NULL)
                CFRelease(interfacePrivate->supported_interface_types);
 
        if (interfacePrivate->supported_interface_types != NULL)
                CFRelease(interfacePrivate->supported_interface_types);
 
@@ -399,6 +450,9 @@ __SCNetworkInterfaceDeallocate(CFTypeRef cf)
        if (interfacePrivate->path != NULL)
                CFRelease(interfacePrivate->path);
 
        if (interfacePrivate->path != NULL)
                CFRelease(interfacePrivate->path);
 
+       if (interfacePrivate->configurationAction != NULL)
+               CFRelease(interfacePrivate->configurationAction);
+
        if (interfacePrivate->overrides != NULL)
                CFRelease(interfacePrivate->overrides);
 
        if (interfacePrivate->overrides != NULL)
                CFRelease(interfacePrivate->overrides);
 
@@ -408,6 +462,7 @@ __SCNetworkInterfaceDeallocate(CFTypeRef cf)
        if (interfacePrivate->unit != NULL)
                CFRelease(interfacePrivate->unit);
 
        if (interfacePrivate->unit != NULL)
                CFRelease(interfacePrivate->unit);
 
+#if    !TARGET_OS_IPHONE
        if (interfacePrivate->bond.interfaces != NULL)
                CFRelease(interfacePrivate->bond.interfaces);
 
        if (interfacePrivate->bond.interfaces != NULL)
                CFRelease(interfacePrivate->bond.interfaces);
 
@@ -425,6 +480,7 @@ __SCNetworkInterfaceDeallocate(CFTypeRef cf)
 
        if (interfacePrivate->vlan.options != NULL)
                CFRelease(interfacePrivate->vlan.options);
 
        if (interfacePrivate->vlan.options != NULL)
                CFRelease(interfacePrivate->vlan.options);
+#endif // !TARGET_OS_IPHONE
 
        return;
 }
 
        return;
 }
@@ -447,6 +503,11 @@ __SCNetworkInterfaceEqual(CFTypeRef cf1, CFTypeRef cf2)
                return FALSE; // if not the same device
        }
 
                return FALSE; // if not the same device
        }
 
+       if (!_SC_CFEqual(if1->entity_device_unique, if2->entity_device_unique)) {
+               return FALSE; // if not the same device unique identifier
+       }
+
+#if    !TARGET_OS_IPHONE
        if (CFEqual(if1->interface_type, kSCNetworkInterfaceTypeBond)) {
                if (!_SC_CFEqual(if1->bond.interfaces, if2->bond.interfaces)) {
                        return FALSE; // if not the same interfaces
        if (CFEqual(if1->interface_type, kSCNetworkInterfaceTypeBond)) {
                if (!_SC_CFEqual(if1->bond.interfaces, if2->bond.interfaces)) {
                        return FALSE; // if not the same interfaces
@@ -464,8 +525,9 @@ __SCNetworkInterfaceEqual(CFTypeRef cf1, CFTypeRef cf2)
                        return FALSE;   // if not the same tag
                }
        }
                        return FALSE;   // if not the same tag
                }
        }
+#endif // !TARGET_OS_IPHONE
 
 
-       if (!CFEqual(if1->interface, if2->interface)) {
+       if (!_SC_CFEqual(if1->interface, if2->interface)) {
                return FALSE;   // if not the same layering
        }
 
                return FALSE;   // if not the same layering
        }
 
@@ -476,13 +538,24 @@ __SCNetworkInterfaceEqual(CFTypeRef cf1, CFTypeRef cf2)
 static CFHashCode
 __SCNetworkInterfaceHash(CFTypeRef cf)
 {
 static CFHashCode
 __SCNetworkInterfaceHash(CFTypeRef cf)
 {
+       CFHashCode                      hash                    = 0;
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)cf;
 
        if (interfacePrivate->entity_device != NULL) {
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)cf;
 
        if (interfacePrivate->entity_device != NULL) {
-               return CFHash(interfacePrivate->entity_device);
+               if (interfacePrivate->entity_device_unique == NULL) {
+                       hash = CFHash(interfacePrivate->entity_device);
+               } else {
+                       CFStringRef     str;
+
+                       str = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@+%@"),
+                                                      interfacePrivate->entity_device,
+                                                      interfacePrivate->entity_device_unique);
+                       hash = CFHash(str);
+                       CFRelease(str);
+               }
        }
 
        }
 
-       return 0;
+       return hash;
 }
 
 
 }
 
 
@@ -549,6 +622,7 @@ __SCNetworkInterfaceCreatePrivate(CFAllocatorRef    allocator,
        interfacePrivate->serviceID                     = (serviceID != NULL) ? CFRetain(serviceID) : NULL;
        interfacePrivate->unsaved                       = NULL;
        interfacePrivate->entity_device                 = NULL;
        interfacePrivate->serviceID                     = (serviceID != NULL) ? CFRetain(serviceID) : NULL;
        interfacePrivate->unsaved                       = NULL;
        interfacePrivate->entity_device                 = NULL;
+       interfacePrivate->entity_device_unique          = NULL;
        interfacePrivate->entity_type                   = NULL;
        interfacePrivate->entity_subtype                = NULL;
        interfacePrivate->supported_interface_types     = NULL;
        interfacePrivate->entity_type                   = NULL;
        interfacePrivate->entity_subtype                = NULL;
        interfacePrivate->supported_interface_types     = NULL;
@@ -556,27 +630,31 @@ __SCNetworkInterfaceCreatePrivate(CFAllocatorRef  allocator,
        interfacePrivate->address                       = NULL;
        interfacePrivate->addressString                 = NULL;
        interfacePrivate->builtin                       = FALSE;
        interfacePrivate->address                       = NULL;
        interfacePrivate->addressString                 = NULL;
        interfacePrivate->builtin                       = FALSE;
+       interfacePrivate->configurationAction           = NULL;
        interfacePrivate->path                          = (path != NULL) ? CFStringCreateWithCString(NULL, path, kCFStringEncodingUTF8)
                                                                         : NULL;
        interfacePrivate->location                      = NULL;
        interfacePrivate->overrides                     = NULL;
        interfacePrivate->modemIsV92                    = FALSE;
        interfacePrivate->path                          = (path != NULL) ? CFStringCreateWithCString(NULL, path, kCFStringEncodingUTF8)
                                                                         : NULL;
        interfacePrivate->location                      = NULL;
        interfacePrivate->overrides                     = NULL;
        interfacePrivate->modemIsV92                    = FALSE;
-       interfacePrivate->supportsBond                  = FALSE;
-       interfacePrivate->supportsVLAN                  = FALSE;
        interfacePrivate->type                          = NULL;
        interfacePrivate->unit                          = NULL;
        interfacePrivate->sort_order                    = kSortUnknown;
        interfacePrivate->type                          = NULL;
        interfacePrivate->unit                          = NULL;
        interfacePrivate->sort_order                    = kSortUnknown;
+#if    !TARGET_OS_IPHONE
+       interfacePrivate->supportsBond                  = FALSE;
        interfacePrivate->bond.interfaces               = NULL;
        interfacePrivate->bond.mode                     = NULL;
        interfacePrivate->bond.options                  = NULL;
        interfacePrivate->bond.interfaces               = NULL;
        interfacePrivate->bond.mode                     = NULL;
        interfacePrivate->bond.options                  = NULL;
+       interfacePrivate->supportsVLAN                  = FALSE;
        interfacePrivate->vlan.interface                = NULL;
        interfacePrivate->vlan.tag                      = NULL;
        interfacePrivate->vlan.options                  = NULL;
        interfacePrivate->vlan.interface                = NULL;
        interfacePrivate->vlan.tag                      = NULL;
        interfacePrivate->vlan.options                  = NULL;
+#endif // !TARGET_OS_IPHONE
 
        return interfacePrivate;
 }
 
 
 
        return interfacePrivate;
 }
 
 
+#if    !TARGET_OS_IPHONE
 __private_extern__
 Boolean
 __SCNetworkInterfaceSupportsVLAN(CFStringRef bsd_if)
 __private_extern__
 Boolean
 __SCNetworkInterfaceSupportsVLAN(CFStringRef bsd_if)
@@ -654,7 +732,7 @@ _SCBondInterfaceCreatePrivate(CFAllocatorRef        allocator,
        }
 
        interfacePrivate->interface_type        = kSCNetworkInterfaceTypeBond;
        }
 
        interfacePrivate->interface_type        = kSCNetworkInterfaceTypeBond;
-       interfacePrivate->entity_type           = kSCEntNetEthernet;
+       interfacePrivate->entity_type           = kSCValNetInterfaceTypeEthernet;
        interfacePrivate->entity_device         = CFStringCreateCopy(allocator, bond_if);
        interfacePrivate->builtin               = TRUE;
        interfacePrivate->supportsVLAN          = __SCNetworkInterfaceSupportsVLAN(bond_if);
        interfacePrivate->entity_device         = CFStringCreateCopy(allocator, bond_if);
        interfacePrivate->builtin               = TRUE;
        interfacePrivate->supportsVLAN          = __SCNetworkInterfaceSupportsVLAN(bond_if);
@@ -684,7 +762,7 @@ _SCVLANInterfaceCreatePrivate(CFAllocatorRef                allocator,
        }
 
        interfacePrivate->interface_type        = kSCNetworkInterfaceTypeVLAN;
        }
 
        interfacePrivate->interface_type        = kSCNetworkInterfaceTypeVLAN;
-       interfacePrivate->entity_type           = kSCEntNetEthernet;
+       interfacePrivate->entity_type           = kSCValNetInterfaceTypeEthernet;
        interfacePrivate->entity_device         = CFStringCreateCopy(allocator, vlan_if);
        interfacePrivate->builtin               = TRUE;
        interfacePrivate->sort_order            = kSortVLAN;
        interfacePrivate->entity_device         = CFStringCreateCopy(allocator, vlan_if);
        interfacePrivate->builtin               = TRUE;
        interfacePrivate->sort_order            = kSortVLAN;
@@ -698,6 +776,7 @@ _SCVLANInterfaceCreatePrivate(CFAllocatorRef                allocator,
 
        return interfacePrivate;
 }
 
        return interfacePrivate;
 }
+#endif // !TARGET_OS_IPHONE
 
 
 #pragma mark -
 
 
 #pragma mark -
@@ -851,9 +930,20 @@ _SCNetworkInterfaceCompare(const void *val1, const void *val2, void *context)
                }
        }
 
                }
        }
 
-       /* ... and lastly, sort by BSD interface name */
+       /* ... and, then sort by BSD interface name */
        if ((dev1->entity_device != NULL) && (dev2->entity_device != NULL)) {
                res = CFStringCompare(dev1->entity_device, dev2->entity_device, 0);
        if ((dev1->entity_device != NULL) && (dev2->entity_device != NULL)) {
                res = CFStringCompare(dev1->entity_device, dev2->entity_device, 0);
+               if (res != kCFCompareEqualTo) {
+                       return (res);
+               }
+       }
+
+       /* ... and lastly, sort by BSD interface unique identifier */
+       if ((dev1->entity_device_unique != NULL) && (dev2->entity_device_unique != NULL)) {
+               res = CFStringCompare(dev1->entity_device_unique, dev2->entity_device_unique, 0);
+//             if (res != kCFCompareEqualTo) {
+//                     return (res);
+//             }
        }
 
        return res;
        }
 
        return res;
@@ -920,7 +1010,7 @@ IOStringValueHasPrefix(CFTypeRef ioVal, CFStringRef prefix)
 {
        Boolean         match           = FALSE;
        CFIndex         prefixLen       = CFStringGetLength(prefix);
 {
        Boolean         match           = FALSE;
        CFIndex         prefixLen       = CFStringGetLength(prefix);
-       CFStringRef     str             = ioVal;
+       CFStringRef     str             = NULL;
 
        if (!isA_CFString(ioVal)) {
                if (isA_CFData(ioVal)) {
 
        if (!isA_CFString(ioVal)) {
                if (isA_CFData(ioVal)) {
@@ -928,21 +1018,22 @@ IOStringValueHasPrefix(CFTypeRef ioVal, CFStringRef prefix)
                                                              (const char *)CFDataGetBytePtr(ioVal),
                                                              kCFStringEncodingUTF8,
                                                              kCFAllocatorNull);
                                                              (const char *)CFDataGetBytePtr(ioVal),
                                                              kCFStringEncodingUTF8,
                                                              kCFAllocatorNull);
+                       ioVal = str;
                } else {
                        return FALSE;
                }
        }
 
                } else {
                        return FALSE;
                }
        }
 
-       if ((str != NULL) &&
-           (CFStringGetLength(str) >= prefixLen) &&
-           (CFStringCompareWithOptions(str,
+       if ((ioVal != NULL) &&
+           (CFStringGetLength(ioVal) >= prefixLen) &&
+           (CFStringCompareWithOptions(ioVal,
                                        prefix,
                                        CFRangeMake(0, prefixLen),
                                        kCFCompareCaseInsensitive) == kCFCompareEqualTo)) {
                match = TRUE;
        }
 
                                        prefix,
                                        CFRangeMake(0, prefixLen),
                                        kCFCompareCaseInsensitive) == kCFCompareEqualTo)) {
                match = TRUE;
        }
 
-       if (str != ioVal)       CFRelease(str);
+       if (str != NULL) CFRelease(str);
        return match;
 }
 
        return match;
 }
 
@@ -1126,6 +1217,7 @@ pci_port(CFTypeRef slot_name, CFStringRef bsdName)
                                                   &child_iterator);
                if (kr != kIOReturnSuccess) {
                        SCLog(TRUE, LOG_DEBUG, CFSTR("pci_port IORegistryEntryCreateIterator() failed, kr = 0x%x"), kr);
                                                   &child_iterator);
                if (kr != kIOReturnSuccess) {
                        SCLog(TRUE, LOG_DEBUG, CFSTR("pci_port IORegistryEntryCreateIterator() failed, kr = 0x%x"), kr);
+                       CFRelease(port_names);
                        return MACH_PORT_NULL;
                }
 
                        return MACH_PORT_NULL;
                }
 
@@ -1208,6 +1300,51 @@ isBuiltin(io_registry_entry_t interface)
 }
 
 
 }
 
 
+static Boolean
+isBluetoothBuiltin(Boolean *haveController)
+{
+       Boolean         builtin         = FALSE;
+       io_object_t     hciController;
+       io_iterator_t   iter            = MACH_PORT_NULL;
+       kern_return_t   kr;
+
+       kr = IOServiceGetMatchingServices(masterPort,
+                                         IOServiceMatching("IOBluetoothHCIController"),
+                                         &iter);
+       if ((kr != kIOReturnSuccess) || (iter == MACH_PORT_NULL)) {
+               if (kr != kIOReturnSuccess) {
+                       SCLog(TRUE, LOG_DEBUG, CFSTR("isBluetoothBuiltin IOServiceGetMatchingServices() failed, kr = 0x%x"), kr);
+               }
+               *haveController = FALSE;
+               return FALSE;
+       }
+       *haveController = TRUE;
+
+       hciController = IOIteratorNext(iter);
+       IOObjectRelease(iter);
+       if(hciController != MACH_PORT_NULL) {
+               CFNumberRef     idVendor;
+
+               idVendor = IORegistryEntryCreateCFProperty(hciController, CFSTR(kUSBVendorID), NULL, 0);
+               if (idVendor != NULL) {
+                       int     idVendorVal;
+
+                       if (isA_CFNumber(idVendor) &&
+                           CFNumberGetValue(idVendor, kCFNumberIntType, &idVendorVal) &&
+                           (idVendorVal == kIOUSBVendorIDAppleComputer)) {
+                               builtin = TRUE;
+                       }
+
+                       CFRelease(idVendor);
+               }
+
+               IOObjectRelease(hciController);
+       }
+
+       return builtin;
+}
+
+
 #pragma mark -
 #pragma mark Interface enumeration
 
 #pragma mark -
 #pragma mark Interface enumeration
 
@@ -1230,12 +1367,12 @@ processNetworkInterface(SCNetworkInterfacePrivateRef    interfacePrivate,
                        io_registry_entry_t             bus,
                        CFDictionaryRef                 bus_dict)
 {
                        io_registry_entry_t             bus,
                        CFDictionaryRef                 bus_dict)
 {
-       CFBooleanRef    bVal;
        CFDataRef       data;
        int             ift     = -1;
        int             iVal;
        CFNumberRef     num;
        CFStringRef     str;
        CFDataRef       data;
        int             ift     = -1;
        int             iVal;
        CFNumberRef     num;
        CFStringRef     str;
+       CFBooleanRef    val;
 
        // interface type
        num = CFDictionaryGetValue(interface_dict, CFSTR(kIOInterfaceType));
 
        // interface type
        num = CFDictionaryGetValue(interface_dict, CFSTR(kIOInterfaceType));
@@ -1255,44 +1392,60 @@ processNetworkInterface(SCNetworkInterfacePrivateRef    interfacePrivate,
                            (IOObjectConformsTo(controller, "AirPortPCI"       )) ||
                            (IOObjectConformsTo(controller, "AirPortDriver"    ))) {
                                interfacePrivate->interface_type        = kSCNetworkInterfaceTypeIEEE80211;
                            (IOObjectConformsTo(controller, "AirPortPCI"       )) ||
                            (IOObjectConformsTo(controller, "AirPortDriver"    ))) {
                                interfacePrivate->interface_type        = kSCNetworkInterfaceTypeIEEE80211;
-                               interfacePrivate->entity_type           = kSCEntNetEthernet;
+                               interfacePrivate->entity_type           = kSCValNetInterfaceTypeEthernet;
                                interfacePrivate->sort_order            = kSortAirPort;
                        } else if (IOObjectConformsTo(controller, "IOBluetoothBNEPDriver")) {
                                interfacePrivate->interface_type        = kSCNetworkInterfaceTypeEthernet;
                                interfacePrivate->sort_order            = kSortAirPort;
                        } else if (IOObjectConformsTo(controller, "IOBluetoothBNEPDriver")) {
                                interfacePrivate->interface_type        = kSCNetworkInterfaceTypeEthernet;
-                               interfacePrivate->entity_type           = kSCEntNetEthernet;
+                               interfacePrivate->entity_type           = kSCValNetInterfaceTypeEthernet;
                                interfacePrivate->sort_order            = kSortBluetoothPAN;
                        } else {
                                str = IODictionaryCopyCFStringValue(bus_dict, CFSTR("name"));
                                if ((str != NULL) && CFEqual(str, CFSTR("radio"))) {
                                        interfacePrivate->interface_type        = kSCNetworkInterfaceTypeEthernet;      // ??
                                interfacePrivate->sort_order            = kSortBluetoothPAN;
                        } else {
                                str = IODictionaryCopyCFStringValue(bus_dict, CFSTR("name"));
                                if ((str != NULL) && CFEqual(str, CFSTR("radio"))) {
                                        interfacePrivate->interface_type        = kSCNetworkInterfaceTypeEthernet;      // ??
-                                       interfacePrivate->entity_type           = kSCEntNetEthernet;
+                                       interfacePrivate->entity_type           = kSCValNetInterfaceTypeEthernet;
                                        interfacePrivate->sort_order            = kSortOtherWireless;
                                } else {
                                        interfacePrivate->interface_type        = kSCNetworkInterfaceTypeEthernet;
                                        interfacePrivate->sort_order            = kSortOtherWireless;
                                } else {
                                        interfacePrivate->interface_type        = kSCNetworkInterfaceTypeEthernet;
-                                       interfacePrivate->entity_type           = kSCEntNetEthernet;
+                                       interfacePrivate->entity_type           = kSCValNetInterfaceTypeEthernet;
                                        interfacePrivate->sort_order            = kSortEthernet;
 
                                        interfacePrivate->sort_order            = kSortEthernet;
 
+#if    !TARGET_OS_IPHONE
                                        // BOND support only enabled for ethernet devices
                                        interfacePrivate->supportsBond = TRUE;
                                        // BOND support only enabled for ethernet devices
                                        interfacePrivate->supportsBond = TRUE;
+#endif // !TARGET_OS_IPHONE
                                }
 
                                if (str != NULL) CFRelease(str);
                        }
 
                                }
 
                                if (str != NULL) CFRelease(str);
                        }
 
+                       // check if WWAN Ethernet
+                       if (IOObjectConformsTo(controller, "AppleUSBEthernetHost")) {
+                               interfacePrivate->sort_order = kSortTethered;
+                       } else if (IOObjectConformsTo(controller, "AppleUSBCDCECMData")) {
+                               interfacePrivate->sort_order = kSortWWANEthernet;
+                       }
+
                        // built-in
                        // built-in
-                       bVal = isA_CFBoolean(CFDictionaryGetValue(interface_dict, CFSTR(kIOBuiltin)));
-                       if (bVal == NULL) {
-                               bVal = isA_CFBoolean(CFDictionaryGetValue(interface_dict, CFSTR(kIOPrimaryInterface)));
+                       val = isA_CFBoolean(CFDictionaryGetValue(interface_dict, CFSTR(kIOBuiltin)));
+                       if (val == NULL) {
+                               val = isA_CFBoolean(CFDictionaryGetValue(interface_dict, CFSTR(kIOPrimaryInterface)));
                        }
                        }
-                       if (bVal != NULL) {
-                               interfacePrivate->builtin = CFBooleanGetValue(bVal);
+                       if (val != NULL) {
+                               interfacePrivate->builtin = CFBooleanGetValue(val);
                        } else {
                                interfacePrivate->builtin = isBuiltin(interface);
                        }
 
                        } else {
                                interfacePrivate->builtin = isBuiltin(interface);
                        }
 
+                       if (!interfacePrivate->builtin &&
+                           CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeIEEE80211)) {
+                               // always treat AirPort interfaces as built-in
+                               interfacePrivate->builtin = TRUE;
+                       }
+
                        // location
                        interfacePrivate->location = IODictionaryCopyCFStringValue(interface_dict, CFSTR(kIOLocation));
 
                        // location
                        interfacePrivate->location = IODictionaryCopyCFStringValue(interface_dict, CFSTR(kIOLocation));
 
+#if    !TARGET_OS_IPHONE
                        // VLAN support
                        num = CFDictionaryGetValue(controller_dict, CFSTR(kIOFeatures));
                        if (isA_CFNumber(num) &&
                        // VLAN support
                        num = CFDictionaryGetValue(controller_dict, CFSTR(kIOFeatures));
                        if (isA_CFNumber(num) &&
@@ -1301,6 +1454,7 @@ processNetworkInterface(SCNetworkInterfacePrivateRef      interfacePrivate,
                                        interfacePrivate->supportsVLAN = TRUE;
                                }
                        }
                                        interfacePrivate->supportsVLAN = TRUE;
                                }
                        }
+#endif // !TARGET_OS_IPHONE
 
                        // localized name
                        if (CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeIEEE80211)) {
 
                        // localized name
                        if (CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeIEEE80211)) {
@@ -1342,15 +1496,22 @@ processNetworkInterface(SCNetworkInterfacePrivateRef    interfacePrivate,
                                                                interfacePrivate->localized_arg2 = port_name;
                                                        }
                                                }
                                                                interfacePrivate->localized_arg2 = port_name;
                                                        }
                                                }
-                                       } else if (CFEqual(provider, CFSTR("IOUSBDevice"))) {
-                                               CFTypeRef       val;
-
+                                       } else if (CFEqual(provider, CFSTR("IOUSBDevice")) ||
+                                                  CFEqual(provider, CFSTR("IOUSBInterface"))) {
                                                // check if a "Product Name" has been provided
                                                val = IORegistryEntrySearchCFProperty(interface,
                                                                                      kIOServicePlane,
                                                                                      CFSTR(kIOPropertyProductNameKey),
                                                                                      NULL,
                                                                                      kIORegistryIterateRecursively | kIORegistryIterateParents);
                                                // check if a "Product Name" has been provided
                                                val = IORegistryEntrySearchCFProperty(interface,
                                                                                      kIOServicePlane,
                                                                                      CFSTR(kIOPropertyProductNameKey),
                                                                                      NULL,
                                                                                      kIORegistryIterateRecursively | kIORegistryIterateParents);
+                                               if (val == NULL) {
+                                                       // check if a "USB Product Name" has been provided
+                                                       val = IORegistryEntrySearchCFProperty(interface,
+                                                                                             kIOServicePlane,
+                                                                                             CFSTR(kUSBProductString),
+                                                                                             NULL,
+                                                                                             kIORegistryIterateRecursively | kIORegistryIterateParents);
+                                               }
                                                if (val != NULL) {
                                                        CFStringRef     productName;
 
                                                if (val != NULL) {
                                                        CFStringRef     productName;
 
@@ -1393,7 +1554,7 @@ processNetworkInterface(SCNetworkInterfacePrivateRef      interfacePrivate,
                        interfacePrivate->interface_type = kSCNetworkInterfaceTypeFireWire;
 
                        // Entity
                        interfacePrivate->interface_type = kSCNetworkInterfaceTypeFireWire;
 
                        // Entity
-                       interfacePrivate->entity_type     = kSCEntNetFireWire;
+                       interfacePrivate->entity_type = kSCValNetInterfaceTypeFireWire;
 
                        // built-in
                        interfacePrivate->builtin = isBuiltin(interface);
 
                        // built-in
                        interfacePrivate->builtin = isBuiltin(interface);
@@ -1561,10 +1722,12 @@ processSerialInterface(SCNetworkInterfacePrivateRef     interfacePrivate,
                       io_registry_entry_t              bus,
                       CFDictionaryRef                  bus_dict)
 {
                       io_registry_entry_t              bus,
                       CFDictionaryRef                  bus_dict)
 {
+       CFStringRef             base            = NULL;
        CFStringRef             ift;
        Boolean                 isModem         = FALSE;
        CFStringRef             ift;
        Boolean                 isModem         = FALSE;
+       Boolean                 isWWAN          = FALSE;
        CFStringRef             modemCCL        = NULL;
        CFStringRef             modemCCL        = NULL;
-       CFStringRef             str;
+       Boolean                 ok              = FALSE;
        CFTypeRef               val;
 
        // check if hidden
        CFTypeRef               val;
 
        // check if hidden
@@ -1578,12 +1741,44 @@ processSerialInterface(SCNetworkInterfacePrivateRef     interfacePrivate,
                return FALSE;   // if this interface should not be exposed
        }
 
                return FALSE;   // if this interface should not be exposed
        }
 
-       // Type
-       str = CFDictionaryGetValue(interface_dict, CFSTR(kIOTTYBaseNameKey));
-       if (str == NULL) {
+       // check if initializing
+       val = IORegistryEntrySearchCFProperty(interface,
+                                             kIOServicePlane,
+                                             CFSTR("Initializing"),
+                                             NULL,
+                                             kIORegistryIterateRecursively | kIORegistryIterateParents);
+       if (val != NULL) {
+               Boolean initializing;
+
+               initializing = isA_CFBoolean(val) && CFBooleanGetValue(val);
+               CFRelease(val);
+               if (initializing) {
+                       return FALSE;   // if this interface is still initializing
+               }
+       }
+
+       // check if WWAN
+       val = IORegistryEntrySearchCFProperty(interface,
+                                             kIOServicePlane,
+                                             CFSTR("WWAN"),
+                                             NULL,
+                                             kIORegistryIterateRecursively | kIORegistryIterateParents);
+       if (val != NULL) {
+               isWWAN = isA_CFBoolean(val) && CFBooleanGetValue(val);
+               CFRelease(val);
+       }
+
+       // Entity (Device)
+       interfacePrivate->entity_device = IODictionaryCopyCFStringValue(interface_dict, CFSTR(kIOTTYDeviceKey));
+       if (interfacePrivate->entity_device == NULL) {
                return FALSE;
        }
 
                return FALSE;
        }
 
+       base = IODictionaryCopyCFStringValue(interface_dict, CFSTR(kIOTTYBaseNameKey));
+       if (base == NULL) {
+               base = CFRetain(interfacePrivate->entity_device);
+       }
+
        /*
         * From MoreSCF:
         *
        /*
         * From MoreSCF:
         *
@@ -1592,21 +1787,28 @@ processSerialInterface(SCNetworkInterfacePrivateRef     interfacePrivate,
         * that only the rev A actually had an IrDA port, and Mac OS X doesn't
         * even support it, these ports definitely shouldn't be listed.
         */
         * that only the rev A actually had an IrDA port, and Mac OS X doesn't
         * even support it, these ports definitely shouldn't be listed.
         */
-       if (CFStringCompare(str,
+       if (CFStringCompare(base,
                            CFSTR("irda"),
                            kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
                            CFSTR("irda"),
                            kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
-               return FALSE;
+               goto done;
        }
 
        }
 
-       if (IOStringValueHasPrefix(str, CFSTR("bluetooth"))) {
+       if (IOStringValueHasPrefix(base, CFSTR("bluetooth"))) {
+               Boolean haveController  = FALSE;
+
                // Bluetooth
                interfacePrivate->interface_type        = kSCNetworkInterfaceTypeBluetooth;
                interfacePrivate->sort_order            = kSortBluetooth;
                // Bluetooth
                interfacePrivate->interface_type        = kSCNetworkInterfaceTypeBluetooth;
                interfacePrivate->sort_order            = kSortBluetooth;
-       } else if (IOStringValueHasPrefix(str, CFSTR("irda-ircomm"))) {
+               interfacePrivate->builtin               = isBluetoothBuiltin(&haveController);
+               if (!haveController) {
+                       // if device with no controller present
+                       goto done;
+               }
+       } else if (IOStringValueHasPrefix(base, CFSTR("irda-ircomm"))) {
                // IrDA
                interfacePrivate->interface_type        = kSCNetworkInterfaceTypeIrDA;
                interfacePrivate->sort_order            = kSortIrDA;
                // IrDA
                interfacePrivate->interface_type        = kSCNetworkInterfaceTypeIrDA;
                interfacePrivate->sort_order            = kSortIrDA;
-       } else if (IOStringValueHasPrefix(str, CFSTR("wwan"))) {
+       } else if (isWWAN) {
                // WWAN
                interfacePrivate->interface_type        = kSCNetworkInterfaceTypeWWAN;
                interfacePrivate->sort_order            = kSortWWAN;
                // WWAN
                interfacePrivate->interface_type        = kSCNetworkInterfaceTypeWWAN;
                interfacePrivate->sort_order            = kSortWWAN;
@@ -1638,29 +1840,26 @@ processSerialInterface(SCNetworkInterfacePrivateRef     interfacePrivate,
        // Entity (Hardware)
        ift = CFDictionaryGetValue(interface_dict, CFSTR(kIOSerialBSDTypeKey));
        if (!isA_CFString(ift)) {
        // Entity (Hardware)
        ift = CFDictionaryGetValue(interface_dict, CFSTR(kIOSerialBSDTypeKey));
        if (!isA_CFString(ift)) {
-               return FALSE;
+               goto done;
        }
 
        if (CFEqual(ift, CFSTR(kIOSerialBSDModemType))) {
                // if modem
                isModem = TRUE;
 
        }
 
        if (CFEqual(ift, CFSTR(kIOSerialBSDModemType))) {
                // if modem
                isModem = TRUE;
 
-               if (CFEqual(str, CFSTR("modem"))) {
+               if (CFEqual(base, CFSTR("modem"))) {
                        interfacePrivate->builtin = TRUE;
                        interfacePrivate->sort_order = kSortInternalModem;
                        interfacePrivate->builtin = TRUE;
                        interfacePrivate->sort_order = kSortInternalModem;
-               } else if (CFEqual(str, CFSTR("usbmodem"))) {
+               } else if (CFEqual(base, CFSTR("usbmodem"))) {
                        interfacePrivate->sort_order = kSortUSBModem;
                }
        } else if (CFEqual(ift, CFSTR(kIOSerialBSDRS232Type))) {
                // if serial port
                interfacePrivate->sort_order = kSortSerialPort;
        } else {
                        interfacePrivate->sort_order = kSortUSBModem;
                }
        } else if (CFEqual(ift, CFSTR(kIOSerialBSDRS232Type))) {
                // if serial port
                interfacePrivate->sort_order = kSortSerialPort;
        } else {
-               return FALSE;
+               goto done;
        }
 
        }
 
-       // Entity (Device)
-       interfacePrivate->entity_device = IODictionaryCopyCFStringValue(interface_dict, CFSTR(kIOTTYDeviceKey));
-
        // configuration template overrides
        val = IORegistryEntrySearchCFProperty(interface,
                                              kIOServicePlane,
        // configuration template overrides
        val = IORegistryEntrySearchCFProperty(interface,
                                              kIOServicePlane,
@@ -1687,6 +1886,8 @@ processSerialInterface(SCNetworkInterfacePrivateRef       interfacePrivate,
                                              kIORegistryIterateRecursively | kIORegistryIterateParents);
        if (val != NULL) {
                if (isA_CFDictionary(val)) {
                                              kIORegistryIterateRecursively | kIORegistryIterateParents);
        if (val != NULL) {
                if (isA_CFDictionary(val)) {
+                       CFStringRef     uniqueID;
+
                        if (interfacePrivate->overrides == NULL) {
                                interfacePrivate->overrides = CFDictionaryCreateMutable(NULL,
                                                                                        0,
                        if (interfacePrivate->overrides == NULL) {
                                interfacePrivate->overrides = CFDictionaryCreateMutable(NULL,
                                                                                        0,
@@ -1697,11 +1898,20 @@ processSerialInterface(SCNetworkInterfacePrivateRef     interfacePrivate,
 
                        modemCCL = CFDictionaryGetValue(val, kSCPropNetModemConnectionScript);
                        modemCCL = isA_CFString(modemCCL);
 
                        modemCCL = CFDictionaryGetValue(val, kSCPropNetModemConnectionScript);
                        modemCCL = isA_CFString(modemCCL);
+
+                       uniqueID = CFDictionaryGetValue(val, CFSTR("UniqueIdentifier"));
+                       uniqueID = isA_CFString(uniqueID);
+                       if (uniqueID != NULL) {
+                               // retain the device's base name and the unique id
+                               CFRelease(interfacePrivate->entity_device);
+                               interfacePrivate->entity_device = CFRetain(base);
+                               interfacePrivate->entity_device_unique = CFStringCreateCopy(NULL, uniqueID);
+                       }
                }
                CFRelease(val);
        }
 
                }
                CFRelease(val);
        }
 
-       // modem CCL
+       // if not part of the DeviceModemOverrides, look harder for the modem CCL
        if (modemCCL == NULL) {
                val = IORegistryEntrySearchCFProperty(interface,
                                                      kIOServicePlane,
        if (modemCCL == NULL) {
                val = IORegistryEntrySearchCFProperty(interface,
                                                      kIOServicePlane,
@@ -1729,7 +1939,7 @@ processSerialInterface(SCNetworkInterfacePrivateRef       interfacePrivate,
                CFStringRef             name            = NULL;
                CFMutableStringRef      port;
 
                CFStringRef             name            = NULL;
                CFMutableStringRef      port;
 
-               port = CFStringCreateMutableCopy(NULL, 0, str);
+               port = CFStringCreateMutableCopy(NULL, 0, base);
                CFStringLowercase(port, NULL);
 
                if (!isModem) {
                CFStringLowercase(port, NULL);
 
                if (!isModem) {
@@ -1747,10 +1957,10 @@ processSerialInterface(SCNetworkInterfacePrivateRef     interfacePrivate,
                        } else {
                                // if no [English] localization available, use TTY base name
                                CFRelease(name);
                        } else {
                                // if no [English] localization available, use TTY base name
                                CFRelease(name);
-                               interfacePrivate->name = CFStringCreateCopy(NULL, str);
+                               interfacePrivate->name = CFStringCreateCopy(NULL, base);
                        }
                } else {
                        }
                } else {
-                       interfacePrivate->name = CFStringCreateCopy(NULL, str);
+                       interfacePrivate->name = CFStringCreateCopy(NULL, base);
                }
 
                // set localized name
                }
 
                // set localized name
@@ -1764,13 +1974,13 @@ processSerialInterface(SCNetworkInterfacePrivateRef     interfacePrivate,
                        } else {
                                // if no localization available, use TTY base name
                                CFRelease(localized);
                        } else {
                                // if no localization available, use TTY base name
                                CFRelease(localized);
-                               interfacePrivate->localized_name = CFStringCreateCopy(NULL, str);
+                               interfacePrivate->localized_name = CFStringCreateCopy(NULL, base);
                        }
                } else {
                        }
                } else {
-                       interfacePrivate->localized_name = CFStringCreateCopy(NULL, str);
+                       interfacePrivate->localized_name = CFStringCreateCopy(NULL, base);
                }
 
                }
 
-               if (!isModem || !CFEqual(str, CFSTR("modem"))) {
+               if (!isModem || !CFEqual(base, CFSTR("modem"))) {
                        CFStringRef     productName;
 
                        // check if a "Product Name" has been provided
                        CFStringRef     productName;
 
                        // check if a "Product Name" has been provided
@@ -1779,6 +1989,14 @@ processSerialInterface(SCNetworkInterfacePrivateRef      interfacePrivate,
                                                              CFSTR(kIOPropertyProductNameKey),
                                                              NULL,
                                                              kIORegistryIterateRecursively | kIORegistryIterateParents);
                                                              CFSTR(kIOPropertyProductNameKey),
                                                              NULL,
                                                              kIORegistryIterateRecursively | kIORegistryIterateParents);
+                       if (val == NULL) {
+                               // check if a "USB Product Name" has been provided
+                               val = IORegistryEntrySearchCFProperty(interface,
+                                                                     kIOServicePlane,
+                                                                     CFSTR(kUSBProductString),
+                                                                     NULL,
+                                                                     kIORegistryIterateRecursively | kIORegistryIterateParents);
+                       }
                        if (val != NULL) {
                                productName = IOCopyCFStringValue(val);
                                CFRelease(val);
                        if (val != NULL) {
                                productName = IOCopyCFStringValue(val);
                                CFRelease(val);
@@ -1800,7 +2018,6 @@ processSerialInterface(SCNetworkInterfacePrivateRef       interfacePrivate,
                                                if ((modemCCL == NULL) &&
                                                    is_valid_connection_script(productName)) {
                                                        set_connection_script(interfacePrivate, productName);
                                                if ((modemCCL == NULL) &&
                                                    is_valid_connection_script(productName)) {
                                                        set_connection_script(interfacePrivate, productName);
-                                                       modemCCL = productName;
                                                }
                                        }
 
                                                }
                                        }
 
@@ -1812,7 +2029,17 @@ processSerialInterface(SCNetworkInterfacePrivateRef      interfacePrivate,
                CFRelease(port);
        }
 
                CFRelease(port);
        }
 
-       return TRUE;
+       ok = TRUE;
+
+    done :
+
+       if (!ok && (interfacePrivate->entity_device != NULL)) {
+               CFRelease(interfacePrivate->entity_device);
+               interfacePrivate->entity_device = NULL;
+       }
+       if (base != NULL) CFRelease(base);
+
+       return ok;
 }
 
 
 }
 
 
@@ -1870,7 +2097,22 @@ createInterface(io_registry_entry_t interface, processInterface func)
 
        interfacePrivate = __SCNetworkInterfaceCreatePrivate(NULL, NULL, NULL, NULL, path);
 
 
        interfacePrivate = __SCNetworkInterfaceCreatePrivate(NULL, NULL, NULL, NULL, path);
 
-       if (!(*func)(interfacePrivate, interface, interface_dict, controller, controller_dict, bus, bus_dict)) {
+       if ((*func)(interfacePrivate, interface, interface_dict, controller, controller_dict, bus, bus_dict)) {
+               CFTypeRef       val;
+
+               /* check user-notification / auto-configuration preferences */
+               val = IORegistryEntrySearchCFProperty(interface,
+                                                     kIOServicePlane,
+                                                     kSCNetworkInterfaceConfigurationActionKey,
+                                                     NULL,
+                                                     kIORegistryIterateRecursively | kIORegistryIterateParents);
+               if (val != NULL) {
+                       if (isA_CFString(val)) {
+                               interfacePrivate->configurationAction = CFRetain(val);
+                       }
+                       CFRelease(val);
+               }
+       } else {
                CFRelease(interfacePrivate);
                interfacePrivate = NULL;
        }
                CFRelease(interfacePrivate);
                interfacePrivate = NULL;
        }
@@ -1981,6 +2223,7 @@ __SCNetworkInterfaceIsValidExtendedConfigurationType(SCNetworkInterfaceRef        inter
        CFIndex                         extendedIndex;
        CFIndex                         interfaceIndex;
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
        CFIndex                         extendedIndex;
        CFIndex                         interfaceIndex;
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+       Boolean                         isL2TP                  = FALSE;
        Boolean                         ok                      = FALSE;
 
        defaultType = __SCNetworkInterfaceGetDefaultConfigurationType(interface);
        Boolean                         ok                      = FALSE;
 
        defaultType = __SCNetworkInterfaceGetDefaultConfigurationType(interface);
@@ -2001,18 +2244,35 @@ __SCNetworkInterfaceIsValidExtendedConfigurationType(SCNetworkInterfaceRef      inter
                goto done;
        }
 
                goto done;
        }
 
-//     It turns out that, for PPP interfaces, we want to be able to store
-//     some extended interface configuration (e.g. IPSec [for L2TP]).  For
-//     now, I'm commenting out the following test.
-//
-//     if (requirePerInterface && !configurations[interfaceIndex].per_interface_config) {
-//             // we don't allow per-service extended configurations
-//             goto done;
-//     }
+       if (CFEqual(extendedType, kSCEntNetIPSec)) {
+               CFStringRef     interfaceType;
+
+               interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
+               if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) {
+                       SCNetworkInterfaceRef   child;
+
+                       child = SCNetworkInterfaceGetInterface(interface);
+                       if (child != NULL) {
+                               interfaceType = SCNetworkInterfaceGetInterfaceType(child);
+                               if (CFEqual(interfaceType, kSCNetworkInterfaceTypeL2TP)) {
+                                       isL2TP = TRUE;
+                               }
+                       }
+               }
+       }
+
+       if (requirePerInterface &&
+           !configurations[interfaceIndex].per_interface_config &&
+           !isL2TP) {
+               // we don't allow per-service extended configurations (except
+               // that we do allow IPSec as an extended type for PPP->L2TP)
+               goto done;
+       }
 
        extendedIndex = findConfiguration(extendedType);
 
        extendedIndex = findConfiguration(extendedType);
-       if (extendedIndex != kCFNotFound) {
-               // extended type cannot match a known interface type
+       if ((extendedIndex != kCFNotFound) && !isL2TP) {
+               // extended type cannot match a known interface type (except
+               // that we do allow IPSec as an extended type for PPP->L2TP)
                goto done;
        }
 
                goto done;
        }
 
@@ -2269,6 +2529,11 @@ __SCNetworkInterfaceCopyInterfaceEntity(SCNetworkInterfaceRef interface)
                                     kSCPropNetInterfaceDeviceName,
                                     interfacePrivate->entity_device);
        }
                                     kSCPropNetInterfaceDeviceName,
                                     interfacePrivate->entity_device);
        }
+       if (interfacePrivate->entity_device_unique != NULL) {
+               CFDictionarySetValue(entity,
+                                    CFSTR("DeviceUniqueIdentifier"),
+                                    interfacePrivate->entity_device_unique);
+       }
 
        // match the "hardware" with the lowest layer
        while (TRUE) {
 
        // match the "hardware" with the lowest layer
        while (TRUE) {
@@ -2283,6 +2548,10 @@ __SCNetworkInterfaceCopyInterfaceEntity(SCNetworkInterfaceRef interface)
        }
        interfacePrivate = (SCNetworkInterfacePrivateRef)interface;
 
        }
        interfacePrivate = (SCNetworkInterfacePrivateRef)interface;
 
+       if (CFEqual(interface, kSCNetworkInterfaceIPv4)) {
+               return entity;
+       }
+
        interfaceIndex = findConfiguration(interfacePrivate->interface_type);
        if (interfaceIndex != kCFNotFound) {
                if (configurations[interfaceIndex].entity_hardware != NULL) {
        interfaceIndex = findConfiguration(interfacePrivate->interface_type);
        if (interfaceIndex != kCFNotFound) {
                if (configurations[interfaceIndex].entity_hardware != NULL) {
@@ -2319,6 +2588,7 @@ __SCNetworkInterfaceCopyInterfaceEntity(SCNetworkInterfaceRef interface)
 }
 
 
 }
 
 
+#if    !TARGET_OS_IPHONE
 static SCNetworkInterfaceRef
 findInterface(CFArrayRef interfaces, CFStringRef match_if)
 {
 static SCNetworkInterfaceRef
 findInterface(CFArrayRef interfaces, CFStringRef match_if)
 {
@@ -2378,6 +2648,7 @@ findVLANInterface(SCPreferencesRef prefs, CFStringRef ifDevice)
        }
        return interface;
 }
        }
        return interface;
 }
+#endif // !TARGET_OS_IPHONE
 
 
 SCNetworkInterfaceRef
 
 
 SCNetworkInterfaceRef
@@ -2393,12 +2664,14 @@ _SCNetworkInterfaceCreateWithBSDName(CFAllocatorRef             allocator,
                                           &kCFTypeDictionaryKeyCallBacks,
                                           &kCFTypeDictionaryValueCallBacks);
        CFDictionarySetValue(entity, kSCPropNetInterfaceDeviceName, bsdName);
                                           &kCFTypeDictionaryKeyCallBacks,
                                           &kCFTypeDictionaryValueCallBacks);
        CFDictionarySetValue(entity, kSCPropNetInterfaceDeviceName, bsdName);
-       if ((flags & kIncludeVLANInterfaces) == 0) {
-               CFDictionarySetValue(entity, CFSTR("_NO_VLAN_INTERFACES_"), kCFBooleanTrue);
-       }
+#if    !TARGET_OS_IPHONE
        if ((flags & kIncludeBondInterfaces) == 0) {
                CFDictionarySetValue(entity, CFSTR("_NO_BOND_INTERFACES_"), kCFBooleanTrue);
        }
        if ((flags & kIncludeBondInterfaces) == 0) {
                CFDictionarySetValue(entity, CFSTR("_NO_BOND_INTERFACES_"), kCFBooleanTrue);
        }
+       if ((flags & kIncludeVLANInterfaces) == 0) {
+               CFDictionarySetValue(entity, CFSTR("_NO_VLAN_INTERFACES_"), kCFBooleanTrue);
+       }
+#endif // !TARGET_OS_IPHONE
        interface = _SCNetworkInterfaceCreateWithEntity(NULL, entity, NULL);
        CFRelease(entity);
 
        interface = _SCNetworkInterfaceCreateWithEntity(NULL, entity, NULL);
        CFRelease(entity);
 
@@ -2406,6 +2679,75 @@ _SCNetworkInterfaceCreateWithBSDName(CFAllocatorRef              allocator,
 }
 
 
 }
 
 
+static void
+__SCNetworkInterfaceSetService(SCNetworkInterfaceRef   interface,
+                              SCNetworkServiceRef      service)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate;
+       SCNetworkServicePrivateRef      servicePrivate;
+
+       interfacePrivate = (SCNetworkInterfacePrivateRef)interface;
+       if (interfacePrivate->prefs != NULL) {
+               CFRelease(interfacePrivate->prefs);
+               interfacePrivate->prefs = NULL;
+       }
+       if (interfacePrivate->serviceID != NULL) {
+               CFRelease(interfacePrivate->serviceID);
+               interfacePrivate->serviceID = NULL;
+       }
+
+       servicePrivate = (SCNetworkServicePrivateRef)service;
+       if (servicePrivate->prefs != NULL) {
+               interfacePrivate->prefs = CFRetain(servicePrivate->prefs);
+       }
+       if (servicePrivate->serviceID != NULL) {
+               interfacePrivate->serviceID = CFRetain(servicePrivate->serviceID);
+       }
+
+       return;
+}
+
+
+static Boolean
+_SCNetworkInterfaceMatchesName(CFStringRef name, CFStringRef key)
+{
+       Boolean         match;
+       CFStringRef     str;
+
+       if (bundle == NULL) {
+               // if no bundle
+               return FALSE;
+       }
+
+       if (!isA_CFString(name)) {
+               // if no interface "name"
+               return FALSE;
+       }
+
+       // check non-localized name for a match
+       str = copy_interface_string(bundle, key, FALSE);
+       if (str != NULL) {
+               match = CFEqual(name, str);
+               CFRelease(str);
+               if (match) {
+                       return TRUE;
+               }
+       }
+
+       // check localized name for a match
+       str = copy_interface_string(bundle, key, TRUE);
+       if (str != NULL) {
+               match = CFEqual(name, str);
+               CFRelease(str);
+               if (match) {
+                       return TRUE;
+               }
+       }
+
+       return FALSE;
+}
+
+
 SCNetworkInterfaceRef
 _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef             allocator,
                                    CFDictionaryRef             interface_entity,
 SCNetworkInterfaceRef
 _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef             allocator,
                                    CFDictionaryRef             interface_entity,
@@ -2413,6 +2755,7 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef                allocator,
 {
        SCNetworkInterfacePrivateRef    interfacePrivate        = NULL;
        CFStringRef                     ifDevice;
 {
        SCNetworkInterfacePrivateRef    interfacePrivate        = NULL;
        CFStringRef                     ifDevice;
+       CFStringRef                     ifUnique;
        CFStringRef                     ifSubType;
        CFStringRef                     ifType;
        CFArrayRef                      matching_interfaces     = NULL;
        CFStringRef                     ifSubType;
        CFStringRef                     ifType;
        CFArrayRef                      matching_interfaces     = NULL;
@@ -2445,6 +2788,7 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef                allocator,
        }
 
        ifDevice = CFDictionaryGetValue(interface_entity, kSCPropNetInterfaceDeviceName);
        }
 
        ifDevice = CFDictionaryGetValue(interface_entity, kSCPropNetInterfaceDeviceName);
+       ifUnique = CFDictionaryGetValue(interface_entity, CFSTR("DeviceUniqueIdentifier"));
 
        if (CFEqual(ifType, kSCValNetInterfaceTypeEthernet) ||
            CFEqual(ifType, kSCValNetInterfaceTypeFireWire) ||
 
        if (CFEqual(ifType, kSCValNetInterfaceTypeEthernet) ||
            CFEqual(ifType, kSCValNetInterfaceTypeFireWire) ||
@@ -2481,7 +2825,7 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef                allocator,
                        match_keys[0] = CFSTR(kIOProviderClassKey);
                        match_vals[0] = CFSTR(kIOSerialBSDServiceValue);
 
                        match_keys[0] = CFSTR(kIOProviderClassKey);
                        match_vals[0] = CFSTR(kIOSerialBSDServiceValue);
 
-                       match_keys[1] = CFSTR(kIOTTYDeviceKey);
+                       match_keys[1] = CFSTR(kIOTTYBaseNameKey);
                        match_vals[1] = ifDevice;
 
                        matching = CFDictionaryCreate(NULL,
                        match_vals[1] = ifDevice;
 
                        matching = CFDictionaryCreate(NULL,
@@ -2512,6 +2856,9 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef                allocator,
 
                interfacePrivate = (SCNetworkInterfacePrivateRef)SCNetworkInterfaceCreateWithInterface(kSCNetworkInterfaceIPv4,
                                                                                                       kSCNetworkInterfaceType6to4);
 
                interfacePrivate = (SCNetworkInterfacePrivateRef)SCNetworkInterfaceCreateWithInterface(kSCNetworkInterfaceIPv4,
                                                                                                       kSCNetworkInterfaceType6to4);
+       } else if (CFEqual(ifType, kSCValNetInterfaceTypeIPSec)) {
+               interfacePrivate = (SCNetworkInterfacePrivateRef)SCNetworkInterfaceCreateWithInterface(kSCNetworkInterfaceIPv4,
+                                                                                                      kSCNetworkInterfaceTypeIPSec);
        } else if ((CFStringFind(ifType, CFSTR("."), 0).location != kCFNotFound) && (ifDevice == NULL)) {
                interfacePrivate = (SCNetworkInterfacePrivateRef)SCNetworkInterfaceCreateWithInterface(kSCNetworkInterfaceIPv4,
                                                                                                       ifType);
        } else if ((CFStringFind(ifType, CFSTR("."), 0).location != kCFNotFound) && (ifDevice == NULL)) {
                interfacePrivate = (SCNetworkInterfacePrivateRef)SCNetworkInterfaceCreateWithInterface(kSCNetworkInterfaceIPv4,
                                                                                                       ifType);
@@ -2523,6 +2870,16 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef               allocator,
 
                n = CFArrayGetCount(matching_interfaces);
                switch (n) {
 
                n = CFArrayGetCount(matching_interfaces);
                switch (n) {
+                       case 1 :
+                               interfacePrivate = (SCNetworkInterfacePrivateRef)CFArrayGetValueAtIndex(matching_interfaces, 0);
+                               if (_SC_CFEqual(ifUnique, interfacePrivate->entity_device_unique)) {
+                                       // if the unique ID's  match
+                                       CFRetain(interfacePrivate);
+                                       break;
+                               }
+
+                               interfacePrivate = NULL;
+                               // fall through
                        case 0 :
                                if (!CFEqual(ifType, kSCValNetInterfaceTypeEthernet)) {
                                        break;
                        case 0 :
                                if (!CFEqual(ifType, kSCValNetInterfaceTypeEthernet)) {
                                        break;
@@ -2531,6 +2888,7 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef                allocator,
                                if (prefs == NULL) {
                                        break;
                                }
                                if (prefs == NULL) {
                                        break;
                                }
+#if    !TARGET_OS_IPHONE
                                if (!CFDictionaryContainsKey(interface_entity, CFSTR("_NO_VLAN_INTERFACES_"))) {
                                        interfacePrivate = (SCNetworkInterfacePrivateRef)findVLANInterface(prefs, ifDevice);
                                }
                                if (!CFDictionaryContainsKey(interface_entity, CFSTR("_NO_VLAN_INTERFACES_"))) {
                                        interfacePrivate = (SCNetworkInterfacePrivateRef)findVLANInterface(prefs, ifDevice);
                                }
@@ -2538,17 +2896,33 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef              allocator,
                                    && !CFDictionaryContainsKey(interface_entity, CFSTR("_NO_BOND_INTERFACES_"))) {
                                        interfacePrivate = (SCNetworkInterfacePrivateRef)findBondInterface(prefs, ifDevice);
                                }
                                    && !CFDictionaryContainsKey(interface_entity, CFSTR("_NO_BOND_INTERFACES_"))) {
                                        interfacePrivate = (SCNetworkInterfacePrivateRef)findBondInterface(prefs, ifDevice);
                                }
+#endif // !TARGET_OS_IPHONE
                                CFRelease(prefs);
                                break;
                                CFRelease(prefs);
                                break;
-                       case 1 :
-                               interfacePrivate = (SCNetworkInterfacePrivateRef)CFArrayGetValueAtIndex(matching_interfaces, 0);
+                       default :
+                               if (ifUnique != NULL) {
+                                       CFIndex i;
+
+                                       for (i = 0; i < n; i++) {
+                                               SCNetworkInterfacePrivateRef    scan;
+
+                                               scan = (SCNetworkInterfacePrivateRef)CFArrayGetValueAtIndex(matching_interfaces, i);
+                                               if (_SC_CFEqual(ifUnique, scan->entity_device_unique)) {
+                                                       if (interfacePrivate != NULL) {
+                                                               // if we've matched more than one interface
+                                                               interfacePrivate = NULL;
+                                                               break;
+                                                       }
+                                                       interfacePrivate = scan;
+                                               }
+                                       }
+                               }
+                               if (interfacePrivate == NULL) {
+                                       SCLog(TRUE, LOG_ERR, CFSTR("_SCNetworkInterfaceCreateWithEntity() failed, more than one interface matches %@"), ifDevice);
+                                       interfacePrivate = (SCNetworkInterfacePrivateRef)CFArrayGetValueAtIndex(matching_interfaces, 0);
+                               }
                                CFRetain(interfacePrivate);
                                break;
                                CFRetain(interfacePrivate);
                                break;
-                       default :
-                               SCLog(TRUE, LOG_DEBUG, CFSTR("_SCNetworkInterfaceCreateWithEntity() failed, more than one interface matches %@"), ifDevice);
-                               CFRelease(matching_interfaces);
-                               _SCErrorSet(kSCStatusFailed);
-                               return NULL;
                }
                CFRelease(matching_interfaces);
        }
                }
                CFRelease(matching_interfaces);
        }
@@ -2560,34 +2934,62 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef              allocator,
                 * if device not present on this system
                 */
                interfacePrivate = __SCNetworkInterfaceCreatePrivate(NULL, NULL, NULL, NULL, NULL);
                 * if device not present on this system
                 */
                interfacePrivate = __SCNetworkInterfaceCreatePrivate(NULL, NULL, NULL, NULL, NULL);
-               interfacePrivate->entity_type     = ifType;
-               interfacePrivate->entity_subtype  = ifSubType;
-               interfacePrivate->entity_device   = (ifDevice != NULL) ? CFStringCreateCopy(NULL, ifDevice) : NULL;
+               interfacePrivate->entity_type          = ifType;
+               interfacePrivate->entity_subtype       = ifSubType;
+               interfacePrivate->entity_device        = (ifDevice != NULL) ? CFStringCreateCopy(NULL, ifDevice) : NULL;
+               interfacePrivate->entity_device_unique = (ifUnique != NULL) ? CFStringCreateCopy(NULL, ifUnique) : NULL;
 
                if (CFEqual(ifType, kSCValNetInterfaceTypeEthernet)) {
                        CFStringRef     entity_hardware;
 
                        entity_hardware = CFDictionaryGetValue(interface_entity, kSCPropNetInterfaceHardware);
 
                if (CFEqual(ifType, kSCValNetInterfaceTypeEthernet)) {
                        CFStringRef     entity_hardware;
 
                        entity_hardware = CFDictionaryGetValue(interface_entity, kSCPropNetInterfaceHardware);
-                       if ((entity_hardware != NULL) &&
+                       if (isA_CFString((entity_hardware)) &&
                            CFEqual(entity_hardware, kSCEntNetAirPort)) {
                                interfacePrivate->interface_type = kSCNetworkInterfaceTypeIEEE80211;
                            CFEqual(entity_hardware, kSCEntNetAirPort)) {
                                interfacePrivate->interface_type = kSCNetworkInterfaceTypeIEEE80211;
+                               interfacePrivate->sort_order     = kSortAirPort;
                        } else {
                        } else {
+                               CFStringRef     name;
+
                                interfacePrivate->interface_type = kSCNetworkInterfaceTypeEthernet;
                                interfacePrivate->interface_type = kSCNetworkInterfaceTypeEthernet;
+
+                               name = CFDictionaryGetValue(interface_entity, kSCPropUserDefinedName);
+                               if (_SCNetworkInterfaceMatchesName(name, CFSTR("iPhone"))) {
+                                       interfacePrivate->sort_order = kSortTethered;
+                               } else if (_SCNetworkInterfaceMatchesName(name, CFSTR("bluetooth-pan"))) {
+                                       interfacePrivate->sort_order = kSortBluetoothPAN;
+                               } else {
+                                       interfacePrivate->sort_order = kSortEthernet;
+                               }
                        }
                } else if (CFEqual(ifType, kSCValNetInterfaceTypeFireWire)) {
                        interfacePrivate->interface_type = kSCNetworkInterfaceTypeFireWire;
                        }
                } else if (CFEqual(ifType, kSCValNetInterfaceTypeFireWire)) {
                        interfacePrivate->interface_type = kSCNetworkInterfaceTypeFireWire;
+                       interfacePrivate->sort_order     = kSortFireWire;
                } else if (CFEqual(ifType, kSCValNetInterfaceTypePPP)) {
                        if (CFEqual(ifSubType, kSCValNetInterfaceSubTypePPPoE)) {
                } else if (CFEqual(ifType, kSCValNetInterfaceTypePPP)) {
                        if (CFEqual(ifSubType, kSCValNetInterfaceSubTypePPPoE)) {
-                               interfacePrivate->interface_type = kSCNetworkInterfaceTypeEthernet;
+                               CFStringRef     entity_hardware;
+
+                               entity_hardware = CFDictionaryGetValue(interface_entity, kSCPropNetInterfaceHardware);
+                               if (isA_CFString((entity_hardware)) &&
+                                   CFEqual(entity_hardware, kSCEntNetAirPort)) {
+                                       interfacePrivate->interface_type = kSCNetworkInterfaceTypeIEEE80211;
+                                       interfacePrivate->sort_order     = kSortAirPort;
+                               } else {
+                                       interfacePrivate->interface_type = kSCNetworkInterfaceTypeEthernet;
+                                       interfacePrivate->sort_order     = kSortEthernet;
+                               }
                        } else if (CFEqual(ifSubType, kSCValNetInterfaceSubTypePPPSerial)) {
                                if (CFStringHasPrefix(ifDevice, CFSTR("Bluetooth"))) {
                                        interfacePrivate->interface_type = kSCNetworkInterfaceTypeBluetooth;
                        } else if (CFEqual(ifSubType, kSCValNetInterfaceSubTypePPPSerial)) {
                                if (CFStringHasPrefix(ifDevice, CFSTR("Bluetooth"))) {
                                        interfacePrivate->interface_type = kSCNetworkInterfaceTypeBluetooth;
+                                       interfacePrivate->sort_order     = kSortBluetooth;
                                } else if (CFStringHasPrefix(ifDevice, CFSTR("irda"))) {
                                        interfacePrivate->interface_type = kSCNetworkInterfaceTypeIrDA;
                                } else if (CFStringHasPrefix(ifDevice, CFSTR("irda"))) {
                                        interfacePrivate->interface_type = kSCNetworkInterfaceTypeIrDA;
+                                       interfacePrivate->sort_order     = kSortIrDA;
                                } else if (CFStringHasPrefix(ifDevice, CFSTR("wwan"))) {
                                        interfacePrivate->interface_type = kSCNetworkInterfaceTypeWWAN;
                                } else if (CFStringHasPrefix(ifDevice, CFSTR("wwan"))) {
                                        interfacePrivate->interface_type = kSCNetworkInterfaceTypeWWAN;
+                                       interfacePrivate->sort_order     = kSortWWAN;
                                } else {
                                        interfacePrivate->interface_type = kSCNetworkInterfaceTypeModem;
                                } else {
                                        interfacePrivate->interface_type = kSCNetworkInterfaceTypeModem;
+                                       interfacePrivate->sort_order     = kSortModem;
                                }
                        } else {
                                // PPTP, L2TP, ...
                                }
                        } else {
                                // PPTP, L2TP, ...
@@ -2606,20 +3008,38 @@ _SCNetworkInterfaceCreateWithEntity(CFAllocatorRef              allocator,
        }
 
        if ((interfacePrivate != NULL) && (service != NULL)) {
        }
 
        if ((interfacePrivate != NULL) && (service != NULL)) {
-               SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
-
-               if (interfacePrivate->prefs != NULL)
-                       CFRelease(interfacePrivate->prefs);
-               if (interfacePrivate->serviceID != NULL)
-                       CFRelease(interfacePrivate->serviceID);
+               __SCNetworkInterfaceSetService((SCNetworkInterfaceRef)interfacePrivate,
+                                              service);
+#if    !TARGET_OS_IPHONE
+               // set prefs & serviceID to VLANs and Bonds
+               if (CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeBond)) {
+                       CFIndex         i;
+                       CFArrayRef      members;
+                       CFIndex         n;
+
+                       members = SCBondInterfaceGetMemberInterfaces((SCNetworkInterfaceRef)interfacePrivate);
+                       n = (members != NULL) ? CFArrayGetCount(members) : 0;
+                       for (i = 0; i < n; i++) {
+                               SCNetworkInterfaceRef   member;
+
+                               member = CFArrayGetValueAtIndex(members, i);
+                               __SCNetworkInterfaceSetService(member, service);
+                       }
+               } else if (CFEqual(interfacePrivate->interface_type, kSCNetworkInterfaceTypeVLAN)) {
+                       SCNetworkInterfaceRef   vlan_physical;
 
 
-               interfacePrivate->prefs     = CFRetain(servicePrivate->prefs);
-               interfacePrivate->serviceID = CFRetain(servicePrivate->serviceID);
+                       vlan_physical = SCVLANInterfaceGetPhysicalInterface((SCNetworkInterfaceRef)interfacePrivate);
+                       if (vlan_physical != NULL) {
+                               __SCNetworkInterfaceSetService(vlan_physical, service);
+                       }
+               }
+#endif // !TARGET_OS_IPHONE
        }
 
        if (CFEqual(ifType, kSCValNetInterfaceTypePPP)) {
                SCNetworkInterfaceRef   parent;
 
        }
 
        if (CFEqual(ifType, kSCValNetInterfaceTypePPP)) {
                SCNetworkInterfaceRef   parent;
 
+               // create parent
                parent = SCNetworkInterfaceCreateWithInterface((SCNetworkInterfaceRef)interfacePrivate,
                                                               kSCNetworkInterfaceTypePPP);
                CFRelease(interfacePrivate);
                parent = SCNetworkInterfaceCreateWithInterface((SCNetworkInterfaceRef)interfacePrivate,
                                                               kSCNetworkInterfaceTypePPP);
                CFRelease(interfacePrivate);
@@ -2750,6 +3170,7 @@ __waitForInterfaces()
        }
 
        while (TRUE) {
        }
 
        while (TRUE) {
+               CFArrayRef      changedKeys;
                CFDictionaryRef dict;
                Boolean         quiet   = FALSE;
 
                CFDictionaryRef dict;
                Boolean         quiet   = FALSE;
 
@@ -2773,6 +3194,11 @@ __waitForInterfaces()
                              CFSTR("SCDynamicStoreNotifyWait() failed: %s"), SCErrorString(SCError()));
                        goto done;
                }
                              CFSTR("SCDynamicStoreNotifyWait() failed: %s"), SCErrorString(SCError()));
                        goto done;
                }
+
+               changedKeys = SCDynamicStoreCopyNotifiedKeys(store);
+               if (changedKeys != NULL) {
+                       CFRelease(changedKeys);
+               }
        }
 
     done :
        }
 
     done :
@@ -2788,7 +3214,9 @@ SCNetworkInterfaceCopyAll()
 {
        CFMutableArrayRef       all_interfaces;
        CFArrayRef              new_interfaces;
 {
        CFMutableArrayRef       all_interfaces;
        CFArrayRef              new_interfaces;
+#if    !TARGET_OS_IPHONE
        SCPreferencesRef        prefs;
        SCPreferencesRef        prefs;
+#endif // !TARGET_OS_IPHONE
 
        /* initialize runtime */
        pthread_once(&initialized, __SCNetworkInterfaceInitialize);
 
        /* initialize runtime */
        pthread_once(&initialized, __SCNetworkInterfaceInitialize);
@@ -2819,6 +3247,7 @@ SCNetworkInterfaceCopyAll()
                CFRelease(new_interfaces);
        }
 
                CFRelease(new_interfaces);
        }
 
+#if    !TARGET_OS_IPHONE
        // get virtual network interfaces (Bond, VLAN)
        prefs = SCPreferencesCreate(NULL, CFSTR("SCNetworkInterfaceCopyAll"), NULL);
        if (prefs != NULL) {
        // get virtual network interfaces (Bond, VLAN)
        prefs = SCPreferencesCreate(NULL, CFSTR("SCNetworkInterfaceCopyAll"), NULL);
        if (prefs != NULL) {
@@ -2836,6 +3265,7 @@ SCNetworkInterfaceCopyAll()
 
                CFRelease(prefs);
        }
 
                CFRelease(prefs);
        }
+#endif // !TARGET_OS_IPHONE
 
        // all interfaces have been identified, order and return
        sort_interfaces(all_interfaces);
 
        // all interfaces have been identified, order and return
        sort_interfaces(all_interfaces);
@@ -2875,6 +3305,9 @@ SCNetworkInterfaceGetSupportedInterfaceTypes(SCNetworkInterfaceRef interface)
                        if (configurations[i].supported_interfaces & doPPTP) {
                                CFArrayAppendValue(interfacePrivate->supported_interface_types, kSCNetworkInterfaceTypePPTP);
                        }
                        if (configurations[i].supported_interfaces & doPPTP) {
                                CFArrayAppendValue(interfacePrivate->supported_interface_types, kSCNetworkInterfaceTypePPTP);
                        }
+                       if (configurations[i].supported_interfaces & doIPSec) {
+                               CFArrayAppendValue(interfacePrivate->supported_interface_types, kSCNetworkInterfaceTypeIPSec);
+                       }
                }
        }
 
                }
        }
 
@@ -2903,9 +3336,11 @@ SCNetworkInterfaceGetSupportedProtocolTypes(SCNetworkInterfaceRef interface)
        if (i != kCFNotFound) {
                if (configurations[i].supported_protocols != doNone) {
                        interfacePrivate->supported_protocol_types = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
        if (i != kCFNotFound) {
                if (configurations[i].supported_protocols != doNone) {
                        interfacePrivate->supported_protocol_types = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+#if    !TARGET_OS_IPHONE
                        if (configurations[i].supported_protocols & doAppleTalk) {
                                CFArrayAppendValue(interfacePrivate->supported_protocol_types, kSCNetworkProtocolTypeAppleTalk);
                        }
                        if (configurations[i].supported_protocols & doAppleTalk) {
                                CFArrayAppendValue(interfacePrivate->supported_protocol_types, kSCNetworkProtocolTypeAppleTalk);
                        }
+#endif // !TARGET_OS_IPHONE
                        if (configurations[i].supported_protocols & doDNS) {
                                CFArrayAppendValue(interfacePrivate->supported_protocol_types, kSCNetworkProtocolTypeDNS);
                        }
                        if (configurations[i].supported_protocols & doDNS) {
                                CFArrayAppendValue(interfacePrivate->supported_protocol_types, kSCNetworkProtocolTypeDNS);
                        }
@@ -2918,9 +3353,11 @@ SCNetworkInterfaceGetSupportedProtocolTypes(SCNetworkInterfaceRef interface)
                        if (configurations[i].supported_protocols & doProxies) {
                                CFArrayAppendValue(interfacePrivate->supported_protocol_types, kSCNetworkProtocolTypeProxies);
                        }
                        if (configurations[i].supported_protocols & doProxies) {
                                CFArrayAppendValue(interfacePrivate->supported_protocol_types, kSCNetworkProtocolTypeProxies);
                        }
+#if    !TARGET_OS_IPHONE
                        if (configurations[i].supported_protocols & doSMB) {
                                CFArrayAppendValue(interfacePrivate->supported_protocol_types, kSCNetworkProtocolTypeSMB);
                        }
                        if (configurations[i].supported_protocols & doSMB) {
                                CFArrayAppendValue(interfacePrivate->supported_protocol_types, kSCNetworkProtocolTypeSMB);
                        }
+#endif // !TARGET_OS_IPHONE
                }
        }
 
                }
        }
 
@@ -2961,7 +3398,7 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i
 
        if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) {
                parentPrivate->interface_type = kSCNetworkInterfaceTypePPP;
 
        if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) {
                parentPrivate->interface_type = kSCNetworkInterfaceTypePPP;
-               parentPrivate->entity_type    = kSCEntNetPPP;
+               parentPrivate->entity_type    = kSCValNetInterfaceTypePPP;
 
                // entity subtype
                if (childIndex != kCFNotFound) {
 
                // entity subtype
                if (childIndex != kCFNotFound) {
@@ -2979,6 +3416,10 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i
                if (childPrivate->entity_device != NULL) {
                        parentPrivate->entity_device = CFStringCreateCopy(NULL, childPrivate->entity_device);
                }
                if (childPrivate->entity_device != NULL) {
                        parentPrivate->entity_device = CFStringCreateCopy(NULL, childPrivate->entity_device);
                }
+
+               if (childPrivate->entity_device_unique != NULL) {
+                       parentPrivate->entity_device_unique = CFStringCreateCopy(NULL, childPrivate->entity_device_unique);
+               }
        } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeL2TP)) {
                if ((childIndex == kCFNotFound) ||
                    ((configurations[childIndex].supported_interfaces & doL2TP) != doL2TP)) {
        } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeL2TP)) {
                if ((childIndex == kCFNotFound) ||
                    ((configurations[childIndex].supported_interfaces & doL2TP) != doL2TP)) {
@@ -2987,7 +3428,7 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i
                }
                parentPrivate->interface_type = kSCNetworkInterfaceTypeL2TP;
                parentPrivate->localized_key  = CFSTR("l2tp");
                }
                parentPrivate->interface_type = kSCNetworkInterfaceTypeL2TP;
                parentPrivate->localized_key  = CFSTR("l2tp");
-               parentPrivate->entity_type    = kSCValNetInterfaceSubTypeL2TP;  // interface config goes into "L2TP"
+               parentPrivate->entity_type    = kSCEntNetL2TP;                  // interface config goes into "L2TP"
        } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPTP)) {
                if ((childIndex == kCFNotFound) ||
                    ((configurations[childIndex].supported_interfaces & doPPTP) != doPPTP)) {
        } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPTP)) {
                if ((childIndex == kCFNotFound) ||
                    ((configurations[childIndex].supported_interfaces & doPPTP) != doPPTP)) {
@@ -2996,7 +3437,7 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i
                }
                parentPrivate->interface_type = kSCNetworkInterfaceTypePPTP;
                parentPrivate->localized_key  = CFSTR("pptp");
                }
                parentPrivate->interface_type = kSCNetworkInterfaceTypePPTP;
                parentPrivate->localized_key  = CFSTR("pptp");
-               parentPrivate->entity_type    = kSCValNetInterfaceSubTypePPTP;  // interface config goes into "PPTP"
+               parentPrivate->entity_type    = kSCEntNetPPTP;                  // interface config goes into "PPTP"
        } else if (CFEqual(interfaceType, kSCNetworkInterfaceType6to4)) {
                if ((childIndex == kCFNotFound) ||
                    ((configurations[childIndex].supported_interfaces & do6to4) != do6to4)) {
        } else if (CFEqual(interfaceType, kSCNetworkInterfaceType6to4)) {
                if ((childIndex == kCFNotFound) ||
                    ((configurations[childIndex].supported_interfaces & do6to4) != do6to4)) {
@@ -3006,8 +3447,17 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i
 
                parentPrivate->interface_type = kSCNetworkInterfaceType6to4;
                parentPrivate->localized_key  = CFSTR("6to4");
 
                parentPrivate->interface_type = kSCNetworkInterfaceType6to4;
                parentPrivate->localized_key  = CFSTR("6to4");
-               parentPrivate->entity_type    = kSCEntNet6to4;
+               parentPrivate->entity_type    = kSCValNetInterfaceType6to4;
                parentPrivate->entity_device  = CFRetain(CFSTR("stf0"));
                parentPrivate->entity_device  = CFRetain(CFSTR("stf0"));
+       } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeIPSec)) {
+               if ((childIndex == kCFNotFound) ||
+                   ((configurations[childIndex].supported_interfaces & doIPSec) != doIPSec)) {
+                       // if the child interface does not support IPSec
+                       goto fail;
+               }
+               parentPrivate->interface_type = kSCNetworkInterfaceTypeIPSec;
+               parentPrivate->localized_key  = CFSTR("ipsec");
+               parentPrivate->entity_type    = kSCValNetInterfaceTypeIPSec;
        } else if (CFStringFind(interfaceType, CFSTR("."), 0).location != kCFNotFound) {
                // if custom interface type
                parentPrivate->interface_type = interfaceType;
        } else if (CFStringFind(interfaceType, CFSTR("."), 0).location != kCFNotFound) {
                // if custom interface type
                parentPrivate->interface_type = interfaceType;
@@ -3021,8 +3471,23 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i
 
        if (childPrivate->overrides != NULL) {
                parentPrivate->overrides = CFDictionaryCreateMutableCopy(NULL, 0, childPrivate->overrides);
 
        if (childPrivate->overrides != NULL) {
                parentPrivate->overrides = CFDictionaryCreateMutableCopy(NULL, 0, childPrivate->overrides);
-       };
-       parentPrivate->sort_order = childPrivate->sort_order;
+       }
+
+       // The following change handles the case where a user has both an Ethernet and
+       // PPPoE network service. Because a PPPoE service is typically associated with
+       // an ISP we want it to be sorted higher in the service order.
+       if ((parentPrivate->entity_subtype != NULL) &&
+           (CFEqual(parentPrivate->entity_subtype, kSCValNetInterfaceSubTypePPPoE))) {
+               if ((childPrivate->interface_type != NULL) &&
+                   (CFEqual(childPrivate->interface_type, kSCNetworkInterfaceTypeIEEE80211))) {
+                       parentPrivate->sort_order = kSortAirportPPP;
+               } else {
+                       parentPrivate->sort_order = kSortEthernetPPP;
+               }
+       } else {
+               // set sort order of the parent to match the child interface
+               parentPrivate->sort_order = childPrivate->sort_order;
+       }
 
        return (SCNetworkInterfaceRef)parentPrivate;
 
 
        return (SCNetworkInterfaceRef)parentPrivate;
 
@@ -3034,6 +3499,51 @@ SCNetworkInterfaceCreateWithInterface(SCNetworkInterfaceRef child, CFStringRef i
 }
 
 
 }
 
 
+__private_extern__
+CFDictionaryRef
+__SCNetworkInterfaceGetDefaultConfiguration(SCNetworkSetRef set, SCNetworkInterfaceRef interface)
+{
+       CFDictionaryRef                 config                  = NULL;
+       CFStringRef                     defaultType;
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+
+       /* initialize runtime (and kSCNetworkInterfaceIPv4) */
+       pthread_once(&initialized, __SCNetworkInterfaceInitialize);
+
+       defaultType = __SCNetworkInterfaceGetDefaultConfigurationType(interface);
+       if (defaultType != NULL) {
+               if (set != NULL) {
+                       CFStringRef     path;
+
+                       path = SCPreferencesPathKeyCreateSetNetworkInterfaceEntity(NULL,                                // allocator
+                                                                                  SCNetworkSetGetSetID(set),           // set
+                                                                                  interfacePrivate->entity_device,     // interface
+                                                                                  defaultType);                        // entity
+                       if (path != NULL) {
+                               config = __getPrefsConfiguration(interfacePrivate->prefs, path);
+                               CFRelease(path);
+
+                               if (config == NULL) {
+                                       // if the "set" does not have a saved configuration, use
+                                       // the [template] "interface" configuration
+                                       if (interfacePrivate->unsaved != NULL) {
+                                               config = CFDictionaryGetValue(interfacePrivate->unsaved, defaultType);
+                                               if (config == (CFDictionaryRef)kCFNull) {
+                                                       config = NULL;
+                                               }
+                                       }
+                               }
+                               if (isA_CFDictionary(config) && (CFDictionaryGetCount(config) == 0)) {
+                                       config = NULL;
+                               }
+                       }
+               }
+       }
+
+       return config;
+}
+
+
 static CFDictionaryRef
 __SCNetworkInterfaceGetConfiguration(SCNetworkInterfaceRef     interface,
                                     CFStringRef                extendedType)
 static CFDictionaryRef
 __SCNetworkInterfaceGetConfiguration(SCNetworkInterfaceRef     interface,
                                     CFStringRef                extendedType)
@@ -3241,7 +3751,7 @@ copy_interface_string(CFBundleRef bundle, CFStringRef key, Boolean localized)
 
 
 static CFStringRef
 
 
 static CFStringRef
-copy_display_name(SCNetworkInterfaceRef interface, Boolean localized)
+copy_display_name(SCNetworkInterfaceRef interface, Boolean localized, Boolean oldLocalization)
 {
        CFMutableStringRef      local;
        CFStringRef             name;
 {
        CFMutableStringRef      local;
        CFStringRef             name;
@@ -3260,8 +3770,13 @@ copy_display_name(SCNetworkInterfaceRef interface, Boolean localized)
 
                if ((bundle != NULL) && (interfacePrivate->localized_key != NULL)) {
                        CFStringRef     fmt;
 
                if ((bundle != NULL) && (interfacePrivate->localized_key != NULL)) {
                        CFStringRef     fmt;
+                       CFStringRef     key     = interfacePrivate->localized_key;
 
 
-                       fmt = copy_interface_string(bundle, interfacePrivate->localized_key, localized);
+                       if (oldLocalization) {
+                               key = CFStringCreateWithFormat(NULL, NULL, CFSTR("X-%@"),
+                                                              interfacePrivate->localized_key);
+                       }
+                       fmt = copy_interface_string(bundle, key, localized);
                        if (fmt != NULL) {
                                CFStringAppendFormat(local,
                                                     NULL,
                        if (fmt != NULL) {
                                CFStringAppendFormat(local,
                                                     NULL,
@@ -3271,6 +3786,9 @@ copy_display_name(SCNetworkInterfaceRef interface, Boolean localized)
                                CFRelease(fmt);
                                added = TRUE;
                        }
                                CFRelease(fmt);
                                added = TRUE;
                        }
+                       if (oldLocalization) {
+                               CFRelease(key);
+                       }
                }
 
                if (!added &&
                }
 
                if (!added &&
@@ -3325,20 +3843,52 @@ copy_display_name(SCNetworkInterfaceRef interface, Boolean localized)
 
 __private_extern__
 CFStringRef
 
 __private_extern__
 CFStringRef
-__SCNetworkInterfaceGetNonLocalizedDisplayName(SCNetworkInterfaceRef interface)
+__SCNetworkInterfaceCopyXLocalizedDisplayName(SCNetworkInterfaceRef interface)
 {
 {
-       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+       CFStringRef                     name;
 
        if (!isA_SCNetworkInterface(interface)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
 
 
        if (!isA_SCNetworkInterface(interface)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
 
-       if (interfacePrivate->name == NULL) {
-               interfacePrivate->name = copy_display_name(interface, FALSE);
-       }
-
-       return interfacePrivate->name;
+       name = copy_display_name(interface, TRUE, TRUE);
+       return name;
+}
+
+
+__private_extern__
+CFStringRef
+__SCNetworkInterfaceCopyXNonLocalizedDisplayName(SCNetworkInterfaceRef interface)
+{
+       CFStringRef                     localized_name;
+
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       localized_name = copy_display_name(interface, FALSE, TRUE);
+       return localized_name;
+}
+
+
+__private_extern__
+CFStringRef
+__SCNetworkInterfaceGetNonLocalizedDisplayName(SCNetworkInterfaceRef interface)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+
+       if (!isA_SCNetworkInterface(interface)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       if (interfacePrivate->name == NULL) {
+               interfacePrivate->name = copy_display_name(interface, FALSE, FALSE);
+       }
+
+       return interfacePrivate->name;
 }
 
 
 }
 
 
@@ -3353,7 +3903,7 @@ SCNetworkInterfaceGetLocalizedDisplayName(SCNetworkInterfaceRef interface)
        }
 
        if (interfacePrivate->localized_name == NULL) {
        }
 
        if (interfacePrivate->localized_name == NULL) {
-               interfacePrivate->localized_name = copy_display_name(interface, TRUE);
+               interfacePrivate->localized_name = copy_display_name(interface, TRUE, FALSE);
        }
 
        return interfacePrivate->localized_name;
        }
 
        return interfacePrivate->localized_name;
@@ -3383,6 +3933,76 @@ SCNetworkInterfaceGetTypeID(void)
 }
 
 
 }
 
 
+__private_extern__
+Boolean
+__SCNetworkInterfaceSetDefaultConfiguration(SCNetworkSetRef            set,
+                                           SCNetworkInterfaceRef       interface,
+                                           CFStringRef                 defaultType,
+                                           CFDictionaryRef             config,
+                                           Boolean                     okToHold)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+       Boolean                         ok                      = FALSE;
+
+       /* initialize runtime (and kSCNetworkInterfaceIPv4) */
+       pthread_once(&initialized, __SCNetworkInterfaceInitialize);
+
+       if (defaultType == NULL) {
+               defaultType = __SCNetworkInterfaceGetDefaultConfigurationType(interface);
+               if (defaultType == NULL) {
+                       return FALSE;
+               }
+       }
+
+       if (isA_CFDictionary(config) && (CFDictionaryGetCount(config) == 0)) {
+               config = NULL;
+       }
+
+       if (set != NULL) {
+               CFStringRef     path;
+
+               path = SCPreferencesPathKeyCreateSetNetworkInterfaceEntity(NULL,                                // allocator
+                                                                          SCNetworkSetGetSetID(set),           // set
+                                                                          interfacePrivate->entity_device,     // interface
+                                                                          defaultType);                        // entity
+               if (path != NULL) {
+                       ok = __setPrefsConfiguration(interfacePrivate->prefs, path, config, FALSE);
+                       CFRelease(path);
+                       if (ok) {
+                               // if configuration has been saved
+                               if (interfacePrivate->unsaved != NULL) {
+                                       CFDictionaryRemoveValue(interfacePrivate->unsaved, defaultType);
+                                       if (CFDictionaryGetCount(interfacePrivate->unsaved) == 0) {
+                                               CFRelease(interfacePrivate->unsaved);
+                                               interfacePrivate->unsaved = NULL;
+                                       }
+                               }
+                       }
+               } else {
+                       if (okToHold) {
+                               if (config == NULL) {
+                                       // remember that we are clearing the configuration
+                                       config = (CFDictionaryRef)kCFNull;
+                               }
+
+                               if (interfacePrivate->unsaved == NULL) {
+                                       interfacePrivate->unsaved = CFDictionaryCreateMutable(NULL,
+                                                                                             0,
+                                                                                             &kCFTypeDictionaryKeyCallBacks,
+                                                                                             &kCFTypeDictionaryValueCallBacks);
+                               }
+                               CFDictionarySetValue(interfacePrivate->unsaved, defaultType, config);
+                               ok = TRUE;
+                       } else {
+                               _SCErrorSet(kSCStatusNoKey);
+                       }
+               }
+       }
+
+       return ok;
+}
+
+
 __private_extern__
 Boolean
 __SCNetworkInterfaceSetConfiguration(SCNetworkInterfaceRef     interface,
 __private_extern__
 Boolean
 __SCNetworkInterfaceSetConfiguration(SCNetworkInterfaceRef     interface,
@@ -3658,7 +4278,7 @@ getPasswordID(CFDictionaryRef config, CFStringRef serviceID)
 static CFStringRef
 copySharedSecretID(CFDictionaryRef config, CFStringRef serviceID)
 {
 static CFStringRef
 copySharedSecretID(CFDictionaryRef config, CFStringRef serviceID)
 {
-       CFMutableStringRef      sharedSecret    = NULL;
+       CFMutableStringRef      shared_id       = NULL;
 
        if (config != NULL) {
                CFStringRef     encryption;
 
        if (config != NULL) {
                CFStringRef     encryption;
@@ -3666,22 +4286,52 @@ copySharedSecretID(CFDictionaryRef config, CFStringRef serviceID)
                encryption = CFDictionaryGetValue(config, kSCPropNetIPSecSharedSecretEncryption);
                if (isA_CFString(encryption) &&
                    CFEqual(encryption, kSCValNetIPSecSharedSecretEncryptionKeychain)) {
                encryption = CFDictionaryGetValue(config, kSCPropNetIPSecSharedSecretEncryption);
                if (isA_CFString(encryption) &&
                    CFEqual(encryption, kSCValNetIPSecSharedSecretEncryptionKeychain)) {
-                       sharedSecret = (CFMutableStringRef)CFDictionaryGetValue(config, kSCPropNetIPSecSharedSecret);
-                       if (sharedSecret != NULL) {
-                               CFRetain(sharedSecret);
+                       shared_id = (CFMutableStringRef)CFDictionaryGetValue(config, kSCPropNetIPSecSharedSecret);
+                       if (shared_id != NULL) {
+                               CFRetain(shared_id);
+                       }
+               }
+       }
+
+       if (shared_id == NULL) {
+               CFStringRef     unique_id;
+
+               unique_id = getPasswordID(config, serviceID);
+               shared_id = CFStringCreateMutableCopy(NULL, 0, unique_id);
+               CFStringAppend(shared_id, CFSTR(".SS"));
+       }
+
+       return shared_id;
+}
+
+
+static CFStringRef
+copyXAuthID(CFDictionaryRef config, CFStringRef serviceID)
+{
+       CFMutableStringRef      xauth_id        = NULL;
+
+       if (config != NULL) {
+               CFStringRef     encryption;
+
+               encryption = CFDictionaryGetValue(config, kSCPropNetIPSecXAuthPasswordEncryption);
+               if (isA_CFString(encryption) &&
+                   CFEqual(encryption, kSCValNetIPSecXAuthPasswordEncryptionKeychain)) {
+                       xauth_id = (CFMutableStringRef)CFDictionaryGetValue(config, kSCPropNetIPSecXAuthPassword);
+                       if (xauth_id != NULL) {
+                               CFRetain(xauth_id);
                        }
                }
        }
 
                        }
                }
        }
 
-       if (sharedSecret == NULL) {
+       if (xauth_id == NULL) {
                CFStringRef     unique_id;
 
                unique_id = getPasswordID(config, serviceID);
                CFStringRef     unique_id;
 
                unique_id = getPasswordID(config, serviceID);
-               sharedSecret = CFStringCreateMutableCopy(NULL, 0, unique_id);
-               CFStringAppend(sharedSecret, CFSTR(".SS"));
+               xauth_id = CFStringCreateMutableCopy(NULL, 0, unique_id);
+               CFStringAppend(xauth_id, CFSTR(".XAUTH"));
        }
 
        }
 
-       return sharedSecret;
+       return xauth_id;
 }
 
 
 }
 
 
@@ -3694,20 +4344,17 @@ checkInterfacePassword(SCNetworkInterfaceRef            interface,
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 
        if (!isA_SCNetworkInterface(interface)) {
        SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
 
        if (!isA_SCNetworkInterface(interface)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
+               goto error;
        }
 
        *serviceID = interfacePrivate->serviceID;
        if (*serviceID == NULL) {
        }
 
        *serviceID = interfacePrivate->serviceID;
        if (*serviceID == NULL) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
+               goto error;
        }
 
        *prefs = interfacePrivate->prefs;
        if (*prefs == NULL) {
        }
 
        *prefs = interfacePrivate->prefs;
        if (*prefs == NULL) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
+               goto error;
        }
 
        switch (passwordType) {
        }
 
        switch (passwordType) {
@@ -3715,45 +4362,61 @@ checkInterfacePassword(SCNetworkInterfaceRef            interface,
                        CFStringRef     interfaceType;
 
                        interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
                        CFStringRef     interfaceType;
 
                        interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
-                       if (!CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) {
-                               _SCErrorSet(kSCStatusInvalidArgument);
-                               return FALSE;
+                       if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) {
+                               // if PPP
+                               break;
                        }
                        }
-                       break;
+
+                       goto error;
                }
 
                case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
                }
 
                case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
-                       CFStringRef             interfaceType;
+                       CFStringRef     interfaceType;
 
                        interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
 
                        interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
-                       if (!CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) {
-                               _SCErrorSet(kSCStatusInvalidArgument);
-                               return FALSE;
-                       }
-
-                       interface = SCNetworkInterfaceGetInterface(interface);
-                       if (interface == NULL) {
-                               _SCErrorSet(kSCStatusInvalidArgument);
-                               return FALSE;
+                       if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) {
+                               interface = SCNetworkInterfaceGetInterface(interface);
+                               if (interface != NULL) {
+                                       interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
+                                       if (CFEqual(interfaceType, kSCNetworkInterfaceTypeL2TP)) {
+                                               // if PPP->L2TP interface
+                                               break;
+                                       }
+                               }
+                       } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeIPSec)) {
+                               // if IPSec interface
+                               break;
                        }
 
                        }
 
-                       interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
-                       if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeL2TP)) {
-                               _SCErrorSet(kSCStatusInvalidArgument);
-                               return FALSE;
-                       }
-                       break;
+                       goto error;
                }
 
                case kSCNetworkInterfacePasswordTypeEAPOL : {
                        break;
                }
 
                }
 
                case kSCNetworkInterfacePasswordTypeEAPOL : {
                        break;
                }
 
+               case kSCNetworkInterfacePasswordTypeIPSecXAuth : {
+                       CFStringRef     interfaceType;
+
+                       interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
+                       if (CFEqual(interfaceType, kSCNetworkInterfaceTypeIPSec)) {
+                               // if IPSec interface
+                               break;
+                       }
+
+                       goto error;
+               }
+
                default :
                        break;
        }
 
        return TRUE;
                default :
                        break;
        }
 
        return TRUE;
+
+    error :
+
+       _SCErrorSet(kSCStatusInvalidArgument);
+       return FALSE;
 }
 
 
 }
 
 
@@ -3793,10 +4456,16 @@ SCNetworkInterfaceCheckPassword(SCNetworkInterfaceRef           interface,
 
                case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
                        CFDictionaryRef config;
 
                case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
                        CFDictionaryRef config;
+                       Boolean         extended;
                        CFStringRef     shared_id;
 
                        // get configuration
                        CFStringRef     shared_id;
 
                        // get configuration
-                       config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec);
+                       extended = CFEqual(SCNetworkInterfaceGetInterfaceType(interface), kSCNetworkInterfaceTypePPP);
+                       if (extended) {
+                               config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec);
+                       } else {
+                               config = SCNetworkInterfaceGetConfiguration(interface);
+                       }
 
                        // get sharedSecret ID
                        shared_id = copySharedSecretID(config, serviceID);
 
                        // get sharedSecret ID
                        shared_id = copySharedSecretID(config, serviceID);
@@ -3833,6 +4502,28 @@ SCNetworkInterfaceCheckPassword(SCNetworkInterfaceRef            interface,
                        break;
                }
 
                        break;
                }
 
+               case kSCNetworkInterfacePasswordTypeIPSecXAuth : {
+                       CFDictionaryRef config;
+                       CFStringRef     xauth_id;
+
+                       // get configuration
+                       config = SCNetworkInterfaceGetConfiguration(interface);
+
+                       // get XAuth ID
+                       xauth_id = copyXAuthID(config, serviceID);
+
+                       // check
+                       exists = __extract_password(prefs,
+                                                   config,
+                                                   kSCPropNetIPSecXAuthPassword,
+                                                   kSCPropNetIPSecXAuthPasswordEncryption,
+                                                   kSCValNetIPSecXAuthPasswordEncryptionKeychain,
+                                                   xauth_id,
+                                                   NULL);
+                       CFRelease(xauth_id);
+                       break;
+               }
+
                default :
                        _SCErrorSet(kSCStatusInvalidArgument);
                        return FALSE;
                default :
                        _SCErrorSet(kSCStatusInvalidArgument);
                        return FALSE;
@@ -3878,10 +4569,16 @@ SCNetworkInterfaceCopyPassword(SCNetworkInterfaceRef            interface,
 
                case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
                        CFDictionaryRef config;
 
                case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
                        CFDictionaryRef config;
+                       Boolean         extended;
                        CFStringRef     shared_id;
 
                        // get configuration
                        CFStringRef     shared_id;
 
                        // get configuration
-                       config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec);
+                       extended = CFEqual(SCNetworkInterfaceGetInterfaceType(interface), kSCNetworkInterfaceTypePPP);
+                       if (extended) {
+                               config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec);
+                       } else {
+                               config = SCNetworkInterfaceGetConfiguration(interface);
+                       }
 
                        // get sharedSecret ID
                        shared_id = copySharedSecretID(config, serviceID);
 
                        // get sharedSecret ID
                        shared_id = copySharedSecretID(config, serviceID);
@@ -3920,6 +4617,28 @@ SCNetworkInterfaceCopyPassword(SCNetworkInterfaceRef             interface,
                        break;
                }
 
                        break;
                }
 
+               case kSCNetworkInterfacePasswordTypeIPSecXAuth : {
+                       CFDictionaryRef config;
+                       CFStringRef     xauth_id;
+
+                       // get configuration
+                       config = SCNetworkInterfaceGetConfiguration(interface);
+
+                       // get XAuth ID
+                       xauth_id = copyXAuthID(config, serviceID);
+
+                       // extract
+                       (void) __extract_password(prefs,
+                                                 config,
+                                                 kSCPropNetIPSecXAuthPassword,
+                                                 kSCPropNetIPSecXAuthPasswordEncryption,
+                                                 kSCValNetIPSecXAuthPasswordEncryptionKeychain,
+                                                 xauth_id,
+                                                 &password);
+                       CFRelease(xauth_id);
+                       break;
+               }
+
                default :
                        _SCErrorSet(kSCStatusInvalidArgument);
                        return NULL;
                default :
                        _SCErrorSet(kSCStatusInvalidArgument);
                        return NULL;
@@ -3944,6 +4663,7 @@ SCNetworkInterfaceRemovePassword(SCNetworkInterfaceRef            interface,
        switch (passwordType) {
                case kSCNetworkInterfacePasswordTypePPP : {
                        CFDictionaryRef config;
        switch (passwordType) {
                case kSCNetworkInterfacePasswordTypePPP : {
                        CFDictionaryRef config;
+                       CFDictionaryRef newConfig       = NULL;
                        CFStringRef     unique_id;
 
                        // get configuration
                        CFStringRef     unique_id;
 
                        // get configuration
@@ -3953,45 +4673,56 @@ SCNetworkInterfaceRemovePassword(SCNetworkInterfaceRef          interface,
                        unique_id = getPasswordID(config, serviceID);
 
                        // remove password
                        unique_id = getPasswordID(config, serviceID);
 
                        // remove password
-                       ok = _SCPreferencesSystemKeychainPasswordItemRemove(prefs, unique_id);
+                       ok = __remove_password(prefs,
+                                              config,
+                                              kSCPropNetPPPAuthPassword,
+                                              kSCPropNetPPPAuthPasswordEncryption,
+                                              kSCValNetPPPAuthPasswordEncryptionKeychain,
+                                              unique_id,
+                                              &newConfig);
                        if (ok) {
                        if (ok) {
-                               CFMutableDictionaryRef  newConfig;
-
-                               if (config != NULL) {
-                                       newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
-                                       CFDictionaryRemoveValue(newConfig, kSCPropNetPPPAuthPassword);
-                                       CFDictionaryRemoveValue(newConfig, kSCPropNetPPPAuthPasswordEncryption);
-                                       ok = SCNetworkInterfaceSetConfiguration(interface, newConfig);
-                                       CFRelease(newConfig);
-                               }
+                               ok = SCNetworkInterfaceSetConfiguration(interface, newConfig);
+                               if (newConfig != NULL) CFRelease(newConfig);
                        }
                        }
+
                        break;
                }
 
                case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
                        CFDictionaryRef config;
                        break;
                }
 
                case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
                        CFDictionaryRef config;
+                       Boolean         extended;
+                       CFDictionaryRef newConfig       = NULL;
                        CFStringRef     shared_id;
 
                        // get configuration
                        CFStringRef     shared_id;
 
                        // get configuration
-                       config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec);
+                       extended = CFEqual(SCNetworkInterfaceGetInterfaceType(interface), kSCNetworkInterfaceTypePPP);
+                       if (extended) {
+                               config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec);
+                       } else {
+                               config = SCNetworkInterfaceGetConfiguration(interface);
+                       }
 
                        // get sharedSecret ID
                        shared_id = copySharedSecretID(config, serviceID);
 
                        // remove password
 
                        // get sharedSecret ID
                        shared_id = copySharedSecretID(config, serviceID);
 
                        // remove password
-                       ok = _SCPreferencesSystemKeychainPasswordItemRemove(prefs, shared_id);
+                       ok = __remove_password(prefs,
+                                              config,
+                                              kSCPropNetIPSecSharedSecret,
+                                              kSCPropNetIPSecSharedSecretEncryption,
+                                              kSCValNetIPSecSharedSecretEncryptionKeychain,
+                                              shared_id,
+                                              &newConfig);
                        if (ok) {
                        if (ok) {
-                               CFMutableDictionaryRef  newConfig;
-
-                               if (config != NULL) {
-                                       newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
-                                       CFDictionaryRemoveValue(newConfig, kSCPropNetIPSecSharedSecret);
-                                       CFDictionaryRemoveValue(newConfig, kSCPropNetIPSecSharedSecretEncryption);
+                               if (extended) {
                                        ok = SCNetworkInterfaceSetExtendedConfiguration(interface,
                                                                                        kSCEntNetIPSec,
                                                                                        newConfig);
                                        ok = SCNetworkInterfaceSetExtendedConfiguration(interface,
                                                                                        kSCEntNetIPSec,
                                                                                        newConfig);
-                                       CFRelease(newConfig);
+                               } else {
+                                       ok = SCNetworkInterfaceSetConfiguration(interface,
+                                                                               newConfig);
                                }
                                }
+                               if (newConfig != NULL) CFRelease(newConfig);
                        }
 
                        CFRelease(shared_id);
                        }
 
                        CFRelease(shared_id);
@@ -4019,6 +4750,34 @@ SCNetworkInterfaceRemovePassword(SCNetworkInterfaceRef           interface,
                        break;
                }
 
                        break;
                }
 
+               case kSCNetworkInterfacePasswordTypeIPSecXAuth : {
+                       CFDictionaryRef config;
+                       CFDictionaryRef newConfig       = NULL;
+                       CFStringRef     xauth_id;
+
+                       // get configuration
+                       config = SCNetworkInterfaceGetConfiguration(interface);
+
+                       // get XAuth ID
+                       xauth_id = copyXAuthID(config, serviceID);
+
+                       // remove password
+                       ok = __remove_password(prefs,
+                                              config,
+                                              kSCPropNetIPSecXAuthPassword,
+                                              kSCPropNetIPSecXAuthPasswordEncryption,
+                                              kSCValNetIPSecXAuthPasswordEncryptionKeychain,
+                                              xauth_id,
+                                              &newConfig);
+                       if (ok) {
+                               ok = SCNetworkInterfaceSetConfiguration(interface, newConfig);
+                               if (newConfig != NULL) CFRelease(newConfig);
+                       }
+
+                       CFRelease(xauth_id);
+                       break;
+               }
+
                default :
                        _SCErrorSet(kSCStatusInvalidArgument);
                        return FALSE;
                default :
                        _SCErrorSet(kSCStatusInvalidArgument);
                        return FALSE;
@@ -4083,7 +4842,7 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef               interface,
                        if (bundle != NULL) {
                                // "PPP Password" --> keychain "Kind"
                                description = CFBundleCopyLocalizedString(bundle,
                        if (bundle != NULL) {
                                // "PPP Password" --> keychain "Kind"
                                description = CFBundleCopyLocalizedString(bundle,
-                                                                         CFSTR("KEYCHAIN_PPP_PASSWORD"),
+                                                                         CFSTR("KEYCHAIN_KIND_PPP_PASSWORD"),
                                                                          CFSTR("PPP Password"),
                                                                          NULL);
                        }
                                                                          CFSTR("PPP Password"),
                                                                          NULL);
                        }
@@ -4091,7 +4850,7 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef               interface,
                        // store password
                        ok = _SCPreferencesSystemKeychainPasswordItemSet(prefs,
                                                                         unique_id,
                        // store password
                        ok = _SCPreferencesSystemKeychainPasswordItemSet(prefs,
                                                                         unique_id,
-                                                                        (label != NULL)       ? label       : CFSTR("PPP"),
+                                                                        (label != NULL)       ? label       : CFSTR("Network Connection"),
                                                                         (description != NULL) ? description : CFSTR("PPP Password"),
                                                                         account,
                                                                         password,
                                                                         (description != NULL) ? description : CFSTR("PPP Password"),
                                                                         account,
                                                                         password,
@@ -4123,19 +4882,47 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef             interface,
                }
 
                case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
                }
 
                case kSCNetworkInterfacePasswordTypeIPSecSharedSecret : {
-                       SCNetworkServiceRef     service = NULL;
+                       CFDictionaryRef         baseConfig      = NULL;
+                       Boolean                 extended;
+                       SCNetworkServiceRef     service         = NULL;
                        CFStringRef             shared_id;
 
                        // get configuration
                        CFStringRef             shared_id;
 
                        // get configuration
-                       config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec);
+                       extended = CFEqual(SCNetworkInterfaceGetInterfaceType(interface), kSCNetworkInterfaceTypePPP);
+                       config = SCNetworkInterfaceGetConfiguration(interface);
+                       if (extended) {
+                               baseConfig = config;
+                               config = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec);
+                       }
 
                        // get sharedSecret ID
                        shared_id = copySharedSecretID(config, serviceID);
 
 
                        // get sharedSecret ID
                        shared_id = copySharedSecretID(config, serviceID);
 
-                       // get "Name", "Kind"
+                       // get "Account", "Name", "Kind"
                        if (config != NULL) {
                        if (config != NULL) {
+                               CFStringRef     localIdentifier;
+                               CFStringRef     localIdentifierType;
+
+                               if (CFDictionaryGetValueIfPresent(config,
+                                                                 kSCPropNetIPSecLocalIdentifierType,
+                                                                 (const void **)&localIdentifierType)
+                                   && CFEqual(localIdentifierType, kSCValNetIPSecLocalIdentifierTypeKeyID)
+                                   && CFDictionaryGetValueIfPresent(config,
+                                                                    kSCPropNetIPSecLocalIdentifier,
+                                                                    (const void **)&localIdentifier)
+                                   && isA_CFString(localIdentifier)) {
+                                       // local identifier --> keychain "Account"
+                                       account = localIdentifier;
+                               }
+
                                // PPP [user defined] "name" --> keychain "Name"
                                // PPP [user defined] "name" --> keychain "Name"
-                               label = CFDictionaryGetValue(config, kSCPropUserDefinedName);
+                               if (!extended) {
+                                       label = CFDictionaryGetValue(config, kSCPropUserDefinedName);
+                               } else {
+                                       if (baseConfig != NULL) {
+                                               label = CFDictionaryGetValue(baseConfig, kSCPropUserDefinedName);
+                                       }
+                               }
                        }
 
                        if (label == NULL) {
                        }
 
                        if (label == NULL) {
@@ -4155,7 +4942,7 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef               interface,
                        if (bundle != NULL) {
                                // "IPSec Shared Secret" --> keychain "Kind"
                                description = CFBundleCopyLocalizedString(bundle,
                        if (bundle != NULL) {
                                // "IPSec Shared Secret" --> keychain "Kind"
                                description = CFBundleCopyLocalizedString(bundle,
-                                                                         CFSTR("KEYCHAIN_IPSEC_SHARED_SECRET"),
+                                                                         CFSTR("KEYCHAIN_KIND_IPSEC_SHARED_SECRET"),
                                                                          CFSTR("IPSec Shared Secret"),
                                                                          NULL);
                        }
                                                                          CFSTR("IPSec Shared Secret"),
                                                                          NULL);
                        }
@@ -4163,9 +4950,9 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef               interface,
                        // set password
                        ok = _SCPreferencesSystemKeychainPasswordItemSet(prefs,
                                                                         shared_id,
                        // set password
                        ok = _SCPreferencesSystemKeychainPasswordItemSet(prefs,
                                                                         shared_id,
-                                                                        (label != NULL)       ? label       : CFSTR("PPP"),
+                                                                        (label != NULL)       ? label       : CFSTR("VPN Connection"),
                                                                         (description != NULL) ? description : CFSTR("IPSec Shared Secret"),
                                                                         (description != NULL) ? description : CFSTR("IPSec Shared Secret"),
-                                                                        NULL,
+                                                                        account,
                                                                         password,
                                                                         options);
                        if (ok) {
                                                                         password,
                                                                         options);
                        if (ok) {
@@ -4185,9 +4972,13 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef              interface,
                                CFDictionarySetValue(newConfig,
                                                     kSCPropNetIPSecSharedSecretEncryption,
                                                     kSCValNetIPSecSharedSecretEncryptionKeychain);
                                CFDictionarySetValue(newConfig,
                                                     kSCPropNetIPSecSharedSecretEncryption,
                                                     kSCValNetIPSecSharedSecretEncryptionKeychain);
-                               ok = SCNetworkInterfaceSetExtendedConfiguration(interface,
-                                                                               kSCEntNetIPSec,
-                                                                               newConfig);
+                               if (extended) {
+                                       ok = SCNetworkInterfaceSetExtendedConfiguration(interface,
+                                                                                       kSCEntNetIPSec,
+                                                                                       newConfig);
+                               } else {
+                                       ok = SCNetworkInterfaceSetConfiguration(interface, newConfig);
+                               }
                                CFRelease(newConfig);
                        }
 
                                CFRelease(newConfig);
                        }
 
@@ -4198,6 +4989,7 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef               interface,
                }
 
                case kSCNetworkInterfacePasswordTypeEAPOL : {
                }
 
                case kSCNetworkInterfacePasswordTypeEAPOL : {
+                       CFStringRef     account         = NULL;
                        CFStringRef     unique_id       = NULL;
 
                        // get configuration
                        CFStringRef     unique_id       = NULL;
 
                        // get configuration
@@ -4217,26 +5009,46 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef             interface,
                                CFRelease(uuid);
                        }
 
                                CFRelease(uuid);
                        }
 
+                       // 802.1x UserName --> keychain "Account"
+                       if (config != NULL) {
+                               account = CFDictionaryGetValue(config, kEAPClientPropUserName);
+                       }
+
                        // get "Name", "Kind"
                        if (bundle != NULL) {
                        // get "Name", "Kind"
                        if (bundle != NULL) {
-                               // "802.1X Password" --> keychain "Name"
-                               label = CFBundleCopyLocalizedString(bundle,
-                                                                   CFSTR("KEYCHAIN_EAPOL_PASSWORD"),
-                                                                   CFSTR("802.1X Password"),
-                                                                   NULL);
-                               // "Internet Connect" --> keychain "Kind"
+                               CFStringRef     interface_name;
+
+                               // "Network Connection (%@)" --> keychain "Name"
+                               interface_name = SCNetworkInterfaceGetLocalizedDisplayName(interface);
+                               if (interface_name != NULL) {
+                                       CFStringRef     label_fmt;
+
+                                       label_fmt = CFBundleCopyLocalizedString(bundle,
+                                                                               CFSTR("KEYCHAIN_DESCRIPTION_EAPOL_INTERFACE"),
+                                                                               CFSTR("Network Connection (%@)"),
+                                                                               NULL);
+                                       label = CFStringCreateWithFormat(NULL, NULL, label_fmt, interface_name);
+                                       CFRelease(label_fmt);
+                               } else {
+                                       label = CFBundleCopyLocalizedString(bundle,
+                                                                           CFSTR("KEYCHAIN_DESCRIPTION_EAPOL"),
+                                                                           CFSTR("Network Connection"),
+                                                                           NULL);
+                               }
+
+                               // "802.1X Password" --> keychain "Kind"
                                description = CFBundleCopyLocalizedString(bundle,
                                description = CFBundleCopyLocalizedString(bundle,
-                                                                         CFSTR("KEYCHAIN_INTERNET_CONNECT"),
-                                                                         CFSTR("Internet Connect"),
+                                                                         CFSTR("KEYCHAIN_KIND_EAPOL"),
+                                                                         CFSTR("802.1X Password"),
                                                                          NULL);
                        }
 
                        // set password
                        ok = _SCPreferencesSystemKeychainPasswordItemSet(prefs,
                                                                         unique_id,
                                                                          NULL);
                        }
 
                        // set password
                        ok = _SCPreferencesSystemKeychainPasswordItemSet(prefs,
                                                                         unique_id,
-                                                                        (label != NULL)       ? label       : CFSTR("802.1X Password"),
-                                                                        (description != NULL) ? description : CFSTR("Internet Connect"),
-                                                                        NULL,
+                                                                        (label != NULL)       ? label       : CFSTR("Network Connection"),
+                                                                        (description != NULL) ? description : CFSTR("802.1X Password"),
+                                                                        account,
                                                                         password,
                                                                         options);
                        if (ok) {
                                                                         password,
                                                                         options);
                        if (ok) {
@@ -4265,6 +5077,82 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef              interface,
                        break;
                }
 
                        break;
                }
 
+               case kSCNetworkInterfacePasswordTypeIPSecXAuth : {
+                       SCNetworkServiceRef     service = NULL;
+                       CFStringRef             xauth_id;
+
+                       // get configuration
+                       config = SCNetworkInterfaceGetConfiguration(interface);
+
+                       // get XAuth ID
+                       xauth_id = copyXAuthID(config, serviceID);
+
+                       // get "Account", "Name", "Kind"
+                       if (config != NULL) {
+                               // auth name --> keychain "Account"
+                               account = CFDictionaryGetValue(config, kSCPropNetIPSecXAuthName);
+
+                               // IPSec [user defined] "name" --> keychain "Name"
+                               label = CFDictionaryGetValue(config, kSCPropUserDefinedName);
+                       }
+
+                       if (label == NULL) {
+                               // service name --> keychain "Name"
+                               service = (SCNetworkServiceRef)__SCNetworkServiceCreatePrivate(NULL,
+                                                                                              prefs,
+                                                                                              serviceID,
+                                                                                              interface);
+
+                               label = SCNetworkServiceGetName(service);
+                               if (label == NULL) {
+                                       // interface name --> keychain "Name"
+                                       label = SCNetworkInterfaceGetLocalizedDisplayName(interface);
+                               }
+                       }
+
+                       if (bundle != NULL) {
+                               // "IPSec XAuth Password" --> keychain "Kind"
+                               description = CFBundleCopyLocalizedString(bundle,
+                                                                         CFSTR("KEYCHAIN_KIND_IPSEC_XAUTH_PASSWORD"),
+                                                                         CFSTR("IPSec XAuth Password"),
+                                                                         NULL);
+                       }
+
+                       // store password
+                       ok = _SCPreferencesSystemKeychainPasswordItemSet(prefs,
+                                                                        xauth_id,
+                                                                        (label != NULL)       ? label       : CFSTR("VPN Connection"),
+                                                                        (description != NULL) ? description : CFSTR("IPSec XAuth Password"),
+                                                                        account,
+                                                                        password,
+                                                                        options);
+                       if (ok) {
+                               CFMutableDictionaryRef  newConfig;
+
+                               if (config != NULL) {
+                                       newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
+                               } else {
+                                       newConfig = CFDictionaryCreateMutable(NULL,
+                                                                             0,
+                                                                             &kCFTypeDictionaryKeyCallBacks,
+                                                                             &kCFTypeDictionaryValueCallBacks);
+                               }
+                               CFDictionarySetValue(newConfig,
+                                                    kSCPropNetIPSecXAuthPassword,
+                                                    xauth_id);
+                               CFDictionarySetValue(newConfig,
+                                                    kSCPropNetIPSecXAuthPasswordEncryption,
+                                                    kSCValNetIPSecXAuthPasswordEncryptionKeychain);
+                               ok = SCNetworkInterfaceSetConfiguration(interface, newConfig);
+                               CFRelease(newConfig);
+                       }
+
+                       CFRelease(xauth_id);
+                       if (description != NULL) CFRelease(description);
+                       if (service     != NULL) CFRelease(service);
+                       break;
+               }
+
                default :
                        _SCErrorSet(kSCStatusInvalidArgument);
                        break;
                default :
                        _SCErrorSet(kSCStatusInvalidArgument);
                        break;
@@ -4281,16 +5169,30 @@ SCNetworkInterfaceSetPassword(SCNetworkInterfaceRef             interface,
 SCNetworkInterfaceRef
 _SCNetworkInterfaceCreateWithIONetworkInterfaceObject(io_object_t if_obj)
 {
 SCNetworkInterfaceRef
 _SCNetworkInterfaceCreateWithIONetworkInterfaceObject(io_object_t if_obj)
 {
-       SCNetworkInterfaceRef   interface;
+       SCNetworkInterfaceRef   interface       = NULL;
 
        /* initialize runtime */
        pthread_once(&initialized, __SCNetworkInterfaceInitialize);
 
 
        /* initialize runtime */
        pthread_once(&initialized, __SCNetworkInterfaceInitialize);
 
-       interface = createInterface(if_obj, processNetworkInterface);
+       if (IOObjectConformsTo(if_obj, kIONetworkInterfaceClass)) {
+               interface = createInterface(if_obj, processNetworkInterface);
+       } else if (IOObjectConformsTo(if_obj, kIOSerialBSDServiceValue)) {
+               interface = createInterface(if_obj, processSerialInterface);
+       }
+
        return interface;
 }
 
 
        return interface;
 }
 
 
+CFStringRef
+_SCNetworkInterfaceGetConfigurationAction(SCNetworkInterfaceRef interface)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+
+       return interfacePrivate->configurationAction;
+}
+
+
 CFDataRef
 _SCNetworkInterfaceGetHardwareAddress(SCNetworkInterfaceRef interface)
 {
 CFDataRef
 _SCNetworkInterfaceGetHardwareAddress(SCNetworkInterfaceRef interface)
 {
@@ -4339,6 +5241,109 @@ _SCNetworkInterfaceIsBuiltin(SCNetworkInterfaceRef interface)
 #pragma mark -
 #pragma mark SCNetworkInterface SPIs
 
 #pragma mark -
 #pragma mark SCNetworkInterface SPIs
 
+
+CFStringRef
+_SCNetworkInterfaceCopySlashDevPath(SCNetworkInterfaceRef interface)
+{
+       io_registry_entry_t             device;
+       io_iterator_t                   device_iterator         = MACH_PORT_NULL;
+       CFStringRef                     device_path             = NULL;
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+       kern_return_t                   kr;
+       CFStringRef                     match_keys[2];
+       CFTypeRef                       match_vals[2];
+       CFDictionaryRef                 match_dict;
+       CFDictionaryRef                 matching;
+
+       if (interfacePrivate->entity_device == NULL) {
+               return NULL;
+       }
+
+       if (interfacePrivate->entity_device_unique == NULL) {
+               goto done;
+       }
+
+       match_keys[0] = CFSTR(kIOTTYBaseNameKey);
+       match_vals[0] = interfacePrivate->entity_device;
+       match_dict = CFDictionaryCreate(NULL,
+                                       (const void **)match_keys,
+                                       (const void **)match_vals,
+                                       1,
+                                       &kCFTypeDictionaryKeyCallBacks,
+                                       &kCFTypeDictionaryValueCallBacks);
+
+       match_keys[0] = CFSTR(kIOProviderClassKey);
+       match_vals[0] = CFSTR(kIOSerialBSDServiceValue);
+       match_keys[1] = CFSTR(kIOPropertyMatchKey);
+       match_vals[1] = match_dict;
+       matching = CFDictionaryCreate(NULL,
+                                     (const void **)match_keys,
+                                     (const void **)match_vals,
+                                     sizeof(match_keys)/sizeof(match_keys[0]),
+                                     &kCFTypeDictionaryKeyCallBacks,
+                                     &kCFTypeDictionaryValueCallBacks);
+       CFRelease(match_dict);
+
+       // note: this "matching" dictionary will be consumed by the call to IOServiceGetMatchingServices
+       kr = IOServiceGetMatchingServices(masterPort, matching, &device_iterator);
+       if (kr != kIOReturnSuccess) {
+               SCLog(TRUE, LOG_DEBUG, CFSTR("IOServiceGetMatchingServices() failed, kr = 0x%x"), kr);
+               goto done;
+       }
+
+       while ((device_path == NULL) &&
+              ((device = IOIteratorNext(device_iterator)) != MACH_PORT_NULL)) {
+               CFDictionaryRef overrides;
+
+               overrides = IORegistryEntrySearchCFProperty(device,
+                                                           kIOServicePlane,
+                                                           CFSTR("DeviceModemOverrides"),
+                                                           NULL,
+                                                           kIORegistryIterateRecursively | kIORegistryIterateParents);
+               if (overrides != NULL) {
+                       if (isA_CFDictionary(overrides)) {
+                               CFStringRef     matchIdentifier;
+
+                               matchIdentifier = CFDictionaryGetValue(overrides, CFSTR("UniqueIdentifier"));
+                               if (isA_CFString(matchIdentifier) &&
+                                   CFEqual(interfacePrivate->entity_device_unique, matchIdentifier)) {
+                                       device_path = IORegistryEntryCreateCFProperty(device,
+                                                                                     CFSTR(kIOTTYDeviceKey),
+                                                                                     NULL,
+                                                                                     0);
+                               }
+                       }
+                       CFRelease(overrides);
+               }
+               IOObjectRelease(device);
+       }
+
+       IOObjectRelease(device_iterator);
+
+    done :
+
+       if (device_path == NULL) {
+               // if we haven't found an exact match to our UniqueIdentifier
+               // so we simply return the base name.
+               device_path = SCNetworkInterfaceGetBSDName(interface);
+               if (device_path != NULL) {
+                       CFRetain(device_path);
+               }
+       }
+
+       return device_path;
+}
+
+
+Boolean
+_SCNetworkInterfaceIsBluetoothPAN(SCNetworkInterfaceRef interface)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+
+       return (interfacePrivate->sort_order == kSortBluetoothPAN);
+}
+
+
 Boolean
 _SCNetworkInterfaceIsModemV92(SCNetworkInterfaceRef interface)
 {
 Boolean
 _SCNetworkInterfaceIsModemV92(SCNetworkInterfaceRef interface)
 {
@@ -4348,6 +5353,15 @@ _SCNetworkInterfaceIsModemV92(SCNetworkInterfaceRef interface)
 }
 
 
 }
 
 
+Boolean
+_SCNetworkInterfaceIsTethered(SCNetworkInterfaceRef interface)
+{
+       SCNetworkInterfacePrivateRef    interfacePrivate        = (SCNetworkInterfacePrivateRef)interface;
+
+       return (interfacePrivate->sort_order == kSortTethered);
+}
+
+
 #pragma mark -
 #pragma mark SCNetworkInterface [internal] SPIs
 
 #pragma mark -
 #pragma mark SCNetworkInterface [internal] SPIs
 
@@ -4365,6 +5379,10 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef            allocator,
        /* initialize runtime (and kSCNetworkInterfaceIPv4) */
        pthread_once(&initialized, __SCNetworkInterfaceInitialize);
 
        /* initialize runtime (and kSCNetworkInterfaceIPv4) */
        pthread_once(&initialized, __SCNetworkInterfaceInitialize);
 
+       if (interface == kSCNetworkInterfaceIPv4) {
+               return (SCNetworkInterfacePrivateRef)CFRetain(interface);
+       }
+
        newPrivate = __SCNetworkInterfaceCreatePrivate(NULL, NULL, prefs, serviceID, NULL);
        newPrivate->interface_type              = oldPrivate->interface_type;
        if (oldPrivate->interface != NULL) {
        newPrivate = __SCNetworkInterfaceCreatePrivate(NULL, NULL, prefs, serviceID, NULL);
        newPrivate->interface_type              = oldPrivate->interface_type;
        if (oldPrivate->interface != NULL) {
@@ -4392,6 +5410,9 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef             allocator,
        if (oldPrivate->entity_device != NULL) {
                newPrivate->entity_device       = CFRetain(oldPrivate->entity_device);
        }
        if (oldPrivate->entity_device != NULL) {
                newPrivate->entity_device       = CFRetain(oldPrivate->entity_device);
        }
+       if (oldPrivate->entity_device_unique != NULL) {
+               newPrivate->entity_device_unique = CFRetain(oldPrivate->entity_device_unique);
+       }
        newPrivate->entity_type                 = oldPrivate->entity_type;
        newPrivate->entity_subtype              = oldPrivate->entity_subtype;
        if (oldPrivate->supported_interface_types != NULL) {
        newPrivate->entity_type                 = oldPrivate->entity_type;
        newPrivate->entity_subtype              = oldPrivate->entity_subtype;
        if (oldPrivate->supported_interface_types != NULL) {
@@ -4404,6 +5425,9 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef             allocator,
                newPrivate->address             = CFRetain(oldPrivate->address);
        }
        newPrivate->builtin                     = oldPrivate->builtin;
                newPrivate->address             = CFRetain(oldPrivate->address);
        }
        newPrivate->builtin                     = oldPrivate->builtin;
+       if (oldPrivate->configurationAction != NULL) {
+               newPrivate->configurationAction = CFRetain(oldPrivate->configurationAction);
+       }
        if (oldPrivate->location != NULL) {
                newPrivate->location            = CFRetain(oldPrivate->location);
        }
        if (oldPrivate->location != NULL) {
                newPrivate->location            = CFRetain(oldPrivate->location);
        }
@@ -4414,8 +5438,6 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef             allocator,
                newPrivate->overrides           = CFDictionaryCreateMutableCopy(NULL, 0, oldPrivate->overrides);
        }
        newPrivate->modemIsV92                  = oldPrivate->modemIsV92;
                newPrivate->overrides           = CFDictionaryCreateMutableCopy(NULL, 0, oldPrivate->overrides);
        }
        newPrivate->modemIsV92                  = oldPrivate->modemIsV92;
-       newPrivate->supportsBond                = oldPrivate->supportsBond;
-       newPrivate->supportsVLAN                = oldPrivate->supportsVLAN;
        if (oldPrivate->type != NULL) {
                newPrivate->type                = CFRetain(oldPrivate->type);
        }
        if (oldPrivate->type != NULL) {
                newPrivate->type                = CFRetain(oldPrivate->type);
        }
@@ -4423,6 +5445,8 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef             allocator,
                newPrivate->unit                = CFRetain(oldPrivate->unit);
        }
        newPrivate->sort_order                  = oldPrivate->sort_order;
                newPrivate->unit                = CFRetain(oldPrivate->unit);
        }
        newPrivate->sort_order                  = oldPrivate->sort_order;
+#if    !TARGET_OS_IPHONE
+       newPrivate->supportsBond                = oldPrivate->supportsBond;
        if (oldPrivate->bond.interfaces != NULL) {
                newPrivate->bond.interfaces     = CFRetain(oldPrivate->bond.interfaces);
        }
        if (oldPrivate->bond.interfaces != NULL) {
                newPrivate->bond.interfaces     = CFRetain(oldPrivate->bond.interfaces);
        }
@@ -4432,6 +5456,7 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef             allocator,
        if (oldPrivate->bond.options != NULL) {
                newPrivate->bond.options        = CFRetain(oldPrivate->bond.options);
        }
        if (oldPrivate->bond.options != NULL) {
                newPrivate->bond.options        = CFRetain(oldPrivate->bond.options);
        }
+       newPrivate->supportsVLAN                = oldPrivate->supportsVLAN;
        if (oldPrivate->vlan.interface != NULL) {
                newPrivate->vlan.interface      = CFRetain(oldPrivate->vlan.interface);
        }
        if (oldPrivate->vlan.interface != NULL) {
                newPrivate->vlan.interface      = CFRetain(oldPrivate->vlan.interface);
        }
@@ -4441,6 +5466,7 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef             allocator,
        if (oldPrivate->vlan.options != NULL) {
                newPrivate->vlan.options        = CFRetain(oldPrivate->vlan.options);
        }
        if (oldPrivate->vlan.options != NULL) {
                newPrivate->vlan.options        = CFRetain(oldPrivate->vlan.options);
        }
+#endif // !TARGET_OS_IPHONE
 
        return newPrivate;
 }
 
        return newPrivate;
 }
@@ -4448,7 +5474,7 @@ __SCNetworkInterfaceCreateCopy(CFAllocatorRef             allocator,
 
 __private_extern__
 CFArrayRef
 
 __private_extern__
 CFArrayRef
-__SCNetworkInterfaceCopyDeepConfiguration(SCNetworkInterfaceRef interface)
+__SCNetworkInterfaceCopyDeepConfiguration(SCNetworkSetRef set, SCNetworkInterfaceRef interface)
 {
        CFMutableArrayRef       configs;
 
 {
        CFMutableArrayRef       configs;
 
@@ -4468,7 +5494,11 @@ __SCNetworkInterfaceCopyDeepConfiguration(SCNetworkInterfaceRef interface)
                        CFDictionaryRef config;
                        CFArrayRef      extendedTypes;
 
                        CFDictionaryRef config;
                        CFArrayRef      extendedTypes;
 
-                       config = __SCNetworkInterfaceGetConfiguration(interface, defaultType);
+                       if (set == NULL) {
+                               config = __SCNetworkInterfaceGetConfiguration(interface, defaultType);
+                       } else {
+                               config = __SCNetworkInterfaceGetDefaultConfiguration(set, interface);
+                       }
                        if (config == NULL) {
                                config = (CFDictionaryRef)kCFNull;
                        }
                        if (config == NULL) {
                                config = (CFDictionaryRef)kCFNull;
                        }
@@ -4507,9 +5537,9 @@ __SCNetworkInterfaceCopyDeepConfiguration(SCNetworkInterfaceRef interface)
 
 __private_extern__
 void
 
 __private_extern__
 void
-__SCNetworkInterfaceSetDeepConfiguration(SCNetworkInterfaceRef interface, CFArrayRef configs)
+__SCNetworkInterfaceSetDeepConfiguration(SCNetworkSetRef set, SCNetworkInterfaceRef interface, CFArrayRef configs)
 {
 {
-       CFIndex         i;
+       CFIndex i;
 
        for (i = 0; interface != NULL; i++) {
                CFStringRef     defaultType;
 
        for (i = 0; interface != NULL; i++) {
                CFStringRef     defaultType;
@@ -4527,11 +5557,22 @@ __SCNetworkInterfaceSetDeepConfiguration(SCNetworkInterfaceRef interface, CFArra
                        if (config == (CFDictionaryRef)kCFNull) {
                                config = NULL;
                        }
                        if (config == (CFDictionaryRef)kCFNull) {
                                config = NULL;
                        }
-                       if (!__SCNetworkInterfaceSetConfiguration(interface, defaultType, config, TRUE)) {
-                               SCLog(TRUE, LOG_DEBUG,
-                                     CFSTR("__SCNetworkInterfaceSetDeepConfiguration __SCNetworkInterfaceSetConfiguration() failed, interface=%@, type=%@"),
-                                     interface,
-                                     defaultType);
+                       if (set == NULL) {
+                               // if service is not associated with the set
+                               if (!__SCNetworkInterfaceSetConfiguration(interface, defaultType, config, TRUE)) {
+                                       SCLog(TRUE, LOG_DEBUG,
+                                                 CFSTR("__SCNetworkInterfaceSetDeepConfiguration __SCNetworkInterfaceSetConfiguration() failed, interface=%@, type=%@"),
+                                                 interface,
+                                                 defaultType);
+                               }
+                       } else {
+                               // apply default configuration to this set
+                               if (!__SCNetworkInterfaceSetDefaultConfiguration(set, interface, defaultType, config, TRUE)) {
+                                       SCLog(TRUE, LOG_DEBUG,
+                                                 CFSTR("__SCNetworkInterfaceSetDeepConfiguration __SCNetworkInterfaceSetDefaultConfiguration() failed, interface=%@, type=%@"),
+                                                 interface,
+                                                 defaultType);
+                               }
                        }
 
                        extendedTypes = extendedConfigurationTypes(interface);
                        }
 
                        extendedTypes = extendedConfigurationTypes(interface);
index c0d57571f9037eaf25dbfe5677643315276c0344..921908a24d53b99214c4305abff3abe7623b3faa 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -45,12 +45,16 @@ static Boolean              __SCNetworkProtocolEqual                (CFTypeRef cf1, CFTypeRef cf2);
 static CFHashCode      __SCNetworkProtocolHash                 (CFTypeRef cf);
 
 
 static CFHashCode      __SCNetworkProtocolHash                 (CFTypeRef cf);
 
 
+#if    !TARGET_OS_IPHONE
 const CFStringRef kSCNetworkProtocolTypeAppleTalk       = CFSTR("AppleTalk");
 const CFStringRef kSCNetworkProtocolTypeAppleTalk       = CFSTR("AppleTalk");
+#endif // !TARGET_OS_IPHONE
 const CFStringRef kSCNetworkProtocolTypeDNS            = CFSTR("DNS");
 const CFStringRef kSCNetworkProtocolTypeIPv4           = CFSTR("IPv4");
 const CFStringRef kSCNetworkProtocolTypeIPv6           = CFSTR("IPv6");
 const CFStringRef kSCNetworkProtocolTypeProxies                = CFSTR("Proxies");
 const CFStringRef kSCNetworkProtocolTypeDNS            = CFSTR("DNS");
 const CFStringRef kSCNetworkProtocolTypeIPv4           = CFSTR("IPv4");
 const CFStringRef kSCNetworkProtocolTypeIPv6           = CFSTR("IPv6");
 const CFStringRef kSCNetworkProtocolTypeProxies                = CFSTR("Proxies");
+#if    !TARGET_OS_IPHONE
 const CFStringRef kSCNetworkProtocolTypeSMB            = CFSTR("SMB");
 const CFStringRef kSCNetworkProtocolTypeSMB            = CFSTR("SMB");
+#endif // !TARGET_OS_IPHONE
 
 
 static CFTypeID __kSCNetworkProtocolTypeID     = _kCFRuntimeNotATypeID;
 
 
 static CFTypeID __kSCNetworkProtocolTypeID     = _kCFRuntimeNotATypeID;
@@ -177,12 +181,16 @@ __SCNetworkProtocolIsValidType(CFStringRef protocolType)
 {
        int                             i;
        static const CFStringRef        *valid_types[]   = {
 {
        int                             i;
        static const CFStringRef        *valid_types[]   = {
+#if    !TARGET_OS_IPHONE
                &kSCNetworkProtocolTypeAppleTalk,
                &kSCNetworkProtocolTypeAppleTalk,
+#endif // !TARGET_OS_IPHONE
                &kSCNetworkProtocolTypeDNS,
                &kSCNetworkProtocolTypeIPv4,
                &kSCNetworkProtocolTypeIPv6,
                &kSCNetworkProtocolTypeProxies,
                &kSCNetworkProtocolTypeDNS,
                &kSCNetworkProtocolTypeIPv4,
                &kSCNetworkProtocolTypeIPv6,
                &kSCNetworkProtocolTypeProxies,
-               &kSCNetworkProtocolTypeSMB
+#if    !TARGET_OS_IPHONE
+               &kSCNetworkProtocolTypeSMB,
+#endif // !TARGET_OS_IPHONE
        };
 
        for (i = 0; i < sizeof(valid_types)/sizeof(valid_types[0]); i++) {
        };
 
        for (i = 0; i < sizeof(valid_types)/sizeof(valid_types[0]); i++) {
index 532c671b2e7b332863f0e7d4ebc3c9feadccb8bc..658d9e479778dbccae34c1eac2c8c0b4f294c498 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2003-2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2003-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  * - add advanced reachability APIs
  */
 
  * - add advanced reachability APIs
  */
 
+#include <Availability.h>
+#include <TargetConditionals.h>
+#include <sys/cdefs.h>
+#if    !TARGET_OS_IPHONE
+#include <dispatch/dispatch.h>
+#endif // !TARGET_OS_IPHONE
+#include <CoreFoundation/CoreFoundation.h>
+#include <CoreFoundation/CFRuntime.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
-
-#include <CoreFoundation/CFRuntime.h>
 #include <pthread.h>
 #include <libkern/OSAtomic.h>
 
 #include <pthread.h>
 #include <libkern/OSAtomic.h>
 
+#if    !TARGET_OS_IPHONE
+#include <IOKit/pwr_mgt/IOPMLibPrivate.h>
+#endif // !TARGET_OS_IPHONE
+
 #include <notify.h>
 #include <dnsinfo.h>
 #include <netinet/in.h>
 #include <notify.h>
 #include <dnsinfo.h>
 #include <netinet/in.h>
@@ -51,6 +61,7 @@
 #include <sys/socket.h>
 #include <net/if.h>
 #include <net/if_dl.h>
 #include <sys/socket.h>
 #include <net/if.h>
 #include <net/if_dl.h>
+#include <net/if_types.h>
 #define        KERNEL_PRIVATE
 #include <net/route.h>
 #undef KERNEL_PRIVATE
 #define        KERNEL_PRIVATE
 #include <net/route.h>
 #undef KERNEL_PRIVATE
@@ -63,8 +74,7 @@
 
 
 
 
 
 
-
-#define kSCNetworkFlagsFirstResolvePending     (1<<31)
+#define kSCNetworkReachabilityFlagsFirstResolvePending (1<<31)
 
 
 #define        N_QUICK 32
 
 
 #define        N_QUICK 32
@@ -79,6 +89,31 @@ typedef enum {
 
 static CFStringRef     __SCNetworkReachabilityCopyDescription  (CFTypeRef cf);
 static void            __SCNetworkReachabilityDeallocate       (CFTypeRef cf);
 
 static CFStringRef     __SCNetworkReachabilityCopyDescription  (CFTypeRef cf);
 static void            __SCNetworkReachabilityDeallocate       (CFTypeRef cf);
+static void            rlsPerform(void *info);
+
+
+static Boolean
+__SCNetworkReachabilityScheduleWithRunLoop     (SCNetworkReachabilityRef       target,
+                                                CFRunLoopRef                   runLoop,
+                                                CFStringRef                    runLoopMode,
+#if    !TARGET_OS_IPHONE
+                                                dispatch_queue_t               queue,
+#else  // !TARGET_OS_IPHONE
+                                                void                           *queue,
+#endif // !TARGET_OS_IPHONE
+                                                Boolean                        onDemand);
+static Boolean
+__SCNetworkReachabilityUnscheduleFromRunLoop   (SCNetworkReachabilityRef       target,
+                                                CFRunLoopRef                   runLoop,
+                                                CFStringRef                    runLoopMode,
+                                                Boolean                        onDemand);
+
+
+typedef struct {
+       SCNetworkReachabilityFlags      flags;
+       uint16_t                        if_index;
+       Boolean                         sleeping;
+} ReachabilityInfo;
 
 
 typedef struct {
 
 
 typedef struct {
@@ -96,6 +131,7 @@ typedef struct {
        const char                      *name;
        const char                      *serv;
        struct addrinfo                 hints;
        const char                      *name;
        const char                      *serv;
        struct addrinfo                 hints;
+       Boolean                         needResolve;
        CFArrayRef                      resolvedAddress;        /* CFArray[CFData] */
        int                             resolvedAddressError;
 
        CFArrayRef                      resolvedAddress;        /* CFArray[CFData] */
        int                             resolvedAddressError;
 
@@ -104,21 +140,39 @@ typedef struct {
        struct sockaddr                 *remoteAddress;
 
        /* current reachability flags */
        struct sockaddr                 *remoteAddress;
 
        /* current reachability flags */
-       SCNetworkConnectionFlags        flags;
-       uint16_t                        if_index;
+       ReachabilityInfo                info;
+       ReachabilityInfo                last_notify;
 
        /* run loop source, callout, context, rl scheduling info */
 
        /* run loop source, callout, context, rl scheduling info */
+       Boolean                         scheduled;
        CFRunLoopSourceRef              rls;
        SCNetworkReachabilityCallBack   rlsFunction;
        SCNetworkReachabilityContext    rlsContext;
        CFMutableArrayRef               rlList;
 
        CFRunLoopSourceRef              rls;
        SCNetworkReachabilityCallBack   rlsFunction;
        SCNetworkReachabilityContext    rlsContext;
        CFMutableArrayRef               rlList;
 
+#if    !TARGET_OS_IPHONE
+       dispatch_queue_t                dispatchQueue;          // SCNetworkReachabilitySetDispatchQueue
+       dispatch_queue_t                asyncDNSQueue;
+       dispatch_source_t               asyncDNSSource;
+#endif // !TARGET_OS_IPHONE
+
        /* [async] DNS query info */
        Boolean                         haveDNS;
        /* [async] DNS query info */
        Boolean                         haveDNS;
+       mach_port_t                     dnsMP;
        CFMachPortRef                   dnsPort;
        CFRunLoopSourceRef              dnsRLS;
        struct timeval                  dnsQueryStart;
 
        CFMachPortRef                   dnsPort;
        CFRunLoopSourceRef              dnsRLS;
        struct timeval                  dnsQueryStart;
 
+       /* on demand info */
+       Boolean                         onDemandBypass;
+       CFStringRef                     onDemandName;
+       CFStringRef                     onDemandRemoteAddress;
+       SCNetworkReachabilityRef        onDemandServer;
+       CFStringRef                     onDemandServiceID;
+
+       /* logging */
+       char                            log_prefix[32];
+
 } SCNetworkReachabilityPrivate, *SCNetworkReachabilityPrivateRef;
 
 
 } SCNetworkReachabilityPrivate, *SCNetworkReachabilityPrivateRef;
 
 
@@ -139,17 +193,31 @@ static const CFRuntimeClass __SCNetworkReachabilityClass = {
 
 
 static pthread_once_t          initialized     = PTHREAD_ONCE_INIT;
 
 
 static pthread_once_t          initialized     = PTHREAD_ONCE_INIT;
+static ReachabilityInfo                NOT_REACHABLE   = { 0,          0,      FALSE };
+static ReachabilityInfo                NOT_REPORTED    = { 0xFFFFFFFF, 0,      FALSE };
 static int                     rtm_seq         = 0;
 
 
 static int                     rtm_seq         = 0;
 
 
+#if    !TARGET_OS_IPHONE
+/*
+ * Power capabilities (sleep/wake)
+ */
+static IOPMSystemPowerStateCapabilities        power_capabilities      = kIOPMSytemPowerStateCapabilitiesMask;
+#endif // !TARGET_OS_IPHONE
+
+
 /*
  * host "something has changed" notifications
  */
 
 static pthread_mutex_t         hn_lock         = PTHREAD_MUTEX_INITIALIZER;
 static SCDynamicStoreRef       hn_store        = NULL;
 /*
  * host "something has changed" notifications
  */
 
 static pthread_mutex_t         hn_lock         = PTHREAD_MUTEX_INITIALIZER;
 static SCDynamicStoreRef       hn_store        = NULL;
+#if    !TARGET_OS_IPHONE
+static dispatch_queue_t                hn_dispatchQueue = NULL;
+#else  // !TARGET_OS_IPHONE
 static CFRunLoopSourceRef      hn_storeRLS     = NULL;
 static CFMutableArrayRef       hn_rlList       = NULL;
 static CFRunLoopSourceRef      hn_storeRLS     = NULL;
 static CFMutableArrayRef       hn_rlList       = NULL;
+#endif // !TARGET_OS_IPHONE
 static CFMutableSetRef         hn_targets      = NULL;
 
 
 static CFMutableSetRef         hn_targets      = NULL;
 
 
@@ -177,10 +245,11 @@ isA_SCNetworkReachability(CFTypeRef obj)
 
 
 static void
 
 
 static void
-__log_query_time(Boolean found, Boolean async, struct timeval *start)
+__log_query_time(SCNetworkReachabilityRef target, Boolean found, Boolean async, struct timeval *start)
 {
 {
-       struct timeval  dnsQueryComplete;
-       struct timeval  dnsQueryElapsed;
+       struct timeval                  dnsQueryComplete;
+       struct timeval                  dnsQueryElapsed;
+       SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
 
        if (!_sc_debug) {
                return;
 
        if (!_sc_debug) {
                return;
@@ -192,8 +261,9 @@ __log_query_time(Boolean found, Boolean async, struct timeval *start)
 
        (void) gettimeofday(&dnsQueryComplete, NULL);
        timersub(&dnsQueryComplete, start, &dnsQueryElapsed);
 
        (void) gettimeofday(&dnsQueryComplete, NULL);
        timersub(&dnsQueryComplete, start, &dnsQueryElapsed);
-       SCLog(TRUE, LOG_DEBUG,
-             CFSTR("%ssync DNS complete%s (query time = %d.%3.3d)"),
+       SCLog(TRUE, LOG_INFO,
+             CFSTR("%s%ssync DNS complete%s (query time = %d.%3.3d)"),
+             targetPrivate->log_prefix,
              async ? "a" : "",
              found ? "" : ", host not found",
              dnsQueryElapsed.tv_sec,
              async ? "a" : "",
              found ? "" : ", host not found",
              dnsQueryElapsed.tv_sec,
@@ -207,7 +277,9 @@ static int
 updatePPPStatus(SCDynamicStoreRef              *storeP,
                const struct sockaddr           *sa,
                const char                      *if_name,
 updatePPPStatus(SCDynamicStoreRef              *storeP,
                const struct sockaddr           *sa,
                const char                      *if_name,
-               SCNetworkConnectionFlags        *flags)
+               SCNetworkReachabilityFlags      *flags,
+               CFStringRef                     *ppp_server,
+               const char                      *log_prefix)
 {
        CFDictionaryRef         dict            = NULL;
        CFStringRef             entity;
 {
        CFDictionaryRef         dict            = NULL;
        CFStringRef             entity;
@@ -217,7 +289,7 @@ updatePPPStatus(SCDynamicStoreRef           *storeP,
        CFIndex                 n;
        CFStringRef             ppp_if;
        int                     sc_status       = kSCStatusReachabilityUnknown;
        CFIndex                 n;
        CFStringRef             ppp_if;
        int                     sc_status       = kSCStatusReachabilityUnknown;
-       SCDynamicStoreRef       store           = (storeP != NULL) ? *storeP : NULL;
+       SCDynamicStoreRef       store           = *storeP;
        const void *            values_q[N_QUICK];
        const void **           values  = values_q;
 
        const void *            values_q[N_QUICK];
        const void **           values  = values_q;
 
@@ -235,14 +307,13 @@ updatePPPStatus(SCDynamicStoreRef         *storeP,
        if (store == NULL) {
                store = SCDynamicStoreCreate(NULL, CFSTR("SCNetworkReachability"), NULL, NULL);
                if (store == NULL) {
        if (store == NULL) {
                store = SCDynamicStoreCreate(NULL, CFSTR("SCNetworkReachability"), NULL, NULL);
                if (store == NULL) {
-                       SCLog(_sc_verbose, LOG_INFO, CFSTR("updatePPPStatus SCDynamicStoreCreate() failed"));
+                       SCLog(TRUE, LOG_ERR, CFSTR("updatePPPStatus SCDynamicStoreCreate() failed"));
                        goto done;
                }
                        goto done;
                }
+               *storeP = store;
        }
 
        }
 
-       /*
-        * grab a snapshot of the PPP configuration from the dynamic store
-        */
+       // grab a snapshot of the PPP configuration from the dynamic store
        {
                CFStringRef             pattern;
                CFMutableArrayRef       patterns;
        {
                CFStringRef             pattern;
                CFMutableArrayRef       patterns;
@@ -270,15 +341,13 @@ updatePPPStatus(SCDynamicStoreRef         *storeP,
                CFRelease(patterns);
        }
        if (dict == NULL) {
                CFRelease(patterns);
        }
        if (dict == NULL) {
-               /* if we could not access the dynamic store */
+               // if we could not access the dynamic store
                goto done;
        }
 
        sc_status = kSCStatusOK;
 
                goto done;
        }
 
        sc_status = kSCStatusOK;
 
-       /*
-        * look for the service which matches the provided interface
-        */
+       // look for the service which matches the provided interface
        n = CFDictionaryGetCount(dict);
        if (n <= 0) {
                goto done;
        n = CFDictionaryGetCount(dict);
        if (n <= 0) {
                goto done;
@@ -301,6 +370,7 @@ updatePPPStatus(SCDynamicStoreRef           *storeP,
                CFNumberRef     num;
                CFDictionaryRef p_setup;
                CFDictionaryRef p_state;
                CFNumberRef     num;
                CFDictionaryRef p_setup;
                CFDictionaryRef p_state;
+               int32_t         ppp_demand;
                int32_t         ppp_status;
                CFStringRef     service         = NULL;
                CFStringRef     s_key           = (CFStringRef)    keys[i];
                int32_t         ppp_status;
                CFStringRef     service         = NULL;
                CFStringRef     s_key           = (CFStringRef)    keys[i];
@@ -324,14 +394,13 @@ updatePPPStatus(SCDynamicStoreRef         *storeP,
                        continue;       // if not this interface
                }
 
                        continue;       // if not this interface
                }
 
-               /*
-                * extract service ID, get PPP "state" entity (for status), and get
-                * the "setup" entity (for dial-on-traffic flag)
-                */
+               // extract the service ID, get the PPP "state" entity for
+               // the "Status", and get the PPP "setup" entity for the
+               // the "DialOnDemand" flag
                components = CFStringCreateArrayBySeparatingStrings(NULL, s_key, CFSTR("/"));
                if (CFArrayGetCount(components) != 5) {
                        CFRelease(components);
                components = CFStringCreateArrayBySeparatingStrings(NULL, s_key, CFSTR("/"));
                if (CFArrayGetCount(components) != 5) {
                        CFRelease(components);
-                       continue;
+                       break;
                }
                service = CFArrayGetValueAtIndex(components, 3);
                key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
                }
                service = CFArrayGetValueAtIndex(components, 3);
                key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
@@ -348,52 +417,63 @@ updatePPPStatus(SCDynamicStoreRef         *storeP,
                CFRelease(key);
                CFRelease(components);
 
                CFRelease(key);
                CFRelease(components);
 
-               // get PPP status
+               // ensure that this is a PPP service
                if (!isA_CFDictionary(p_state)) {
                if (!isA_CFDictionary(p_state)) {
-                       continue;
+                       break;
                }
                }
-               num = CFDictionaryGetValue(p_state, kSCPropNetPPPStatus);
-               if (!isA_CFNumber(num)) {
-                       continue;
+
+               *flags |= kSCNetworkReachabilityFlagsTransientConnection;
+
+               // get PPP server
+               if (ppp_server != NULL) {
+                       *ppp_server = CFDictionaryGetValue(s_dict, CFSTR("ServerAddress"));
+                       *ppp_server = isA_CFString(*ppp_server);
+                       if (*ppp_server != NULL) {
+                               CFRetain(*ppp_server);
+                       }
                }
 
                }
 
-               if (!CFNumberGetValue(num, kCFNumberSInt32Type, &ppp_status)) {
-                       continue;
+               // get PPP status
+               if (!CFDictionaryGetValueIfPresent(p_state,
+                                                  kSCPropNetPPPStatus,
+                                                  (const void **)&num) ||
+                   !isA_CFNumber(num) ||
+                   !CFNumberGetValue(num, kCFNumberSInt32Type, &ppp_status)) {
+                       break;
                }
                switch (ppp_status) {
                        case PPP_RUNNING :
                }
                switch (ppp_status) {
                        case PPP_RUNNING :
-                               /* if we're really UP and RUNNING */
+                               // if we're really UP and RUNNING
                                break;
                        case PPP_ONHOLD :
                                break;
                        case PPP_ONHOLD :
-                               /* if we're effectively UP and RUNNING */
+                               // if we're effectively UP and RUNNING
                                break;
                        case PPP_IDLE :
                        case PPP_STATERESERVED :
                                break;
                        case PPP_IDLE :
                        case PPP_STATERESERVED :
-                               /* if we're not connected at all */
-                               SCLog(_sc_debug, LOG_INFO, CFSTR("  PPP link idle, dial-on-traffic to connect"));
-                               *flags |= kSCNetworkFlagsConnectionRequired;
+                               // if we're not connected at all
+                               SCLog(_sc_debug, LOG_INFO, CFSTR("%s  PPP link idle, dial-on-traffic to connect"),
+                                     log_prefix);
+                               *flags |= kSCNetworkReachabilityFlagsConnectionRequired;
                                break;
                        default :
                                break;
                        default :
-                               /* if we're in the process of [dis]connecting */
-                               SCLog(_sc_debug, LOG_INFO, CFSTR("  PPP link, connection in progress"));
-                               *flags |= kSCNetworkFlagsConnectionRequired;
+                               // if we're in the process of [dis]connecting
+                               SCLog(_sc_debug, LOG_INFO, CFSTR("%s  PPP link, connection in progress"),
+                                     log_prefix);
+                               *flags |= kSCNetworkReachabilityFlagsConnectionRequired;
                                break;
                }
 
                                break;
                }
 
-               // check PPP dial-on-traffic status
-               if (isA_CFDictionary(p_setup)) {
-                       num = CFDictionaryGetValue(p_setup, kSCPropNetPPPDialOnDemand);
-                       if (isA_CFNumber(num)) {
-                               int32_t ppp_demand;
-
-                               if (CFNumberGetValue(num, kCFNumberSInt32Type, &ppp_demand)) {
-                                       if (ppp_demand) {
-                                               *flags |= kSCNetworkFlagsConnectionAutomatic;
-                                               if (ppp_status == PPP_IDLE) {
-                                                       *flags |= kSCNetworkFlagsInterventionRequired;
-                                               }
-                                       }
-                               }
+               // get PPP dial-on-traffic status
+               if (isA_CFDictionary(p_setup) &&
+                   CFDictionaryGetValueIfPresent(p_setup,
+                                                 kSCPropNetPPPDialOnDemand,
+                                                 (const void **)&num) &&
+                   isA_CFNumber(num) &&
+                   CFNumberGetValue(num, kCFNumberSInt32Type, &ppp_demand) &&
+                   (ppp_demand != 0)) {
+                       *flags |= kSCNetworkReachabilityFlagsConnectionOnTraffic;
+                       if (ppp_status == PPP_IDLE) {
+                               *flags |= kSCNetworkReachabilityFlagsInterventionRequired;
                        }
                }
 
                        }
                }
 
@@ -409,7 +489,6 @@ updatePPPStatus(SCDynamicStoreRef           *storeP,
     done :
 
        if (dict != NULL)       CFRelease(dict);
     done :
 
        if (dict != NULL)       CFRelease(dict);
-       if (storeP != NULL)     *storeP = store;
        return sc_status;
 }
 
        return sc_status;
 }
 
@@ -417,7 +496,8 @@ updatePPPStatus(SCDynamicStoreRef           *storeP,
 static int
 updatePPPAvailable(SCDynamicStoreRef           *storeP,
                   const struct sockaddr        *sa,
 static int
 updatePPPAvailable(SCDynamicStoreRef           *storeP,
                   const struct sockaddr        *sa,
-                  SCNetworkConnectionFlags     *flags)
+                  SCNetworkReachabilityFlags   *flags,
+                  const char                   *log_prefix)
 {
        CFDictionaryRef         dict            = NULL;
        CFStringRef             entity;
 {
        CFDictionaryRef         dict            = NULL;
        CFStringRef             entity;
@@ -426,7 +506,7 @@ updatePPPAvailable(SCDynamicStoreRef                *storeP,
        const void **           keys            = keys_q;
        CFIndex                 n;
        int                     sc_status       = kSCStatusReachabilityUnknown;
        const void **           keys            = keys_q;
        CFIndex                 n;
        int                     sc_status       = kSCStatusReachabilityUnknown;
-       SCDynamicStoreRef       store           = (storeP != NULL) ? *storeP : NULL;
+       SCDynamicStoreRef       store           = *storeP;
        const void *            values_q[N_QUICK];
        const void **           values  = values_q;
 
        const void *            values_q[N_QUICK];
        const void **           values  = values_q;
 
@@ -448,14 +528,13 @@ updatePPPAvailable(SCDynamicStoreRef              *storeP,
        if (store == NULL) {
                store = SCDynamicStoreCreate(NULL, CFSTR("SCNetworkReachability"), NULL, NULL);
                if (store == NULL) {
        if (store == NULL) {
                store = SCDynamicStoreCreate(NULL, CFSTR("SCNetworkReachability"), NULL, NULL);
                if (store == NULL) {
-                       SCLog(_sc_debug, LOG_INFO, CFSTR("  status    = unknown (could not access SCDynamicStore"));
+                       SCLog(TRUE, LOG_ERR, CFSTR("updatePPPAvailable SCDynamicStoreCreate() failed"));
                        goto done;
                }
                        goto done;
                }
+               *storeP = store;
        }
 
        }
 
-       /*
-        * grab a snapshot of the PPP configuration from the dynamic store
-        */
+       // grab a snapshot of the PPP configuration from the dynamic store
        {
                CFStringRef             pattern;
                CFMutableArrayRef       patterns;
        {
                CFStringRef             pattern;
                CFMutableArrayRef       patterns;
@@ -467,6 +546,12 @@ updatePPPAvailable(SCDynamicStoreRef               *storeP,
                                                                      entity);
                CFArrayAppendValue(patterns, pattern);
                CFRelease(pattern);
                                                                      entity);
                CFArrayAppendValue(patterns, pattern);
                CFRelease(pattern);
+               pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                                     kSCDynamicStoreDomainSetup,
+                                                                     kSCCompAnyRegex,
+                                                                     kSCEntNetInterface);
+               CFArrayAppendValue(patterns, pattern);
+               CFRelease(pattern);
                pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
                                                                      kSCDynamicStoreDomainSetup,
                                                                      kSCCompAnyRegex,
                pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
                                                                      kSCDynamicStoreDomainSetup,
                                                                      kSCCompAnyRegex,
@@ -477,16 +562,14 @@ updatePPPAvailable(SCDynamicStoreRef              *storeP,
                CFRelease(patterns);
        }
        if (dict == NULL) {
                CFRelease(patterns);
        }
        if (dict == NULL) {
-               /* if we could not access the dynamic store */
+               // if we could not access the dynamic store
                goto done;
        }
 
        sc_status = kSCStatusOK;
 
                goto done;
        }
 
        sc_status = kSCStatusOK;
 
-       /*
-        * look for an available service which will provide connectivity
-        * for the requested address family.
-        */
+       // look for an available service which will provide connectivity
+       // for the requested address family.
        n = CFDictionaryGetCount(dict);
        if (n <= 0) {
                goto done;
        n = CFDictionaryGetCount(dict);
        if (n <= 0) {
                goto done;
@@ -501,6 +584,8 @@ updatePPPAvailable(SCDynamicStoreRef                *storeP,
        for (i = 0; i < n; i++) {
                CFArrayRef      components;
                Boolean         found           = FALSE;
        for (i = 0; i < n; i++) {
                CFArrayRef      components;
                Boolean         found           = FALSE;
+               CFStringRef     i_key;
+               CFDictionaryRef i_dict;
                CFStringRef     p_key;
                CFDictionaryRef p_dict;
                CFStringRef     service;
                CFStringRef     p_key;
                CFDictionaryRef p_dict;
                CFStringRef     service;
@@ -523,7 +608,7 @@ updatePPPAvailable(SCDynamicStoreRef                *storeP,
                }
                service = CFArrayGetValueAtIndex(components, 3);
 
                }
                service = CFArrayGetValueAtIndex(components, 3);
 
-               // check for PPP entity
+               // check for [non-VPN] PPP entity
                p_key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
                                                                    kSCDynamicStoreDomainSetup,
                                                                    service,
                p_key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
                                                                    kSCDynamicStoreDomainSetup,
                                                                    service,
@@ -531,35 +616,43 @@ updatePPPAvailable(SCDynamicStoreRef              *storeP,
                p_dict = CFDictionaryGetValue(dict, p_key);
                CFRelease(p_key);
 
                p_dict = CFDictionaryGetValue(dict, p_key);
                CFRelease(p_key);
 
-               if (isA_CFDictionary(p_dict)) {
+               i_key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                                   kSCDynamicStoreDomainSetup,
+                                                                   service,
+                                                                   kSCEntNetInterface);
+               i_dict = CFDictionaryGetValue(dict, i_key);
+               CFRelease(i_key);
+
+               if (isA_CFDictionary(p_dict) &&
+                   isA_CFDictionary(i_dict) &&
+                   CFDictionaryContainsKey(i_dict, kSCPropNetInterfaceDeviceName)) {
                        CFNumberRef     num;
 
                        CFNumberRef     num;
 
-                       /*
-                        * we have a PPP service for this address family
-                        */
+                       // we have a PPP service for this address family
                        found = TRUE;
 
                        found = TRUE;
 
-                       *flags |= kSCNetworkFlagsReachable;
-                       *flags |= kSCNetworkFlagsTransientConnection;
-                       *flags |= kSCNetworkFlagsConnectionRequired;
+                       *flags |= kSCNetworkReachabilityFlagsReachable;
+                       *flags |= kSCNetworkReachabilityFlagsTransientConnection;
+                       *flags |= kSCNetworkReachabilityFlagsConnectionRequired;
 
 
-                       /*
-                        * get PPP dial-on-traffic status
-                        */
+                       // get PPP dial-on-traffic status
                        num = CFDictionaryGetValue(p_dict, kSCPropNetPPPDialOnDemand);
                        if (isA_CFNumber(num)) {
                                int32_t ppp_demand;
 
                                if (CFNumberGetValue(num, kCFNumberSInt32Type, &ppp_demand)) {
                                        if (ppp_demand) {
                        num = CFDictionaryGetValue(p_dict, kSCPropNetPPPDialOnDemand);
                        if (isA_CFNumber(num)) {
                                int32_t ppp_demand;
 
                                if (CFNumberGetValue(num, kCFNumberSInt32Type, &ppp_demand)) {
                                        if (ppp_demand) {
-                                               *flags |= kSCNetworkFlagsConnectionAutomatic;
+                                               *flags |= kSCNetworkReachabilityFlagsConnectionOnTraffic;
                                        }
                                }
                        }
 
                        if (_sc_debug) {
                                        }
                                }
                        }
 
                        if (_sc_debug) {
-                               SCLog(TRUE, LOG_INFO, CFSTR("  status    = isReachable (after connect)"));
-                               SCLog(TRUE, LOG_INFO, CFSTR("  service   = %@"), service);
+                               SCLog(TRUE, LOG_INFO, CFSTR("%s  status    = isReachable (after connect)"),
+                                     log_prefix);
+                               SCLog(TRUE, LOG_INFO, CFSTR("%s  service   = %@"),
+                                     log_prefix,
+                                     service);
                        }
 
                }
                        }
 
                }
@@ -579,11 +672,170 @@ updatePPPAvailable(SCDynamicStoreRef             *storeP,
     done :
 
        if (dict != NULL)       CFRelease(dict);
     done :
 
        if (dict != NULL)       CFRelease(dict);
-       if (storeP != NULL)     *storeP = store;
        return sc_status;
 }
 
 
        return sc_status;
 }
 
 
+static int
+updateIPSecStatus(SCDynamicStoreRef            *storeP,
+                 const struct sockaddr         *sa,
+                 const char                    *if_name,
+                 SCNetworkReachabilityFlags    *flags,
+                 CFStringRef                   *ipsec_server)
+{
+       CFDictionaryRef         dict            = NULL;
+       CFStringRef             entity;
+       CFIndex                 i;
+       CFStringRef             ipsec_if;
+       const void *            keys_q[N_QUICK];
+       const void **           keys            = keys_q;
+       CFIndex                 n;
+       int                     sc_status       = kSCStatusReachabilityUnknown;
+       SCDynamicStoreRef       store           = *storeP;
+       const void *            values_q[N_QUICK];
+       const void **           values  = values_q;
+
+       switch (sa->sa_family) {
+               case AF_INET :
+                       entity = kSCEntNetIPv4;
+                       break;
+               case AF_INET6 :
+                       entity = kSCEntNetIPv6;
+                       break;
+               default :
+                       goto done;
+       }
+
+       if (store == NULL) {
+               store = SCDynamicStoreCreate(NULL, CFSTR("SCNetworkReachability"), NULL, NULL);
+               if (store == NULL) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("updateIPSecStatus SCDynamicStoreCreate() failed"));
+                       goto done;
+               }
+               *storeP = store;
+       }
+
+       // grab a snapshot of the IPSec configuration from the dynamic store
+       {
+               CFStringRef             pattern;
+               CFMutableArrayRef       patterns;
+
+               patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+               pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                                     kSCDynamicStoreDomainState,
+                                                                     kSCCompAnyRegex,
+                                                                     entity);
+               CFArrayAppendValue(patterns, pattern);
+               CFRelease(pattern);
+               pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                                     kSCDynamicStoreDomainSetup,
+                                                                     kSCCompAnyRegex,
+                                                                     kSCEntNetIPSec);
+               CFArrayAppendValue(patterns, pattern);
+               CFRelease(pattern);
+               dict = SCDynamicStoreCopyMultiple(store, NULL, patterns);
+               CFRelease(patterns);
+       }
+       if (dict == NULL) {
+               // if we could not access the dynamic store
+               goto done;
+       }
+
+       sc_status = kSCStatusOK;
+
+       // look for the service which matches the provided interface
+       n = CFDictionaryGetCount(dict);
+       if (n <= 0) {
+               goto done;
+       }
+
+       ipsec_if = CFStringCreateWithCStringNoCopy(NULL,
+                                                  if_name,
+                                                  kCFStringEncodingASCII,
+                                                  kCFAllocatorNull);
+
+       if (n > (CFIndex)(sizeof(keys_q) / sizeof(CFTypeRef))) {
+               keys   = CFAllocatorAllocate(NULL, n * sizeof(CFTypeRef), 0);
+               values = CFAllocatorAllocate(NULL, n * sizeof(CFTypeRef), 0);
+       }
+       CFDictionaryGetKeysAndValues(dict, keys, values);
+
+       for (i=0; i < n; i++) {
+               CFArrayRef      components;
+               CFStringRef     key;
+               CFDictionaryRef i_setup;
+               CFStringRef     service         = NULL;
+               CFStringRef     s_key           = (CFStringRef)    keys[i];
+               CFDictionaryRef s_dict          = (CFDictionaryRef)values[i];
+               CFStringRef     s_if;
+
+               if (!isA_CFString(s_key) || !isA_CFDictionary(s_dict)) {
+                       continue;
+               }
+
+               if (!CFStringHasSuffix(s_key, entity)) {
+                       continue;       // if not an IPv4 or IPv6 entity
+               }
+
+               s_if = CFDictionaryGetValue(s_dict, kSCPropInterfaceName);
+               if (!isA_CFString(s_if)) {
+                       continue;       // if no interface
+               }
+
+               if (!CFEqual(ipsec_if, s_if)) {
+                       continue;       // if not this interface
+               }
+
+               // extract the service ID and get the IPSec "setup" entity
+               // to confirm that we're looking at what we're expecting
+               components = CFStringCreateArrayBySeparatingStrings(NULL, s_key, CFSTR("/"));
+               if (CFArrayGetCount(components) != 5) {
+                       CFRelease(components);
+                       break;
+               }
+               service = CFArrayGetValueAtIndex(components, 3);
+               key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                                 kSCDynamicStoreDomainSetup,
+                                                                 service,
+                                                                 kSCEntNetIPSec);
+               i_setup = CFDictionaryGetValue(dict, key);
+               CFRelease(key);
+               CFRelease(components);
+
+               // ensure that this is an IPSec service
+               if (!isA_CFDictionary(i_setup)) {
+                       break;
+               }
+
+               *flags |= kSCNetworkReachabilityFlagsTransientConnection;
+
+               // get IPSec server
+               if (ipsec_server != NULL) {
+                       *ipsec_server = CFDictionaryGetValue(s_dict, CFSTR("ServerAddress"));
+                       *ipsec_server = isA_CFString(*ipsec_server);
+                       if (*ipsec_server != NULL) {
+                               CFRetain(*ipsec_server);
+                       }
+               }
+
+               break;
+       }
+
+       CFRelease(ipsec_if);
+       if (keys != keys_q) {
+               CFAllocatorDeallocate(NULL, keys);
+               CFAllocatorDeallocate(NULL, values);
+       }
+
+    done :
+
+       if (dict != NULL)       CFRelease(dict);
+       return sc_status;
+}
+
+
+
+
 #define ROUNDUP(a, size) \
        (((a) & ((size)-1)) ? (1 + ((a) | ((size)-1))) : (a))
 
 #define ROUNDUP(a, size) \
        (((a) & ((size)-1)) ? (1 + ((a) | ((size)-1))) : (a))
 
@@ -609,76 +861,50 @@ get_rtaddrs(int addrs, struct sockaddr *sa, struct sockaddr **rti_info)
 
 #define BUFLEN (sizeof(struct rt_msghdr) + 512)        /* 8 * sizeof(struct sockaddr_in6) = 192 */
 
 
 #define BUFLEN (sizeof(struct rt_msghdr) + 512)        /* 8 * sizeof(struct sockaddr_in6) = 192 */
 
-static Boolean
-checkAddress(SCDynamicStoreRef         *storeP,
-            const struct sockaddr      *address,
-            SCNetworkConnectionFlags   *flags,
-            uint16_t                   *if_index)
-{
+
+typedef struct {
        char                    buf[BUFLEN];
        char                    buf[BUFLEN];
-       struct ifreq            ifr;
-       char                    if_name[IFNAMSIZ + 1];
-       int                     isock;
+       int                     error;
+       struct sockaddr         *rti_info[RTAX_MAX];
+       struct rt_msghdr        *rtm;
+       struct sockaddr_dl      *sdl;
+} route_info, *route_info_p;
+
+
+/*
+ * route_get()
+ *     returns zero if route exists an data returned, EHOSTUNREACH
+ *     if no route, or errno for any other error.
+ */
+static int
+route_get(const struct sockaddr        *address,
+         route_info            *info)
+{
        int                     n;
        pid_t                   pid             = getpid();
        int                     rsock;
        int                     n;
        pid_t                   pid             = getpid();
        int                     rsock;
-       struct sockaddr         *rti_info[RTAX_MAX];
-       struct rt_msghdr        *rtm;
        struct sockaddr         *sa;
        struct sockaddr         *sa;
-       int                     sc_status       = kSCStatusReachabilityUnknown;
-       struct sockaddr_dl      *sdl;
        int32_t                 seq             = OSAtomicIncrement32Barrier(&rtm_seq);
        int32_t                 seq             = OSAtomicIncrement32Barrier(&rtm_seq);
-       SCDynamicStoreRef       store           = (storeP != NULL) ? *storeP : NULL;
-       char                    *statusMessage  = NULL;
 #ifndef        RTM_GET_SILENT
 #warning Note: Using RTM_GET (and not RTM_GET_SILENT)
        static pthread_mutex_t  lock            = PTHREAD_MUTEX_INITIALIZER;
        int                     sosize          = 48 * 1024;
 #endif
 
 #ifndef        RTM_GET_SILENT
 #warning Note: Using RTM_GET (and not RTM_GET_SILENT)
        static pthread_mutex_t  lock            = PTHREAD_MUTEX_INITIALIZER;
        int                     sosize          = 48 * 1024;
 #endif
 
-       *flags = 0;
-       if (if_index != NULL) {
-               *if_index = 0;
-       }
-
-       if (address == NULL) {
-               /* special case: check only for available paths off the system */
-               goto checkAvailable;
-       }
-
-       switch (address->sa_family) {
-               case AF_INET :
-               case AF_INET6 :
-                       if (_sc_debug) {
-                               _SC_sockaddr_to_string(address, buf, sizeof(buf));
-                               SCLog(TRUE, LOG_INFO, CFSTR("checkAddress(%s)"), buf);
-                       }
-                       break;
-               default :
-                       /*
-                        * if no code for this address family (yet)
-                        */
-                       SCLog(_sc_verbose, LOG_ERR,
-                             CFSTR("checkAddress(): unexpected address family %d"),
-                             address->sa_family);
-                       sc_status = kSCStatusInvalidArgument;
-                       goto done;
-       }
-
-       bzero(&buf, sizeof(buf));
+       bzero(info, sizeof(*info));
 
 
-       rtm = (struct rt_msghdr *)&buf;
-       rtm->rtm_msglen  = sizeof(struct rt_msghdr);
-       rtm->rtm_version = RTM_VERSION;
+       info->rtm = (struct rt_msghdr *)&info->buf;
+       info->rtm->rtm_msglen  = sizeof(struct rt_msghdr);
+       info->rtm->rtm_version = RTM_VERSION;
 #ifdef RTM_GET_SILENT
 #ifdef RTM_GET_SILENT
-       rtm->rtm_type    = RTM_GET_SILENT;
+       info->rtm->rtm_type    = RTM_GET_SILENT;
 #else
 #else
-       rtm->rtm_type    = RTM_GET;
+       info->rtm->rtm_type    = RTM_GET;
 #endif
 #endif
-       rtm->rtm_flags   = RTF_STATIC|RTF_UP|RTF_HOST|RTF_GATEWAY;
-       rtm->rtm_addrs   = RTA_DST|RTA_IFP; /* Both destination and device */
-       rtm->rtm_pid     = pid;
-       rtm->rtm_seq     = seq;
+       info->rtm->rtm_flags   = RTF_STATIC|RTF_UP|RTF_HOST|RTF_GATEWAY;
+       info->rtm->rtm_addrs   = RTA_DST|RTA_IFP; /* Both destination and device */
+       info->rtm->rtm_pid     = pid;
+       info->rtm->rtm_seq     = seq;
 
        switch (address->sa_family) {
                case AF_INET6: {
 
        switch (address->sa_family) {
                case AF_INET6: {
@@ -695,52 +921,54 @@ checkAddress(SCDynamicStoreRef            *storeP,
                }
        }
 
                }
        }
 
-       sa  = (struct sockaddr *) (rtm + 1);
+       sa  = (struct sockaddr *) (info->rtm + 1);
        bcopy(address, sa, address->sa_len);
        n = ROUNDUP(sa->sa_len, sizeof(uint32_t));
        bcopy(address, sa, address->sa_len);
        n = ROUNDUP(sa->sa_len, sizeof(uint32_t));
-       rtm->rtm_msglen += n;
+       info->rtm->rtm_msglen += n;
 
 
-       sdl = (struct sockaddr_dl *) ((void *)sa + n);
-       sdl->sdl_family = AF_LINK;
-       sdl->sdl_len = sizeof (struct sockaddr_dl);
-       n = ROUNDUP(sdl->sdl_len, sizeof(uint32_t));
-       rtm->rtm_msglen += n;
+       info->sdl = (struct sockaddr_dl *) ((void *)sa + n);
+       info->sdl->sdl_family = AF_LINK;
+       info->sdl->sdl_len = sizeof (struct sockaddr_dl);
+       n = ROUNDUP(info->sdl->sdl_len, sizeof(uint32_t));
+       info->rtm->rtm_msglen += n;
 
 #ifndef        RTM_GET_SILENT
        pthread_mutex_lock(&lock);
 #endif
        rsock = socket(PF_ROUTE, SOCK_RAW, 0);
        if (rsock == -1) {
 
 #ifndef        RTM_GET_SILENT
        pthread_mutex_lock(&lock);
 #endif
        rsock = socket(PF_ROUTE, SOCK_RAW, 0);
        if (rsock == -1) {
+               int     error   = errno;
+
 #ifndef        RTM_GET_SILENT
                pthread_mutex_unlock(&lock);
 #endif
 #ifndef        RTM_GET_SILENT
                pthread_mutex_unlock(&lock);
 #endif
-               SCLog(TRUE, LOG_ERR, CFSTR("socket(PF_ROUTE) failed: %s"), strerror(errno));
-               sc_status = kSCStatusFailed;
-               goto done;
+               SCLog(TRUE, LOG_ERR, CFSTR("socket(PF_ROUTE) failed: %s"), strerror(error));
+               return error;
        }
 
 #ifndef        RTM_GET_SILENT
        if (setsockopt(rsock, SOL_SOCKET, SO_RCVBUF, &sosize, sizeof(sosize)) == -1) {
        }
 
 #ifndef        RTM_GET_SILENT
        if (setsockopt(rsock, SOL_SOCKET, SO_RCVBUF, &sosize, sizeof(sosize)) == -1) {
+               int     error   = errno;
+
                (void)close(rsock);
                pthread_mutex_unlock(&lock);
                (void)close(rsock);
                pthread_mutex_unlock(&lock);
-               SCLog(TRUE, LOG_ERR, CFSTR("setsockopt(SO_RCVBUF) failed: %s"), strerror(errno));
-               sc_status = kSCStatusFailed;
-               goto done;
+               SCLog(TRUE, LOG_ERR, CFSTR("setsockopt(SO_RCVBUF) failed: %s"), strerror(error));
+               return error;
        }
 #endif
 
        }
 #endif
 
-       if (write(rsock, &buf, rtm->rtm_msglen) == -1) {
-               int     err     = errno;
+       if (write(rsock, &info->buf, info->rtm->rtm_msglen) == -1) {
+               int     error   = errno;
 
                (void)close(rsock);
 #ifndef        RTM_GET_SILENT
                pthread_mutex_unlock(&lock);
 #endif
 
                (void)close(rsock);
 #ifndef        RTM_GET_SILENT
                pthread_mutex_unlock(&lock);
 #endif
-               if (err != ESRCH) {
-                       SCLog(TRUE, LOG_ERR, CFSTR("write() failed: %s"), strerror(err));
-                       goto done;
+               if (error != ESRCH) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("write() failed: %s"), strerror(error));
+                       return error;
                }
                }
-               goto checkAvailable;
+               return EHOSTUNREACH;
        }
 
        /*
        }
 
        /*
@@ -750,113 +978,190 @@ checkAddress(SCDynamicStoreRef          *storeP,
        do {
                int     n;
 
        do {
                int     n;
 
-               n = read(rsock, (void *)&buf, sizeof(buf));
+               n = read(rsock, (void *)&info->buf, sizeof(info->buf));
                if (n == -1) {
                if (n == -1) {
-                       int     err     = errno;
+                       if (errno != EINTR) {
+                               int     error   = errno;
 
 
-                       if (err != EINTR) {
                                (void)close(rsock);
                                (void)close(rsock);
-                               SCLog(TRUE, LOG_ERR, CFSTR("read() failed: %s"), strerror(err));
 #ifndef        RTM_GET_SILENT
                                pthread_mutex_unlock(&lock);
 #endif
 #ifndef        RTM_GET_SILENT
                                pthread_mutex_unlock(&lock);
 #endif
-                               goto done;
+                               SCLog(TRUE, LOG_ERR, CFSTR("read() failed: %s"), strerror(error));
+                               return error;
                        }
                }
                        }
                }
-       } while (rtm->rtm_type != RTM_GET       ||
-                rtm->rtm_seq  != seq           ||
-                rtm->rtm_pid  != pid);
+       } while ((info->rtm->rtm_type != RTM_GET)       ||
+                (info->rtm->rtm_seq  != seq)           ||
+                (info->rtm->rtm_pid  != pid));
 
        (void)close(rsock);
 #ifndef        RTM_GET_SILENT
        pthread_mutex_unlock(&lock);
 #endif
 
 
        (void)close(rsock);
 #ifndef        RTM_GET_SILENT
        pthread_mutex_unlock(&lock);
 #endif
 
-       get_rtaddrs(rtm->rtm_addrs, sa, rti_info);
+       get_rtaddrs(info->rtm->rtm_addrs, sa, info->rti_info);
 
 
-#ifdef DEBUG
-{
-       int     i;
-       char    buf[200];
+#ifdef LOG_RTADDRS
+       {
+               int     i;
 
 
-       SCLog(_sc_debug, LOG_DEBUG, CFSTR("rtm_flags = 0x%8.8x"), rtm->rtm_flags);
+               SCLog(_sc_debug, LOG_DEBUG, CFSTR("rtm_flags = 0x%8.8x"), info->rtm->rtm_flags);
 
 
-       if ((rti_info[RTAX_NETMASK] != NULL) && (rti_info[RTAX_DST] != NULL)) {
-               rti_info[RTAX_NETMASK]->sa_family = rti_info[RTAX_DST]->sa_family;
-       }
+               if ((info->rti_info[RTAX_NETMASK] != NULL) && (info->rti_info[RTAX_DST] != NULL)) {
+                       info->rti_info[RTAX_NETMASK]->sa_family = info->rti_info[RTAX_DST]->sa_family;
+               }
 
 
-       for (i = 0; i < RTAX_MAX; i++) {
-               if (rti_info[i] != NULL) {
-                       _SC_sockaddr_to_string(rti_info[i], buf, sizeof(buf));
-                       SCLog(_sc_debug, LOG_DEBUG, CFSTR("%d: %s"), i, buf);
+               for (i = 0; i < RTAX_MAX; i++) {
+                       if (info->rti_info[i] != NULL) {
+                               char    addr[128];
+
+                               _SC_sockaddr_to_string(info->rti_info[i], addr, sizeof(addr));
+                               SCLog(_sc_debug, LOG_DEBUG, CFSTR("%d: %s"), i, addr);
+                       }
                }
        }
                }
        }
-}
-#endif /* DEBUG */
+#endif /* LOG_RTADDRS */
 
 
-       if ((rti_info[RTAX_IFP] == NULL) ||
-           (rti_info[RTAX_IFP]->sa_family != AF_LINK)) {
+       if ((info->rti_info[RTAX_IFP] == NULL) ||
+           (info->rti_info[RTAX_IFP]->sa_family != AF_LINK)) {
                /* no interface info */
                /* no interface info */
-               goto done;
+               SCLog(TRUE, LOG_DEBUG, CFSTR("route_get() no interface info"));
+               return EINVAL;
        }
 
        }
 
-       sdl = (struct sockaddr_dl *) rti_info[RTAX_IFP];
-       if ((sdl->sdl_nlen == 0) || (sdl->sdl_nlen > IFNAMSIZ)) {
+       info->sdl = (struct sockaddr_dl *) info->rti_info[RTAX_IFP];
+       if ((info->sdl->sdl_nlen == 0) || (info->sdl->sdl_nlen > IFNAMSIZ)) {
                /* no interface name */
                /* no interface name */
-               goto checkAvailable;
+               return EHOSTUNREACH;
        }
 
        }
 
-       /* get the interface flags */
+       return 0;
+}
 
 
-       bzero(&ifr, sizeof(ifr));
-       bcopy(sdl->sdl_data, ifr.ifr_name, sdl->sdl_nlen);
+
+static Boolean
+checkAddress(SCDynamicStoreRef         *storeP,
+            const struct sockaddr      *address,
+            ReachabilityInfo           *reach_info,
+            const char                 *log_prefix)
+{
+       route_info              info;
+       struct ifreq            ifr;
+       char                    if_name[IFNAMSIZ + 1];
+       int                     isock           = -1;
+       int                     ret;
+       int                     sc_status       = kSCStatusReachabilityUnknown;
+       CFStringRef             server          = NULL;
+       char                    *statusMessage  = NULL;
+       struct sockaddr_in      v4mapped;
+
+       *reach_info = NOT_REACHABLE;
+
+       if (address == NULL) {
+               /* special case: check only for available paths off the system */
+               goto checkAvailable;
+       }
+
+       switch (address->sa_family) {
+               case AF_INET :
+               case AF_INET6 :
+                       if (_sc_debug) {
+                               char    addr[128];
+
+                               _SC_sockaddr_to_string(address, addr, sizeof(addr));
+                               SCLog(TRUE, LOG_INFO, CFSTR("%scheckAddress(%s)"),
+                                     log_prefix,
+                                     addr);
+                       }
+                       break;
+               default :
+                       /*
+                        * if no code for this address family (yet)
+                        */
+                       SCLog(TRUE, LOG_INFO,
+                             CFSTR("checkAddress(): unexpected address family %d"),
+                             address->sa_family);
+                       sc_status = kSCStatusInvalidArgument;
+                       goto done;
+       }
+
+       if (address->sa_family == AF_INET6) {
+               struct sockaddr_in6     *sin6   = (struct sockaddr_in6 *)address;
+
+               if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
+                       bzero(&v4mapped, sizeof(v4mapped));
+                       v4mapped.sin_len         = sizeof(v4mapped);
+                       v4mapped.sin_family      = AF_INET;
+                       v4mapped.sin_port        = sin6->sin6_port;
+                       v4mapped.sin_addr.s_addr = sin6->sin6_addr.__u6_addr.__u6_addr32[3];
+                       address = (struct sockaddr *)&v4mapped;
+               }
+       }
+
+       ret = route_get(address, &info);
+       switch (ret) {
+               case 0 :
+                       break;
+               case EHOSTUNREACH :
+                       // if no route
+                       goto checkAvailable;
+               default :
+                       // if error
+                       sc_status = ret;
+                       goto done;
+       }
+
+       /* get the interface flags */
 
        isock = socket(AF_INET, SOCK_DGRAM, 0);
        if (isock == -1) {
 
        isock = socket(AF_INET, SOCK_DGRAM, 0);
        if (isock == -1) {
-               SCLog(TRUE, LOG_NOTICE, CFSTR("socket() failed: %s"), strerror(errno));
+               SCLog(TRUE, LOG_ERR, CFSTR("socket() failed: %s"), strerror(errno));
                goto done;
        }
 
                goto done;
        }
 
+       bzero(&ifr, sizeof(ifr));
+       bcopy(info.sdl->sdl_data, ifr.ifr_name, info.sdl->sdl_nlen);
+
        if (ioctl(isock, SIOCGIFFLAGS, (char *)&ifr) == -1) {
        if (ioctl(isock, SIOCGIFFLAGS, (char *)&ifr) == -1) {
-               SCLog(TRUE, LOG_NOTICE, CFSTR("ioctl() failed: %s"), strerror(errno));
-               (void)close(isock);
+               SCLog(TRUE, LOG_ERR, CFSTR("ioctl() failed: %s"), strerror(errno));
                goto done;
        }
                goto done;
        }
-       (void)close(isock);
 
        if (!(ifr.ifr_flags & IFF_UP)) {
                goto checkAvailable;
        }
 
        statusMessage = "isReachable";
 
        if (!(ifr.ifr_flags & IFF_UP)) {
                goto checkAvailable;
        }
 
        statusMessage = "isReachable";
-       *flags |= kSCNetworkFlagsReachable;
+       reach_info->flags |= kSCNetworkReachabilityFlagsReachable;
 
 
-       if (rtm->rtm_flags & RTF_LOCAL) {
+       if (info.rtm->rtm_flags & RTF_LOCAL) {
                statusMessage = "isReachable (is a local address)";
                statusMessage = "isReachable (is a local address)";
-               *flags |= kSCNetworkFlagsIsLocalAddress;
+               reach_info->flags |= kSCNetworkReachabilityFlagsIsLocalAddress;
        } else if (ifr.ifr_flags & IFF_LOOPBACK) {
                statusMessage = "isReachable (is loopback network)";
        } else if (ifr.ifr_flags & IFF_LOOPBACK) {
                statusMessage = "isReachable (is loopback network)";
-               *flags |= kSCNetworkFlagsIsLocalAddress;
-       } else if (rti_info[RTAX_IFA]) {
+               reach_info->flags |= kSCNetworkReachabilityFlagsIsLocalAddress;
+       } else if ((info.rti_info[RTAX_IFA] != NULL) &&
+                  (info.rti_info[RTAX_IFA]->sa_family != AF_LINK)) {
                void    *addr1  = (void *)address;
                void    *addr1  = (void *)address;
-               void    *addr2  = (void *)rti_info[RTAX_IFA];
+               void    *addr2  = (void *)info.rti_info[RTAX_IFA];
                size_t  len     = address->sa_len;
 
                size_t  len     = address->sa_len;
 
-               if ((address->sa_family != rti_info[RTAX_IFA]->sa_family) &&
-                   (address->sa_len    != rti_info[RTAX_IFA]->sa_len)) {
+               if ((address->sa_family != info.rti_info[RTAX_IFA]->sa_family) &&
+                   (address->sa_len    != info.rti_info[RTAX_IFA]->sa_len)) {
                        SCLog(TRUE, LOG_NOTICE,
                              CFSTR("address family/length mismatch: %d/%d != %d/%d"),
                              address->sa_family,
                              address->sa_len,
                        SCLog(TRUE, LOG_NOTICE,
                              CFSTR("address family/length mismatch: %d/%d != %d/%d"),
                              address->sa_family,
                              address->sa_len,
-                             rti_info[RTAX_IFA]->sa_family,
-                             rti_info[RTAX_IFA]->sa_len);
+                             info.rti_info[RTAX_IFA]->sa_family,
+                             info.rti_info[RTAX_IFA]->sa_len);
                        goto done;
                }
 
                switch (address->sa_family) {
                        case AF_INET :
                                addr1 = &((struct sockaddr_in *)address)->sin_addr;
                        goto done;
                }
 
                switch (address->sa_family) {
                        case AF_INET :
                                addr1 = &((struct sockaddr_in *)address)->sin_addr;
-                               addr2 = &((struct sockaddr_in *)rti_info[RTAX_IFA])->sin_addr;
+                               addr2 = &((struct sockaddr_in *)info.rti_info[RTAX_IFA])->sin_addr;
                                len = sizeof(struct in_addr);
 
                                /*
                                len = sizeof(struct in_addr);
 
                                /*
@@ -864,76 +1169,83 @@ checkAddress(SCDynamicStoreRef           *storeP,
                                 */
                                if (((struct sockaddr_in *)address)->sin_addr.s_addr == 0) {
                                        statusMessage = "isReachable (this host)";
                                 */
                                if (((struct sockaddr_in *)address)->sin_addr.s_addr == 0) {
                                        statusMessage = "isReachable (this host)";
-                                       *flags |= kSCNetworkFlagsIsLocalAddress;
+                                       reach_info->flags |= kSCNetworkReachabilityFlagsIsLocalAddress;
                                }
                                break;
                        case AF_INET6 :
                                addr1 = &((struct sockaddr_in6 *)address)->sin6_addr;
                                }
                                break;
                        case AF_INET6 :
                                addr1 = &((struct sockaddr_in6 *)address)->sin6_addr;
-                               addr2 = &((struct sockaddr_in6 *)rti_info[RTAX_IFA])->sin6_addr;
+                               addr2 = &((struct sockaddr_in6 *)info.rti_info[RTAX_IFA])->sin6_addr;
                                len = sizeof(struct in6_addr);
                                break;
                        default :
                                break;
                }
 
                                len = sizeof(struct in6_addr);
                                break;
                        default :
                                break;
                }
 
-               if (memcmp(addr1, addr2, len) == 0) {
+               if (bcmp(addr1, addr2, len) == 0) {
                        statusMessage = "isReachable (is interface address)";
                        statusMessage = "isReachable (is interface address)";
-                       *flags |= kSCNetworkFlagsIsLocalAddress;
+                       reach_info->flags |= kSCNetworkReachabilityFlagsIsLocalAddress;
                }
        }
 
                }
        }
 
-       if (!(rtm->rtm_flags & RTF_GATEWAY) &&
-           (rti_info[RTAX_GATEWAY] != NULL) &&
-           (rti_info[RTAX_GATEWAY]->sa_family == AF_LINK) &&
+       if (!(info.rtm->rtm_flags & RTF_GATEWAY) &&
+           (info.rti_info[RTAX_GATEWAY] != NULL) &&
+           (info.rti_info[RTAX_GATEWAY]->sa_family == AF_LINK) &&
            !(ifr.ifr_flags & IFF_POINTOPOINT)) {
            !(ifr.ifr_flags & IFF_POINTOPOINT)) {
-               *flags |= kSCNetworkFlagsIsDirect;
+               reach_info->flags |= kSCNetworkReachabilityFlagsIsDirect;
        }
 
        bzero(&if_name, sizeof(if_name));
        }
 
        bzero(&if_name, sizeof(if_name));
-       bcopy(sdl->sdl_data,
+       bcopy(info.sdl->sdl_data,
              if_name,
              if_name,
-             (sdl->sdl_nlen <= IFNAMSIZ) ? sdl->sdl_nlen : IFNAMSIZ);
+             (info.sdl->sdl_nlen <= IFNAMSIZ) ? info.sdl->sdl_nlen : IFNAMSIZ);
 
 
-       if (if_index != NULL) {
-               *if_index = sdl->sdl_index;
-       }
+       reach_info->if_index = info.sdl->sdl_index;
 
        if (_sc_debug) {
 
        if (_sc_debug) {
-               SCLog(TRUE, LOG_INFO, CFSTR("  status    = %s"), statusMessage);
-               SCLog(TRUE, LOG_INFO, CFSTR("  device    = %s (%hu)"), if_name, sdl->sdl_index);
-               SCLog(TRUE, LOG_INFO, CFSTR("  ifr_flags = 0x%04hx"), ifr.ifr_flags);
-               SCLog(TRUE, LOG_INFO, CFSTR("  rtm_flags = 0x%08x"), rtm->rtm_flags);
+               SCLog(TRUE, LOG_INFO, CFSTR("%s  status    = %s"), log_prefix, statusMessage);
+               SCLog(TRUE, LOG_INFO, CFSTR("%s  device    = %s (%hu)"), log_prefix, if_name, info.sdl->sdl_index);
+               SCLog(TRUE, LOG_INFO, CFSTR("%s  sdl_type  = 0x%x"), log_prefix, info.sdl->sdl_type);
+               SCLog(TRUE, LOG_INFO, CFSTR("%s  ifr_flags = 0x%04hx"), log_prefix, ifr.ifr_flags);
+               SCLog(TRUE, LOG_INFO, CFSTR("%s  rtm_flags = 0x%08x"), log_prefix, info.rtm->rtm_flags);
        }
 
        sc_status = kSCStatusOK;
 
        if (ifr.ifr_flags & IFF_POINTOPOINT) {
        }
 
        sc_status = kSCStatusOK;
 
        if (ifr.ifr_flags & IFF_POINTOPOINT) {
+               reach_info->flags |= kSCNetworkReachabilityFlagsTransientConnection;
+       }
+
+       if (info.sdl->sdl_type == IFT_PPP) {
                /*
                /*
-                * We have an interface which "claims" to be a valid path
-                * off of the system.
+                * 1. check if PPP service
+                * 2. check for dial-on-demand PPP link that is not yet connected
+                * 3. get PPP server address
                 */
                 */
-               *flags |= kSCNetworkFlagsTransientConnection;
-
+               sc_status = updatePPPStatus(storeP, address, if_name, &reach_info->flags, &server, log_prefix);
+       } else if (info.sdl->sdl_type == IFT_OTHER) {
                /*
                /*
-                * Check if this is a dial-on-demand PPP link that isn't
-                * connected yet.
+                * 1. check if IPSec service
+                * 2. get IPSec server address
                 */
                 */
-               sc_status = updatePPPStatus(&store, address, if_name, flags);
+               sc_status = updateIPSecStatus(storeP, address, if_name, &reach_info->flags, &server);
        }
 
        }
 
+
        goto done;
 
     checkAvailable :
 
        goto done;
 
     checkAvailable :
 
-       sc_status = updatePPPAvailable(&store, address, flags);
+
+       sc_status = updatePPPAvailable(storeP, address, &reach_info->flags, log_prefix);
 
     done :
 
 
     done :
 
-       if (*flags == 0) {
-               SCLog(_sc_debug, LOG_INFO, CFSTR("  cannot be reached"));
+       if (reach_info->flags == 0) {
+               SCLog(_sc_debug, LOG_INFO, CFSTR("%s  cannot be reached"), log_prefix);
        }
 
        }
 
-       if (storeP != NULL)     *storeP = store;
+       if (isock != -1)        (void)close(isock);
+       if (server != NULL)     CFRelease(server);
        if (sc_status != kSCStatusOK) {
                _SCErrorSet(sc_status);
                return FALSE;
        if (sc_status != kSCStatusOK) {
                _SCErrorSet(sc_status);
                return FALSE;
@@ -943,6 +1255,10 @@ checkAddress(SCDynamicStoreRef            *storeP,
 }
 
 
 }
 
 
+#pragma mark -
+#pragma mark SCNetworkReachability APIs
+
+
 static CFStringRef
 __SCNetworkReachabilityCopyDescription(CFTypeRef cf)
 {
 static CFStringRef
 __SCNetworkReachabilityCopyDescription(CFTypeRef cf)
 {
@@ -1014,12 +1330,12 @@ __SCNetworkReachabilityCopyDescription(CFTypeRef cf)
                        break;
                }
        }
                        break;
                }
        }
-       if (targetPrivate->rls != NULL) {
+       if (targetPrivate->scheduled) {
                CFStringAppendFormat(result,
                                     NULL,
                CFStringAppendFormat(result,
                                     NULL,
-                                    CFSTR(", flags = %8.8x, if_index = %hu"),
-                                    targetPrivate->flags,
-                                    targetPrivate->if_index);
+                                    CFSTR(", flags = 0x%08x, if_index = %hu"),
+                                    targetPrivate->info.flags,
+                                    targetPrivate->info.if_index);
        }
        CFStringAppendFormat(result, NULL, CFSTR("}"));
 
        }
        CFStringAppendFormat(result, NULL, CFSTR("}"));
 
@@ -1055,6 +1371,22 @@ __SCNetworkReachabilityDeallocate(CFTypeRef cf)
                (*targetPrivate->rlsContext.release)(targetPrivate->rlsContext.info);
        }
 
                (*targetPrivate->rlsContext.release)(targetPrivate->rlsContext.info);
        }
 
+       if (targetPrivate->onDemandName != NULL) {
+               CFRelease(targetPrivate->onDemandName);
+       }
+
+       if (targetPrivate->onDemandRemoteAddress != NULL) {
+               CFRelease(targetPrivate->onDemandRemoteAddress);
+       }
+
+       if (targetPrivate->onDemandServer != NULL) {
+               CFRelease(targetPrivate->onDemandServer);
+       }
+
+       if (targetPrivate->onDemandServiceID != NULL) {
+               CFRelease(targetPrivate->onDemandServiceID);
+       }
+
        return;
 }
 
        return;
 }
 
@@ -1067,6 +1399,29 @@ __SCNetworkReachabilityInitialize(void)
 }
 
 
 }
 
 
+static void
+__SCNetworkReachabilityPerform(SCNetworkReachabilityRef target)
+{
+       SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
+
+#if    !TARGET_OS_IPHONE
+       if (targetPrivate->dispatchQueue != NULL) {
+               CFRetain(target);
+               dispatch_async(targetPrivate->dispatchQueue,
+                              ^{
+                                      rlsPerform((void *)target);
+                                      CFRelease(target);
+                              });
+       } else
+#endif // !TARGET_OS_IPHONE
+       if (targetPrivate->rls != NULL) {
+               CFRunLoopSourceSignal(targetPrivate->rls);
+               _SC_signalRunLoop(target, targetPrivate->rls, targetPrivate->rlList);
+       }
+
+       return;
+}
+
 static SCNetworkReachabilityPrivateRef
 __SCNetworkReachabilityCreatePrivate(CFAllocatorRef    allocator)
 {
 static SCNetworkReachabilityPrivateRef
 __SCNetworkReachabilityCreatePrivate(CFAllocatorRef    allocator)
 {
@@ -1096,15 +1451,17 @@ __SCNetworkReachabilityCreatePrivate(CFAllocatorRef     allocator)
        targetPrivate->hints.ai_flags |= AI_PARALLEL;
 #endif /* AI_PARALLEL */
 
        targetPrivate->hints.ai_flags |= AI_PARALLEL;
 #endif /* AI_PARALLEL */
 
+       targetPrivate->needResolve                      = FALSE;
        targetPrivate->resolvedAddress                  = NULL;
        targetPrivate->resolvedAddressError             = NETDB_SUCCESS;
 
        targetPrivate->localAddress                     = NULL;
        targetPrivate->remoteAddress                    = NULL;
 
        targetPrivate->resolvedAddress                  = NULL;
        targetPrivate->resolvedAddressError             = NETDB_SUCCESS;
 
        targetPrivate->localAddress                     = NULL;
        targetPrivate->remoteAddress                    = NULL;
 
-       targetPrivate->flags                            = 0;
-       targetPrivate->if_index                         = 0;
+       targetPrivate->info                             = NOT_REACHABLE;
+       targetPrivate->last_notify                      = NOT_REPORTED;
 
 
+       targetPrivate->scheduled                        = FALSE;
        targetPrivate->rls                              = NULL;
        targetPrivate->rlsFunction                      = NULL;
        targetPrivate->rlsContext.info                  = NULL;
        targetPrivate->rls                              = NULL;
        targetPrivate->rlsFunction                      = NULL;
        targetPrivate->rlsContext.info                  = NULL;
@@ -1114,9 +1471,24 @@ __SCNetworkReachabilityCreatePrivate(CFAllocatorRef      allocator)
        targetPrivate->rlList                           = NULL;
 
        targetPrivate->haveDNS                          = FALSE;
        targetPrivate->rlList                           = NULL;
 
        targetPrivate->haveDNS                          = FALSE;
+       targetPrivate->dnsMP                            = MACH_PORT_NULL;
        targetPrivate->dnsPort                          = NULL;
        targetPrivate->dnsRLS                           = NULL;
 
        targetPrivate->dnsPort                          = NULL;
        targetPrivate->dnsRLS                           = NULL;
 
+       targetPrivate->onDemandBypass                   = FALSE;
+       targetPrivate->onDemandName                     = NULL;
+       targetPrivate->onDemandRemoteAddress            = NULL;
+       targetPrivate->onDemandServer                   = NULL;
+       targetPrivate->onDemandServiceID                = NULL;
+
+       targetPrivate->log_prefix[0] = '\0';
+       if (_sc_log > 0) {
+               snprintf(targetPrivate->log_prefix,
+                        sizeof(targetPrivate->log_prefix),
+                        "[%p] ",
+                        targetPrivate);
+       }
+
        return targetPrivate;
 }
 
        return targetPrivate;
 }
 
@@ -1248,11 +1620,12 @@ SCNetworkReachabilityCreateWithName(CFAllocatorRef      allocator,
 
        targetPrivate->type = reachabilityTypeName;
 
 
        targetPrivate->type = reachabilityTypeName;
 
-       targetPrivate->flags |= kSCNetworkFlagsFirstResolvePending;
-
        targetPrivate->name = CFAllocatorAllocate(NULL, nodenameLen + 1, 0);
        strlcpy((char *)targetPrivate->name, nodename, nodenameLen + 1);
 
        targetPrivate->name = CFAllocatorAllocate(NULL, nodenameLen + 1, 0);
        strlcpy((char *)targetPrivate->name, nodename, nodenameLen + 1);
 
+       targetPrivate->needResolve = TRUE;
+       targetPrivate->info.flags |= kSCNetworkReachabilityFlagsFirstResolvePending;
+
        return (SCNetworkReachabilityRef)targetPrivate;
 }
 
        return (SCNetworkReachabilityRef)targetPrivate;
 }
 
@@ -1261,8 +1634,10 @@ SCNetworkReachabilityRef
 SCNetworkReachabilityCreateWithOptions(CFAllocatorRef  allocator,
                                       CFDictionaryRef  options)
 {
 SCNetworkReachabilityCreateWithOptions(CFAllocatorRef  allocator,
                                       CFDictionaryRef  options)
 {
+       CFBooleanRef                    bypass;
        CFDataRef                       data;
        struct addrinfo                 *hints  = NULL;
        CFDataRef                       data;
        struct addrinfo                 *hints  = NULL;
+       const char                      *name;
        CFStringRef                     nodename;
        CFStringRef                     servname;
        SCNetworkReachabilityPrivateRef targetPrivate;
        CFStringRef                     nodename;
        CFStringRef                     servname;
        SCNetworkReachabilityPrivateRef targetPrivate;
@@ -1300,25 +1675,34 @@ SCNetworkReachabilityCreateWithOptions(CFAllocatorRef   allocator,
                        return NULL;
                }
        }
                        return NULL;
                }
        }
+       bypass = CFDictionaryGetValue(options, kSCNetworkReachabilityOptionConnectionOnDemandByPass);
+       if ((bypass != NULL) && !isA_CFBoolean(bypass)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
        if ((nodename == NULL) && (servname == NULL)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
 
        if ((nodename == NULL) && (servname == NULL)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
 
-       targetPrivate = __SCNetworkReachabilityCreatePrivate(allocator);
+       name = _SC_cfstring_to_cstring(nodename, NULL, 0, kCFStringEncodingUTF8);
+       targetPrivate = (SCNetworkReachabilityPrivateRef)SCNetworkReachabilityCreateWithName(allocator, name);
+       CFAllocatorDeallocate(NULL, (void *)name);
        if (targetPrivate == NULL) {
                return NULL;
        }
        if (targetPrivate == NULL) {
                return NULL;
        }
-       targetPrivate->type = reachabilityTypeName;
-       targetPrivate->flags |= kSCNetworkFlagsFirstResolvePending;
-       if (nodename != NULL) {
-               targetPrivate->name = _SC_cfstring_to_cstring(nodename, NULL, 0, kCFStringEncodingUTF8);
-       }
-       if (servname != NULL) {
-               targetPrivate->serv = _SC_cfstring_to_cstring(servname, NULL, 0, kCFStringEncodingUTF8);
+
+       if (targetPrivate->type == reachabilityTypeName) {
+               if (servname != NULL) {
+                       targetPrivate->serv = _SC_cfstring_to_cstring(servname, NULL, 0, kCFStringEncodingUTF8);
+               }
+               if (hints != NULL) {
+                       bcopy(hints, &targetPrivate->hints, sizeof(targetPrivate->hints));
+               }
        }
        }
-       if (hints != NULL) {
-               bcopy(hints, &targetPrivate->hints, sizeof(targetPrivate->hints));
+
+       if (bypass != NULL) {
+               targetPrivate->onDemandBypass = CFBooleanGetValue(bypass);
        }
 
        return (SCNetworkReachabilityRef)targetPrivate;
        }
 
        return (SCNetworkReachabilityRef)targetPrivate;
@@ -1333,7 +1717,7 @@ SCNetworkReachabilityGetTypeID(void)
 }
 
 
 }
 
 
-CFArrayRef
+CFArrayRef     /* CFArray[CFData], where each CFData is a (struct sockaddr *) */
 SCNetworkReachabilityCopyResolvedAddress(SCNetworkReachabilityRef      target,
                                         int                            *error_num)
 {
 SCNetworkReachabilityCopyResolvedAddress(SCNetworkReachabilityRef      target,
                                         int                            *error_num)
 {
@@ -1382,16 +1766,20 @@ __SCNetworkReachabilitySetResolvedAddress(int32_t                       status,
        }
 
        if ((status == 0) && (res != NULL)) {
        }
 
        if ((status == 0) && (res != NULL)) {
-
                CFMutableArrayRef       addresses;
 
                addresses = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
                for (resP = res; resP; resP = resP->ai_next) {
                CFMutableArrayRef       addresses;
 
                addresses = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 
                for (resP = res; resP; resP = resP->ai_next) {
+                       CFIndex         n;
                        CFDataRef       newAddress;
 
                        newAddress = CFDataCreate(NULL, (void *)resP->ai_addr, resP->ai_addr->sa_len);
                        CFDataRef       newAddress;
 
                        newAddress = CFDataCreate(NULL, (void *)resP->ai_addr, resP->ai_addr->sa_len);
-                       CFArrayAppendValue(addresses, newAddress);
+                       n = CFArrayGetCount(addresses);
+                       if ((n == 0) ||
+                           !CFArrayContainsValue(addresses, CFRangeMake(0, n), newAddress)) {
+                               CFArrayAppendValue(addresses, newAddress);
+                       }
                        CFRelease(newAddress);
                }
 
                        CFRelease(newAddress);
                }
 
@@ -1399,19 +1787,20 @@ __SCNetworkReachabilitySetResolvedAddress(int32_t                       status,
                targetPrivate->resolvedAddress      = addresses;
                targetPrivate->resolvedAddressError = NETDB_SUCCESS;
        } else {
                targetPrivate->resolvedAddress      = addresses;
                targetPrivate->resolvedAddressError = NETDB_SUCCESS;
        } else {
-               SCLog(_sc_debug, LOG_INFO, CFSTR("getaddrinfo() failed: %s"), gai_strerror(status));
+               SCLog(_sc_debug, LOG_INFO, CFSTR("%sgetaddrinfo() failed: %s"),
+                     targetPrivate->log_prefix,
+                     gai_strerror(status));
 
                /* save the error associated with the attempt to resolve the name */
                targetPrivate->resolvedAddress      = CFRetain(kCFNull);
                targetPrivate->resolvedAddressError = status;
        }
 
                /* save the error associated with the attempt to resolve the name */
                targetPrivate->resolvedAddress      = CFRetain(kCFNull);
                targetPrivate->resolvedAddressError = status;
        }
+       targetPrivate->needResolve = FALSE;
 
        if (res != NULL)        freeaddrinfo(res);
 
 
        if (res != NULL)        freeaddrinfo(res);
 
-       if (targetPrivate->rls != NULL) {
-               SCLog(_sc_debug, LOG_INFO, CFSTR("DNS request completed"));
-               CFRunLoopSourceSignal(targetPrivate->rls);
-               _SC_signalRunLoop(target, targetPrivate->rls, targetPrivate->rlList);
+       if (targetPrivate->scheduled) {
+               __SCNetworkReachabilityPerform(target);
        }
 
        return;
        }
 
        return;
@@ -1424,7 +1813,8 @@ __SCNetworkReachabilityCallbackSetResolvedAddress(int32_t status, struct addrinf
        SCNetworkReachabilityRef        target          = (SCNetworkReachabilityRef)context;
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
 
        SCNetworkReachabilityRef        target          = (SCNetworkReachabilityRef)context;
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
 
-       __log_query_time(((status == 0) && (res != NULL)),      // if successful query
+       __log_query_time(target,
+                        ((status == 0) && (res != NULL)),      // if successful query
                         TRUE,                                  // async
                         &targetPrivate->dnsQueryStart);        // start time
 
                         TRUE,                                  // async
                         &targetPrivate->dnsQueryStart);        // start time
 
@@ -1440,42 +1830,223 @@ __SCNetworkReachabilityCallbackSetResolvedAddress(int32_t status, struct addrinf
  *   Reachable           == 2
  */
 static int
  *   Reachable           == 2
  */
 static int
-rankReachability(SCNetworkConnectionFlags flags)
+rankReachability(SCNetworkReachabilityFlags flags)
 {
        int     rank = 0;
 
 {
        int     rank = 0;
 
-       if (flags & kSCNetworkFlagsReachable)           rank = 2;
-       if (flags & kSCNetworkFlagsConnectionRequired)  rank = 1;
+       if (flags & kSCNetworkReachabilityFlagsReachable)               rank = 2;
+       if (flags & kSCNetworkReachabilityFlagsConnectionRequired)      rank = 1;
        return rank;
 }
 
 
        return rank;
 }
 
 
+#pragma mark -
+#pragma mark DNS name resolution
+
+
+static CFStringRef
+replyMPCopyDescription(const void *info)
+{
+       SCNetworkReachabilityRef        target          = (SCNetworkReachabilityRef)info;
+       SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
+
+       return CFStringCreateWithFormat(NULL,
+                                       NULL,
+                                       CFSTR("<getaddrinfo_async_start reply MP> {%s%s%s%s%s, target = %p}"),
+                                       targetPrivate->name != NULL ? "name = " : "",
+                                       targetPrivate->name != NULL ? targetPrivate->name : "",
+                                       targetPrivate->name != NULL && targetPrivate->serv != NULL ? ", " : "",
+                                       targetPrivate->serv != NULL ? "serv = " : "",
+                                       targetPrivate->serv != NULL ? targetPrivate->serv : "",
+                                       target);
+}
+
+
+static void
+processAsyncDNSReply(mach_port_t mp, void *msg, SCNetworkReachabilityRef target);
+
+
 static void
 getaddrinfo_async_handleCFReply(CFMachPortRef port, void *msg, CFIndex size, void *info)
 static void
 getaddrinfo_async_handleCFReply(CFMachPortRef port, void *msg, CFIndex size, void *info)
+{
+       mach_port_t                     mp      = CFMachPortGetPort(port);
+       SCNetworkReachabilityRef        target  = (SCNetworkReachabilityRef)info;
+
+       processAsyncDNSReply(mp, msg, target);
+       return;
+}
+
+
+#if    !TARGET_OS_IPHONE
+static boolean_t
+SCNetworkReachabilityNotifyMIGCallback(mach_msg_header_t *message, mach_msg_header_t *reply)
+{
+       mach_port_t                     mp      = message->msgh_local_port;
+       SCNetworkReachabilityRef        target  = dispatch_get_context(dispatch_get_current_queue());
+
+       processAsyncDNSReply(mp, message, target);
+       reply->msgh_remote_port = MACH_PORT_NULL;
+       return false;
+}
+#endif // !TARGET_OS_IPHONE
+
+
+static Boolean
+enqueueAsyncDNSQuery(SCNetworkReachabilityRef target, mach_port_t mp)
+{
+       CFMachPortContext               context = { 0
+                                                 , (void *)target
+                                                 , CFRetain
+                                                 , CFRelease
+                                                 , replyMPCopyDescription
+                                                 };
+       SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
+
+       targetPrivate->dnsMP = mp;
+       targetPrivate->dnsPort = CFMachPortCreateWithPort(NULL,
+                                                         mp,
+                                                         getaddrinfo_async_handleCFReply,
+                                                         &context,
+                                                         NULL);
+#if    !TARGET_OS_IPHONE
+       if (targetPrivate->dispatchQueue != NULL) {
+               dispatch_queue_attr_t   attr;
+               long                    res;
+
+               attr = dispatch_queue_attr_create();
+               res = dispatch_queue_attr_set_finalizer(attr,
+                                                       ^(dispatch_queue_t dq) {
+                                                               SCNetworkReachabilityRef        target;
+
+                                                               target = (SCNetworkReachabilityRef)dispatch_get_context(dq);
+                                                               CFRelease(target);
+                                                       });
+               if (res != 0) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCNetworkReachability dispatch_queue_attr_set_finalizer() failed"));
+                       dispatch_release(attr);
+                       goto fail;
+               }
+               targetPrivate->asyncDNSQueue = dispatch_queue_create("com.apple.SCNetworkReachabilty.async_DNS_query", attr);
+               dispatch_release(attr);
+               if (targetPrivate->asyncDNSQueue == NULL) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCNetworkReachability dispatch_queue_create() failed"));
+                       goto fail;
+               }
+               CFRetain(target);       // Note: will be released when the dispatch queue is released
+               dispatch_set_context(targetPrivate->asyncDNSQueue, (void *)target);
+               targetPrivate->asyncDNSSource = dispatch_source_mig_create(mp,
+                                                                          sizeof(mach_msg_header_t),
+                                                                          NULL,
+                                                                          targetPrivate->asyncDNSQueue,
+                                                                          SCNetworkReachabilityNotifyMIGCallback);
+               if (targetPrivate->asyncDNSSource == NULL) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCNetworkReachability dispatch_source_mig_create() failed"));
+                       goto fail;
+               }
+       } else
+#endif // !TARGET_OS_IPHONE
+       if (targetPrivate->rls != NULL) {
+               CFIndex i;
+               CFIndex n;
+
+               targetPrivate->dnsRLS = CFMachPortCreateRunLoopSource(NULL, targetPrivate->dnsPort, 0);
+
+               n = CFArrayGetCount(targetPrivate->rlList);
+               for (i = 0; i < n; i += 3) {
+                       CFRunLoopRef    rl      = (CFRunLoopRef)CFArrayGetValueAtIndex(targetPrivate->rlList, i+1);
+                       CFStringRef     rlMode  = (CFStringRef) CFArrayGetValueAtIndex(targetPrivate->rlList, i+2);
+
+                       CFRunLoopAddSource(rl, targetPrivate->dnsRLS, rlMode);
+               }
+       }
+
+       return TRUE;
+
+#if    !TARGET_OS_IPHONE
+    fail :
+
+       if (targetPrivate->asyncDNSSource != NULL) {
+               dispatch_cancel(targetPrivate->asyncDNSSource);
+               dispatch_release(targetPrivate->asyncDNSSource);
+               targetPrivate->asyncDNSSource = NULL;
+       }
+       if (targetPrivate->asyncDNSQueue != NULL) {
+               dispatch_release(targetPrivate->asyncDNSQueue);
+               targetPrivate->asyncDNSQueue = NULL;
+       }
+
+       CFMachPortInvalidate(targetPrivate->dnsPort);
+       CFRelease(targetPrivate->dnsPort);
+       targetPrivate->dnsPort = NULL;
+       targetPrivate->dnsMP = MACH_PORT_NULL;
+
+       _SCErrorSet(kSCStatusFailed);
+       return FALSE;
+#endif // !TARGET_OS_IPHONE
+}
+
+
+static void
+dequeueAsyncDNSQuery(SCNetworkReachabilityRef target)
+{
+       SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
+
+#if    !TARGET_OS_IPHONE
+       if (targetPrivate->asyncDNSSource != NULL) {
+               dispatch_cancel(targetPrivate->asyncDNSSource);
+               dispatch_release(targetPrivate->asyncDNSSource);
+               targetPrivate->asyncDNSSource = NULL;
+       }
+       if (targetPrivate->asyncDNSQueue != NULL) {
+               dispatch_release(targetPrivate->asyncDNSQueue);
+               targetPrivate->asyncDNSQueue = NULL;
+       }
+#endif // !TARGET_OS_IPHONE
+
+       if (targetPrivate->dnsRLS != NULL) {
+               CFRelease(targetPrivate->dnsRLS);
+               targetPrivate->dnsRLS = NULL;
+       }
+
+       CFMachPortInvalidate(targetPrivate->dnsPort);
+       CFRelease(targetPrivate->dnsPort);
+       targetPrivate->dnsPort = NULL;
+       targetPrivate->dnsMP = MACH_PORT_NULL;
+
+       return;
+}
+
+
+static void
+processAsyncDNSReply(mach_port_t mp, void *msg, SCNetworkReachabilityRef target)
 {
        int32_t                         status;
 {
        int32_t                         status;
-       SCNetworkReachabilityRef        target          = (SCNetworkReachabilityRef)info;
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
 
        pthread_mutex_lock(&targetPrivate->lock);
 
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
 
        pthread_mutex_lock(&targetPrivate->lock);
 
+       if (mp != targetPrivate->dnsMP) {
+               // we've received a callback on the async DNS port but since the
+               // associated CFMachPort doesn't match than the request must have
+               // already been cancelled.
+               SCLog(TRUE, LOG_ERR, CFSTR("processAsyncDNSReply(): mp != targetPrivate->dnsMP"));
+               pthread_mutex_unlock(&targetPrivate->lock);
+               return;
+       }
+
+       dequeueAsyncDNSQuery(target);
        status = getaddrinfo_async_handle_reply(msg);
        if ((status == 0) &&
            (targetPrivate->resolvedAddress == NULL) && (targetPrivate->resolvedAddressError == NETDB_SUCCESS)) {
        status = getaddrinfo_async_handle_reply(msg);
        if ((status == 0) &&
            (targetPrivate->resolvedAddress == NULL) && (targetPrivate->resolvedAddressError == NETDB_SUCCESS)) {
-               // if request has been re-queued
-               goto again;
-       }
+               Boolean ok;
 
 
-       if (port == targetPrivate->dnsPort) {
-               CFRunLoopSourceInvalidate(targetPrivate->dnsRLS);
-               CFRelease(targetPrivate->dnsRLS);
-               targetPrivate->dnsRLS = NULL;
-               CFRelease(targetPrivate->dnsPort);
-               targetPrivate->dnsPort = NULL;
+               // if the request is not complete and needs to be re-queued
+               ok = enqueueAsyncDNSQuery(target, mp);
+               if (!ok) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("processAsyncDNSReply enqueueAsyncDNSQuery() failed"));
+               }
        }
 
        }
 
-    again :
-
        pthread_mutex_unlock(&targetPrivate->lock);
 
        return;
        pthread_mutex_unlock(&targetPrivate->lock);
 
        return;
@@ -1485,18 +2056,19 @@ getaddrinfo_async_handleCFReply(CFMachPortRef port, void *msg, CFIndex size, voi
 static Boolean
 check_resolver_reachability(SCDynamicStoreRef          *storeP,
                            dns_resolver_t              *resolver,
 static Boolean
 check_resolver_reachability(SCDynamicStoreRef          *storeP,
                            dns_resolver_t              *resolver,
-                           SCNetworkConnectionFlags    *flags,
-                           Boolean                     *haveDNS)
+                           SCNetworkReachabilityFlags  *flags,
+                           Boolean                     *haveDNS,
+                           const char                  *log_prefix)
 {
        int             i;
        Boolean         ok      = TRUE;
 
 {
        int             i;
        Boolean         ok      = TRUE;
 
-       *flags   = kSCNetworkFlagsReachable;
+       *flags   = kSCNetworkReachabilityFlagsReachable;
        *haveDNS = FALSE;
 
        for (i = 0; i < resolver->n_nameserver; i++) {
        *haveDNS = FALSE;
 
        for (i = 0; i < resolver->n_nameserver; i++) {
-               struct sockaddr                 *address        = resolver->nameserver[i];
-               SCNetworkConnectionFlags        ns_flags        = 0;
+               struct sockaddr         *address        = resolver->nameserver[i];
+               ReachabilityInfo        ns_info;
 
                *haveDNS = TRUE;
 
 
                *haveDNS = TRUE;
 
@@ -1509,15 +2081,15 @@ check_resolver_reachability(SCDynamicStoreRef           *storeP,
                        continue;
                }
 
                        continue;
                }
 
-               ok = checkAddress(storeP, address, &ns_flags, NULL);
+               ok = checkAddress(storeP, address, &ns_info, log_prefix);
                if (!ok) {
                        /* not today */
                        goto done;
                }
 
                if (!ok) {
                        /* not today */
                        goto done;
                }
 
-               if (rankReachability(ns_flags) < rankReachability(*flags)) {
+               if (rankReachability(ns_info.flags) < rankReachability(*flags)) {
                        /* return the worst case result */
                        /* return the worst case result */
-                       *flags = ns_flags;
+                       *flags = ns_info.flags;
                }
        }
 
                }
        }
 
@@ -1531,8 +2103,9 @@ static Boolean
 check_matching_resolvers(SCDynamicStoreRef             *storeP,
                         dns_config_t                   *dns_config,
                         const char                     *fqdn,
 check_matching_resolvers(SCDynamicStoreRef             *storeP,
                         dns_config_t                   *dns_config,
                         const char                     *fqdn,
-                        SCNetworkConnectionFlags       *flags,
-                        Boolean                        *haveDNS)
+                        SCNetworkReachabilityFlags     *flags,
+                        Boolean                        *haveDNS,
+                        const char                     *log_prefix)
 {
        int             i;
        Boolean         matched = FALSE;
 {
        int             i;
        Boolean         matched = FALSE;
@@ -1560,7 +2133,7 @@ check_matching_resolvers(SCDynamicStoreRef                *storeP,
                                         * if name matches domain
                                         */
                                        matched = TRUE;
                                         * if name matches domain
                                         */
                                        matched = TRUE;
-                                       ok = check_resolver_reachability(storeP, resolver, flags, haveDNS);
+                                       ok = check_resolver_reachability(storeP, resolver, flags, haveDNS, log_prefix);
                                        if (!ok) {
                                                /* not today */
                                                return FALSE;
                                        if (!ok) {
                                                /* not today */
                                                return FALSE;
@@ -1715,12 +2288,13 @@ dns_configuration_unwatch()
 }
 
 
 }
 
 
-Boolean
-_SC_checkResolverReachability(SCDynamicStoreRef                        *storeP,
-                             SCNetworkConnectionFlags          *flags,
-                             Boolean                           *haveDNS,
-                             const char *                      nodename,
-                             const char *                      servname)
+static Boolean
+_SC_R_checkResolverReachability(SCDynamicStoreRef              *storeP,
+                               SCNetworkReachabilityFlags      *flags,
+                               Boolean                         *haveDNS,
+                               const char                      *nodename,
+                               const char                      *servname,
+                               const char                      *log_prefix)
 {
        dns_resolver_t          *default_resolver;
        dns_configuration_t     *dns;
 {
        dns_resolver_t          *default_resolver;
        dns_configuration_t     *dns;
@@ -1730,6 +2304,7 @@ _SC_checkResolverReachability(SCDynamicStoreRef                   *storeP,
        Boolean                 isFQDN                  = FALSE;
        uint32_t                len;
        Boolean                 ok                      = TRUE;
        Boolean                 isFQDN                  = FALSE;
        uint32_t                len;
        Boolean                 ok                      = TRUE;
+       Boolean                 useDefault              = FALSE;
 
        /*
         * We first assume that all of the configured DNS servers
 
        /*
         * We first assume that all of the configured DNS servers
@@ -1739,7 +2314,7 @@ _SC_checkResolverReachability(SCDynamicStoreRef                   *storeP,
         * proceed if we know that our query can be answered.
         */
 
         * proceed if we know that our query can be answered.
         */
 
-       *flags   = kSCNetworkFlagsReachable;
+       *flags   = kSCNetworkReachabilityFlagsReachable;
        *haveDNS = FALSE;
 
        len = (nodename != NULL) ? strlen(nodename) : 0;
        *haveDNS = FALSE;
 
        len = (nodename != NULL) ? strlen(nodename) : 0;
@@ -1754,15 +2329,17 @@ _SC_checkResolverReachability(SCDynamicStoreRef                 *storeP,
        dns = dns_configuration_retain();
        if (dns == NULL) {
                // if error
        dns = dns_configuration_retain();
        if (dns == NULL) {
                // if error
+               SCLog(_sc_debug, LOG_INFO, CFSTR("%sDNS: no configuration"), log_prefix);
                goto done;
        }
 
        if (dns->config->n_resolver == 0) {
                // if no resolver configuration
                goto done;
        }
 
        if (dns->config->n_resolver == 0) {
                // if no resolver configuration
+               SCLog(_sc_debug, LOG_INFO, CFSTR("%sDNS: no resolvers"), log_prefix);
                goto done;
        }
 
                goto done;
        }
 
-       *flags = kSCNetworkFlagsReachable;
+       *flags = kSCNetworkReachabilityFlagsReachable;
 
        if (fqdn[len - 1] == '.') {
                isFQDN = TRUE;
 
        if (fqdn[len - 1] == '.') {
                isFQDN = TRUE;
@@ -1779,12 +2356,54 @@ _SC_checkResolverReachability(SCDynamicStoreRef                 *storeP,
        default_resolver = dns->config->resolver[0];
 
        /*
        default_resolver = dns->config->resolver[0];
 
        /*
-        * try the provided name
+        * check if the provided name matches a supplemental domain
         */
         */
-       found = check_matching_resolvers(storeP, dns->config, fqdn, flags, haveDNS);
-       if (!found && !isFQDN && (dns->config->n_resolver > 1)) {
+       found = check_matching_resolvers(storeP, dns->config, fqdn, flags, haveDNS, log_prefix);
+
+       if (!found && !isFQDN) {
+               /*
+                * if we did not match a supplemental domain name and if the
+                * provided name has enough "."s then the first query will be
+                * directed to the default resolver.
+                */
+               char    *cp;
+               int     dots;
+               int     ndots   = 1;
+
+#define        NDOTS_OPT       "ndots="
+#define        NDOTS_OPT_LEN   (sizeof("ndots=") - 1)
+
+               if (default_resolver->options != NULL) {
+                       cp = strstr(default_resolver->options, NDOTS_OPT);
+                       if ((cp != NULL) &&
+                           ((cp == default_resolver->options) || isspace(cp[-1])) &&
+                           ((cp[NDOTS_OPT_LEN] != '\0') && isdigit(cp[NDOTS_OPT_LEN]))) {
+                               char    *end;
+                               long    val;
+
+                               cp +=  NDOTS_OPT_LEN;
+                               errno = 0;
+                               val = strtol(cp, &end, 10);
+                               if ((*cp != '\0') && (cp != end) && (errno == 0) &&
+                               ((*end == '\0') || isspace(*end))) {
+                                       ndots = val;
+                               }
+                       }
+               }
+
+               dots = 0;
+               for (cp = fqdn; *cp != '\0'; cp++) {
+                       if (*cp == '.') dots++;
+               }
+
+               if (dots > ndots) {
+                       useDefault = TRUE;
+               }
+       }
+
+       if (!found && !isFQDN && !useDefault && (dns->config->n_resolver > 1)) {
                /*
                /*
-                * FQDN not specified, try w/search or default domain(s) too
+                * FQDN not specified, try matching w/search domains
                 */
                if (default_resolver->n_search > 0) {
                        for (i = 0; !found && (i < default_resolver->n_search); i++) {
                 */
                if (default_resolver->n_search > 0) {
                        for (i = 0; !found && (i < default_resolver->n_search); i++) {
@@ -1797,7 +2416,12 @@ _SC_checkResolverReachability(SCDynamicStoreRef                  *storeP,
                                }
 
                                // try the provided name with the search domain appended
                                }
 
                                // try the provided name with the search domain appended
-                               found = check_matching_resolvers(storeP, dns->config, search_fqdn, flags, haveDNS);
+                               found = check_matching_resolvers(storeP,
+                                                                dns->config,
+                                                                search_fqdn,
+                                                                flags,
+                                                                haveDNS,
+                                                                log_prefix);
                                free(search_fqdn);
                        }
                } else if (default_resolver->domain != NULL) {
                                free(search_fqdn);
                        }
                } else if (default_resolver->domain != NULL) {
@@ -1833,7 +2457,12 @@ _SC_checkResolverReachability(SCDynamicStoreRef                  *storeP,
                                }
 
                                // try the provided name with the [default] domain appended
                                }
 
                                // try the provided name with the [default] domain appended
-                               found = check_matching_resolvers(storeP, dns->config, search_fqdn, flags, haveDNS);
+                               found = check_matching_resolvers(storeP,
+                                                                dns->config,
+                                                                search_fqdn,
+                                                                flags,
+                                                                haveDNS,
+                                                                log_prefix);
                                free(search_fqdn);
 
                                // move to the next component of the [default] domain
                                free(search_fqdn);
 
                                // move to the next component of the [default] domain
@@ -1846,7 +2475,7 @@ _SC_checkResolverReachability(SCDynamicStoreRef                   *storeP,
                /*
                 * check the reachability of the default resolver
                 */
                /*
                 * check the reachability of the default resolver
                 */
-               ok = check_resolver_reachability(storeP, default_resolver, flags, haveDNS);
+               ok = check_resolver_reachability(storeP, default_resolver, flags, haveDNS, log_prefix);
        }
 
        if (fqdn != nodename)   free(fqdn);
        }
 
        if (fqdn != nodename)   free(fqdn);
@@ -1861,6 +2490,17 @@ _SC_checkResolverReachability(SCDynamicStoreRef                  *storeP,
 }
 
 
 }
 
 
+Boolean
+_SC_checkResolverReachability(SCDynamicStoreRef                        *storeP,
+                             SCNetworkReachabilityFlags        *flags,
+                             Boolean                           *haveDNS,
+                             const char                        *nodename,
+                             const char                        *servname)
+{
+       return _SC_R_checkResolverReachability(storeP, flags, haveDNS, nodename, servname, "");
+}
+
+
 /*
  * _SC_checkResolverReachabilityByAddress()
  *
 /*
  * _SC_checkResolverReachabilityByAddress()
  *
@@ -1868,10 +2508,10 @@ _SC_checkResolverReachability(SCDynamicStoreRef                 *storeP,
  * using the current network configuration.
  */
 Boolean
  * using the current network configuration.
  */
 Boolean
-_SC_checkResolverReachabilityByAddress(SCDynamicStoreRef       *storeP,
-                                      SCNetworkConnectionFlags *flags,
-                                      Boolean                  *haveDNS,
-                                      struct sockaddr          *sa)
+_SC_checkResolverReachabilityByAddress(SCDynamicStoreRef               *storeP,
+                                      SCNetworkReachabilityFlags       *flags,
+                                      Boolean                          *haveDNS,
+                                      struct sockaddr                  *sa)
 {
        int                             i;
        Boolean                         ok              = FALSE;
 {
        int                             i;
        Boolean                         ok              = FALSE;
@@ -1942,7 +2582,7 @@ _SC_checkResolverReachabilityByAddress(SCDynamicStoreRef  *storeP,
                        goto done;
        }
 
                        goto done;
        }
 
-       ok = _SC_checkResolverReachability(storeP, flags, haveDNS, ptr_name, NULL);
+       ok = _SC_R_checkResolverReachability(storeP, flags, haveDNS, ptr_name, NULL, "");
 
     done :
 
 
     done :
 
@@ -1950,41 +2590,16 @@ _SC_checkResolverReachabilityByAddress(SCDynamicStoreRef        *storeP,
 }
 
 
 }
 
 
-static CFStringRef
-replyMPCopyDescription(const void *info)
-{
-       SCNetworkReachabilityRef        target          = (SCNetworkReachabilityRef)info;
-       SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
-
-       return CFStringCreateWithFormat(NULL,
-                                       NULL,
-                                       CFSTR("<getaddrinfo_async_start reply MP> {%s%s%s%s%s, target = %p}"),
-                                       targetPrivate->name != NULL ? "name = " : "",
-                                       targetPrivate->name != NULL ? targetPrivate->name : "",
-                                       targetPrivate->name != NULL && targetPrivate->serv != NULL ? ", " : "",
-                                       targetPrivate->serv != NULL ? "serv = " : "",
-                                       targetPrivate->serv != NULL ? targetPrivate->serv : "",
-                                       target);
-}
-
-
 static Boolean
 startAsyncDNSQuery(SCNetworkReachabilityRef target) {
 static Boolean
 startAsyncDNSQuery(SCNetworkReachabilityRef target) {
-       CFMachPortContext               context         = { 0
-                                                         , (void *)target
-                                                         , CFRetain
-                                                         , CFRelease
-                                                         , replyMPCopyDescription
-                                                         };
        int                             error;
        int                             error;
-       CFIndex                         i;
-       CFIndex                         n;
-       mach_port_t                     port;
+       mach_port_t                     mp;
+       Boolean                         ok;
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
 
        (void) gettimeofday(&targetPrivate->dnsQueryStart, NULL);
 
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
 
        (void) gettimeofday(&targetPrivate->dnsQueryStart, NULL);
 
-       error = getaddrinfo_async_start(&port,
+       error = getaddrinfo_async_start(&mp,
                                        targetPrivate->name,
                                        targetPrivate->serv,
                                        &targetPrivate->hints,
                                        targetPrivate->name,
                                        targetPrivate->serv,
                                        &targetPrivate->hints,
@@ -1996,64 +2611,273 @@ startAsyncDNSQuery(SCNetworkReachabilityRef target) {
                return FALSE;
        }
 
                return FALSE;
        }
 
-       targetPrivate->dnsPort = CFMachPortCreateWithPort(NULL,
-                                                         port,
-                                                         getaddrinfo_async_handleCFReply,
-                                                         &context,
-                                                         NULL);
-       targetPrivate->dnsRLS = CFMachPortCreateRunLoopSource(NULL, targetPrivate->dnsPort, 0);
-
-       n = CFArrayGetCount(targetPrivate->rlList);
-       for (i = 0; i < n; i += 3) {
-               CFRunLoopRef    rl      = (CFRunLoopRef)CFArrayGetValueAtIndex(targetPrivate->rlList, i+1);
-               CFStringRef     rlMode  = (CFStringRef) CFArrayGetValueAtIndex(targetPrivate->rlList, i+2);
+       ok = enqueueAsyncDNSQuery(target, mp);
+       return ok;
+}
 
 
-               CFRunLoopAddSource(rl, targetPrivate->dnsRLS, rlMode);
-       }
 
 
-       return TRUE;
-}
+#pragma mark -
+#pragma mark OnDemand
 
 
 
 
-static Boolean
-__SCNetworkReachabilityGetFlags(SCDynamicStoreRef              *storeP,
-                               SCNetworkReachabilityRef        target,
-                               SCNetworkConnectionFlags        *flags,
-                               uint16_t                        *if_index,
-                               Boolean                         async)
+SCNetworkServiceRef
+SCNetworkReachabilityCopyOnDemandService(SCNetworkReachabilityRef      target,
+                                        CFDictionaryRef                *userOptions)
 {
 {
-       CFMutableArrayRef               addresses       = NULL;
+       SCNetworkServiceRef             service         = NULL;
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
-       SCNetworkConnectionFlags        my_flags        = 0;
-       uint16_t                        my_index        = 0;
-       Boolean                         ok              = TRUE;
-
-       *flags = 0;
-       if (if_index != NULL) {
-               *if_index = 0;
-       }
 
        if (!isA_SCNetworkReachability(target)) {
                _SCErrorSet(kSCStatusInvalidArgument);
 
        if (!isA_SCNetworkReachability(target)) {
                _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
+               return NULL;
        }
 
        }
 
-       switch (targetPrivate->type) {
-               case reachabilityTypeAddress :
-               case reachabilityTypeAddressPair : {
-                       /*
-                        * Check "local" address
-                        */
-                       if (targetPrivate->localAddress != NULL) {
-                               /*
+       if (targetPrivate->onDemandServiceID != NULL) {
+               service = _SCNetworkServiceCopyActive(NULL, targetPrivate->onDemandServiceID);
+       }
+
+       if (userOptions != NULL) {
+               if (targetPrivate->onDemandName != NULL) {
+                       *userOptions = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+                       CFDictionarySetValue((CFMutableDictionaryRef)*userOptions, kSCNetworkConnectionSelectionOptionOnDemandHostName, targetPrivate->onDemandName);
+               } else {
+                       *userOptions = NULL;
+               }
+       }
+
+       return service;
+}
+
+
+static void
+__SCNetworkReachabilityOnDemandCheckCallback(SCNetworkReachabilityRef  onDemandServer,
+                                            SCNetworkReachabilityFlags onDemandFlags,
+                                            void                       *info)
+{
+       SCNetworkReachabilityRef        target          = (SCNetworkReachabilityRef)info;
+       SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
+
+       pthread_mutex_lock(&targetPrivate->lock);
+
+       if (!targetPrivate->scheduled) {
+               // if not currently scheduled
+               pthread_mutex_unlock(&targetPrivate->lock);
+               return;
+       }
+
+       SCLog(_sc_debug, LOG_INFO, CFSTR("%sOnDemand \"server\" status changed"),
+             targetPrivate->log_prefix);
+       __SCNetworkReachabilityPerform(target);
+
+       pthread_mutex_unlock(&targetPrivate->lock);
+
+       return;
+}
+
+
+static Boolean
+__SCNetworkReachabilityOnDemandCheck(SCDynamicStoreRef         *storeP,
+                                    SCNetworkReachabilityRef   target,
+                                    Boolean                    onDemandRetry,
+                                    SCNetworkReachabilityFlags *flags)
+{
+       Boolean                         ok;
+       Boolean                         onDemand                = FALSE;
+       CFStringRef                     onDemandRemoteAddress   = NULL;
+       CFStringRef                     onDemandServiceID       = NULL;
+       SCNetworkConnectionStatus       onDemandStatus;
+       SCNetworkReachabilityPrivateRef targetPrivate           = (SCNetworkReachabilityPrivateRef)target;
+
+//     SCLog(_sc_debug, LOG_INFO,
+//           CFSTR("%s__SCNetworkReachabilityOnDemandCheck %s"),
+//           targetPrivate->log_prefix,
+//           onDemandRetry ? "after" : "before");
+
+       if (targetPrivate->onDemandName == NULL) {
+               targetPrivate->onDemandName = CFStringCreateWithCString(NULL, targetPrivate->name, kCFStringEncodingUTF8);
+       }
+
+       /*
+        * check if an OnDemand VPN configuration matches the name.
+        */
+       ok = __SCNetworkConnectionCopyOnDemandInfoWithName(storeP,
+                                                          targetPrivate->onDemandName,
+                                                          onDemandRetry,
+                                                          &onDemandServiceID,
+                                                          &onDemandStatus,
+                                                          &onDemandRemoteAddress);
+       if (!_SC_CFEqual(targetPrivate->onDemandRemoteAddress, onDemandRemoteAddress) ||
+           !_SC_CFEqual(targetPrivate->onDemandServiceID, onDemandServiceID)) {
+               if (targetPrivate->onDemandRemoteAddress != NULL) {
+                       CFRelease(targetPrivate->onDemandRemoteAddress);
+                       targetPrivate->onDemandRemoteAddress = NULL;
+               }
+
+               if (targetPrivate->onDemandServer != NULL) {
+#if    !TARGET_OS_IPHONE
+                       if (targetPrivate->dispatchQueue != NULL) {
+                               // unschedule
+                               __SCNetworkReachabilityUnscheduleFromRunLoop(targetPrivate->onDemandServer, NULL, NULL, TRUE);
+                       } else
+#endif // !TARGET_OS_IPHONE
+                       if (targetPrivate->rls != NULL) {
+                               CFIndex i;
+                               CFIndex n;
+
+                               // unschedule
+                               n = CFArrayGetCount(targetPrivate->rlList);
+                               for (i = 0; i < n; i += 3) {
+                                       CFRunLoopRef    rl      = (CFRunLoopRef)CFArrayGetValueAtIndex(targetPrivate->rlList, i+1);
+                                       CFStringRef     rlMode  = (CFStringRef) CFArrayGetValueAtIndex(targetPrivate->rlList, i+2);
+
+                                       __SCNetworkReachabilityUnscheduleFromRunLoop(targetPrivate->onDemandServer, rl, rlMode, TRUE);
+                               }
+                       }
+
+                       CFRelease(targetPrivate->onDemandServer);
+                       targetPrivate->onDemandServer = NULL;
+               }
+
+               if (targetPrivate->onDemandServiceID != NULL) {
+                       CFRelease(targetPrivate->onDemandServiceID);
+                       targetPrivate->onDemandServiceID = NULL;
+               }
+       }
+       if (ok) {
+               if (onDemandStatus != kSCNetworkConnectionConnected) {
+                       /*
+                        * if we have a VPN configuration matching the name *and* we need to
+                        * bring the VPN up.  Combine our flags with those of the VPN server.
+                        */
+                       if (targetPrivate->onDemandServer == NULL) {
+                               CFMutableDictionaryRef          options;
+
+                               options = CFDictionaryCreateMutable(NULL,
+                                                                   0,
+                                                                   &kCFTypeDictionaryKeyCallBacks,
+                                                                   &kCFTypeDictionaryValueCallBacks);
+                               CFDictionarySetValue(options, kSCNetworkReachabilityOptionNodeName, onDemandRemoteAddress);
+                               CFDictionarySetValue(options, kSCNetworkReachabilityOptionConnectionOnDemandByPass, kCFBooleanTrue);
+                               targetPrivate->onDemandServer = SCNetworkReachabilityCreateWithOptions(NULL, options);
+                               CFRelease(options);
+
+                               if (targetPrivate->scheduled) {
+                                       SCNetworkReachabilityContext    context = { 0, NULL, CFRetain, CFRelease, CFCopyDescription };
+
+                                       context.info = (void *)target;
+                                       SCNetworkReachabilitySetCallback(targetPrivate->onDemandServer,
+                                                                        __SCNetworkReachabilityOnDemandCheckCallback,
+                                                                        &context);
+
+                                       // schedule server reachability to match that of the target
+#if    !TARGET_OS_IPHONE
+                                       if (targetPrivate->dispatchQueue != NULL) {
+                                               __SCNetworkReachabilityScheduleWithRunLoop(targetPrivate->onDemandServer, NULL, NULL, targetPrivate->dispatchQueue, TRUE);
+                                       } else
+#endif // !TARGET_OS_IPHONE
+                                       {
+                                               CFIndex i;
+                                               CFIndex n;
+
+                                               n = CFArrayGetCount(targetPrivate->rlList);
+                                               for (i = 0; i < n; i += 3) {
+                                                       CFRunLoopRef    rl      = (CFRunLoopRef)CFArrayGetValueAtIndex(targetPrivate->rlList, i+1);
+                                                       CFStringRef     rlMode  = (CFStringRef) CFArrayGetValueAtIndex(targetPrivate->rlList, i+2);
+
+                                                       __SCNetworkReachabilityScheduleWithRunLoop(targetPrivate->onDemandServer, rl, rlMode, NULL, TRUE);
+                                               }
+                                       }
+                               }
+                       }
+
+                       ok = SCNetworkReachabilityGetFlags(targetPrivate->onDemandServer, flags);
+                       SCLog(_sc_debug, LOG_INFO, CFSTR("%s  status  * = 0x%08x"),
+                             targetPrivate->log_prefix,
+                             *flags);
+                       if (ok && (*flags & kSCNetworkReachabilityFlagsReachable)) {
+                               if (!(*flags & kSCNetworkReachabilityFlagsTransientConnection)) {
+                                       // start clean if not already layered on a transient network
+                                       *flags = 0;
+                               }
+                               *flags |= kSCNetworkReachabilityFlagsReachable;
+                               *flags |= kSCNetworkReachabilityFlagsTransientConnection;
+                               *flags |= kSCNetworkReachabilityFlagsConnectionRequired;
+                               *flags |= kSCNetworkReachabilityFlagsConnectionOnDemand;
+
+                               if (_sc_debug) {
+                                       SCLog(TRUE, LOG_INFO, CFSTR("%s  service * = %@"),
+                                             targetPrivate->log_prefix,
+                                             onDemandServiceID);
+                                       SCLog(TRUE, LOG_INFO, CFSTR("%s  status    = isReachable (after OnDemand connect)"),
+                                             targetPrivate->log_prefix);
+                               }
+
+                               onDemand = TRUE;
+                       }
+               }
+
+               if (onDemandRemoteAddress != NULL) {
+                       if (targetPrivate->onDemandRemoteAddress == NULL) {
+                               targetPrivate->onDemandRemoteAddress = onDemandRemoteAddress;
+                       } else {
+                               CFRelease(onDemandRemoteAddress);
+                       }
+               }
+
+               if (onDemandServiceID != NULL) {
+                       if (targetPrivate->onDemandServiceID == NULL) {
+                               targetPrivate->onDemandServiceID = onDemandServiceID;
+                       } else {
+                               CFRelease(onDemandServiceID);
+                       }
+               }
+       }
+
+       return onDemand;
+}
+
+
+#pragma mark -
+#pragma mark Reachability Flags
+
+
+static Boolean
+__SCNetworkReachabilityGetFlags(SCDynamicStoreRef              *storeP,
+                               SCNetworkReachabilityRef        target,
+                               ReachabilityInfo                *reach_info,
+                               Boolean                         async)
+{
+       CFMutableArrayRef               addresses       = NULL;
+       SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
+       ReachabilityInfo                my_info         = NOT_REACHABLE;
+       Boolean                         ok              = TRUE;
+
+       *reach_info = NOT_REACHABLE;
+
+       if (!isA_SCNetworkReachability(target)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       switch (targetPrivate->type) {
+               case reachabilityTypeAddress :
+               case reachabilityTypeAddressPair : {
+                       /*
+                        * Check "local" address
+                        */
+                       if (targetPrivate->localAddress != NULL) {
+                               /*
                                 * Check "local" address
                                 */
                                 * Check "local" address
                                 */
-                               ok = checkAddress(storeP, targetPrivate->localAddress, &my_flags, &my_index);
+                               ok = checkAddress(storeP,
+                                                 targetPrivate->localAddress,
+                                                 &my_info,
+                                                 targetPrivate->log_prefix);
                                if (!ok) {
                                        goto error;     /* not today */
                                }
 
                                if (!ok) {
                                        goto error;     /* not today */
                                }
 
-                               if (!(my_flags & kSCNetworkFlagsIsLocalAddress)) {
+                               if (!(my_info.flags & kSCNetworkReachabilityFlagsIsLocalAddress)) {
                                        goto error;     /* not reachable, non-"local" address */
                                }
                        }
                                        goto error;     /* not reachable, non-"local" address */
                                }
                        }
@@ -2066,13 +2890,15 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef               *storeP,
                                 * in cases where we have "local" and "remote" addresses
                                 * we need to re-initialize the to-be-returned flags.
                                 */
                                 * in cases where we have "local" and "remote" addresses
                                 * we need to re-initialize the to-be-returned flags.
                                 */
-                               my_flags = 0;
-                               my_index = 0;
+                               my_info = NOT_REACHABLE;
 
                                /*
                                 * Check "remote" address
                                 */
 
                                /*
                                 * Check "remote" address
                                 */
-                               ok = checkAddress(storeP, targetPrivate->remoteAddress, &my_flags, &my_index);
+                               ok = checkAddress(storeP,
+                                                 targetPrivate->remoteAddress,
+                                                 &my_info,
+                                                 targetPrivate->log_prefix);
                                if (!ok) {
                                        goto error;     /* not today */
                                }
                                if (!ok) {
                                        goto error;     /* not today */
                                }
@@ -2085,40 +2911,68 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef               *storeP,
                case reachabilityTypeName : {
                        struct timeval                  dnsQueryStart;
                        int                             error;
                case reachabilityTypeName : {
                        struct timeval                  dnsQueryStart;
                        int                             error;
-                       SCNetworkConnectionFlags        ns_flags;
+                       SCNetworkReachabilityFlags      ns_flags;
                        struct addrinfo                 *res;
 
                        addresses = (CFMutableArrayRef)SCNetworkReachabilityCopyResolvedAddress(target, &error);
                        if ((addresses != NULL) || (error != NETDB_SUCCESS)) {
                                /* if resolved or an error had been detected */
                        struct addrinfo                 *res;
 
                        addresses = (CFMutableArrayRef)SCNetworkReachabilityCopyResolvedAddress(target, &error);
                        if ((addresses != NULL) || (error != NETDB_SUCCESS)) {
                                /* if resolved or an error had been detected */
-                               goto checkResolvedAddress;
+                               if (!async) {
+                                       /* if not an async request */
+                                       goto checkResolvedAddress;
+                               } else if ((targetPrivate->dnsPort == NULL) && !targetPrivate->needResolve) {
+                                       /* if async request, no query active, and no query needed */
+                                       goto checkResolvedAddress;
+                               }
+                       }
+
+                       if (!targetPrivate->onDemandBypass) {
+                               Boolean onDemand;
+
+                               /*
+                                * before we attempt our initial DNS query, check if there is
+                                * an OnDemand configuration that we should be using.
+                                */
+                               onDemand = __SCNetworkReachabilityOnDemandCheck(storeP, target, FALSE, &my_info.flags);
+                               if (onDemand) {
+                                       /* if OnDemand connection is needed */
+                                       goto done;
+                               }
                        }
 
                        /* check the reachability of the DNS servers */
                        }
 
                        /* check the reachability of the DNS servers */
-                       ok = _SC_checkResolverReachability(storeP,
-                                                          &ns_flags,
-                                                          &targetPrivate->haveDNS,
-                                                          targetPrivate->name,
-                                                          targetPrivate->serv);
+                       ok = _SC_R_checkResolverReachability(storeP,
+                                                            &ns_flags,
+                                                            &targetPrivate->haveDNS,
+                                                            targetPrivate->name,
+                                                            targetPrivate->serv,
+                                                            targetPrivate->log_prefix);
                        if (!ok) {
                                /* if we could not get DNS server info */
                        if (!ok) {
                                /* if we could not get DNS server info */
+                               SCLog(_sc_debug, LOG_INFO, CFSTR("%sDNS server reachability unknown"),
+                                     targetPrivate->log_prefix);
                                goto error;
                                goto error;
-                       }
-
-                       if (rankReachability(ns_flags) < 2) {
+                       } else if (rankReachability(ns_flags) < 2) {
                                /*
                                 * if DNS servers are not (or are no longer) reachable, set
                                 * flags based on the availability of configured (but not
                                 * active) services.
                                 */
 
                                /*
                                 * if DNS servers are not (or are no longer) reachable, set
                                 * flags based on the availability of configured (but not
                                 * active) services.
                                 */
 
-                               SCLog(_sc_debug, LOG_INFO, CFSTR("DNS server(s) not available"));
+                               SCLog(_sc_debug, LOG_INFO, CFSTR("%sDNS server(s) not available"),
+                                     targetPrivate->log_prefix);
 
 
-                               if (!checkAddress(storeP, NULL, &my_flags, &my_index)) {
+                               ok = checkAddress(storeP,
+                                                 NULL,
+                                                 &my_info,
+                                                 targetPrivate->log_prefix);
+                               if (!ok) {
+                                       SCLog(_sc_debug, LOG_INFO, CFSTR("%sNo available networks"),
+                                             targetPrivate->log_prefix);
                                        goto error;
                                }
 
                                        goto error;
                                }
 
-                               if (async && (targetPrivate->rls != NULL)) {
+                               if (async && targetPrivate->scheduled) {
                                        /*
                                         * return "host not found", set flags appropriately,
                                         * and schedule notification.
                                        /*
                                         * return "host not found", set flags appropriately,
                                         * and schedule notification.
@@ -2126,27 +2980,34 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef               *storeP,
                                        __SCNetworkReachabilityCallbackSetResolvedAddress(EAI_NONAME,
                                                                                          NULL,
                                                                                          (void *)target);
                                        __SCNetworkReachabilityCallbackSetResolvedAddress(EAI_NONAME,
                                                                                          NULL,
                                                                                          (void *)target);
-                                       my_flags |= (targetPrivate->flags & kSCNetworkFlagsFirstResolvePending);
+                                       my_info.flags |= (targetPrivate->info.flags & kSCNetworkReachabilityFlagsFirstResolvePending);
 
 
-                                       SCLog(_sc_debug, LOG_INFO, CFSTR("no DNS servers are reachable"));
-                                       CFRunLoopSourceSignal(targetPrivate->rls);
-                                       _SC_signalRunLoop(target, targetPrivate->rls, targetPrivate->rlList);
+                                       SCLog(_sc_debug, LOG_INFO, CFSTR("%sno DNS servers are reachable"),
+                                             targetPrivate->log_prefix);
+                                       __SCNetworkReachabilityPerform(target);
                                }
                                break;
                        }
 
                        if (async) {
                                /* for async requests we return the last known status */
                                }
                                break;
                        }
 
                        if (async) {
                                /* for async requests we return the last known status */
-                               my_flags = targetPrivate->flags;
-                               my_index = targetPrivate->if_index;
+                               my_info = targetPrivate->info;
 
                                if (targetPrivate->dnsPort != NULL) {
                                        /* if request already in progress */
 
                                if (targetPrivate->dnsPort != NULL) {
                                        /* if request already in progress */
+                                       SCLog(_sc_debug, LOG_INFO,
+                                             CFSTR("%swaiting for DNS reply"),
+                                             targetPrivate->log_prefix);
+                                       if ((addresses != NULL) || (error != NETDB_SUCCESS)) {
+                                               /* updated reachability based on the previous reply */
+                                               goto checkResolvedAddress;
+                                       }
                                        break;
                                }
 
                                SCLog(_sc_debug, LOG_INFO,
                                        break;
                                }
 
                                SCLog(_sc_debug, LOG_INFO,
-                                     CFSTR("start DNS query for %s%s%s%s%s"),
+                                     CFSTR("%sstart DNS query for %s%s%s%s%s"),
+                                     targetPrivate->log_prefix,
                                      targetPrivate->name != NULL ? "name = " : "",
                                      targetPrivate->name != NULL ? targetPrivate->name : "",
                                      targetPrivate->name != NULL && targetPrivate->serv != NULL ? ", " : "",
                                      targetPrivate->name != NULL ? "name = " : "",
                                      targetPrivate->name != NULL ? targetPrivate->name : "",
                                      targetPrivate->name != NULL && targetPrivate->serv != NULL ? ", " : "",
@@ -2166,7 +3027,8 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef         *storeP,
                        }
 
                        SCLog(_sc_debug, LOG_INFO,
                        }
 
                        SCLog(_sc_debug, LOG_INFO,
-                             CFSTR("check DNS for %s%s%s%s%s"),
+                             CFSTR("%scheck DNS for %s%s%s%s%s"),
+                             targetPrivate->log_prefix,
                              targetPrivate->name != NULL ? "name = " : "",
                              targetPrivate->name != NULL ? targetPrivate->name : "",
                              targetPrivate->name != NULL && targetPrivate->serv != NULL ? ", " : "",
                              targetPrivate->name != NULL ? "name = " : "",
                              targetPrivate->name != NULL ? targetPrivate->name : "",
                              targetPrivate->name != NULL && targetPrivate->serv != NULL ? ", " : "",
@@ -2186,9 +3048,10 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef                *storeP,
                                            &targetPrivate->hints,
                                            &res);
 
                                            &targetPrivate->hints,
                                            &res);
 
-                       __log_query_time(((error == 0) && (res != NULL)),// if successful query
-                                        FALSE,                         // sync
-                                        &dnsQueryStart);               // start time
+                       __log_query_time(target,
+                                        ((error == 0) && (res != NULL)),       // if successful query
+                                        FALSE,                                 // sync
+                                        &dnsQueryStart);                       // start time
 
                        __SCNetworkReachabilitySetResolvedAddress(error, res, target);
 
 
                        __SCNetworkReachabilitySetResolvedAddress(error, res, target);
 
@@ -2201,63 +3064,84 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef               *storeP,
                         * Then, check each address for accessibility and return the
                         * best status available.
                         */
                         * Then, check each address for accessibility and return the
                         * best status available.
                         */
-                       my_flags = 0;
-                       my_index = 0;
+                       my_info = NOT_REACHABLE;
 
                        if (isA_CFArray(addresses)) {
                                CFIndex         i;
                                CFIndex         n       = CFArrayGetCount(addresses);
 
                                for (i = 0; i < n; i++) {
 
                        if (isA_CFArray(addresses)) {
                                CFIndex         i;
                                CFIndex         n       = CFArrayGetCount(addresses);
 
                                for (i = 0; i < n; i++) {
-                                       SCNetworkConnectionFlags        ns_flags        = 0;
-                                       uint16_t                        ns_if_index     = 0;
-                                       struct sockaddr                 *sa;
+                                       ReachabilityInfo        ns_info = NOT_REACHABLE;
+                                       struct sockaddr         *sa;
 
                                        sa = (struct sockaddr *)CFDataGetBytePtr(CFArrayGetValueAtIndex(addresses, i));
 
 
                                        sa = (struct sockaddr *)CFDataGetBytePtr(CFArrayGetValueAtIndex(addresses, i));
 
-                                       ok = checkAddress(storeP, sa, &ns_flags, &ns_if_index);
+                                       ok = checkAddress(storeP,
+                                                         sa,
+                                                         &ns_info,
+                                                         targetPrivate->log_prefix);
                                        if (!ok) {
                                                goto error;     /* not today */
                                        }
 
                                        if (!ok) {
                                                goto error;     /* not today */
                                        }
 
-                                       if (rankReachability(ns_flags) > rankReachability(my_flags)) {
+                                       if (rankReachability(ns_info.flags) > rankReachability(my_info.flags)) {
                                                /* return the best case result */
                                                /* return the best case result */
-                                               my_flags = ns_flags;
-                                               my_index = ns_if_index;
-                                               if (rankReachability(my_flags) == 2) {
+                                               my_info = ns_info;
+                                               if (rankReachability(my_info.flags) == 2) {
                                                        /* we're in luck */
                                                        break;
                                                }
                                        }
                                }
                        } else {
                                                        /* we're in luck */
                                                        break;
                                                }
                                        }
                                }
                        } else {
-                               if (((error == EAI_NONAME)
+                               if ((error == EAI_NONAME)
 #if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
                                     || (error == EAI_NODATA)
 #endif
 #if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
                                     || (error == EAI_NODATA)
 #endif
-                                    ) && !targetPrivate->haveDNS) {
+                                    ) {
                                        /*
                                        /*
-                                        * No DNS servers are defined. Set flags based on
-                                        * the availability of configured (but not active)
-                                        * services.
+                                        * the target host name could not be resolved
                                         */
                                         */
-                                       ok = checkAddress(storeP, NULL, &my_flags, &my_index);
-                                       if (!ok) {
-                                               goto error;     /* not today */
-                                       }
+                                       if (!targetPrivate->onDemandBypass) {
+                                               Boolean onDemand;
 
 
-                                       if ((my_flags & kSCNetworkFlagsReachable) &&
-                                           (my_flags & kSCNetworkFlagsConnectionRequired)) {
                                                /*
                                                /*
-                                                * Since we might pick up a set of DNS servers when this connection
-                                                * is established, don't reply with a "HOST NOT FOUND" error just yet.
+                                                * our initial DNS query failed, check again to see if there
+                                                * there is an OnDemand configuration that we should be using.
                                                 */
                                                 */
-                                               break;
+                                               onDemand = __SCNetworkReachabilityOnDemandCheck(storeP, target, TRUE, &my_info.flags);
+                                               if (onDemand) {
+                                                       /* if OnDemand connection is needed */
+                                                       goto done;
+                                               }
                                        }
 
                                        }
 
-                                       /* Host not found, not reachable! */
-                                       my_flags = 0;
-                                       my_index = 0;
+                                       if (!targetPrivate->haveDNS) {
+                                               /*
+                                                * No DNS servers are defined. Set flags based on
+                                                * the availability of configured (but not active)
+                                                * services.
+                                                */
+                                               ok = checkAddress(storeP,
+                                                                 NULL,
+                                                                 &my_info,
+                                                                 targetPrivate->log_prefix);
+                                               if (!ok) {
+                                                       goto error;     /* not today */
+                                               }
+
+                                               if ((my_info.flags & kSCNetworkReachabilityFlagsReachable) &&
+                                                       (my_info.flags & kSCNetworkReachabilityFlagsConnectionRequired)) {
+                                                       /*
+                                                        * Since we might pick up a set of DNS servers when this connection
+                                                        * is established, don't reply with a "HOST NOT FOUND" error just yet.
+                                                        */
+                                                       break;
+                                               }
+
+                                               /* Host not found, not reachable! */
+                                               my_info = NOT_REACHABLE;
+                                       }
                                }
                        }
 
                                }
                        }
 
@@ -2265,10 +3149,9 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef                *storeP,
                }
        }
 
                }
        }
 
-       *flags = my_flags;
-       if (if_index != NULL) {
-               *if_index = my_index;
-       }
+    done:
+
+       *reach_info = my_info;
 
     error :
 
 
     error :
 
@@ -2278,8 +3161,8 @@ __SCNetworkReachabilityGetFlags(SCDynamicStoreRef         *storeP,
 
 
 Boolean
 
 
 Boolean
-SCNetworkReachabilityGetFlags(SCNetworkReachabilityRef target,
-                             SCNetworkConnectionFlags  *flags)
+SCNetworkReachabilityGetFlags(SCNetworkReachabilityRef         target,
+                             SCNetworkReachabilityFlags        *flags)
 {
        Boolean                         ok              = TRUE;
        SCDynamicStoreRef               store           = NULL;
 {
        Boolean                         ok              = TRUE;
        SCDynamicStoreRef               store           = NULL;
@@ -2292,15 +3175,15 @@ SCNetworkReachabilityGetFlags(SCNetworkReachabilityRef  target,
 
        pthread_mutex_lock(&targetPrivate->lock);
 
 
        pthread_mutex_lock(&targetPrivate->lock);
 
-       if (targetPrivate->rlList != NULL) {
+       if (targetPrivate->scheduled) {
                // if being watched, return the last known (and what should be current) status
                // if being watched, return the last known (and what should be current) status
-               *flags = targetPrivate->flags & ~kSCNetworkFlagsFirstResolvePending;
+               *flags = targetPrivate->info.flags & ~kSCNetworkReachabilityFlagsFirstResolvePending;
                goto done;
        }
 
 
                goto done;
        }
 
 
-       ok = __SCNetworkReachabilityGetFlags(&store, target, flags, NULL, FALSE);
-       *flags &= ~kSCNetworkFlagsFirstResolvePending;
+       ok = __SCNetworkReachabilityGetFlags(&store, target, &targetPrivate->info, FALSE);
+       *flags = targetPrivate->info.flags & ~kSCNetworkReachabilityFlagsFirstResolvePending;
        if (store != NULL) CFRelease(store);
 
     done :
        if (store != NULL) CFRelease(store);
 
     done :
@@ -2310,6 +3193,10 @@ SCNetworkReachabilityGetFlags(SCNetworkReachabilityRef   target,
 }
 
 
 }
 
 
+#pragma mark -
+#pragma mark Notifications
+
+
 static void
 __SCNetworkReachabilityReachabilitySetNotifications(SCDynamicStoreRef  store)
 {
 static void
 __SCNetworkReachabilityReachabilitySetNotifications(SCDynamicStoreRef  store)
 {
@@ -2328,6 +3215,7 @@ __SCNetworkReachabilityReachabilitySetNotifications(SCDynamicStoreRef     store)
        CFArrayAppendValue(keys, key);
        CFRelease(key);
 
        CFArrayAppendValue(keys, key);
        CFRelease(key);
 
+       // State:/Network/Global/DNS
        key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                         kSCDynamicStoreDomainState,
                                                         kSCEntNetDNS);
        key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                         kSCDynamicStoreDomainState,
                                                         kSCEntNetDNS);
@@ -2341,6 +3229,13 @@ __SCNetworkReachabilityReachabilitySetNotifications(SCDynamicStoreRef    store)
        CFArrayAppendValue(keys, key);
        CFRelease(key);
 
        CFArrayAppendValue(keys, key);
        CFRelease(key);
 
+       // State:/Network/Global/OnDemand
+       key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
+                                                        kSCDynamicStoreDomainState,
+                                                        kSCEntNetOnDemand);
+       CFArrayAppendValue(keys, key);
+       CFRelease(key);
+
        // Setup: per-service IPv4 info
        pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
                                                              kSCDynamicStoreDomainSetup,
        // Setup: per-service IPv4 info
        pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
                                                              kSCDynamicStoreDomainSetup,
@@ -2365,6 +3260,22 @@ __SCNetworkReachabilityReachabilitySetNotifications(SCDynamicStoreRef    store)
        CFArrayAppendValue(patterns, pattern);
        CFRelease(pattern);
 
        CFArrayAppendValue(patterns, pattern);
        CFRelease(pattern);
 
+       // State: per-service PPP info (for kSCPropNetPPPStatus)
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainState,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetPPP);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+
+       // Setup: per-service IPSec info
+       pattern = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                             kSCDynamicStoreDomainSetup,
+                                                             kSCCompAnyRegex,
+                                                             kSCEntNetIPSec);
+       CFArrayAppendValue(patterns, pattern);
+       CFRelease(pattern);
+
        // State: per-interface IPv4 info
        pattern = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL,
                                                                kSCDynamicStoreDomainState,
        // State: per-interface IPv4 info
        pattern = SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL,
                                                                kSCDynamicStoreDomainState,
@@ -2381,6 +3292,16 @@ __SCNetworkReachabilityReachabilitySetNotifications(SCDynamicStoreRef    store)
        CFArrayAppendValue(patterns, pattern);
        CFRelease(pattern);
 
        CFArrayAppendValue(patterns, pattern);
        CFRelease(pattern);
 
+#if    !TARGET_OS_IPHONE
+       // State: Power Management Capabilities
+       key = SCDynamicStoreKeyCreate(NULL, CFSTR("%@%@"),
+                                     kSCDynamicStoreDomainState,
+                                     CFSTR(kIOPMSystemPowerCapabilitiesKeySuffix));
+       CFArrayAppendValue(keys, key);
+       CFRelease(key);
+#endif // TARGET_OS_IPHONE
+
+
        (void)SCDynamicStoreSetNotificationKeys(store, keys, patterns);
        CFRelease(keys);
        CFRelease(patterns);
        (void)SCDynamicStoreSetNotificationKeys(store, keys, patterns);
        CFRelease(keys);
        CFRelease(patterns);
@@ -2390,43 +3311,98 @@ __SCNetworkReachabilityReachabilitySetNotifications(SCDynamicStoreRef   store)
 
 
 static void
 
 
 static void
-__SCNetworkReachabilityReachabilityHandleChanges(SCDynamicStoreRef     store,
-                                                CFArrayRef             changedKeys,
-                                                void                   *info)
+__SCNetworkReachabilityHandleChanges(SCDynamicStoreRef store,
+                                    CFArrayRef         changedKeys,
+                                    void               *info)
 {
        Boolean         dnsConfigChanged        = FALSE;
        CFIndex         i;
        CFStringRef     key;
 {
        Boolean         dnsConfigChanged        = FALSE;
        CFIndex         i;
        CFStringRef     key;
+       CFIndex         nChanges                = CFArrayGetCount(changedKeys);
        CFIndex         nTargets;
        CFIndex         nTargets;
+#if    !TARGET_OS_IPHONE
+       Boolean         powerStatusChanged      = FALSE;
+#endif // !TARGET_OS_IPHONE
        const void *    targets_q[N_QUICK];
        const void **   targets                 = targets_q;
 
        const void *    targets_q[N_QUICK];
        const void **   targets                 = targets_q;
 
+       if (nChanges == 0) {
+               /* if no changes */
+               return;
+       }
+
        pthread_mutex_lock(&hn_lock);
 
        pthread_mutex_lock(&hn_lock);
 
-       nTargets = CFSetGetCount(hn_targets);
+       nTargets = (hn_targets != NULL) ? CFSetGetCount(hn_targets) : 0;
        if (nTargets == 0) {
                /* if no addresses being monitored */
                goto done;
        }
 
        if (nTargets == 0) {
                /* if no addresses being monitored */
                goto done;
        }
 
-       if (CFArrayGetCount(changedKeys) == 0) {
-               /* if no changes */
-               goto done;
-       }
+#if    !TARGET_OS_IPHONE
+       key = SCDynamicStoreKeyCreate(NULL, CFSTR("%@%@"),
+                                     kSCDynamicStoreDomainState,
+                                     CFSTR(kIOPMSystemPowerCapabilitiesKeySuffix));
+       if (CFArrayContainsValue(changedKeys, CFRangeMake(0, nChanges), key)) {
+               CFNumberRef     num;
+
+               num = SCDynamicStoreCopyValue(store, key);
+               if (num != NULL) {
+                       if (isA_CFNumber(num) &&
+                           CFNumberGetValue(num, kCFNumberSInt32Type, &power_capabilities)) {
+                               powerStatusChanged = TRUE;
+                       }
 
 
-       SCLog(_sc_debug, LOG_INFO, CFSTR("process configuration change"));
+                       CFRelease(num);
+               }
+       }
+       CFRelease(key);
+#endif // !TARGET_OS_IPHONE
 
        key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                         kSCDynamicStoreDomainState,
                                                         kSCEntNetDNS);
 
        key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
                                                         kSCDynamicStoreDomainState,
                                                         kSCEntNetDNS);
-       if (CFArrayContainsValue(changedKeys,
-                                CFRangeMake(0, CFArrayGetCount(changedKeys)),
-                                key)) {
+       if (CFArrayContainsValue(changedKeys, CFRangeMake(0, nChanges), key)) {
                dnsConfigChanged = TRUE;        /* the DNS server(s) have changed */
        }
        CFRelease(key);
 
                dnsConfigChanged = TRUE;        /* the DNS server(s) have changed */
        }
        CFRelease(key);
 
-       SCLog(_sc_debug && dnsConfigChanged, LOG_INFO, CFSTR("  DNS configuration changed"));
+       if (_sc_debug) {
+               int             changes = 0;
+               const char      *str;
+
+#if    !TARGET_OS_IPHONE
+               if (powerStatusChanged) {
+                       changes |= 4;
+                       nChanges -= 1;
+               }
+#endif // !TARGET_OS_IPHONE
+
+               if (dnsConfigChanged) {
+                       changes |= 2;
+                       nChanges -= 1;
+               }
+
+               if (nChanges > 0) {
+                       changes |= 1;
+               }
+
+               switch (changes) {
+                       case 0  : str = "";                             break;
+                       case 1  : str = "network ";                     break;
+                       case 2  : str = "DNS ";                         break;
+                       case 3  : str = "network and DNS ";             break;
+#if    !TARGET_OS_IPHONE
+                       case 4  : str = "power ";                       break;
+                       case 5  : str = "network and power ";           break;
+                       case 6  : str = "DNS and power ";               break;
+                       case 7  : str = "network, DNS, and power ";     break;
+#endif // !TARGET_OS_IPHONE
+                       default : str = "??? ";
+               }
+
+               SCLog(TRUE, LOG_INFO, CFSTR("process %sconfiguration change"), str);
+       }
 
        if (nTargets > (CFIndex)(sizeof(targets_q) / sizeof(CFTypeRef)))
                targets = CFAllocatorAllocate(NULL, nTargets * sizeof(CFTypeRef), 0);
 
        if (nTargets > (CFIndex)(sizeof(targets_q) / sizeof(CFTypeRef)))
                targets = CFAllocatorAllocate(NULL, nTargets * sizeof(CFTypeRef), 0);
@@ -2445,44 +3421,56 @@ __SCNetworkReachabilityReachabilityHandleChanges(SCDynamicStoreRef      store,
                                 * if the DNS configuration didn't change we still need to
                                 * check that the DNS servers are accessible.
                                 */
                                 * if the DNS configuration didn't change we still need to
                                 * check that the DNS servers are accessible.
                                 */
-                               SCNetworkConnectionFlags        ns_flags;
+                               SCNetworkReachabilityFlags      ns_flags;
                                Boolean                         ok;
 
                                /* check the reachability of the DNS servers */
                                Boolean                         ok;
 
                                /* check the reachability of the DNS servers */
-                               ok = _SC_checkResolverReachability(&store,
-                                                                  &ns_flags,
-                                                                  &targetPrivate->haveDNS,
-                                                                  targetPrivate->name,
-                                                                  targetPrivate->serv);
-                               if (!ok || (rankReachability(ns_flags) < 2)) {
-                                       /* if DNS servers are not reachable */
+                               ok = _SC_R_checkResolverReachability(&store,
+                                                                    &ns_flags,
+                                                                    &targetPrivate->haveDNS,
+                                                                    targetPrivate->name,
+                                                                    targetPrivate->serv,
+                                                                    targetPrivate->log_prefix);
+                               if (!ok) {
+                                       /* if we could not get DNS server info */
+                                       SCLog(_sc_debug, LOG_INFO, CFSTR("%sDNS server reachability unknown"),
+                                             targetPrivate->log_prefix);
+                                       dnsChanged = TRUE;
+                               } else if (rankReachability(ns_flags) < 2) {
+                                       /*
+                                        * if DNS servers are not (or are no longer) reachable, set
+                                        * flags based on the availability of configured (but not
+                                        * active) services.
+                                        */
+                                       SCLog(_sc_debug, LOG_INFO, CFSTR("%sDNS server(s) not available"),
+                                             targetPrivate->log_prefix);
                                        dnsChanged = TRUE;
                                }
                        }
 
                        if (dnsChanged) {
                                if (targetPrivate->dnsPort != NULL) {
                                        dnsChanged = TRUE;
                                }
                        }
 
                        if (dnsChanged) {
                                if (targetPrivate->dnsPort != NULL) {
+                                       mach_port_t     mp      = CFMachPortGetPort(targetPrivate->dnsPort);
+
                                        /* cancel the outstanding DNS query */
                                        /* cancel the outstanding DNS query */
-                                       getaddrinfo_async_cancel(CFMachPortGetPort(targetPrivate->dnsPort));
-                                       CFRunLoopSourceInvalidate(targetPrivate->dnsRLS);
-                                       CFRelease(targetPrivate->dnsRLS);
-                                       targetPrivate->dnsRLS = NULL;
-                                       CFRelease(targetPrivate->dnsPort);
-                                       targetPrivate->dnsPort = NULL;
+                                       SCLog(_sc_debug, LOG_INFO,
+                                             CFSTR("%scancel DNS query for %s%s%s%s%s"),
+                                             targetPrivate->log_prefix,
+                                             targetPrivate->name != NULL ? "name = " : "",
+                                             targetPrivate->name != NULL ? targetPrivate->name : "",
+                                             targetPrivate->name != NULL && targetPrivate->serv != NULL ? ", " : "",
+                                             targetPrivate->serv != NULL ? "serv = " : "",
+                                             targetPrivate->serv != NULL ? targetPrivate->serv : "");
+                                       dequeueAsyncDNSQuery(target);
+                                       getaddrinfo_async_cancel(mp);
                                }
 
                                /* schedule request to resolve the name again */
                                }
 
                                /* schedule request to resolve the name again */
-                               if (targetPrivate->resolvedAddress != NULL) {
-                                       CFRelease(targetPrivate->resolvedAddress);
-                                       targetPrivate->resolvedAddress = NULL;
-                               }
-                               targetPrivate->resolvedAddress      = NULL;
-                               targetPrivate->resolvedAddressError = NETDB_SUCCESS;
+                               targetPrivate->needResolve = TRUE;
                        }
                }
 
                        }
                }
 
-               CFRunLoopSourceSignal(targetPrivate->rls);
-               _SC_signalRunLoop(target, targetPrivate->rls, targetPrivate->rlList);
+               __SCNetworkReachabilityPerform(target);
 
                pthread_mutex_unlock(&targetPrivate->lock);
        }
 
                pthread_mutex_unlock(&targetPrivate->lock);
        }
@@ -2495,50 +3483,127 @@ __SCNetworkReachabilityReachabilityHandleChanges(SCDynamicStoreRef     store,
 }
 
 
 }
 
 
+#if    !TARGET_OS_IPHONE
+static __inline__ Boolean
+systemIsAwake(IOPMSystemPowerStateCapabilities power_capabilities)
+{
+
+#define POWER_CAPABILITIES_NEED        (kIOPMSystemPowerStateCapabilityCPU             \
+                                | kIOPMSystemPowerStateCapabilityNetwork       \
+                                | kIOPMSystemPowerStateCapabilityDisk)
+
+       if ((power_capabilities & POWER_CAPABILITIES_NEED) != POWER_CAPABILITIES_NEED) {
+               /*
+                * we're not awake (from a networking point of view) unless we
+                * have the CPU, disk, *and* network.
+                */
+               return FALSE;
+       }
+
+       if ((power_capabilities & kIOPMSytemPowerStateCapabilitiesMask) == POWER_CAPABILITIES_NEED) {
+               /*
+                * if all we have is the CPU, disk, and network than this must
+                * be a "maintenance" wake.
+                */
+               return FALSE;
+       }
+
+       return TRUE;
+}
+#endif // !TARGET_OS_IPHONE
+
+
 static void
 rlsPerform(void *info)
 {
        void                            *context_info;
        void                            (*context_release)(const void *);
 static void
 rlsPerform(void *info)
 {
        void                            *context_info;
        void                            (*context_release)(const void *);
-       SCNetworkConnectionFlags        flags;
-       uint16_t                        if_index;
+       Boolean                         defer           = FALSE;
        Boolean                         ok;
        Boolean                         ok;
+       ReachabilityInfo                reach_info      = NOT_REACHABLE;
        SCNetworkReachabilityCallBack   rlsFunction;
        SCDynamicStoreRef               store           = NULL;
        SCNetworkReachabilityRef        target          = (SCNetworkReachabilityRef)info;
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
 
        SCNetworkReachabilityCallBack   rlsFunction;
        SCDynamicStoreRef               store           = NULL;
        SCNetworkReachabilityRef        target          = (SCNetworkReachabilityRef)info;
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
 
-       SCLog(_sc_debug, LOG_DEBUG, CFSTR("process reachability change"));
+       SCLog(_sc_debug, LOG_INFO, CFSTR("%schecking target reachability"),
+             targetPrivate->log_prefix);
 
 
        pthread_mutex_lock(&targetPrivate->lock);
 
 
 
        pthread_mutex_lock(&targetPrivate->lock);
 
+       if (!targetPrivate->scheduled) {
+               // if not currently scheduled
+               pthread_mutex_unlock(&targetPrivate->lock);
+               return;
+       }
+
        /* update reachability, notify if status changed */
        /* update reachability, notify if status changed */
-       ok = __SCNetworkReachabilityGetFlags(&store, target, &flags, &if_index, TRUE);
+       ok = __SCNetworkReachabilityGetFlags(&store, target, &reach_info, TRUE);
        if (store != NULL) CFRelease(store);
        if (!ok) {
                /* if reachability status not available */
        if (store != NULL) CFRelease(store);
        if (!ok) {
                /* if reachability status not available */
-               flags    = 0;
-               if_index = 0;
+               SCLog(_sc_debug, LOG_INFO, CFSTR("%flags not available"),
+                     targetPrivate->log_prefix);
+               reach_info = NOT_REACHABLE;
        }
 
        }
 
-       if ((targetPrivate->flags == flags) && (targetPrivate->if_index == if_index)) {
-               /* if reachability flags and interface have not changed */
+#if    !TARGET_OS_IPHONE
+       /*
+        * We want to defer the notification if this is a maintenance wake *and*
+        * the reachability flags that we would be reporting to the application
+        * are better than those that we last reported.
+        */
+       if (!systemIsAwake(power_capabilities)) {
+               /* if this is a maintenace wake */
+               reach_info.sleeping = TRUE;
+
+               if (rankReachability(reach_info.flags) >= rankReachability(targetPrivate->info.flags)) {
+                       /*
+                        * don't report the change if the new reachability flags are
+                        * the same or "better"
+                        */
+                       defer = TRUE;
+               } else if (bcmp(&targetPrivate->last_notify, &reach_info, sizeof(reach_info)) == 0) {
+                       /* if we have already posted this change */
+                       defer = TRUE;
+               }
+       }
+#endif // !TARGET_OS_IPHONE
+
+       if (bcmp(&targetPrivate->info, &reach_info, sizeof(reach_info)) == 0) {
+               SCLog(_sc_debug, LOG_INFO,
+                     CFSTR("%sflags/interface match (now 0x%08x/%hu%s)"),
+                     targetPrivate->log_prefix,
+                     reach_info.flags,
+                     reach_info.if_index,
+                     reach_info.sleeping ? "*" : "");
                pthread_mutex_unlock(&targetPrivate->lock);
                pthread_mutex_unlock(&targetPrivate->lock);
-               SCLog(_sc_debug, LOG_DEBUG,
-                     CFSTR("flags/interface match (now %8.8x/%hu)"),
-                     flags, if_index);
                return;
                return;
-       } else {
-               SCLog(_sc_debug, LOG_DEBUG,
-                     CFSTR("flags/interface have changed (was %8.8x/%hu, now %8.8x/%hu)"),
-                     targetPrivate->flags, targetPrivate->if_index,
-                     flags, if_index);
        }
 
        }
 
+       SCLog(_sc_debug, LOG_INFO,
+             CFSTR("%sflags/interface have changed (was 0x%08x/%hu%s, now 0x%08x/%hu%s)%s"),
+             targetPrivate->log_prefix,
+             targetPrivate->info.flags,
+             targetPrivate->info.if_index,
+             targetPrivate->info.sleeping ? "*" : "",
+             reach_info.flags,
+             reach_info.if_index,
+             reach_info.sleeping ? "*" : "",
+             defer ? ", deferred" : "");
+
        /* update flags / interface */
        /* update flags / interface */
-       targetPrivate->flags    = flags;
-       targetPrivate->if_index = if_index;
+       targetPrivate->info = reach_info;
+
+       /* as needed, defer the notification */
+       if (defer) {
+               pthread_mutex_unlock(&targetPrivate->lock);
+               return;
+       }
+
+       /* save last notification info */
+       targetPrivate->last_notify = reach_info;
 
        /* callout */
        rlsFunction = targetPrivate->rlsFunction;
 
        /* callout */
        rlsFunction = targetPrivate->rlsFunction;
@@ -2553,7 +3618,7 @@ rlsPerform(void *info)
        pthread_mutex_unlock(&targetPrivate->lock);
 
        if (rlsFunction != NULL) {
        pthread_mutex_unlock(&targetPrivate->lock);
 
        if (rlsFunction != NULL) {
-               (*rlsFunction)(target, flags, context_info);
+               (*rlsFunction)(target, reach_info.flags, context_info);
        }
 
        if (context_release != NULL) {
        }
 
        if (context_release != NULL) {
@@ -2608,26 +3673,37 @@ reachRLSCopyDescription(const void *info)
 }
 
 
 }
 
 
-Boolean
-SCNetworkReachabilityScheduleWithRunLoop(SCNetworkReachabilityRef      target,
-                                        CFRunLoopRef                   runLoop,
-                                        CFStringRef                    runLoopMode)
+static Boolean
+__SCNetworkReachabilityScheduleWithRunLoop(SCNetworkReachabilityRef    target,
+                                          CFRunLoopRef                 runLoop,
+                                          CFStringRef                  runLoopMode,
+#if    !TARGET_OS_IPHONE
+                                          dispatch_queue_t             queue,
+#else  // !TARGET_OS_IPHONE
+                                          void                         *queue,
+#endif // !TARGET_OS_IPHONE
+                                          Boolean                      onDemand)
 {
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
        Boolean                         init            = FALSE;
        Boolean                         ok              = FALSE;
 
 {
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
        Boolean                         init            = FALSE;
        Boolean                         ok              = FALSE;
 
-       if (!isA_SCNetworkReachability(target) || runLoop == NULL || runLoopMode == NULL) {
+       if (!onDemand) {
+               pthread_mutex_lock(&hn_lock);
+       }
+       pthread_mutex_lock(&targetPrivate->lock);
+
+#if    !TARGET_OS_IPHONE
+       if ((targetPrivate->dispatchQueue != NULL) ||           // if we are already scheduled with a dispatch queue
+           ((queue != NULL) && targetPrivate->scheduled)) {    // if we are already scheduled on a CFRunLoop
                _SCErrorSet(kSCStatusInvalidArgument);
                _SCErrorSet(kSCStatusInvalidArgument);
-              return FALSE;
+               goto done;
        }
        }
+#endif // !TARGET_OS_IPHONE
 
        /* schedule the SCNetworkReachability run loop source */
 
 
        /* schedule the SCNetworkReachability run loop source */
 
-       pthread_mutex_lock(&hn_lock);
-       pthread_mutex_lock(&targetPrivate->lock);
-
-       if (hn_store == NULL) {
+       if (!onDemand && (hn_store == NULL)) {
                /*
                 * if we are not monitoring any hosts, start watching
                 */
                /*
                 * if we are not monitoring any hosts, start watching
                 */
@@ -2639,21 +3715,64 @@ SCNetworkReachabilityScheduleWithRunLoop(SCNetworkReachabilityRef       target,
 
                hn_store = SCDynamicStoreCreate(NULL,
                                                CFSTR("SCNetworkReachability"),
 
                hn_store = SCDynamicStoreCreate(NULL,
                                                CFSTR("SCNetworkReachability"),
-                                               __SCNetworkReachabilityReachabilityHandleChanges,
+                                               __SCNetworkReachabilityHandleChanges,
                                                NULL);
                if (hn_store == NULL) {
                                                NULL);
                if (hn_store == NULL) {
-                       SCLog(_sc_verbose, LOG_INFO, CFSTR("SCDynamicStoreCreate() failed"));
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreCreate() failed"));
                        goto done;
                }
 
                __SCNetworkReachabilityReachabilitySetNotifications(hn_store);
 
                        goto done;
                }
 
                __SCNetworkReachabilityReachabilitySetNotifications(hn_store);
 
+#if    !TARGET_OS_IPHONE
+               dispatch_queue_attr_t   attr;
+               long                    res;
+
+               attr = dispatch_queue_attr_create();
+               res = dispatch_queue_attr_set_finalizer(attr,
+                                                       ^(dispatch_queue_t dq) {
+                                                               SCDynamicStoreRef       hn_store;
+
+                                                               hn_store = (SCDynamicStoreRef)dispatch_get_context(dq);
+                                                               CFRelease(hn_store);
+                                                       });
+               if (res != 0) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("__SCNetworkReachabilityScheduleWithRunLoop dispatch_queue_attr_set_finalizer() failed"));
+                       dispatch_release(attr);
+                       CFRelease(hn_store);
+                       hn_store = NULL;
+                       _SCErrorSet(kSCStatusFailed);
+                       goto done;
+               }
+               hn_dispatchQueue = dispatch_queue_create("com.apple.SCNetworkReachabilty.network_changes", attr);
+               dispatch_release(attr);
+               if (hn_dispatchQueue == NULL) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("__SCNetworkReachabilityScheduleWithRunLoop dispatch_queue_create() failed"));
+                       _SCErrorSet(kSCStatusFailed);
+                       CFRelease(hn_store);
+                       hn_store = NULL;
+                       goto done;
+               }
+               CFRetain(hn_store);     // Note: will be released when the dispatch queue is released
+               dispatch_set_context(hn_dispatchQueue, (void *)hn_store);
+
+               ok = SCDynamicStoreSetDispatchQueue(hn_store, hn_dispatchQueue);
+               if (!ok) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCDynamicStoreSetDispatchQueue() failed"));
+                       dispatch_release(hn_dispatchQueue);
+                       hn_dispatchQueue = NULL;
+                       CFRelease(hn_store);
+                       hn_store = NULL;
+                       goto done;
+               }
+#else  // !TARGET_OS_IPHONE
                hn_storeRLS = SCDynamicStoreCreateRunLoopSource(NULL, hn_store, 0);
                hn_rlList   = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
                hn_storeRLS = SCDynamicStoreCreateRunLoopSource(NULL, hn_store, 0);
                hn_rlList   = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+#endif // !TARGET_OS_IPHONE
                hn_targets  = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
        }
 
                hn_targets  = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
        }
 
-       if (targetPrivate->rls == NULL) {
+       if (!targetPrivate->scheduled) {
                CFRunLoopSourceContext  context = { 0                           // version
                                                  , (void *)target              // info
                                                  , CFRetain                    // retain
                CFRunLoopSourceContext  context = { 0                           // version
                                                  , (void *)target              // info
                                                  , CFRetain                    // retain
@@ -2666,178 +3785,323 @@ SCNetworkReachabilityScheduleWithRunLoop(SCNetworkReachabilityRef     target,
                                                  , rlsPerform                  // perform
                                                  };
 
                                                  , rlsPerform                  // perform
                                                  };
 
-               targetPrivate->rls    = CFRunLoopSourceCreate(NULL, 0, &context);
-               targetPrivate->rlList = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+               if (runLoop != NULL) {
+                       targetPrivate->rls    = CFRunLoopSourceCreate(NULL, 0, &context);
+                       targetPrivate->rlList = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+               }
+
+               targetPrivate->scheduled = TRUE;
+               if (targetPrivate->type == reachabilityTypeName) {
+                       targetPrivate->needResolve = TRUE;
+               }
                init = TRUE;
        }
 
                init = TRUE;
        }
 
-       if (!_SC_isScheduled(NULL, runLoop, runLoopMode, targetPrivate->rlList)) {
-               /*
-                * if we do not already have host notifications scheduled with
-                * this runLoop / runLoopMode
-                */
-               CFRunLoopAddSource(runLoop, targetPrivate->rls, runLoopMode);
+#if    !TARGET_OS_IPHONE
+       if (queue != NULL) {
+               targetPrivate->dispatchQueue = queue;
+               dispatch_retain(targetPrivate->dispatchQueue);
+       } else
+#endif // !TARGET_OS_IPHONE
+       {
+               if (!_SC_isScheduled(NULL, runLoop, runLoopMode, targetPrivate->rlList)) {
+                       /*
+                        * if we do not already have host notifications scheduled with
+                        * this runLoop / runLoopMode
+                        */
+                       CFRunLoopAddSource(runLoop, targetPrivate->rls, runLoopMode);
 
 
-               if (targetPrivate->dnsRLS != NULL) {
-                       /* if we have an active async DNS query too */
-                       CFRunLoopAddSource(runLoop, targetPrivate->dnsRLS, runLoopMode);
+                       if (targetPrivate->dnsRLS != NULL) {
+                               /* if we have an active async DNS query too */
+                               CFRunLoopAddSource(runLoop, targetPrivate->dnsRLS, runLoopMode);
+                       }
                }
                }
-       }
 
 
-       _SC_schedule(target, runLoop, runLoopMode, targetPrivate->rlList);
+               _SC_schedule(target, runLoop, runLoopMode, targetPrivate->rlList);
 
 
-       /* schedule the SCNetworkReachability run loop source */
+#if    TARGET_OS_IPHONE
+               if (!onDemand) {
+                       /* schedule the global SCDynamicStore run loop source */
 
 
-       if (!_SC_isScheduled(NULL, runLoop, runLoopMode, hn_rlList)) {
-               /*
-                * if we do not already have SC notifications scheduled with
-                * this runLoop / runLoopMode
-                */
-               CFRunLoopAddSource(runLoop, hn_storeRLS, runLoopMode);
+                       if (!_SC_isScheduled(NULL, runLoop, runLoopMode, hn_rlList)) {
+                               /*
+                                * if we do not already have SC notifications scheduled with
+                                * this runLoop / runLoopMode
+                                */
+                               CFRunLoopAddSource(runLoop, hn_storeRLS, runLoopMode);
+                       }
+
+                       _SC_schedule(target, runLoop, runLoopMode, hn_rlList);
+               }
+#endif // TARGET_OS_IPHONE
        }
 
        }
 
-       _SC_schedule(target, runLoop, runLoopMode, hn_rlList);
        CFSetAddValue(hn_targets, target);
 
        if (init) {
        CFSetAddValue(hn_targets, target);
 
        if (init) {
-               SCNetworkConnectionFlags        flags;
-               uint16_t                        if_index;
-               SCDynamicStoreRef               store   = NULL;
+               ReachabilityInfo        reach_info      = NOT_REACHABLE;
+               SCDynamicStoreRef       store           = NULL;
 
                /*
                 * if we have yet to schedule SC notifications for this address
                 * - initialize current reachability status
                 */
 
                /*
                 * if we have yet to schedule SC notifications for this address
                 * - initialize current reachability status
                 */
-               if (__SCNetworkReachabilityGetFlags(&store, target, &flags, &if_index, TRUE)) {
+               if (__SCNetworkReachabilityGetFlags(&store, target, &reach_info, TRUE)) {
                        /*
                         * if reachability status available
                         * - set flags
                         * - schedule notification to report status via callback
                         */
                        /*
                         * if reachability status available
                         * - set flags
                         * - schedule notification to report status via callback
                         */
-                       targetPrivate->flags    = flags;
-                       targetPrivate->if_index = if_index;
-                       CFRunLoopSourceSignal(targetPrivate->rls);
-                       _SC_signalRunLoop(target, targetPrivate->rls, targetPrivate->rlList);
+                       targetPrivate->info = reach_info;
+                       __SCNetworkReachabilityPerform(target);
                } else {
                        /* if reachability status not available, async lookup started */
                } else {
                        /* if reachability status not available, async lookup started */
-                       targetPrivate->flags    = 0;
-                       targetPrivate->if_index = 0;
+                       targetPrivate->info = NOT_REACHABLE;
                }
                if (store != NULL) CFRelease(store);
        }
 
                }
                if (store != NULL) CFRelease(store);
        }
 
+       if (targetPrivate->onDemandServer != NULL) {
+               __SCNetworkReachabilityScheduleWithRunLoop(targetPrivate->onDemandServer, runLoop, runLoopMode, queue, TRUE);
+       }
+
        ok = TRUE;
 
     done :
 
        pthread_mutex_unlock(&targetPrivate->lock);
        ok = TRUE;
 
     done :
 
        pthread_mutex_unlock(&targetPrivate->lock);
-       pthread_mutex_unlock(&hn_lock);
+       if (!onDemand) {
+               pthread_mutex_unlock(&hn_lock);
+       }
        return ok;
 }
 
 
        return ok;
 }
 
 
-Boolean
-SCNetworkReachabilityUnscheduleFromRunLoop(SCNetworkReachabilityRef    target,
-                                          CFRunLoopRef                 runLoop,
-                                          CFStringRef                  runLoopMode)
+static Boolean
+__SCNetworkReachabilityUnscheduleFromRunLoop(SCNetworkReachabilityRef  target,
+                                            CFRunLoopRef               runLoop,
+                                            CFStringRef                runLoopMode,
+                                            Boolean                    onDemand)
 {
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
 {
        SCNetworkReachabilityPrivateRef targetPrivate   = (SCNetworkReachabilityPrivateRef)target;
-       CFIndex                         n;
+       CFIndex                         n               = 0;
        Boolean                         ok              = FALSE;
 
        Boolean                         ok              = FALSE;
 
-       if (!isA_SCNetworkReachability(target) || runLoop == NULL || runLoopMode == NULL) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
+       if (!onDemand) {
+               pthread_mutex_lock(&hn_lock);
        }
        }
-
-       pthread_mutex_lock(&hn_lock);
        pthread_mutex_lock(&targetPrivate->lock);
 
        pthread_mutex_lock(&targetPrivate->lock);
 
-       if (targetPrivate->rls == NULL) {
-               /* if not currently scheduled */
+#if    !TARGET_OS_IPHONE
+       if (((runLoop == NULL) && (targetPrivate->dispatchQueue == NULL)) ||    // if we should be scheduled on a dispatch queue (but are not)
+           ((runLoop != NULL) && (targetPrivate->dispatchQueue != NULL))) {    // if we should be scheduled on a CFRunLoop (but are not)
                _SCErrorSet(kSCStatusInvalidArgument);
                goto done;
        }
                _SCErrorSet(kSCStatusInvalidArgument);
                goto done;
        }
+#endif // !TARGET_OS_IPHONE
 
 
-       if (!_SC_unschedule(NULL, runLoop, runLoopMode, targetPrivate->rlList, FALSE)) {
-               /* if not currently scheduled */
+       if (!targetPrivate->scheduled) {
+               // if not currently scheduled
                _SCErrorSet(kSCStatusInvalidArgument);
                goto done;
        }
 
                _SCErrorSet(kSCStatusInvalidArgument);
                goto done;
        }
 
-       n = CFArrayGetCount(targetPrivate->rlList);
-       if (n == 0 || !_SC_isScheduled(NULL, runLoop, runLoopMode, targetPrivate->rlList)) {
-               /*
-                * if this host is no longer scheduled for this runLoop / runLoopMode
-                */
-               CFRunLoopRemoveSource(runLoop, targetPrivate->rls, runLoopMode);
+       // first, unschedule the target specific sources
+#if    !TARGET_OS_IPHONE
+       if (targetPrivate->dispatchQueue != NULL) {
+               if (targetPrivate->onDemandServer != NULL) {
+                       __SCNetworkReachabilityUnscheduleFromRunLoop(targetPrivate->onDemandServer, NULL, NULL, TRUE);
+               }
+       } else
+#endif // !TARGET_OS_IPHONE
+       {
+               if (!_SC_unschedule(target, runLoop, runLoopMode, targetPrivate->rlList, FALSE)) {
+                       // if not currently scheduled
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       goto done;
+               }
 
 
-               if (targetPrivate->dnsRLS != NULL) {
-                       /* if we have an active async DNS query too */
-                       CFRunLoopRemoveSource(runLoop, targetPrivate->dnsRLS, runLoopMode);
+               if (targetPrivate->onDemandServer != NULL) {
+                       __SCNetworkReachabilityUnscheduleFromRunLoop(targetPrivate->onDemandServer, runLoop, runLoopMode, TRUE);
                }
 
                }
 
-               if (n == 0) {
-                       /*
-                        * if this host is no longer scheduled
-                        */
-                       CFRunLoopSourceInvalidate(targetPrivate->rls);  /* cleanup SCNetworkReachability resources */
-                       CFRelease(targetPrivate->rls);
-                       targetPrivate->rls = NULL;
-                       CFRelease(targetPrivate->rlList);
-                       targetPrivate->rlList = NULL;
-                       CFSetRemoveValue(hn_targets, target);           /* cleanup notification resources */
-
-                       if (targetPrivate->dnsPort != NULL) {
-                               /* if we have an active async DNS query too */
-                               getaddrinfo_async_cancel(CFMachPortGetPort(targetPrivate->dnsPort));
-                               CFRunLoopSourceInvalidate(targetPrivate->dnsRLS);
-                               CFRelease(targetPrivate->dnsRLS);
-                               targetPrivate->dnsRLS = NULL;
-                               CFRelease(targetPrivate->dnsPort);
-                               targetPrivate->dnsPort = NULL;
+               n = CFArrayGetCount(targetPrivate->rlList);
+               if ((n == 0) || !_SC_isScheduled(NULL, runLoop, runLoopMode, targetPrivate->rlList)) {
+                       // if target is no longer scheduled for this runLoop / runLoopMode
+                       CFRunLoopRemoveSource(runLoop, targetPrivate->rls, runLoopMode);
+
+                       if (targetPrivate->dnsRLS != NULL) {
+                               // if we have an active async DNS query too
+                               CFRunLoopRemoveSource(runLoop, targetPrivate->dnsRLS, runLoopMode);
+                       }
+
+                       if (n == 0) {
+                               // if *all* notifications have been unscheduled
+                               CFRelease(targetPrivate->rlList);
+                               targetPrivate->rlList = NULL;
+                               CFRunLoopSourceInvalidate(targetPrivate->rls);
+                               CFRelease(targetPrivate->rls);
+                               targetPrivate->rls = NULL;
                        }
                }
        }
 
                        }
                }
        }
 
-       (void)_SC_unschedule(target, runLoop, runLoopMode, hn_rlList, FALSE);
+       if (n == 0) {
+               // if *all* notifications have been unscheduled
+               targetPrivate->scheduled = FALSE;
 
 
-       n = CFArrayGetCount(hn_rlList);
-       if (n == 0 || !_SC_isScheduled(NULL, runLoop, runLoopMode, hn_rlList)) {
-               /*
-                * if we no longer have any addresses scheduled for
-                * this runLoop / runLoopMode
-                */
-               CFRunLoopRemoveSource(runLoop, hn_storeRLS, runLoopMode);
+               if (!onDemand) {
+                       CFSetRemoveValue(hn_targets, target);   // cleanup notification resources
+               }
 
 
-               if (n == 0) {
-                       /*
-                        * if we are no longer monitoring any addresses
-                        */
-                       CFRelease(hn_targets);
-                       hn_targets = NULL;
-                       CFRelease(hn_rlList);
-                       hn_rlList = NULL;
-                       CFRunLoopSourceInvalidate(hn_storeRLS);
-                       CFRelease(hn_storeRLS);
-                       hn_storeRLS = NULL;
-                       CFRelease(hn_store);
-                       hn_store = NULL;
+               if (targetPrivate->dnsPort != NULL) {
+                       mach_port_t     mp      = CFMachPortGetPort(targetPrivate->dnsPort);
+
+                       // if we have an active async DNS query
+                       dequeueAsyncDNSQuery(target);
+                       getaddrinfo_async_cancel(mp);
+               }
+       }
+
+#if    !TARGET_OS_IPHONE
+       if (runLoop == NULL) {
+               dispatch_release(targetPrivate->dispatchQueue);
+               targetPrivate->dispatchQueue = NULL;
+       }
+#endif // !TARGET_OS_IPHONE
 
 
+       // now, unschedule the global dynamic store source
+#if    TARGET_OS_IPHONE
+       if (!onDemand) {
+               (void)_SC_unschedule(target, runLoop, runLoopMode, hn_rlList, FALSE);
+
+               n = CFArrayGetCount(hn_rlList);
+               if ((n == 0) || !_SC_isScheduled(NULL, runLoop, runLoopMode, hn_rlList)) {
                        /*
                        /*
-                        * until we start monitoring again, ensure that
-                        * any resources associated with tracking the
-                        * DNS configuration have been released.
+                        * if we no longer have any addresses scheduled for
+                        * this runLoop / runLoopMode
                         */
                         */
-                       dns_configuration_unwatch();
+                       CFRunLoopRemoveSource(runLoop, hn_storeRLS, runLoopMode);
+
+                       if (n > 0) {
+                               if (CFEqual(runLoopMode, kCFRunLoopCommonModes)) {
+                                       CFArrayRef      modes;
+
+                                       modes = CFRunLoopCopyAllModes(runLoop);
+                                       if (modes != NULL) {
+                                               CFIndex i;
+                                               CFIndex n       = CFArrayGetCount(modes);
+
+                                               for (i = 0; i < n; i++) {
+                                                       CFStringRef     mode;
+
+                                                       mode = CFArrayGetValueAtIndex(modes, i);
+                                                       if (_SC_isScheduled(NULL, runLoop, mode, hn_rlList)) {
+                                                               /*
+                                                                * removing kCFRunLoopCommonModes cleaned up more
+                                                                * than we wanted.  Add back the modes that were
+                                                                * expect to be present.
+                                                                */
+                                                               CFRunLoopAddSource(runLoop, hn_storeRLS, mode);
+                                                       }
+                                               }
+
+                                               CFRelease(modes);
+                                       }
+                               } else if (_SC_isScheduled(NULL, runLoop, kCFRunLoopCommonModes, hn_rlList)) {
+                                       /*
+                                        * if we are still scheduling kCFRunLoopCommonModes, make sure that
+                                        * none of the common modes were inadvertently removed.
+                                        */
+                                       CFRunLoopAddSource(runLoop, hn_storeRLS, kCFRunLoopCommonModes);
+                               }
+                       }
                }
        }
                }
        }
+#endif // TARGET_OS_IPHONE
+
+       n = CFSetGetCount(hn_targets);
+       if (n == 0) {
+               // if we are no longer monitoring any targets
+#if    !TARGET_OS_IPHONE
+               SCDynamicStoreSetDispatchQueue(hn_store, NULL);
+               dispatch_release(hn_dispatchQueue);
+               hn_dispatchQueue = NULL;
+#else  // !TARGET_OS_IPHONE
+               CFRunLoopSourceInvalidate(hn_storeRLS);
+               CFRelease(hn_storeRLS);
+               hn_storeRLS = NULL;
+               CFRelease(hn_rlList);
+               hn_rlList = NULL;
+#endif // !TARGET_OS_IPHONE
+               CFRelease(hn_store);
+               hn_store = NULL;
+               CFRelease(hn_targets);
+               hn_targets = NULL;
+
+               /*
+                * until we start monitoring again, ensure that
+                * any resources associated with tracking the
+                * DNS configuration have been released.
+                */
+               dns_configuration_unwatch();
+       }
 
        ok = TRUE;
 
     done :
 
        pthread_mutex_unlock(&targetPrivate->lock);
 
        ok = TRUE;
 
     done :
 
        pthread_mutex_unlock(&targetPrivate->lock);
-       pthread_mutex_unlock(&hn_lock);
+       if (!onDemand) {
+               pthread_mutex_unlock(&hn_lock);
+       }
+       return ok;
+}
+
+Boolean
+SCNetworkReachabilityScheduleWithRunLoop(SCNetworkReachabilityRef      target,
+                                        CFRunLoopRef                   runLoop,
+                                        CFStringRef                    runLoopMode)
+{
+       if (!isA_SCNetworkReachability(target) || (runLoop == NULL) || (runLoopMode == NULL)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       return __SCNetworkReachabilityScheduleWithRunLoop(target, runLoop, runLoopMode, NULL, FALSE);
+}
+
+Boolean
+SCNetworkReachabilityUnscheduleFromRunLoop(SCNetworkReachabilityRef    target,
+                                          CFRunLoopRef                 runLoop,
+                                          CFStringRef                  runLoopMode)
+{
+       if (!isA_SCNetworkReachability(target) || (runLoop == NULL) || (runLoopMode == NULL)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       return __SCNetworkReachabilityUnscheduleFromRunLoop(target, runLoop, runLoopMode, FALSE);
+}
+
+#if    !TARGET_OS_IPHONE
+Boolean
+SCNetworkReachabilitySetDispatchQueue(SCNetworkReachabilityRef target,
+                                     dispatch_queue_t          queue)
+{
+       Boolean ok      = FALSE;
+
+       if (!isA_SCNetworkReachability(target)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (queue != NULL) {
+               ok = __SCNetworkReachabilityScheduleWithRunLoop(target, NULL, NULL, queue, FALSE);
+       } else {
+               ok = __SCNetworkReachabilityUnscheduleFromRunLoop(target, NULL, NULL, FALSE);
+       }
+
        return ok;
 }
        return ok;
 }
+#endif // !TARGET_OS_IPHONE
index be2f3f7b2c30cb078b4b60c91e367c4803e87d9e..7d00c230239f1ff75c77996f94ba1efce8b12256 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2003-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003-2005, 2008, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #ifndef _SCNETWORKREACHABILITY_H
 #define _SCNETWORKREACHABILITY_H
 
 #ifndef _SCNETWORKREACHABILITY_H
 #define _SCNETWORKREACHABILITY_H
 
-#include <AvailabilityMacros.h>
+#include <Availability.h>
+#include <TargetConditionals.h>
 #include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCNetwork.h>
 #include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCNetwork.h>
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
+#if    !TARGET_OS_IPHONE
+#include <dispatch/dispatch.h>
+#endif // !TARGET_OS_IPHONE
 
 /*!
        @header SCNetworkReachability
 
 /*!
        @header SCNetworkReachability
@@ -80,19 +82,102 @@ typedef struct {
        CFStringRef     (*copyDescription)(const void *info);
 } SCNetworkReachabilityContext;
 
        CFStringRef     (*copyDescription)(const void *info);
 } SCNetworkReachabilityContext;
 
+/*!
+       @enum SCNetworkReachabilityFlags
+       @discussion Flags that indicate whether the specified network
+               nodename or address is reachable, whether a connection is
+               required, and whether some user intervention may be required
+               when establishing a connection.
+       @constant kSCNetworkReachabilityFlagsTransientConnection
+               This flag indicates that the specified nodename or address can
+               be reached via a transient connection, such as PPP.
+       @constant kSCNetworkReachabilityFlagsReachable
+               This flag indicates that the specified nodename or address can
+               be reached using the current network configuration.
+       @constant kSCNetworkReachabilityFlagsConnectionRequired
+               This flag indicates that the specified nodename or address can
+               be reached using the current network configuration, but a
+               connection must first be established.
+
+               As an example, this status would be returned for a dialup
+               connection that was not currently active, but could handle
+               network traffic for the target system.
+       @constant kSCNetworkReachabilityFlagsConnectionOnTraffic
+               This flag indicates that the specified nodename or address can
+               be reached using the current network configuration, but a
+               connection must first be established.  Any traffic directed
+               to the specified name or address will initiate the connection.
+
+               Note: this flag was previously named kSCNetworkReachabilityFlagsConnectionAutomatic
+       @constant kSCNetworkReachabilityFlagsInterventionRequired
+               This flag indicates that the specified nodename or address can
+               be reached using the current network configuration, but a
+               connection must first be established.  In addition, some
+               form of user intervention will be required to establish this
+               connection, such as providing a password, an authentication
+               token, etc.
+
+               Note: At the present time, this flag will only be returned
+               in the case where you have a dial-on-traffic configuration
+               (ConnectionOnTraffic), where an attempt to connect has
+               already been made, and where some error (e.g. no dial tone,
+               no answer, bad password, ...) was encountered during the
+               automatic connection attempt.  In this case the PPP controller
+               will stop attempting to establish a connection until the user
+               has intervened.
+       @constant kSCNetworkReachabilityFlagsConnectionOnDemand
+               This flag indicates that the specified nodename or address can
+               be reached using the current network configuration, but a
+               connection must first be established.
+               The connection will be established "On Demand" by the
+               CFSocketStream APIs.
+               Other APIs will not establish the connection.
+       @constant kSCNetworkReachabilityFlagsIsLocalAddress
+               This flag indicates that the specified nodename or address
+               is one associated with a network interface on the current
+               system.
+       @constant kSCNetworkReachabilityFlagsIsDirect
+               This flag indicates that network traffic to the specified
+               nodename or address will not go through a gateway, but is
+               routed directly to one of the interfaces in the system.
+#if    TARGET_OS_IPHONE
+       @constant kSCNetworkReachabilityFlagsIsWWAN
+               This flag indicates that the specified nodename or address can
+               be reached via an EDGE, GPRS, or other "cell" connection.
+#endif // TARGET_OS_IPHONE
+ */
+enum {
+       kSCNetworkReachabilityFlagsTransientConnection  = 1<<0,
+       kSCNetworkReachabilityFlagsReachable            = 1<<1,
+       kSCNetworkReachabilityFlagsConnectionRequired   = 1<<2,
+       kSCNetworkReachabilityFlagsConnectionOnTraffic  = 1<<3,
+       kSCNetworkReachabilityFlagsInterventionRequired = 1<<4,
+#if    (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000) || TARGET_IPHONE_SIMULATOR
+       kSCNetworkReachabilityFlagsConnectionOnDemand   = 1<<5,
+#endif
+       kSCNetworkReachabilityFlagsIsLocalAddress       = 1<<16,
+       kSCNetworkReachabilityFlagsIsDirect             = 1<<17,
+#if    TARGET_OS_IPHONE
+       kSCNetworkReachabilityFlagsIsWWAN               = 1<<18,
+#endif // TARGET_OS_IPHONE
+
+       kSCNetworkReachabilityFlagsConnectionAutomatic  = kSCNetworkReachabilityFlagsConnectionOnTraffic
+};
+typedef        uint32_t        SCNetworkReachabilityFlags;
+
 /*!
        @typedef SCNetworkReachabilityCallBack
        @discussion Type of the callback function used when the
                reachability of a network address or name changes.
        @param target The SCNetworkReachability reference being monitored
                for changes.
 /*!
        @typedef SCNetworkReachabilityCallBack
        @discussion Type of the callback function used when the
                reachability of a network address or name changes.
        @param target The SCNetworkReachability reference being monitored
                for changes.
-       @param flags The new SCNetworkConnectionFlags representing the
+       @param flags The new SCNetworkReachabilityFlags representing the
                reachability status of the network address/name.
        @param info A C pointer to a user-specified block of data.
  */
 typedef void (*SCNetworkReachabilityCallBack)  (
                                                SCNetworkReachabilityRef        target,
                reachability status of the network address/name.
        @param info A C pointer to a user-specified block of data.
  */
 typedef void (*SCNetworkReachabilityCallBack)  (
                                                SCNetworkReachabilityRef        target,
-                                               SCNetworkConnectionFlags        flags,
+                                               SCNetworkReachabilityFlags      flags,
                                                void                            *info
                                                );
 
                                                void                            *info
                                                );
 
@@ -112,7 +197,7 @@ SCNetworkReachabilityRef
 SCNetworkReachabilityCreateWithAddress         (
                                                CFAllocatorRef                  allocator,
                                                const struct sockaddr           *address
 SCNetworkReachabilityCreateWithAddress         (
                                                CFAllocatorRef                  allocator,
                                                const struct sockaddr           *address
-                                               )                               AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
+                                               )                               __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
 
 /*!
        @function SCNetworkReachabilityCreateWithAddressPair
 
 /*!
        @function SCNetworkReachabilityCreateWithAddressPair
@@ -132,7 +217,7 @@ SCNetworkReachabilityCreateWithAddressPair  (
                                                CFAllocatorRef                  allocator,
                                                const struct sockaddr           *localAddress,
                                                const struct sockaddr           *remoteAddress
                                                CFAllocatorRef                  allocator,
                                                const struct sockaddr           *localAddress,
                                                const struct sockaddr           *remoteAddress
-                                               )                               AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
+                                               )                               __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
 
 /*!
        @function SCNetworkReachabilityCreateWithName
 
 /*!
        @function SCNetworkReachabilityCreateWithName
@@ -150,7 +235,7 @@ SCNetworkReachabilityRef
 SCNetworkReachabilityCreateWithName            (
                                                CFAllocatorRef                  allocator,
                                                const char                      *nodename
 SCNetworkReachabilityCreateWithName            (
                                                CFAllocatorRef                  allocator,
                                                const char                      *nodename
-                                               )                               AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
+                                               )                               __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
 
 /*!
        @function SCNetworkReachabilityGetTypeID
 
 /*!
        @function SCNetworkReachabilityGetTypeID
@@ -158,7 +243,7 @@ SCNetworkReachabilityCreateWithName         (
                instances.
  */
 CFTypeID
                instances.
  */
 CFTypeID
-SCNetworkReachabilityGetTypeID                 (void)                          AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
+SCNetworkReachabilityGetTypeID                 (void)                          __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
 
 
 /*!
 
 
 /*!
@@ -168,7 +253,7 @@ SCNetworkReachabilityGetTypeID                      (void)                          AVAILABLE_MAC_OS_X_VERSION_10_3_AND_L
        @param target The network reference associated with the address or name
                to be checked for reachability.
        @param flags A pointer to memory that will be filled with the
        @param target The network reference associated with the address or name
                to be checked for reachability.
        @param flags A pointer to memory that will be filled with the
-               SCNetworkConnectionFlags detailing the reachability
+               SCNetworkReachabilityFlags detailing the reachability
                of the specified target.
        @result Returns TRUE if the network connection flags are valid;
                FALSE if the status could not be determined.
                of the specified target.
        @result Returns TRUE if the network connection flags are valid;
                FALSE if the status could not be determined.
@@ -176,8 +261,8 @@ SCNetworkReachabilityGetTypeID                      (void)                          AVAILABLE_MAC_OS_X_VERSION_10_3_AND_L
 Boolean
 SCNetworkReachabilityGetFlags                  (
                                                SCNetworkReachabilityRef        target,
 Boolean
 SCNetworkReachabilityGetFlags                  (
                                                SCNetworkReachabilityRef        target,
-                                               SCNetworkConnectionFlags        *flags
-                                               )                               AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
+                                               SCNetworkReachabilityFlags      *flags
+                                               )                               __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
 
 /*!
        @function SCNetworkReachabilitySetCallback
 
 /*!
        @function SCNetworkReachabilitySetCallback
@@ -197,7 +282,7 @@ SCNetworkReachabilitySetCallback            (
                                                SCNetworkReachabilityRef        target,
                                                SCNetworkReachabilityCallBack   callout,
                                                SCNetworkReachabilityContext    *context
                                                SCNetworkReachabilityRef        target,
                                                SCNetworkReachabilityCallBack   callout,
                                                SCNetworkReachabilityContext    *context
-                                               )                               AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
+                                               )                               __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
 
 /*!
        @function SCNetworkReachabilityScheduleWithRunLoop
 
 /*!
        @function SCNetworkReachabilityScheduleWithRunLoop
@@ -216,7 +301,7 @@ SCNetworkReachabilityScheduleWithRunLoop    (
                                                SCNetworkReachabilityRef        target,
                                                CFRunLoopRef                    runLoop,
                                                CFStringRef                     runLoopMode
                                                SCNetworkReachabilityRef        target,
                                                CFRunLoopRef                    runLoop,
                                                CFStringRef                     runLoopMode
-                                               )                               AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
+                                               )                               __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
 
 /*!
        @function SCNetworkReachabilityUnscheduleFromRunLoop
 
 /*!
        @function SCNetworkReachabilityUnscheduleFromRunLoop
@@ -236,10 +321,26 @@ SCNetworkReachabilityUnscheduleFromRunLoop        (
                                                SCNetworkReachabilityRef        target,
                                                CFRunLoopRef                    runLoop,
                                                CFStringRef                     runLoopMode
                                                SCNetworkReachabilityRef        target,
                                                CFRunLoopRef                    runLoop,
                                                CFStringRef                     runLoopMode
-                                               )                               AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
+                                               )                               __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
 
 
-__END_DECLS
+#if    !TARGET_OS_IPHONE
+/*!
+       @function SCNetworkReachabilitySetDispatchQueue
+       @discussion Schedules callbacks for the given target on the given
+               dispatch queue.
+       @param target The address or name that is set up for asynchronous
+               notifications.  Must be non-NULL.
+       @param queue A libdispatch queue to run the callback on. Pass NULL to disable notifications, and release queue.
+       @result Returns TRUE if the target is unscheduled successfully;
+               FALSE otherwise.
+ */
+Boolean
+SCNetworkReachabilitySetDispatchQueue          (
+                                               SCNetworkReachabilityRef        target,
+                                               dispatch_queue_t                queue
+                                               )                               __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA);
+#endif // !TARGET_OS_IPHONE
 
 
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */
+__END_DECLS
 
 #endif /* _SCNETWORKREACHABILITY_H */
 
 #endif /* _SCNETWORKREACHABILITY_H */
index 43725da48745d95f266718001eef564a7f57cd1e..d01acc0f707cdb5fd771eb3244723e7cb018bb15 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -45,7 +45,7 @@ static Boolean                __SCNetworkServiceEqual                 (CFTypeRef cf1, CFTypeRef cf2);
 static CFHashCode      __SCNetworkServiceHash                  (CFTypeRef cf);
 
 
 static CFHashCode      __SCNetworkServiceHash                  (CFTypeRef cf);
 
 
-static CFTypeID __kSCNetworkServiceTypeID      = _kCFRuntimeNotATypeID;
+static CFTypeID __kSCNetworkServiceTypeID              = _kCFRuntimeNotATypeID;
 
 
 static const CFRuntimeClass __SCNetworkServiceClass = {
 
 
 static const CFRuntimeClass __SCNetworkServiceClass = {
@@ -61,7 +61,7 @@ static const CFRuntimeClass __SCNetworkServiceClass = {
 };
 
 
 };
 
 
-static pthread_once_t          initialized     = PTHREAD_ONCE_INIT;
+static pthread_once_t          initialized             = PTHREAD_ONCE_INIT;
 
 
 static CFStringRef
 
 
 static CFStringRef
@@ -74,7 +74,11 @@ __SCNetworkServiceCopyDescription(CFTypeRef cf)
        result = CFStringCreateMutable(allocator, 0);
        CFStringAppendFormat(result, NULL, CFSTR("<SCNetworkService %p [%p]> {"), cf, allocator);
        CFStringAppendFormat(result, NULL, CFSTR("id = %@"), servicePrivate->serviceID);
        result = CFStringCreateMutable(allocator, 0);
        CFStringAppendFormat(result, NULL, CFSTR("<SCNetworkService %p [%p]> {"), cf, allocator);
        CFStringAppendFormat(result, NULL, CFSTR("id = %@"), servicePrivate->serviceID);
-       CFStringAppendFormat(result, NULL, CFSTR(", prefs = %p"), servicePrivate->prefs);
+       if (servicePrivate->prefs != NULL) {
+               CFStringAppendFormat(result, NULL, CFSTR(", prefs = %p"), servicePrivate->prefs);
+       } else if (servicePrivate->store != NULL) {
+               CFStringAppendFormat(result, NULL, CFSTR(", store = %p"), servicePrivate->store);
+       }
        if (servicePrivate->name != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(", name = %@"), servicePrivate->name);
        }
        if (servicePrivate->name != NULL) {
                CFStringAppendFormat(result, NULL, CFSTR(", name = %@"), servicePrivate->name);
        }
@@ -93,7 +97,8 @@ __SCNetworkServiceDeallocate(CFTypeRef cf)
 
        CFRelease(servicePrivate->serviceID);
        if (servicePrivate->interface != NULL) CFRelease(servicePrivate->interface);
 
        CFRelease(servicePrivate->serviceID);
        if (servicePrivate->interface != NULL) CFRelease(servicePrivate->interface);
-       CFRelease(servicePrivate->prefs);
+       if (servicePrivate->prefs != NULL) CFRelease(servicePrivate->prefs);
+       if (servicePrivate->store != NULL) CFRelease(servicePrivate->store);
        if (servicePrivate->name != NULL) CFRelease(servicePrivate->name);
 
        return;
        if (servicePrivate->name != NULL) CFRelease(servicePrivate->name);
 
        return;
@@ -158,7 +163,7 @@ __SCNetworkServiceCreatePrivate(CFAllocatorRef              allocator,
                return NULL;
        }
 
                return NULL;
        }
 
-       servicePrivate->prefs           = CFRetain(prefs);
+       servicePrivate->prefs           = (prefs != NULL) ? CFRetain(prefs): NULL;
        servicePrivate->serviceID       = CFStringCreateCopy(NULL, serviceID);
        servicePrivate->interface       = (interface != NULL) ? CFRetain(interface) : NULL;
        servicePrivate->name            = NULL;
        servicePrivate->serviceID       = CFStringCreateCopy(NULL, serviceID);
        servicePrivate->interface       = (interface != NULL) ? CFRetain(interface) : NULL;
        servicePrivate->name            = NULL;
@@ -217,7 +222,7 @@ SCNetworkServiceAddProtocolType(SCNetworkServiceRef service, CFStringRef protoco
        SCNetworkProtocolRef            protocol;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
        SCNetworkProtocolRef            protocol;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
-       if (!isA_SCNetworkService(service)) {
+       if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
@@ -408,6 +413,24 @@ SCNetworkServiceCopy(SCPreferencesRef prefs, CFStringRef serviceID)
 }
 
 
 }
 
 
+SCNetworkServiceRef
+_SCNetworkServiceCopyActive(SCDynamicStoreRef store, CFStringRef serviceID)
+{
+       SCNetworkServicePrivateRef      servicePrivate;
+
+       if (!isA_CFString(serviceID)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return NULL;
+       }
+
+       servicePrivate = __SCNetworkServiceCreatePrivate(NULL, NULL, serviceID, NULL);
+       if (store != NULL) {
+               servicePrivate->store = CFRetain(store);
+       }
+       return (SCNetworkServiceRef)servicePrivate;
+}
+
+
 SCNetworkProtocolRef
 SCNetworkServiceCopyProtocol(SCNetworkServiceRef service, CFStringRef protocolType)
 {
 SCNetworkProtocolRef
 SCNetworkServiceCopyProtocol(SCNetworkServiceRef service, CFStringRef protocolType)
 {
@@ -417,7 +440,7 @@ SCNetworkServiceCopyProtocol(SCNetworkServiceRef service, CFStringRef protocolTy
        SCNetworkProtocolPrivateRef     protocolPrivate = NULL;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
        SCNetworkProtocolPrivateRef     protocolPrivate = NULL;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
-       if (!isA_SCNetworkService(service)) {
+       if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
                _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
@@ -433,7 +456,7 @@ SCNetworkServiceCopyProtocol(SCNetworkServiceRef service, CFStringRef protocolTy
        protocols = SCPreferencesPathGetValue(servicePrivate->prefs, path);
        CFRelease(path);
 
        protocols = SCPreferencesPathGetValue(servicePrivate->prefs, path);
        CFRelease(path);
 
-       if ((protocols != NULL) && !isA_CFDictionary(protocols)) {
+       if (!isA_CFDictionary(protocols)) {
                // if corrupt prefs
                _SCErrorSet(kSCStatusFailed);
                return NULL;
                // if corrupt prefs
                _SCErrorSet(kSCStatusFailed);
                return NULL;
@@ -472,7 +495,7 @@ SCNetworkServiceCopyProtocols(SCNetworkServiceRef service)
        CFDictionaryRef                 protocols;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
        CFDictionaryRef                 protocols;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
-       if (!isA_SCNetworkService(service)) {
+       if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
                _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
@@ -484,6 +507,8 @@ SCNetworkServiceCopyProtocols(SCNetworkServiceRef service)
        CFRelease(path);
 
        if (!isA_CFDictionary(protocols)) {
        CFRelease(path);
 
        if (!isA_CFDictionary(protocols)) {
+               // if corrupt prefs
+               _SCErrorSet(kSCStatusFailed);
                return NULL;
        }
 
                return NULL;
        }
 
@@ -642,7 +667,6 @@ SCNetworkServiceCreate(SCPreferencesRef prefs, SCNetworkInterfaceRef interface)
                            CFEqual(interfaceType, kSCNetworkInterfaceTypeSerial   ) ||
                            CFEqual(interfaceType, kSCNetworkInterfaceTypeWWAN     )) {
                                CFDictionaryRef overrides;
                            CFEqual(interfaceType, kSCNetworkInterfaceTypeSerial   ) ||
                            CFEqual(interfaceType, kSCNetworkInterfaceTypeWWAN     )) {
                                CFDictionaryRef overrides;
-                               CFStringRef     script;
 
                                overrides = __SCNetworkInterfaceGetTemplateOverrides(interface, kSCNetworkInterfaceTypeModem);
 
 
                                overrides = __SCNetworkInterfaceGetTemplateOverrides(interface, kSCNetworkInterfaceTypeModem);
 
@@ -661,26 +685,6 @@ SCNetworkServiceCreate(SCPreferencesRef prefs, SCNetworkInterfaceRef interface)
                                        config = newConfig;
                                }
 
                                        config = newConfig;
                                }
 
-                               // update template for v.92 modems
-                               if ((overrides == NULL) &&
-                                   CFDictionaryGetValueIfPresent(config,
-                                                                 kSCPropNetModemConnectionScript,
-                                                                 (const void **)&script) &&
-                                   CFEqual(script, CFSTR("v.34 Personality")) &&
-                                   _SCNetworkInterfaceIsModemV92(interface)) {
-                                       CFMutableDictionaryRef  newConfig;
-
-                                       newConfig = CFDictionaryCreateMutableCopy(NULL, 0, config);
-                                       CFDictionarySetValue(newConfig,
-                                                            kSCPropNetModemConnectionPersonality,
-                                                            CFSTR("v.92 Personality"));
-                                       CFDictionarySetValue(newConfig,
-                                                            kSCPropNetModemDeviceModel,
-                                                            CFSTR("Apple Modem (v.92)"));
-                                       CFRelease(config);
-                                       config = newConfig;
-                               }
-
                                if (overrides != NULL) {
                                        CFMutableDictionaryRef  newConfig;
 
                                if (overrides != NULL) {
                                        CFMutableDictionaryRef  newConfig;
 
@@ -717,8 +721,8 @@ SCNetworkServiceCreate(SCPreferencesRef prefs, SCNetworkInterfaceRef interface)
                                                    servicePrivate->interface);
 
        // push the [deep] interface configuration into the service.
                                                    servicePrivate->interface);
 
        // push the [deep] interface configuration into the service.
-       interface_config = __SCNetworkInterfaceCopyDeepConfiguration(servicePrivate->interface);
-       __SCNetworkInterfaceSetDeepConfiguration(servicePrivate->interface, interface_config);
+       interface_config = __SCNetworkInterfaceCopyDeepConfiguration(NULL, servicePrivate->interface);
+       __SCNetworkInterfaceSetDeepConfiguration(NULL, servicePrivate->interface, interface_config);
        if (interface_config != NULL) CFRelease(interface_config);
 
        // set the service name to match that of the associated interface
        if (interface_config != NULL) CFRelease(interface_config);
 
        // set the service name to match that of the associated interface
@@ -745,10 +749,16 @@ SCNetworkServiceCreate(SCPreferencesRef prefs, SCNetworkInterfaceRef interface)
 Boolean
 SCNetworkServiceEstablishDefaultConfiguration(SCNetworkServiceRef service)
 {
 Boolean
 SCNetworkServiceEstablishDefaultConfiguration(SCNetworkServiceRef service)
 {
-       CFIndex                 i;
-       SCNetworkInterfaceRef   interface;
-       CFIndex                 n;
-       CFArrayRef              protocolTypes;
+       CFIndex                         i;
+       SCNetworkInterfaceRef           interface;
+       CFIndex                         n;
+       CFArrayRef                      protocolTypes;
+       SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
+
+       if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
 
        interface = SCNetworkServiceGetInterface(service);
        if (interface == NULL) {
 
        interface = SCNetworkServiceGetInterface(service);
        if (interface == NULL) {
@@ -808,7 +818,7 @@ SCNetworkServiceGetEnabled(SCNetworkServiceRef service)
        CFStringRef                     path;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
        CFStringRef                     path;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
-       if (!isA_SCNetworkService(service)) {
+       if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
@@ -828,7 +838,7 @@ SCNetworkServiceGetInterface(SCNetworkServiceRef service)
 {
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
 {
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
-       if (!isA_SCNetworkService(service)) {
+       if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
                _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
@@ -857,11 +867,11 @@ SCNetworkServiceGetName(SCNetworkServiceRef service)
 {
        CFDictionaryRef                 entity;
        SCNetworkInterfaceRef           interface;
 {
        CFDictionaryRef                 entity;
        SCNetworkInterfaceRef           interface;
-       SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
        CFStringRef                     name            = NULL;
        CFStringRef                     path;
        CFStringRef                     name            = NULL;
        CFStringRef                     path;
+       SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
 
-       if (!isA_SCNetworkService(service)) {
+       if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
                _SCErrorSet(kSCStatusInvalidArgument);
                return NULL;
        }
@@ -888,7 +898,7 @@ SCNetworkServiceGetName(SCNetworkServiceRef service)
                SCNetworkInterfaceRef   childInterface;
 
                childInterface = SCNetworkInterfaceGetInterface(interface);
                SCNetworkInterfaceRef   childInterface;
 
                childInterface = SCNetworkInterfaceGetInterface(interface);
-               if (childInterface == NULL) {
+               if ((childInterface == NULL) || CFEqual(childInterface, kSCNetworkInterfaceIPv4)) {
                        break;
                }
 
                        break;
                }
 
@@ -896,17 +906,52 @@ SCNetworkServiceGetName(SCNetworkServiceRef service)
        }
 
        if (interface != NULL) {
        }
 
        if (interface != NULL) {
-               CFStringRef     interface_name;
+               int             i;
+               CFStringRef     interface_name  = NULL;
                CFStringRef     suffix          = NULL;
 
                CFStringRef     suffix          = NULL;
 
-               if (servicePrivate->name != NULL) {
-                       interface_name = __SCNetworkInterfaceGetNonLocalizedDisplayName(interface);
+               //
+               // check if the [stored] service name matches the non-localized interface
+               // name.  If so, return the localized name.
+               //
+               // Also, the older "Built-in XXX" interface names are too long for the
+               // current UI. If we find that the [stored] service name matches the older
+               // name, return the newer (and shorter) localized name.
+               //
+               // Note: the user/admin will no longer be able to set the service name
+               //       to "Built-in Ethernet".
+               //
+               for (i = 0; i < 3; i++) {
+                       if (servicePrivate->name == NULL) {
+                               // if no [stored] service name to compare
+                               break;
+                       }
+
+                       switch (i) {
+                               case 0 :
+                                       // compare the non-localized interface name
+                                       interface_name = __SCNetworkInterfaceGetNonLocalizedDisplayName(interface);
+                                       if (interface_name != NULL) {
+                                               CFRetain(interface_name);
+                                       }
+                                       break;
+                               case 1 :
+                                       // compare the older "Built-in XXX" localized name
+                                       interface_name = __SCNetworkInterfaceCopyXLocalizedDisplayName(interface);
+                                       break;
+                               case 2 :
+                                       // compare the older "Built-in XXX" non-localized name
+                                       interface_name = __SCNetworkInterfaceCopyXNonLocalizedDisplayName(interface);
+                                       break;
+                       }
+
                        if (interface_name != NULL) {
                        if (interface_name != NULL) {
+                               Boolean match   = FALSE;
+                               
                                if (CFEqual(name, interface_name)) {
                                if (CFEqual(name, interface_name)) {
-                                       // if service name matches the [non-]localized
+                                       // if service name matches the OLD localized
                                        // interface name
                                        // interface name
-                                       CFRelease(servicePrivate->name);
-                                       servicePrivate->name = NULL;
+                                       match = TRUE;
                                } else if (CFStringHasPrefix(name, interface_name)) {
                                        CFIndex prefixLen       = CFStringGetLength(interface_name);
                                        CFIndex suffixLen       = CFStringGetLength(name);
                                } else if (CFStringHasPrefix(name, interface_name)) {
                                        CFIndex prefixLen       = CFStringGetLength(interface_name);
                                        CFIndex suffixLen       = CFStringGetLength(name);
@@ -914,12 +959,21 @@ SCNetworkServiceGetName(SCNetworkServiceRef service)
                                        suffix = CFStringCreateWithSubstring(NULL,
                                                                             name,
                                                                             CFRangeMake(prefixLen, suffixLen - prefixLen));
                                        suffix = CFStringCreateWithSubstring(NULL,
                                                                             name,
                                                                             CFRangeMake(prefixLen, suffixLen - prefixLen));
+                                       match = TRUE;
+                               }
+                               CFRelease(interface_name);
+
+                               if (match) {
                                        CFRelease(servicePrivate->name);
                                        servicePrivate->name = NULL;
                                        CFRelease(servicePrivate->name);
                                        servicePrivate->name = NULL;
+                                       break;
                                }
                        }
                }
 
                                }
                        }
                }
 
+               //
+               // if the service name has not been set, use the localized interface name
+               //
                if (servicePrivate->name == NULL) {
                        interface_name = SCNetworkInterfaceGetLocalizedDisplayName(interface);
                        if (interface_name != NULL) {
                if (servicePrivate->name == NULL) {
                        interface_name = SCNetworkInterfaceGetLocalizedDisplayName(interface);
                        if (interface_name != NULL) {
@@ -967,11 +1021,11 @@ Boolean
 SCNetworkServiceRemove(SCNetworkServiceRef service)
 {
        Boolean                         ok              = FALSE;
 SCNetworkServiceRemove(SCNetworkServiceRef service)
 {
        Boolean                         ok              = FALSE;
+       CFStringRef                     path;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
        CFArrayRef                      sets;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
        CFArrayRef                      sets;
-       CFStringRef                     path;
 
 
-       if (!isA_SCNetworkService(service)) {
+       if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
@@ -1017,7 +1071,7 @@ SCNetworkServiceRemoveProtocolType(SCNetworkServiceRef service, CFStringRef prot
        CFStringRef                     path;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
        CFStringRef                     path;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
-       if (!isA_SCNetworkService(service)) {
+       if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
@@ -1054,7 +1108,7 @@ SCNetworkServiceSetEnabled(SCNetworkServiceRef service, Boolean enabled)
        CFStringRef                     path;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
        CFStringRef                     path;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
-       if (!isA_SCNetworkService(service)) {
+       if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
@@ -1078,7 +1132,7 @@ SCNetworkServiceSetName(SCNetworkServiceRef service, CFStringRef name)
        CFStringRef                     saveName        = NULL;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
        CFStringRef                     saveName        = NULL;
        SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
 
-       if (!isA_SCNetworkService(service)) {
+       if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
@@ -1213,18 +1267,18 @@ SCNetworkServiceSetName(SCNetworkServiceRef service, CFStringRef name)
                                                              servicePrivate->serviceID,        // service
                                                              NULL);                            // entity
        entity = SCPreferencesPathGetValue(servicePrivate->prefs, path);
                                                              servicePrivate->serviceID,        // service
                                                              NULL);                            // entity
        entity = SCPreferencesPathGetValue(servicePrivate->prefs, path);
-       if ((entity == NULL) && (name != NULL)) {
-               entity = CFDictionaryCreate(NULL,
-                                           NULL,
-                                           NULL,
-                                           0,
-                                           &kCFTypeDictionaryKeyCallBacks,
-                                           &kCFTypeDictionaryValueCallBacks);
-       }
-       if (isA_CFDictionary(entity)) {
+       if (isA_CFDictionary(entity) ||
+           ((entity == NULL) && (name != NULL))) {
                CFMutableDictionaryRef  newEntity;
 
                CFMutableDictionaryRef  newEntity;
 
-               newEntity = CFDictionaryCreateMutableCopy(NULL, 0, entity);
+               if (entity != NULL) {
+                       newEntity = CFDictionaryCreateMutableCopy(NULL, 0, entity);
+               } else {
+                       newEntity = CFDictionaryCreateMutable(NULL,
+                                                             0,
+                                                             &kCFTypeDictionaryKeyCallBacks,
+                                                             &kCFTypeDictionaryValueCallBacks);
+               }
                if (saveName != NULL) {
                        CFDictionarySetValue(newEntity, kSCPropUserDefinedName, saveName);
                } else {
                if (saveName != NULL) {
                        CFDictionarySetValue(newEntity, kSCPropUserDefinedName, saveName);
                } else {
@@ -1242,3 +1296,215 @@ SCNetworkServiceSetName(SCNetworkServiceRef service, CFStringRef name)
 
        return ok;
 }
 
        return ok;
 }
+
+
+#pragma mark -
+#pragma mark SCNetworkService SPIs
+
+
+static Boolean
+str_to_rank(CFStringRef rankStr, SCNetworkServicePrimaryRank *rank)
+{
+       if (isA_CFString(rankStr)) {
+               if (CFEqual(rankStr, kSCValNetServicePrimaryRankFirst)) {
+                       *rank = kSCNetworkServicePrimaryRankFirst;
+               } else if (CFEqual(rankStr, kSCValNetServicePrimaryRankLast)) {
+                       *rank = kSCNetworkServicePrimaryRankLast;
+               } else if (CFEqual(rankStr, kSCValNetServicePrimaryRankNever)) {
+                       *rank = kSCNetworkServicePrimaryRankNever;
+               } else {
+                       return FALSE;
+               }
+       } else if (rankStr == NULL) {
+               *rank = kSCNetworkServicePrimaryRankDefault;
+       } else {
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+
+SCNetworkServicePrimaryRank
+SCNetworkServiceGetPrimaryRank(SCNetworkServiceRef service)
+{
+       CFDictionaryRef                 entity;
+       Boolean                         ok              = TRUE;
+       CFStringRef                     path;
+       SCNetworkServicePrimaryRank     rank            = kSCNetworkServicePrimaryRankDefault;
+       CFStringRef                     rankStr         = NULL;
+       SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
+
+       if (!isA_SCNetworkService(service)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return rank;
+       }
+
+       if (servicePrivate->prefs != NULL) {
+               path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,
+                                                                     servicePrivate->serviceID,
+                                                                     NULL);
+               entity = SCPreferencesPathGetValue(servicePrivate->prefs, path);
+               CFRelease(path);
+               if (isA_CFDictionary(entity)) {
+                       rankStr = CFDictionaryGetValue(entity, kSCPropNetServicePrimaryRank);
+                       ok = str_to_rank(rankStr, &rank);
+               }
+       } else if (servicePrivate->store != NULL) {
+               path = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                                  kSCDynamicStoreDomainState,
+                                                                  servicePrivate->serviceID,
+                                                                  NULL);
+               entity = SCDynamicStoreCopyValue(servicePrivate->store, path);
+               CFRelease(path);
+               if (entity != NULL) {
+                       if (isA_CFDictionary(entity)) {
+                               rankStr = CFDictionaryGetValue(entity, kSCPropNetServicePrimaryRank);
+                               ok = str_to_rank(rankStr, &rank);
+                       }
+                       CFRelease(entity);
+               }
+       } else {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return rank;
+       }
+
+       if (!ok) {
+               rank = kSCNetworkServicePrimaryRankDefault;
+               _SCErrorSet(kSCStatusInvalidArgument);
+       } else if (rank == kSCNetworkServicePrimaryRankDefault) {
+               _SCErrorSet(kSCStatusOK);
+       }
+
+       return rank;
+}
+
+
+static Boolean
+rank_to_str(SCNetworkServicePrimaryRank rank, CFStringRef *rankStr)
+{
+       switch (rank) {
+               case kSCNetworkServicePrimaryRankDefault :
+                       *rankStr = NULL;
+                       break;
+               case kSCNetworkServicePrimaryRankFirst :
+                       *rankStr = kSCValNetServicePrimaryRankFirst;
+                       break;
+               case kSCNetworkServicePrimaryRankLast :
+                       *rankStr = kSCValNetServicePrimaryRankLast;
+                       break;
+               case kSCNetworkServicePrimaryRankNever :
+                       *rankStr = kSCValNetServicePrimaryRankNever;
+                       break;
+               default :
+                       return FALSE;
+       }
+
+       return TRUE;
+}
+
+
+Boolean
+SCNetworkServiceSetPrimaryRank(SCNetworkServiceRef             service,
+                              SCNetworkServicePrimaryRank      newRank)
+{
+       Boolean                         ok;
+       CFDictionaryRef                 entity;
+       CFMutableDictionaryRef          newEntity;
+       CFStringRef                     path            = NULL;
+       CFStringRef                     rankStr         = NULL;
+       SCNetworkServicePrivateRef      servicePrivate  = (SCNetworkServicePrivateRef)service;
+
+       if (!isA_SCNetworkService(service)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       ok = rank_to_str(newRank, &rankStr);
+       if (!ok) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       if (servicePrivate->prefs != NULL) {
+               if ((newRank == kSCNetworkServicePrimaryRankDefault) || (newRank == kSCNetworkServicePrimaryRankNever)) {
+                       path = SCPreferencesPathKeyCreateNetworkServiceEntity(NULL,
+                                                                             servicePrivate->serviceID,
+                                                                             NULL);
+                       entity = SCPreferencesPathGetValue(servicePrivate->prefs, path);
+                       if (entity != NULL) {
+                               if (!isA_CFDictionary(entity)) {
+                                       // if corrupt prefs
+                                       _SCErrorSet(kSCStatusFailed);
+                                       goto done;
+                               }
+                               newEntity = CFDictionaryCreateMutableCopy(NULL, 0, entity);
+                       } else {
+                               newEntity = CFDictionaryCreateMutable(NULL,
+                                                                     0,
+                                                                     &kCFTypeDictionaryKeyCallBacks,
+                                                                     &kCFTypeDictionaryValueCallBacks);
+                       }
+                       if (rankStr != NULL) {
+                               CFDictionarySetValue(newEntity, kSCPropNetServicePrimaryRank, rankStr);
+                       } else {
+                               CFDictionaryRemoveValue(newEntity, kSCPropNetServicePrimaryRank);
+                       }
+                       if (CFDictionaryGetCount(newEntity) > 0) {
+                               ok = SCPreferencesPathSetValue(servicePrivate->prefs, path, newEntity);
+                       } else {
+                               ok = SCPreferencesPathRemoveValue(servicePrivate->prefs, path);
+                       }
+                       CFRelease(newEntity);
+                       if (!ok) {
+                               goto done;
+                       }
+               } else {
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       return FALSE;
+               }
+       } else if (servicePrivate->store != NULL) {
+               path = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
+                                                                  kSCDynamicStoreDomainState,
+                                                                  servicePrivate->serviceID,
+                                                                  NULL);
+               entity = SCDynamicStoreCopyValue(servicePrivate->store, path);
+               if (entity != NULL) {
+                       if (!isA_CFDictionary(entity)) {
+                               // if corrupt prefs
+                               CFRelease(entity);
+                               _SCErrorSet(kSCStatusFailed);
+                               goto done;
+                       }
+                       newEntity = CFDictionaryCreateMutableCopy(NULL, 0, entity);
+                       CFRelease(entity);
+               } else {
+                       newEntity = CFDictionaryCreateMutable(NULL,
+                                                             0,
+                                                             &kCFTypeDictionaryKeyCallBacks,
+                                                             &kCFTypeDictionaryValueCallBacks);
+               }
+               if (rankStr != NULL) {
+                       CFDictionarySetValue(newEntity, kSCPropNetServicePrimaryRank, rankStr);
+               } else {
+                       CFDictionaryRemoveValue(newEntity, kSCPropNetServicePrimaryRank);
+               }
+               if (CFDictionaryGetCount(newEntity) > 0) {
+                       ok = SCDynamicStoreSetValue(servicePrivate->store, path, newEntity);
+               } else {
+                       ok = SCDynamicStoreRemoveValue(servicePrivate->store, path);
+               }
+               CFRelease(newEntity);
+               if (!ok) {
+                       goto done;
+               }
+       } else {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+    done :
+
+       if (path != NULL)       CFRelease(path);
+       return ok;
+}
index 1b29b1818a19da277e4e9a00180ccd3a34aeb0ab..7ff57505d30fc699975a0b690c715afe8110f67e 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2007, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -160,6 +160,7 @@ __SCNetworkSetCreatePrivate(CFAllocatorRef      allocator,
        setPrivate->setID       = CFStringCreateCopy(NULL, setID);
        setPrivate->prefs       = CFRetain(prefs);
        setPrivate->name        = NULL;
        setPrivate->setID       = CFStringCreateCopy(NULL, setID);
        setPrivate->prefs       = CFRetain(prefs);
        setPrivate->name        = NULL;
+       setPrivate->established = FALSE;        // "new" (not yet established) set
 
        return setPrivate;
 }
 
        return setPrivate;
 }
@@ -169,7 +170,7 @@ __SCNetworkSetCreatePrivate(CFAllocatorRef      allocator,
 
 
 static Boolean
 
 
 static Boolean
-_serviceIsPPP(SCNetworkServiceRef service)
+_serviceIsVPN(SCNetworkServiceRef service)
 {
        SCNetworkInterfaceRef   interface;
        CFStringRef             interfaceType;
 {
        SCNetworkInterfaceRef   interface;
        CFStringRef             interfaceType;
@@ -180,33 +181,26 @@ _serviceIsPPP(SCNetworkServiceRef service)
        }
 
        interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
        }
 
        interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
-       return CFEqual(interfaceType, kSCNetworkInterfaceTypePPP);
-}
-
-
-static Boolean
-_serviceIsVPN(SCNetworkServiceRef service)
-{
-       SCNetworkInterfaceRef   interface;
-       CFStringRef             interfaceType;
-
-//     if (!_serviceIsPPP(service)) {
-//             return FALSE;
-//     }
-
-       interface = SCNetworkServiceGetInterface(service);
-//     if (interface == NULL) {
-//             return FALSE;
-//     }
+       if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) {
+               interface = SCNetworkInterfaceGetInterface(interface);
+               if (interface == NULL) {
+                       return FALSE;
+               }
 
 
-       interface = SCNetworkInterfaceGetInterface(interface);
-       if (interface == NULL) {
+               interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
+               if (CFEqual(interfaceType, kSCNetworkInterfaceTypeL2TP)) {
+                       return TRUE;
+               }
+               if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPTP)) {
+                       return TRUE;
+               }
                return FALSE;
        }
                return FALSE;
        }
+       if (CFEqual(interfaceType, kSCNetworkInterfaceTypeIPSec)) {
+               return TRUE;
+       }
 
 
-       interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
-       return (CFEqual(interfaceType, kSCNetworkInterfaceTypeL2TP) ||
-               CFEqual(interfaceType, kSCNetworkInterfaceTypePPTP));
+       return FALSE;
 }
 
 
 }
 
 
@@ -216,8 +210,8 @@ _serviceOrder(SCNetworkServiceRef service)
        SCNetworkInterfaceRef   interface;
 
        interface = SCNetworkServiceGetInterface(service);
        SCNetworkInterfaceRef   interface;
 
        interface = SCNetworkServiceGetInterface(service);
-       if (interface == NULL) {
-               return 100000;  // sort last
+       if ((interface == NULL) || _serviceIsVPN(service)) {
+               return 100000;  // if unknown or VPN interface, sort last
        }
 
        return __SCNetworkInterfaceOrder(interface);
        }
 
        return __SCNetworkInterfaceOrder(interface);
@@ -232,6 +226,7 @@ _serviceOrder_add(SCNetworkSetRef set, SCNetworkServiceRef service)
        CFMutableArrayRef       newOrder;
        CFArrayRef              order;
        CFStringRef             serviceID;
        CFMutableArrayRef       newOrder;
        CFArrayRef              order;
        CFStringRef             serviceID;
+       CFIndex                 serviceOrder;
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)set;
        CFIndex                 slot;
 
        SCNetworkSetPrivateRef  setPrivate      = (SCNetworkSetPrivateRef)set;
        CFIndex                 slot;
 
@@ -249,51 +244,33 @@ _serviceOrder_add(SCNetworkSetRef set, SCNetworkServiceRef service)
                goto done;
        }
 
                goto done;
        }
 
-       if (_serviceIsPPP(service) && !_serviceIsVPN(service)) {
-               int     serviceOrder;
+       serviceOrder = _serviceOrder(service);
 
 
-               /*
-                * we add [non-VPN] PPP interfaces to the head of the
-                * service order but ensure that "modem" devices are
-                * in front of "Bluetooth" & "IrDA" devices.
-                */
-               slot = 0;
-
-               serviceOrder = _serviceOrder(service);
-
-               for (i = 0; i < n; i++) {
-                       int                     slotOrder;
-                       CFStringRef             slotServiceID;
-                       SCNetworkServiceRef     slotService;
-
-                       slotServiceID = CFArrayGetValueAtIndex(newOrder, i);
-                       if (!isA_CFString(slotServiceID)) {
-                               // if bad prefs
-                               continue;
-                       }
+       slot = 0;
+       for (i = 0; i < n; i++) {
+               int                     slotOrder;
+               SCNetworkServiceRef     slotService;
+               CFStringRef             slotServiceID;
 
 
-                       slotService = SCNetworkServiceCopy(setPrivate->prefs, slotServiceID);
-                       if (slotService == NULL) {
-                               // if serviceID not valid
-                               continue;
-                       }
+               slotServiceID = CFArrayGetValueAtIndex(newOrder, i);
+               if (!isA_CFString(slotServiceID)) {
+                       // if bad prefs
+                       continue;
+               }
 
 
-                       if (_serviceIsPPP(slotService)) {
-                               // if  PPP service
-                               slotOrder = _serviceOrder(slotService);
-                               if (serviceOrder >= slotOrder) {
-                                       // add the service *after* this one
-                                       slot = i + 1;
-                               }
-                       }
+               slotService = SCNetworkServiceCopy(setPrivate->prefs, slotServiceID);
+               if (slotService == NULL) {
+                       // if serviceID not valid
+                       continue;
+               }
 
 
-                       CFRelease(slotService);
+               slotOrder = _serviceOrder(slotService);
+               if (serviceOrder >= slotOrder) {
+                       // add the service *after* this one
+                       slot = i + 1;
                }
                }
-       } else {
-               /*
-                * non-PPP interfaces are added to the end of the list.
-                */
-               slot = n;
+
+               CFRelease(slotService);
        }
 
        CFArrayInsertValueAtIndex(newOrder, slot, serviceID);
        }
 
        CFArrayInsertValueAtIndex(newOrder, slot, serviceID);
@@ -364,7 +341,7 @@ SCNetworkSetAddService(SCNetworkSetRef set, SCNetworkServiceRef service)
                return FALSE;
        }
 
                return FALSE;
        }
 
-       if (!isA_SCNetworkService(service)) {
+       if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
@@ -441,7 +418,7 @@ SCNetworkSetAddService(SCNetworkSetRef set, SCNetworkServiceRef service)
        // get the [deep] interface configuration settings
        interface = SCNetworkServiceGetInterface(service);
        if (interface != NULL) {
        // get the [deep] interface configuration settings
        interface = SCNetworkServiceGetInterface(service);
        if (interface != NULL) {
-               interface_config = __SCNetworkInterfaceCopyDeepConfiguration(interface);
+               interface_config = __SCNetworkInterfaceCopyDeepConfiguration(set, interface);
        }
 
        // create the link between "set" and the "service"
        }
 
        // create the link between "set" and the "service"
@@ -461,12 +438,15 @@ SCNetworkSetAddService(SCNetworkSetRef set, SCNetworkServiceRef service)
 
        // push the [deep] interface configuration into all sets which contain this service.
        if (interface != NULL) {
 
        // push the [deep] interface configuration into all sets which contain this service.
        if (interface != NULL) {
-               __SCNetworkInterfaceSetDeepConfiguration(interface, interface_config);
+               __SCNetworkInterfaceSetDeepConfiguration(set, interface, interface_config);
        }
 
        // add service to ServiceOrder
        _serviceOrder_add(set, service);
 
        }
 
        // add service to ServiceOrder
        _serviceOrder_add(set, service);
 
+       // mark set as no longer "new"
+       setPrivate->established = TRUE;
+
     done :
 
        if (interface_config != NULL)   CFRelease(interface_config);
     done :
 
        if (interface_config != NULL)   CFRelease(interface_config);
@@ -496,6 +476,10 @@ SCNetworkSetCopy(SCPreferencesRef prefs, CFStringRef setID)
        }
 
        setPrivate = __SCNetworkSetCreatePrivate(NULL, prefs, setID);
        }
 
        setPrivate = __SCNetworkSetCreatePrivate(NULL, prefs, setID);
+
+       // mark set as "old" (already established)
+       setPrivate->established = TRUE;
+
        return (SCNetworkSetRef)setPrivate;
 }
 
        return (SCNetworkSetRef)setPrivate;
 }
 
@@ -586,6 +570,10 @@ SCNetworkSetCopyAll(SCPreferencesRef prefs)
                        }
 
                        setPrivate = __SCNetworkSetCreatePrivate(NULL, prefs, keys[i]);
                        }
 
                        setPrivate = __SCNetworkSetCreatePrivate(NULL, prefs, keys[i]);
+
+                       // mark set as "old" (already established)
+                       setPrivate->established = TRUE;
+
                        CFArrayAppendValue(array, (SCNetworkSetRef)setPrivate);
                        CFRelease(setPrivate);
                }
                        CFArrayAppendValue(array, (SCNetworkSetRef)setPrivate);
                        CFRelease(setPrivate);
                }
@@ -620,6 +608,9 @@ SCNetworkSetCopyCurrent(SCPreferencesRef prefs)
                path = SCPreferencesPathKeyCreateSet(NULL, setID);
                if (CFEqual(path, currentID)) {
                        setPrivate = __SCNetworkSetCreatePrivate(NULL, prefs, setID);
                path = SCPreferencesPathKeyCreateSet(NULL, setID);
                if (CFEqual(path, currentID)) {
                        setPrivate = __SCNetworkSetCreatePrivate(NULL, prefs, setID);
+
+                       // mark set as "old" (already established)
+                       setPrivate->established = TRUE;
                } else {
                        SCLog(TRUE, LOG_ERR, CFSTR("SCNetworkSetCopyCurrent(): preferences are non-conformant"));
                }
                } else {
                        SCLog(TRUE, LOG_ERR, CFSTR("SCNetworkSetCopyCurrent(): preferences are non-conformant"));
                }
@@ -738,6 +729,9 @@ SCNetworkSetCreate(SCPreferencesRef prefs)
        setPrivate = __SCNetworkSetCreatePrivate(NULL, prefs, setID);
        CFRelease(components);
 
        setPrivate = __SCNetworkSetCreatePrivate(NULL, prefs, setID);
        CFRelease(components);
 
+       // mark set as "new" (not yet established)
+       setPrivate->established = FALSE;
+
        return (SCNetworkSetRef)setPrivate;
 }
 
        return (SCNetworkSetRef)setPrivate;
 }
 
@@ -889,6 +883,7 @@ SCNetworkSetRemoveService(SCNetworkSetRef set, SCNetworkServiceRef service)
        CFArrayRef                      interface_config        = NULL;
        Boolean                         ok;
        CFStringRef                     path;
        CFArrayRef                      interface_config        = NULL;
        Boolean                         ok;
        CFStringRef                     path;
+       int                             sc_status               = kSCStatusOK;
        SCNetworkServicePrivateRef      servicePrivate          = (SCNetworkServicePrivateRef)service;
        SCNetworkSetPrivateRef          setPrivate              = (SCNetworkSetPrivateRef)set;
 
        SCNetworkServicePrivateRef      servicePrivate          = (SCNetworkServicePrivateRef)service;
        SCNetworkSetPrivateRef          setPrivate              = (SCNetworkSetPrivateRef)set;
 
@@ -897,7 +892,7 @@ SCNetworkSetRemoveService(SCNetworkSetRef set, SCNetworkServiceRef service)
                return FALSE;
        }
 
                return FALSE;
        }
 
-       if (!isA_SCNetworkService(service)) {
+       if (!isA_SCNetworkService(service) || (servicePrivate->prefs == NULL)) {
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
                _SCErrorSet(kSCStatusInvalidArgument);
                return FALSE;
        }
@@ -908,10 +903,10 @@ SCNetworkSetRemoveService(SCNetworkSetRef set, SCNetworkServiceRef service)
        // get the [deep] interface configuration settings
        interface = SCNetworkServiceGetInterface(service);
        if (interface != NULL) {
        // get the [deep] interface configuration settings
        interface = SCNetworkServiceGetInterface(service);
        if (interface != NULL) {
-               interface_config = __SCNetworkInterfaceCopyDeepConfiguration(interface);
+               interface_config = __SCNetworkInterfaceCopyDeepConfiguration(set, interface);
                if (interface_config != NULL) {
                        // remove the interface configuration from all sets which contain this service.
                if (interface_config != NULL) {
                        // remove the interface configuration from all sets which contain this service.
-                       __SCNetworkInterfaceSetDeepConfiguration(interface, NULL);
+                       __SCNetworkInterfaceSetDeepConfiguration(set, interface, NULL);
                }
        }
 
                }
        }
 
@@ -921,19 +916,20 @@ SCNetworkSetRemoveService(SCNetworkSetRef set, SCNetworkServiceRef service)
                                                                 servicePrivate->serviceID,
                                                                 NULL);
        ok = SCPreferencesPathRemoveValue(setPrivate->prefs, path);
                                                                 servicePrivate->serviceID,
                                                                 NULL);
        ok = SCPreferencesPathRemoveValue(setPrivate->prefs, path);
-       CFRelease(path);
        if (!ok) {
        if (!ok) {
-               goto done;
+               sc_status = SCError();  // preserve the error
        }
        }
+       CFRelease(path);
 
        // push the [deep] interface configuration [back] into all sets which contain the service.
        if (interface_config != NULL) {
 
        // push the [deep] interface configuration [back] into all sets which contain the service.
        if (interface_config != NULL) {
-               __SCNetworkInterfaceSetDeepConfiguration(interface, interface_config);
+               __SCNetworkInterfaceSetDeepConfiguration(set, interface, interface_config);
        }
 
        }
 
-    done :
-
        if (interface_config != NULL)     CFRelease(interface_config);
        if (interface_config != NULL)     CFRelease(interface_config);
+       if (!ok) {
+               _SCErrorSet(sc_status);
+       }
        return ok;
 }
 
        return ok;
 }
 
@@ -1058,18 +1054,18 @@ SCNetworkSetSetName(SCNetworkSetRef set, CFStringRef name)
 
        path = SCPreferencesPathKeyCreateSet(NULL, setPrivate->setID);
        entity = SCPreferencesPathGetValue(setPrivate->prefs, path);
 
        path = SCPreferencesPathKeyCreateSet(NULL, setPrivate->setID);
        entity = SCPreferencesPathGetValue(setPrivate->prefs, path);
-       if ((entity == NULL) && (name != NULL)) {
-               entity = CFDictionaryCreate(NULL,
-                                           NULL,
-                                           NULL,
-                                           0,
-                                           &kCFTypeDictionaryKeyCallBacks,
-                                           &kCFTypeDictionaryValueCallBacks);
-       }
-       if (isA_CFDictionary(entity)) {
+       if (isA_CFDictionary(entity) ||
+           ((entity == NULL) && (name != NULL))) {
                CFMutableDictionaryRef  newEntity;
 
                CFMutableDictionaryRef  newEntity;
 
-               newEntity = CFDictionaryCreateMutableCopy(NULL, 0, entity);
+               if (entity != NULL) {
+                       newEntity = CFDictionaryCreateMutableCopy(NULL, 0, entity);
+               } else {
+                       newEntity = CFDictionaryCreateMutable(NULL,
+                                                             0,
+                                                             &kCFTypeDictionaryKeyCallBacks,
+                                                             &kCFTypeDictionaryValueCallBacks);
+               }
                if (name != NULL) {
                        CFDictionarySetValue(newEntity, kSCPropUserDefinedName, name);
                } else {
                if (name != NULL) {
                        CFDictionarySetValue(newEntity, kSCPropUserDefinedName, name);
                } else {
@@ -1234,11 +1230,10 @@ __SCNetworkSetEstablishDefaultConfigurationForInterfaces(SCNetworkSetRef set, CF
        // for those interfaces that are not represented in the
        // current set.
        services = SCNetworkSetCopyServices(set);
        // for those interfaces that are not represented in the
        // current set.
        services = SCNetworkSetCopyServices(set);
-       if ((services != NULL) && (CFArrayGetCount(services) > 0)) {
-               // but, if we are starting off with a non-empty
-               // set than we only want to add new services for
-               // those interfaces that are not represented in
-               // *any* set.
+       if ((services != NULL) && setPrivate->established) {
+               // but, if we are given an existing (or "established") set
+               // than we only want to add new services for those interfaces
+               // that are not represented in *any* set.
                CFRelease(services);
                services = SCNetworkServiceCopyAll(setPrivate->prefs);
        }
                CFRelease(services);
                services = SCNetworkServiceCopyAll(setPrivate->prefs);
        }
index 0c7d4c9245de0095b9a9136bf3b2914800f74a47..274bc151390865b1a660d47f2fe35c9d7af08e63 100644 (file)
  * @APPLE_LICENSE_HEADER_END@
  */
 
  * @APPLE_LICENSE_HEADER_END@
  */
 
-/* 
+/*
  * SCNetworkSignature.c
  * - implementation of SCNetworkSignatureRef API that allows access to
      network identification information
  * SCNetworkSignature.c
  * - implementation of SCNetworkSignatureRef API that allows access to
      network identification information
- *     
+ *
  */
 /*
  * Modification History
  */
 /*
  * Modification History
 #include "SCNetworkSignature.h"
 #include "SCNetworkSignaturePrivate.h"
 
 #include "SCNetworkSignature.h"
 #include "SCNetworkSignaturePrivate.h"
 
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
-#error MAC_OS_X_VERSION_MIN_REQUIRED < 1050, Check MACOSX_DEPLOYMENT_TARGET
-#endif
-
 const char * kSCNetworkSignatureActiveChangedNotifyName = NETWORK_ID_KEY ".active";
 
 
 const char * kSCNetworkSignatureActiveChangedNotifyName = NETWORK_ID_KEY ".active";
 
 
@@ -67,7 +63,7 @@ store_copy_id_dict(CFAllocatorRef alloc, SCDynamicStoreRef store)
 {
        CFDictionaryRef id_dict = NULL;
        Boolean         release_store = FALSE;
 {
        CFDictionaryRef id_dict = NULL;
        Boolean         release_store = FALSE;
-       
+
        if (store == NULL) {
                store = store_create(alloc);
                if (store == NULL) {
        if (store == NULL) {
                store = store_create(alloc);
                if (store == NULL) {
@@ -75,7 +71,7 @@ store_copy_id_dict(CFAllocatorRef alloc, SCDynamicStoreRef store)
                }
                release_store = TRUE;
        }
                }
                release_store = TRUE;
        }
-       id_dict = SCDynamicStoreCopyValue(store, 
+       id_dict = SCDynamicStoreCopyValue(store,
                                          kSCNetworkIdentificationStoreKey);
        if (isA_CFDictionary(id_dict) == NULL) {
                if (id_dict != NULL) {
                                          kSCNetworkIdentificationStoreKey);
        if (isA_CFDictionary(id_dict) == NULL) {
                if (id_dict != NULL) {
@@ -91,7 +87,7 @@ store_copy_id_dict(CFAllocatorRef alloc, SCDynamicStoreRef store)
        return (id_dict);
 }
 
        return (id_dict);
 }
 
-#pragma - 
+#pragma -
 
 #pragma mark SCNetworkSignature APIs
 
 
 #pragma mark SCNetworkSignature APIs
 
@@ -106,7 +102,7 @@ SCNetworkSignatureCopyActiveIdentifierForAddress(CFAllocatorRef alloc,
 
        /* only accept 0.0.0.0 (i.e. default) for now */
        sin_p = (struct sockaddr_in *)addr;
 
        /* only accept 0.0.0.0 (i.e. default) for now */
        sin_p = (struct sockaddr_in *)addr;
-       if (addr == NULL 
+       if (addr == NULL
            || addr->sa_family != AF_INET
            || addr->sa_len != sizeof(struct sockaddr_in)
            || sin_p->sin_addr.s_addr != 0) {
            || addr->sa_family != AF_INET
            || addr->sa_len != sizeof(struct sockaddr_in)
            || sin_p->sin_addr.s_addr != 0) {
@@ -161,7 +157,7 @@ SCNetworkSignatureCopyActiveIdentifiers(CFAllocatorRef alloc)
                }
        }
        CFRetain(active);
                }
        }
        CFRetain(active);
-       
+
  done:
        if (id_dict != NULL) {
                CFRelease(id_dict);
  done:
        if (id_dict != NULL) {
                CFRelease(id_dict);
index d8d7a4214276392b3abe349bbf4fe5b9e9f38261..c065caa177639a8fefe87ad1a6f6636c110aa555 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2006, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #ifndef _SCNETWORKSIGNATURE_H
 #define _SCNETWORKSIGNATURE_H
 
 #ifndef _SCNETWORKSIGNATURE_H
 #define _SCNETWORKSIGNATURE_H
 
-#include <AvailabilityMacros.h>
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-
+#include <Availability.h>
 #include <CoreFoundation/CFString.h>
 #include <CoreFoundation/CFArray.h>
 #include <netinet/in.h>
 
 /*!
        @header SCNetworkSignature
 #include <CoreFoundation/CFString.h>
 #include <CoreFoundation/CFArray.h>
 #include <netinet/in.h>
 
 /*!
        @header SCNetworkSignature
-       @discussion The SCNetworkSignature API provides access to the 
+       @discussion The SCNetworkSignature API provides access to the
                network identification information.  Each routable network
                has an associated signature that is assigned a unique
                identifier.  The unique identifier allows an application
                network identification information.  Each routable network
                has an associated signature that is assigned a unique
                identifier.  The unique identifier allows an application
@@ -61,7 +59,7 @@ extern const char * kSCNetworkSignatureActiveChangedNotifyName;
                NULL if no networks are currently active.
  */
 CFArrayRef /* of CFStringRef's */
                NULL if no networks are currently active.
  */
 CFArrayRef /* of CFStringRef's */
-SCNetworkSignatureCopyActiveIdentifiers(CFAllocatorRef alloc);
+SCNetworkSignatureCopyActiveIdentifiers(CFAllocatorRef alloc)                  __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCNetworkSignatureCopyActiveIdentifierForAddress
 
 /*!
        @function SCNetworkSignatureCopyActiveIdentifierForAddress
@@ -81,8 +79,6 @@ SCNetworkSignatureCopyActiveIdentifiers(CFAllocatorRef alloc);
  */
 CFStringRef
 SCNetworkSignatureCopyActiveIdentifierForAddress(CFAllocatorRef alloc,
  */
 CFStringRef
 SCNetworkSignatureCopyActiveIdentifierForAddress(CFAllocatorRef alloc,
-                                                const struct sockaddr * addr);
-
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
+                                                const struct sockaddr * addr)  __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/);
 
 #endif /* _SCNETWORKSIGNATURE_H */
 
 #endif /* _SCNETWORKSIGNATURE_H */
index 2f8d071e49ef8e42c293ba222b29db2fc442ed1e..1acfe1d1e910cc0bbd1903c949242c145372eb8b 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2003-2005, 2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2007, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -52,7 +52,8 @@ __SCPSignatureFromStatbuf(const struct stat *statBuf)
        sig = (SCPSignatureDataRef)CFDataGetBytePtr(signature);
        sig->st_dev       = statBuf->st_dev;
        sig->st_ino       = statBuf->st_ino;
        sig = (SCPSignatureDataRef)CFDataGetBytePtr(signature);
        sig->st_dev       = statBuf->st_dev;
        sig->st_ino       = statBuf->st_ino;
-       sig->st_mtimespec = statBuf->st_mtimespec;
+       sig->tv_sec       = statBuf->st_mtimespec.tv_sec;
+       sig->tv_nsec      = statBuf->st_mtimespec.tv_nsec;
        sig->st_size      = statBuf->st_size;
        return signature;
 }
        sig->st_size      = statBuf->st_size;
        return signature;
 }
index 8e73cf3c419bcb1bdb4edd2e9706a9fbbf73b50d..c380dc068fda442246365999dedb330a3dc8d3d1 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -106,7 +106,7 @@ __SCPreferencesCommitChanges_helper(SCPreferencesRef prefs)
 
 
 static ssize_t
 
 
 static ssize_t
-writen(int ref, void *data, size_t len)
+writen(int ref, const void *data, size_t len)
 {
        size_t          left    = len;
        ssize_t         n;
 {
        size_t          left    = len;
        ssize_t         n;
@@ -210,7 +210,7 @@ SCPreferencesCommitChanges(SCPreferencesRef prefs)
                        (void) close(fd);
                        goto done;
                }
                        (void) close(fd);
                        goto done;
                }
-               if (writen(fd, (void *)CFDataGetBytePtr(newPrefs), CFDataGetLength(newPrefs)) == -1) {
+               if (writen(fd, (const void *)CFDataGetBytePtr(newPrefs), CFDataGetLength(newPrefs)) == -1) {
                        _SCErrorSet(errno);
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesCommitChanges write() failed: %s"), strerror(errno));
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("  path = %s"), thePath);
                        _SCErrorSet(errno);
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("SCPreferencesCommitChanges write() failed: %s"), strerror(errno));
                        SCLog(_sc_verbose, LOG_ERR, CFSTR("  path = %s"), thePath);
@@ -221,6 +221,7 @@ SCPreferencesCommitChanges(SCPreferencesRef prefs)
                        goto done;
                }
 
                        goto done;
                }
 
+#if    !TARGET_OS_IPHONE
                /* synchronize the file's in-core state with that on disk */
                if (fsync(fd) == -1) {
                        _SCErrorSet(errno);
                /* synchronize the file's in-core state with that on disk */
                if (fsync(fd) == -1) {
                        _SCErrorSet(errno);
@@ -239,6 +240,7 @@ SCPreferencesCommitChanges(SCPreferencesRef prefs)
                 * Note: at present, this only works on HFS filesystems
                 */
                (void) fcntl(fd, F_FULLFSYNC, 0);
                 * Note: at present, this only works on HFS filesystems
                 */
                (void) fcntl(fd, F_FULLFSYNC, 0);
+#endif // !TARGET_OS_IPHONE
 
                /* new preferences have been written */
                if (close(fd) == -1) {
 
                /* new preferences have been written */
                if (close(fd) == -1) {
index 0e6fcb377b68326fcf4e587205d45b8290a1954e..3bffe8b093c7742784577f900b4a2ea2db9c0491 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2004-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 
 #include <grp.h>
 #include <fcntl.h>
 
 #include <grp.h>
 #include <fcntl.h>
+#include <stdio.h>
 #include <unistd.h>
 #include <pthread.h>
 #include <sys/errno.h>
 
 
 
 #include <unistd.h>
 #include <pthread.h>
 #include <sys/errno.h>
 
 
 
+#if    TARGET_OS_IPHONE
+__private_extern__ int
+getgrnam_r(const char *name, __unused struct group *grp, __unused char *buf, __unused size_t bufsize, struct group **grpP)
+{
+       *grpP = getgrnam(name);
+       return (*grpP == NULL) ? -1 : 0;
+}
+#endif /* TARGET_OS_IPHONE */
+
+
 static Boolean
 __SCPreferencesLock_helper(SCPreferencesRef prefs, Boolean wait)
 {
 static Boolean
 __SCPreferencesLock_helper(SCPreferencesRef prefs, Boolean wait)
 {
@@ -194,10 +205,43 @@ createParentDirectory(const char *path)
 }
 
 
 }
 
 
+static void
+reportDelay(SCPreferencesRef prefs, struct timeval *delay, Boolean isStale)
+{
+       aslmsg                  m;
+       SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+       char                    str[256];
+
+       m = asl_new(ASL_TYPE_MSG);
+       asl_set(m, "com.apple.message.domain", "com.apple.SystemConfiguration.SCPreferencesLock");
+       (void) _SC_cfstring_to_cstring(prefsPrivate->name, str, sizeof(str), kCFStringEncodingUTF8);
+       asl_set(m, "com.apple.message.signature", str);
+       (void) _SC_cfstring_to_cstring(prefsPrivate->prefsID, str, sizeof(str), kCFStringEncodingUTF8);
+       asl_set(m, "com.apple.message.signature2", str);
+       (void) snprintf(str, sizeof(str),
+                       "%d.%3.3d",
+                       (int)delay->tv_sec,
+                       delay->tv_usec / 1000);
+       asl_set(m, "com.apple.message.value", str);
+       SCLOG(NULL, m, ASL_LEVEL_DEBUG,
+             CFSTR("SCPreferences(%@:%@) lock delayed for %d.%3.3d seconds%s"),
+             prefsPrivate->name,
+             prefsPrivate->prefsID,
+             (int)delay->tv_sec,
+             delay->tv_usec / 1000,
+             isStale ? " (stale)" : "");
+       asl_free(m);
+
+       return;
+}
+
+
 Boolean
 SCPreferencesLock(SCPreferencesRef prefs, Boolean wait)
 {
        char                    buf[32];
 Boolean
 SCPreferencesLock(SCPreferencesRef prefs, Boolean wait)
 {
        char                    buf[32];
+       struct timeval          lockStart;
+       struct timeval          lockElapsed;
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
        int                     sc_status       = kSCStatusFailed;
        struct stat             statBuf;
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
        int                     sc_status       = kSCStatusFailed;
        struct stat             statBuf;
@@ -241,6 +285,8 @@ SCPreferencesLock(SCPreferencesRef prefs, Boolean wait)
                snprintf(prefsPrivate->lockPath, pathLen, "%s-lock", path);
        }
 
                snprintf(prefsPrivate->lockPath, pathLen, "%s-lock", path);
        }
 
+       (void)gettimeofday(&lockStart, NULL);
+
     retry :
 
        prefsPrivate->lockFD = open(prefsPrivate->lockPath,
     retry :
 
        prefsPrivate->lockFD = open(prefsPrivate->lockPath,
@@ -301,6 +347,9 @@ SCPreferencesLock(SCPreferencesRef prefs, Boolean wait)
 
     locked :
 
 
     locked :
 
+       (void)gettimeofday(&prefsPrivate->lockTime, NULL);
+       timersub(&prefsPrivate->lockTime, &lockStart, &lockElapsed);
+
        if (prefsPrivate->accessed) {
                CFDataRef       currentSignature;
                Boolean         match;
        if (prefsPrivate->accessed) {
                CFDataRef       currentSignature;
                Boolean         match;
@@ -317,9 +366,7 @@ SCPreferencesLock(SCPreferencesRef prefs, Boolean wait)
                                SCLog(TRUE, LOG_DEBUG,
                                      CFSTR("SCPreferencesLock stat() failed: %s"),
                                      strerror(errno));
                                SCLog(TRUE, LOG_DEBUG,
                                      CFSTR("SCPreferencesLock stat() failed: %s"),
                                      strerror(errno));
-                               sc_status = kSCStatusStale;
-                               unlink(prefsPrivate->lockPath);
-                               goto error;
+                               goto stale;
                        }
                }
 
                        }
                }
 
@@ -332,9 +379,7 @@ SCPreferencesLock(SCPreferencesRef prefs, Boolean wait)
                         * session was accessed so we've got no choice
                         * but to deny the lock request.
                         */
                         * session was accessed so we've got no choice
                         * but to deny the lock request.
                         */
-                       sc_status = kSCStatusStale;
-                       unlink(prefsPrivate->lockPath);
-                       goto error;
+                       goto stale;
                }
 //     } else {
 //             /*
                }
 //     } else {
 //             /*
@@ -344,10 +389,25 @@ SCPreferencesLock(SCPreferencesRef prefs, Boolean wait)
 //              */
        }
 
 //              */
        }
 
+       if (lockElapsed.tv_sec > 0) {
+               // if we waited more than 1 second to acquire the lock
+               reportDelay(prefs, &lockElapsed, FALSE);
+       }
+
        prefsPrivate->locked = TRUE;
        pthread_mutex_unlock(&prefsPrivate->lock);
        return TRUE;
 
        prefsPrivate->locked = TRUE;
        pthread_mutex_unlock(&prefsPrivate->lock);
        return TRUE;
 
+    stale :
+
+       sc_status = kSCStatusStale;
+       unlink(prefsPrivate->lockPath);
+
+       if (lockElapsed.tv_sec > 0) {
+               // if we waited more than 1 second to acquire the lock
+               reportDelay(prefs, &lockElapsed, TRUE);
+       }
+
     error :
 
        if (prefsPrivate->lockFD != -1) {
     error :
 
        if (prefsPrivate->lockFD != -1) {
index 7ea196835a63d43895c3d4cd44c8b1fc7d82176d..9dfde1d1c16bcf8f1c7a40a67497c383f6729f8b 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright(c) 2000-2007 Apple Inc. All rights reserved.
+ * Copyright(c) 2000-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  * - initial revision
  */
 
  * - initial revision
  */
 
+#include <Availability.h>
+#include <TargetConditionals.h>
+#include <sys/cdefs.h>
+#if    !TARGET_OS_IPHONE
+#include <dispatch/dispatch.h>
+#endif // !TARGET_OS_IPHONE
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include "SCPreferencesInternal.h"
 #include "SCHelper_client.h"
 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCValidation.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include "SCPreferencesInternal.h"
 #include "SCHelper_client.h"
 
-#include <Security/Security.h>
 #include "dy_framework.h"
 
 #include <fcntl.h>
 #include "dy_framework.h"
 
 #include <fcntl.h>
 #include <sys/errno.h>
 
 
 #include <sys/errno.h>
 
 
+static __inline__ CFTypeRef
+isA_SCPreferences(CFTypeRef obj)
+{
+       return (isA_CFType(obj, SCPreferencesGetTypeID()));
+}
+
+
 static CFStringRef
 __SCPreferencesCopyDescription(CFTypeRef cf) {
        CFAllocatorRef          allocator       = CFGetAllocator(cf);
 static CFStringRef
 __SCPreferencesCopyDescription(CFTypeRef cf) {
        CFAllocatorRef          allocator       = CFGetAllocator(cf);
@@ -174,6 +186,7 @@ __SCPreferencesCreatePrivate(CFAllocatorRef allocator)
        prefsPrivate->session                           = NULL;
        prefsPrivate->sessionKeyCommit                  = NULL;
        prefsPrivate->sessionKeyApply                   = NULL;
        prefsPrivate->session                           = NULL;
        prefsPrivate->sessionKeyCommit                  = NULL;
        prefsPrivate->sessionKeyApply                   = NULL;
+       prefsPrivate->scheduled                         = FALSE;
        prefsPrivate->rls                               = NULL;
        prefsPrivate->rlsFunction                       = NULL;
        prefsPrivate->rlsContext.info                   = NULL;
        prefsPrivate->rls                               = NULL;
        prefsPrivate->rlsFunction                       = NULL;
        prefsPrivate->rlsContext.info                   = NULL;
@@ -181,6 +194,9 @@ __SCPreferencesCreatePrivate(CFAllocatorRef allocator)
        prefsPrivate->rlsContext.release                = NULL;
        prefsPrivate->rlsContext.copyDescription        = NULL;
        prefsPrivate->rlList                            = NULL;
        prefsPrivate->rlsContext.release                = NULL;
        prefsPrivate->rlsContext.copyDescription        = NULL;
        prefsPrivate->rlList                            = NULL;
+#if    !TARGET_OS_IPHONE
+       prefsPrivate->dispatchQueue                     = NULL;
+#endif // !TARGET_OS_IPHONE
        prefsPrivate->prefs                             = NULL;
        prefsPrivate->accessed                          = FALSE;
        prefsPrivate->changed                           = FALSE;
        prefsPrivate->prefs                             = NULL;
        prefsPrivate->accessed                          = FALSE;
        prefsPrivate->changed                           = FALSE;
@@ -196,9 +212,12 @@ __private_extern__ Boolean
 __SCPreferencesCreate_helper(SCPreferencesRef prefs)
 {
        CFDataRef               data            = NULL;
 __SCPreferencesCreate_helper(SCPreferencesRef prefs)
 {
        CFDataRef               data            = NULL;
+       CFMutableDictionaryRef  info;
+       CFNumberRef             num;
        Boolean                 ok;
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
        uint32_t                status          = kSCStatusOK;
        Boolean                 ok;
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
        uint32_t                status          = kSCStatusOK;
+       uint32_t                pid             = getpid();
 
        // start helper
        prefsPrivate->helper = _SCHelperOpen(prefsPrivate->authorizationData);
 
        // start helper
        prefsPrivate->helper = _SCHelperOpen(prefsPrivate->authorizationData);
@@ -206,12 +225,24 @@ __SCPreferencesCreate_helper(SCPreferencesRef prefs)
                goto fail;
        }
 
                goto fail;
        }
 
-       // serialize the "prefsID"
+       // create a dictionary of information to pass to the helper
+       info = CFDictionaryCreateMutable(NULL,
+                                        0,
+                                        &kCFTypeDictionaryKeyCallBacks,
+                                        &kCFTypeDictionaryValueCallBacks);
        if (prefsPrivate->prefsID != NULL) {
        if (prefsPrivate->prefsID != NULL) {
-               ok = _SCSerializeString(prefsPrivate->prefsID, &data, NULL, NULL);
-               if (!ok) {
-                       goto fail;
-               }
+               CFDictionarySetValue(info, CFSTR("prefsID"), prefsPrivate->prefsID);
+       }
+       CFDictionarySetValue(info, CFSTR("name"), prefsPrivate->name);
+       num = CFNumberCreate(NULL, kCFNumberSInt32Type, &pid);
+       CFDictionarySetValue(info, CFSTR("PID"), num);
+       CFRelease(num);
+
+       // serialize the info
+       ok = _SCSerialize(info, &data, NULL, NULL);
+       CFRelease(info);
+       if (data == NULL || !ok) {
+               goto fail;
        }
 
        // have the helper "open" the prefs
        }
 
        // have the helper "open" the prefs
@@ -406,13 +437,14 @@ __SCPreferencesCreate(CFAllocatorRef      allocator,
                                        goto done;
                                }
 
                                        goto done;
                                }
 
+                               SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCPreferencesCreate open() failed: %s"), strerror(errno));
                                sc_status = kSCStatusAccessError;
                                break;
                        default :
                                sc_status = kSCStatusAccessError;
                                break;
                        default :
+                               SCLog(TRUE, LOG_ERR, CFSTR("__SCPreferencesCreate open() failed: %s"), strerror(errno));
                                sc_status = kSCStatusFailed;
                                break;
                }
                                sc_status = kSCStatusFailed;
                                break;
                }
-               SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCPreferencesCreate open() failed: %s"), strerror(errno));
                goto error;
        }
 
                goto error;
        }
 
@@ -533,14 +565,13 @@ __SCPreferencesAccess(SCPreferencesRef    prefs)
 
        if (fd != -1) {
                (void) close(fd);
 
        if (fd != -1) {
                (void) close(fd);
-               fd = -1;
        }
 
        if (prefsPrivate->prefs == NULL) {
                /*
                 * new file, create empty preferences
                 */
        }
 
        if (prefsPrivate->prefs == NULL) {
                /*
                 * new file, create empty preferences
                 */
-               SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCPreferencesAccess(): creating new preferences file."));
+//             SCLog(_sc_verbose, LOG_DEBUG, CFSTR("__SCPreferencesAccess(): creating new preferences file."));
                prefsPrivate->prefs = CFDictionaryCreateMutable(allocator,
                                                                0,
                                                                &kCFTypeDictionaryKeyCallBacks,
                prefsPrivate->prefs = CFDictionaryCreateMutable(allocator,
                                                                0,
                                                                &kCFTypeDictionaryKeyCallBacks,
@@ -571,10 +602,12 @@ SCPreferencesCreateWithAuthorization(CFAllocatorRef       allocator,
                                     CFStringRef        prefsID,
                                     AuthorizationRef   authorization)
 {
                                     CFStringRef        prefsID,
                                     AuthorizationRef   authorization)
 {
-       CFDataRef                       authorizationData;
+       CFDataRef                       authorizationData       = NULL;
+       SCPreferencesPrivateRef         prefsPrivate;
+
+#if    !TARGET_OS_IPHONE
        AuthorizationExternalForm       extForm;
        OSStatus                        os_status;
        AuthorizationExternalForm       extForm;
        OSStatus                        os_status;
-       SCPreferencesPrivateRef         prefsPrivate;
 
        os_status = AuthorizationMakeExternalForm(authorization, &extForm);
        if (os_status != errAuthorizationSuccess) {
 
        os_status = AuthorizationMakeExternalForm(authorization, &extForm);
        if (os_status != errAuthorizationSuccess) {
@@ -584,6 +617,41 @@ SCPreferencesCreateWithAuthorization(CFAllocatorRef        allocator,
        }
 
        authorizationData = CFDataCreate(NULL, (const UInt8 *)extForm.bytes, sizeof(extForm.bytes));
        }
 
        authorizationData = CFDataCreate(NULL, (const UInt8 *)extForm.bytes, sizeof(extForm.bytes));
+#else  // !TARGET_OS_IPHONE
+       CFBundleRef     bundle;
+       CFStringRef     bundleID        = NULL;
+
+       /* get the application/executable/bundle name */
+       bundle = CFBundleGetMainBundle();
+       if (bundle != NULL) {
+               bundleID = CFBundleGetIdentifier(bundle);
+               if (bundleID != NULL) {
+                       CFRetain(bundleID);
+               } else {
+                       CFURLRef        url;
+
+                       url = CFBundleCopyExecutableURL(bundle);
+                       if (url != NULL) {
+                               bundleID = CFURLCopyPath(url);
+                               CFRelease(url);
+                       }
+               }
+
+               if (bundleID != NULL) {
+                       if (CFEqual(bundleID, CFSTR("/"))) {
+                               CFRelease(bundleID);
+                               bundleID = NULL;
+                       }
+               }
+       }
+       if (bundleID == NULL) {
+               bundleID = CFStringCreateWithFormat(NULL, NULL, CFSTR("Unknown(%d)"), getpid());
+       }
+
+       _SCSerializeString(bundleID, &authorizationData, NULL, NULL);
+       CFRelease(bundleID);
+#endif // !TARGET_OS_IPHONE
+
        prefsPrivate = __SCPreferencesCreate(allocator, name, prefsID, authorizationData);
        CFRelease(authorizationData);
 
        prefsPrivate = __SCPreferencesCreate(allocator, name, prefsID, authorizationData);
        CFRelease(authorizationData);
 
@@ -670,7 +738,7 @@ __SCPreferencesAddSession(SCPreferencesRef prefs)
 
        /* establish a dynamic store session */
        prefsPrivate->session = SCDynamicStoreCreate(allocator,
 
        /* establish a dynamic store session */
        prefsPrivate->session = SCDynamicStoreCreate(allocator,
-                                                    CFSTR("SCPreferences"),
+                                                    prefsPrivate->name,
                                                     prefsNotify,
                                                     &context);
        if (prefsPrivate->session == NULL) {
                                                     prefsNotify,
                                                     &context);
        if (prefsPrivate->session == NULL) {
@@ -699,7 +767,7 @@ SCPreferencesSetCallback(SCPreferencesRef       prefs,
 {
        SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs;
 
 {
        SCPreferencesPrivateRef prefsPrivate = (SCPreferencesPrivateRef)prefs;
 
-       if (prefs == NULL) {
+       if (!isA_SCPreferences(prefs)) {
                /* sorry, you must provide a session */
                _SCErrorSet(kSCStatusNoPrefsSession);
                return FALSE;
                /* sorry, you must provide a session */
                _SCErrorSet(kSCStatusNoPrefsSession);
                return FALSE;
@@ -730,26 +798,38 @@ SCPreferencesSetCallback(SCPreferencesRef       prefs,
 }
 
 
 }
 
 
-Boolean
-SCPreferencesScheduleWithRunLoop(SCPreferencesRef       prefs,
-                                CFRunLoopRef           runLoop,
-                                CFStringRef            runLoopMode)
+static Boolean
+__SCPreferencesScheduleWithRunLoop(SCPreferencesRef    prefs,
+                                  CFRunLoopRef         runLoop,
+                                  CFStringRef          runLoopMode,
+#if    !TARGET_OS_IPHONE
+                                  dispatch_queue_t     queue
+#else  // !TARGET_OS_IPHONE
+                                  void                 *queue
+#endif // !TARGET_OS_IPHONE
+                                  )
 {
 {
+       Boolean                 ok              = FALSE;
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
 
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
 
-       if (prefs == NULL) {
-               /* sorry, you must provide a session */
-               _SCErrorSet(kSCStatusNoPrefsSession);
-               return FALSE;
-       }
-
        pthread_mutex_lock(&prefsPrivate->lock);
 
        pthread_mutex_lock(&prefsPrivate->lock);
 
-       if (prefsPrivate->rls == NULL) {
+#if    !TARGET_OS_IPHONE
+       if ((prefsPrivate->dispatchQueue != NULL) ||            // if we are already scheduled on a dispatch queue
+           ((queue != NULL) && prefsPrivate->scheduled)) {     // if we are already scheduled on a CFRunLoop
+               _SCErrorSet(kSCStatusInvalidArgument);
+               goto done;
+       }
+#endif // !TARGET_OS_IPHONE
+
+       if (!prefsPrivate->scheduled) {
                CFMutableArrayRef       keys;
 
                if (prefsPrivate->session == NULL) {
                CFMutableArrayRef       keys;
 
                if (prefsPrivate->session == NULL) {
-                       __SCPreferencesAddSession(prefs);
+                       ok = __SCPreferencesAddSession(prefs);
+                       if (!ok) {
+                               goto done;
+                       }
                }
 
                CFRetain(prefs);        // hold a reference to the prefs
                }
 
                CFRetain(prefs);        // hold a reference to the prefs
@@ -760,83 +840,123 @@ SCPreferencesScheduleWithRunLoop(SCPreferencesRef       prefs,
                (void) SCDynamicStoreSetNotificationKeys(prefsPrivate->session, keys, NULL);
                CFRelease(keys);
 
                (void) SCDynamicStoreSetNotificationKeys(prefsPrivate->session, keys, NULL);
                CFRelease(keys);
 
-               prefsPrivate->rls    = SCDynamicStoreCreateRunLoopSource(NULL, prefsPrivate->session, 0);
-               prefsPrivate->rlList = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+               if (runLoop != NULL) {
+                       prefsPrivate->rls = SCDynamicStoreCreateRunLoopSource(NULL, prefsPrivate->session, 0);
+                       prefsPrivate->rlList = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+               }
+
+               prefsPrivate->scheduled = TRUE;
        }
 
        }
 
-       if (!_SC_isScheduled(NULL, runLoop, runLoopMode, prefsPrivate->rlList)) {
-               /*
-                * if we do not already have notifications scheduled with
-                * this runLoop / runLoopMode
-                */
-               CFRunLoopAddSource(runLoop, prefsPrivate->rls, runLoopMode);
+#if    !TARGET_OS_IPHONE
+       if (queue != NULL) {
+               ok = SCDynamicStoreSetDispatchQueue(prefsPrivate->session, queue);
+               if (!ok) {
+                       prefsPrivate->scheduled = FALSE;
+                       (void) SCDynamicStoreSetNotificationKeys(prefsPrivate->session, NULL, NULL);
+                       CFRelease(prefs);
+                       goto done;
+               }
+
+               prefsPrivate->dispatchQueue = queue;
+               dispatch_retain(prefsPrivate->dispatchQueue);
+       } else
+#endif // !TARGET_OS_IPHONE
+       {
+               if (!_SC_isScheduled(NULL, runLoop, runLoopMode, prefsPrivate->rlList)) {
+                       /*
+                        * if we do not already have notifications scheduled with
+                        * this runLoop / runLoopMode
+                        */
+                       CFRunLoopAddSource(runLoop, prefsPrivate->rls, runLoopMode);
+               }
+
+               _SC_schedule(prefs, runLoop, runLoopMode, prefsPrivate->rlList);
        }
 
        }
 
-       _SC_schedule(prefs, runLoop, runLoopMode, prefsPrivate->rlList);
+       ok = TRUE;
+
+    done :
 
        pthread_mutex_unlock(&prefsPrivate->lock);
 
        pthread_mutex_unlock(&prefsPrivate->lock);
-       return TRUE;
+       return ok;
 }
 
 
 }
 
 
-Boolean
-SCPreferencesUnscheduleFromRunLoop(SCPreferencesRef     prefs,
-                                  CFRunLoopRef         runLoop,
-                                  CFStringRef          runLoopMode)
+static Boolean
+__SCPreferencesUnscheduleFromRunLoop(SCPreferencesRef  prefs,
+                                    CFRunLoopRef       runLoop,
+                                    CFStringRef        runLoopMode)
 {
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
 {
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
-       CFIndex                 n;
+       CFIndex                 n               = 0;
        Boolean                 ok              = FALSE;
 
        Boolean                 ok              = FALSE;
 
-       if (prefs == NULL) {
-               /* sorry, you must provide a session */
-               _SCErrorSet(kSCStatusNoPrefsSession);
-               return FALSE;
-       }
-
        pthread_mutex_lock(&prefsPrivate->lock);
 
        pthread_mutex_lock(&prefsPrivate->lock);
 
-       if (prefsPrivate->rls == NULL) {
-               /* if not currently scheduled */
+       if ((runLoop != NULL) && !prefsPrivate->scheduled) {                    // if we should be scheduled (but are not)
+               _SCErrorSet(kSCStatusInvalidArgument);
                goto done;
        }
 
                goto done;
        }
 
-       if (!_SC_unschedule(NULL, runLoop, runLoopMode, prefsPrivate->rlList, FALSE)) {
-               /* if not currently scheduled */
+#if    !TARGET_OS_IPHONE
+       if (((runLoop == NULL) && (prefsPrivate->dispatchQueue == NULL)) ||     // if we should be scheduled on a dispatch queue (but are not)
+           ((runLoop != NULL) && (prefsPrivate->dispatchQueue != NULL))) {     // if we should be scheduled on a CFRunLoop (but are scheduled on a dispatch queue)
+               _SCErrorSet(kSCStatusInvalidArgument);
                goto done;
        }
                goto done;
        }
+#endif // !TARGET_OS_IPHONE
+
+#if    !TARGET_OS_IPHONE
+       if (runLoop == NULL) {
+               SCDynamicStoreSetDispatchQueue(prefsPrivate->session, NULL);
+               dispatch_release(prefsPrivate->dispatchQueue);
+               prefsPrivate->dispatchQueue = NULL;
+       } else
+#endif // !TARGET_OS_IPHONE
+       {
+               if (!_SC_unschedule(prefs, runLoop, runLoopMode, prefsPrivate->rlList, FALSE)) {
+                       // if not currently scheduled on this runLoop / runLoopMode
+                       _SCErrorSet(kSCStatusInvalidArgument);
+                       goto done;
+               }
 
 
-       n = CFArrayGetCount(prefsPrivate->rlList);
-       if (n == 0 || !_SC_isScheduled(NULL, runLoop, runLoopMode, prefsPrivate->rlList)) {
-               /*
-                * if we are no longer scheduled to receive notifications for
-                * this runLoop / runLoopMode
-                */
-               CFRunLoopRemoveSource(runLoop, prefsPrivate->rls, runLoopMode);
-
-               if (n == 0) {
-                       CFArrayRef      changedKeys;
-
+               n = CFArrayGetCount(prefsPrivate->rlList);
+               if (n == 0 || !_SC_isScheduled(NULL, runLoop, runLoopMode, prefsPrivate->rlList)) {
                        /*
                        /*
-                        * if *all* notifications have been unscheduled
+                        * if we are no longer scheduled to receive notifications for
+                        * this runLoop / runLoopMode
                         */
                         */
-                       CFRunLoopSourceInvalidate(prefsPrivate->rls);
-                       CFRelease(prefsPrivate->rls);
-                       prefsPrivate->rls = NULL;
-                       CFRelease(prefsPrivate->rlList);
-                       prefsPrivate->rlList = NULL;
+                       CFRunLoopRemoveSource(runLoop, prefsPrivate->rls, runLoopMode);
+
+                       if (n == 0) {
+                               // if *all* notifications have been unscheduled
+                               CFRelease(prefsPrivate->rlList);
+                               prefsPrivate->rlList = NULL;
+                               CFRunLoopSourceInvalidate(prefsPrivate->rls);
+                               CFRelease(prefsPrivate->rls);
+                               prefsPrivate->rls = NULL;
+                       }
+               }
+       }
 
 
-                       CFRelease(prefs);       // release our reference to the prefs
+       if (n == 0) {
+               CFArrayRef      changedKeys;
 
 
-                       // no need to track changes
-                       (void) SCDynamicStoreSetNotificationKeys(prefsPrivate->session, NULL, NULL);
+               // if *all* notifications have been unscheduled
+               prefsPrivate->scheduled = FALSE;
 
 
-                       // clear out any pending notifications
-                       changedKeys = SCDynamicStoreCopyNotifiedKeys(prefsPrivate->session);
-                       if (changedKeys != NULL) {
-                               CFRelease(changedKeys);
-                       }
+               // no need to track changes
+               (void) SCDynamicStoreSetNotificationKeys(prefsPrivate->session, NULL, NULL);
+
+               // clear out any pending notifications
+               changedKeys = SCDynamicStoreCopyNotifiedKeys(prefsPrivate->session);
+               if (changedKeys != NULL) {
+                       CFRelease(changedKeys);
                }
                }
+
+               // release our reference to the prefs
+               CFRelease(prefs);
        }
 
        ok = TRUE;
        }
 
        ok = TRUE;
@@ -847,6 +967,55 @@ SCPreferencesUnscheduleFromRunLoop(SCPreferencesRef     prefs,
        return ok;
 }
 
        return ok;
 }
 
+Boolean
+SCPreferencesScheduleWithRunLoop(SCPreferencesRef       prefs,
+                                CFRunLoopRef           runLoop,
+                                CFStringRef            runLoopMode)
+{
+       if (!isA_SCPreferences(prefs) || (runLoop == NULL) || (runLoopMode == NULL)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       return __SCPreferencesScheduleWithRunLoop(prefs, runLoop, runLoopMode, NULL);
+}
+
+Boolean
+SCPreferencesUnscheduleFromRunLoop(SCPreferencesRef     prefs,
+                                  CFRunLoopRef         runLoop,
+                                  CFStringRef          runLoopMode)
+{
+       if (!isA_SCPreferences(prefs) || (runLoop == NULL) || (runLoopMode == NULL)) {
+               _SCErrorSet(kSCStatusInvalidArgument);
+               return FALSE;
+       }
+
+       return __SCPreferencesUnscheduleFromRunLoop(prefs, runLoop, runLoopMode);
+}
+
+#if    !TARGET_OS_IPHONE
+Boolean
+SCPreferencesSetDispatchQueue(SCPreferencesRef prefs,
+                             dispatch_queue_t  queue)
+{
+       Boolean ok      = FALSE;
+
+       if (!isA_SCPreferences(prefs)) {
+               /* sorry, you must provide a session */
+               _SCErrorSet(kSCStatusNoPrefsSession);
+               return FALSE;
+       }
+
+       if (queue != NULL) {
+               ok = __SCPreferencesScheduleWithRunLoop(prefs, NULL, NULL, queue);
+       } else {
+               ok = __SCPreferencesUnscheduleFromRunLoop(prefs, NULL, NULL);
+       }
+
+       return ok;
+}
+#endif // !TARGET_OS_IPHONE
+
 
 static void
 __SCPreferencesSynchronize_helper(SCPreferencesRef prefs)
 
 static void
 __SCPreferencesSynchronize_helper(SCPreferencesRef prefs)
@@ -854,12 +1023,12 @@ __SCPreferencesSynchronize_helper(SCPreferencesRef prefs)
        Boolean                 ok;
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
        uint32_t                status          = kSCStatusOK;
        Boolean                 ok;
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
        uint32_t                status          = kSCStatusOK;
-       
+
        if (prefsPrivate->helper == -1) {
                // if no helper
                return;
        }
        if (prefsPrivate->helper == -1) {
                // if no helper
                return;
        }
-       
+
        // have the helper "synchronize" the prefs
        ok = _SCHelperExec(prefsPrivate->helper,
                           SCHELPER_MSG_PREFS_SYNCHRONIZE,
        // have the helper "synchronize" the prefs
        ok = _SCHelperExec(prefsPrivate->helper,
                           SCHELPER_MSG_PREFS_SYNCHRONIZE,
@@ -873,17 +1042,17 @@ __SCPreferencesSynchronize_helper(SCPreferencesRef prefs)
                        prefsPrivate->helper = -1;
                }
        }
                        prefsPrivate->helper = -1;
                }
        }
-       
+
        return;
 }
 
 
 void
        return;
 }
 
 
 void
-SCPreferencesSynchronize(SCPreferencesRef       prefs)
+SCPreferencesSynchronize(SCPreferencesRef prefs)
 {
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
 
 {
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
 
-       if (prefs == NULL) {
+       if (!isA_SCPreferences(prefs)) {
                /* sorry, you must provide a session */
                _SCErrorSet(kSCStatusNoPrefsSession);
                return;
                /* sorry, you must provide a session */
                _SCErrorSet(kSCStatusNoPrefsSession);
                return;
@@ -892,7 +1061,6 @@ SCPreferencesSynchronize(SCPreferencesRef       prefs)
        if (prefsPrivate->authorizationData != NULL) {
                __SCPreferencesSynchronize_helper(prefs);
        }
        if (prefsPrivate->authorizationData != NULL) {
                __SCPreferencesSynchronize_helper(prefs);
        }
-
        if (prefsPrivate->prefs != NULL) {
                CFRelease(prefsPrivate->prefs);
                prefsPrivate->prefs = NULL;
        if (prefsPrivate->prefs != NULL) {
                CFRelease(prefsPrivate->prefs);
                prefsPrivate->prefs = NULL;
@@ -903,5 +1071,6 @@ SCPreferencesSynchronize(SCPreferencesRef       prefs)
        }
        prefsPrivate->accessed = FALSE;
        prefsPrivate->changed  = FALSE;
        }
        prefsPrivate->accessed = FALSE;
        prefsPrivate->changed  = FALSE;
+
        return;
 }
        return;
 }
index 5711b843959f638f67d727f3332e600c7bf967f8..c3d5b5f6f4be2407cc74f83c8474d0cfcb9cfc5f 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2006, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -142,6 +142,7 @@ getPath(SCPreferencesRef prefs, CFStringRef path, CFDictionaryRef *entity)
                        }
 
                        newElements = CFArrayCreateMutableCopy(NULL, 0, linkElements);
                        }
 
                        newElements = CFArrayCreateMutableCopy(NULL, 0, linkElements);
+                       CFRelease(linkElements);
                        CFArrayAppendArray(newElements,
                                           elements,
                                           CFRangeMake(i + 1, nElements-i - 1));
                        CFArrayAppendArray(newElements,
                                           elements,
                                           CFRangeMake(i + 1, nElements-i - 1));
@@ -267,6 +268,7 @@ setPath(SCPreferencesRef prefs, CFStringRef path, CFDictionaryRef entity)
                        }
 
                        newElements = CFArrayCreateMutableCopy(NULL, 0, linkElements);
                        }
 
                        newElements = CFArrayCreateMutableCopy(NULL, 0, linkElements);
+                       CFRelease(linkElements);
                        CFArrayAppendArray(newElements,
                                           elements,
                                           CFRangeMake(i + 1, nElements-i - 1));
                        CFArrayAppendArray(newElements,
                                           elements,
                                           CFRangeMake(i + 1, nElements-i - 1));
index 80c47c8d8ec54958e925f869e90e0220517ce7ac..2419fb80daa0f68c46affd37609cd223d90287d6 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2004-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -87,9 +87,41 @@ __SCPreferencesUnlock_helper(SCPreferencesRef prefs)
 }
 
 
 }
 
 
+static void
+reportDelay(SCPreferencesRef prefs, struct timeval *delay)
+{
+       aslmsg                  m;
+       SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+       char                    str[256];
+
+       m = asl_new(ASL_TYPE_MSG);
+       asl_set(m, "com.apple.message.domain", "com.apple.SystemConfiguration.SCPreferencesUnlock");
+       (void) _SC_cfstring_to_cstring(prefsPrivate->name, str, sizeof(str), kCFStringEncodingUTF8);
+       asl_set(m, "com.apple.message.signature", str);
+       (void) _SC_cfstring_to_cstring(prefsPrivate->prefsID, str, sizeof(str), kCFStringEncodingUTF8);
+       asl_set(m, "com.apple.message.signature2", str);
+       (void) snprintf(str, sizeof(str),
+                       "%d.%3.3d",
+                       (int)delay->tv_sec,
+                       delay->tv_usec / 1000);
+       asl_set(m, "com.apple.message.value", str);
+       SCLOG(NULL, m, ASL_LEVEL_DEBUG,
+             CFSTR("SCPreferences(%@:%@) lock held for %d.%3.3d seconds"),
+             prefsPrivate->name,
+             prefsPrivate->prefsID,
+             (int)delay->tv_sec,
+             delay->tv_usec / 1000);
+       asl_free(m);
+
+       return;
+}
+
+
 Boolean
 SCPreferencesUnlock(SCPreferencesRef prefs)
 {
 Boolean
 SCPreferencesUnlock(SCPreferencesRef prefs)
 {
+       struct timeval          lockElapsed;
+       struct timeval          lockEnd;
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
 
        if (prefs == NULL) {
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
 
        if (prefs == NULL) {
@@ -118,6 +150,13 @@ SCPreferencesUnlock(SCPreferencesRef prefs)
                prefsPrivate->lockFD = -1;
        }
 
                prefsPrivate->lockFD = -1;
        }
 
+       (void)gettimeofday(&lockEnd, NULL);
+       timersub(&lockEnd, &prefsPrivate->lockTime, &lockElapsed);
+       if (lockElapsed.tv_sec > 0) {
+               // if we held the lock for more than 1 second
+               reportDelay(prefs, &lockElapsed);
+       }
+
        prefsPrivate->locked = FALSE;
 
        pthread_mutex_unlock(&prefsPrivate->lock);
        prefsPrivate->locked = FALSE;
 
        pthread_mutex_unlock(&prefsPrivate->lock);
index 20bf2df291633b483eefb24b607a32fa0e98ba93..f05a427e33e0a02bfb4088c378dbfdff9232a4df 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005, 2007-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  */
 
 #ifndef _SCPREFERENCES_H
  */
 
 #ifndef _SCPREFERENCES_H
+#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS
+#include <SystemConfiguration/_SCPreferences.h>
+#else  /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
 #define _SCPREFERENCES_H
 
 #define _SCPREFERENCES_H
 
-#include <AvailabilityMacros.h>
+#include <Availability.h>
+#include <TargetConditionals.h>
 #include <sys/cdefs.h>
 #include <sys/cdefs.h>
+#if    !TARGET_OS_IPHONE
+#include <dispatch/dispatch.h>
+#endif // !TARGET_OS_IPHONE
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCDynamicStore.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCDynamicStore.h>
+
+#if    !TARGET_OS_IPHONE
 #include <Security/Security.h>
 #include <Security/Security.h>
+#else  // !TARGET_OS_IPHONE
+typedef const struct AuthorizationOpaqueRef *  AuthorizationRef;
+#endif // !TARGET_OS_IPHONE
+
 
 /*!
        @header SCPreferences
 
 /*!
        @header SCPreferences
@@ -62,8 +75,6 @@
  */
 typedef const struct __SCPreferences * SCPreferencesRef;
 
  */
 typedef const struct __SCPreferences * SCPreferencesRef;
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-
 /*!
        @enum SCPreferencesNotification
        @discussion Used with the SCPreferencesCallBack callback
 /*!
        @enum SCPreferencesNotification
        @discussion Used with the SCPreferencesCallBack callback
@@ -74,10 +85,13 @@ typedef const struct __SCPreferences *      SCPreferencesRef;
                request has been made to apply the currently saved
                preferences to the active system configuration.
  */
                request has been made to apply the currently saved
                preferences to the active system configuration.
  */
+#if    (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
 enum {
        kSCPreferencesNotificationCommit        = 1<<0,
        kSCPreferencesNotificationApply         = 1<<1
 };
 enum {
        kSCPreferencesNotificationCommit        = 1<<0,
        kSCPreferencesNotificationApply         = 1<<1
 };
+#endif (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
+
 typedef        uint32_t        SCPreferencesNotification;
 
 /*!
 typedef        uint32_t        SCPreferencesNotification;
 
 /*!
@@ -122,8 +136,6 @@ typedef void (*SCPreferencesCallBack)   (
                                        void                            *info
                                        );
 
                                        void                            *info
                                        );
 
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */
-
 
 __BEGIN_DECLS
 
 
 __BEGIN_DECLS
 
@@ -132,7 +144,7 @@ __BEGIN_DECLS
        @discussion Returns the type identifier of all SCPreferences instances.
  */
 CFTypeID
        @discussion Returns the type identifier of all SCPreferences instances.
  */
 CFTypeID
-SCPreferencesGetTypeID         (void);
+SCPreferencesGetTypeID                 (void)                  __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCPreferencesCreate
 
 /*!
        @function SCPreferencesCreate
@@ -152,13 +164,12 @@ SCPreferencesGetTypeID            (void);
                You must release the returned value.
  */
 SCPreferencesRef
                You must release the returned value.
  */
 SCPreferencesRef
-SCPreferencesCreate            (
-                               CFAllocatorRef          allocator,
-                               CFStringRef             name,
-                               CFStringRef             prefsID
-                               );
+SCPreferencesCreate                    (
+                                       CFAllocatorRef          allocator,
+                                       CFStringRef             name,
+                                       CFStringRef             prefsID
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
 
 /*!
        @function SCPreferencesCreateWithAuthorization
 
 /*!
        @function SCPreferencesCreateWithAuthorization
@@ -186,9 +197,7 @@ SCPreferencesCreateWithAuthorization        (
                                        CFStringRef             name,
                                        CFStringRef             prefsID,
                                        AuthorizationRef        authorization
                                        CFStringRef             name,
                                        CFStringRef             prefsID,
                                        AuthorizationRef        authorization
-                                       )                               AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
-
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCPreferencesLock
 
 /*!
        @function SCPreferencesLock
@@ -206,10 +215,10 @@ SCPreferencesCreateWithAuthorization      (
                FALSE if an error occurred.
  */
 Boolean
                FALSE if an error occurred.
  */
 Boolean
-SCPreferencesLock              (
-                               SCPreferencesRef        prefs,
-                               Boolean                 wait
-                               );
+SCPreferencesLock                      (
+                                       SCPreferencesRef        prefs,
+                                       Boolean                 wait
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCPreferencesCommitChanges
 
 /*!
        @function SCPreferencesCommitChanges
@@ -229,9 +238,9 @@ SCPreferencesLock           (
                FALSE if an error occurred.
  */
 Boolean
                FALSE if an error occurred.
  */
 Boolean
-SCPreferencesCommitChanges     (
-                               SCPreferencesRef        prefs
-                               );
+SCPreferencesCommitChanges             (
+                                       SCPreferencesRef        prefs
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCPreferencesApplyChanges
 
 /*!
        @function SCPreferencesApplyChanges
@@ -242,9 +251,9 @@ SCPreferencesCommitChanges  (
                FALSE if an error occurred.
  */
 Boolean
                FALSE if an error occurred.
  */
 Boolean
-SCPreferencesApplyChanges      (
-                               SCPreferencesRef        prefs
-                               );
+SCPreferencesApplyChanges              (
+                                       SCPreferencesRef        prefs
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCPreferencesUnlock
 
 /*!
        @function SCPreferencesUnlock
@@ -258,9 +267,9 @@ SCPreferencesApplyChanges   (
                FALSE if an error occurred.
  */
 Boolean
                FALSE if an error occurred.
  */
 Boolean
-SCPreferencesUnlock            (
-                               SCPreferencesRef        prefs
-                               );
+SCPreferencesUnlock                    (
+                                       SCPreferencesRef        prefs
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCPreferencesGetSignature
 
 /*!
        @function SCPreferencesGetSignature
@@ -271,9 +280,9 @@ SCPreferencesUnlock         (
                preferences at the time of the call to the SCPreferencesCreate function.
  */
 CFDataRef
                preferences at the time of the call to the SCPreferencesCreate function.
  */
 CFDataRef
-SCPreferencesGetSignature      (
-                               SCPreferencesRef        prefs
-                               );
+SCPreferencesGetSignature              (
+                                       SCPreferencesRef        prefs
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCPreferencesCopyKeyList
 
 /*!
        @function SCPreferencesCopyKeyList
@@ -283,9 +292,9 @@ SCPreferencesGetSignature   (
                You must release the returned value.
  */
 CFArrayRef
                You must release the returned value.
  */
 CFArrayRef
-SCPreferencesCopyKeyList       (
-                               SCPreferencesRef        prefs
-                               );
+SCPreferencesCopyKeyList               (
+                                       SCPreferencesRef        prefs
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCPreferencesGetValue
 
 /*!
        @function SCPreferencesGetValue
@@ -302,10 +311,10 @@ SCPreferencesCopyKeyList  (
                NULL if no value was located.
  */
 CFPropertyListRef
                NULL if no value was located.
  */
 CFPropertyListRef
-SCPreferencesGetValue          (
-                               SCPreferencesRef        prefs,
-                               CFStringRef             key
-                               );
+SCPreferencesGetValue                  (
+                                       SCPreferencesRef        prefs,
+                                       CFStringRef             key
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCPreferencesAddValue
 
 /*!
        @function SCPreferencesAddValue
@@ -323,11 +332,11 @@ SCPreferencesGetValue             (
                if an error occurred.
  */
 Boolean
                if an error occurred.
  */
 Boolean
-SCPreferencesAddValue          (
-                               SCPreferencesRef        prefs,
-                               CFStringRef             key,
-                               CFPropertyListRef       value
-                               );
+SCPreferencesAddValue                  (
+                                       SCPreferencesRef        prefs,
+                                       CFStringRef             key,
+                                       CFPropertyListRef       value
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCPreferencesSetValue
 
 /*!
        @function SCPreferencesSetValue
@@ -344,11 +353,11 @@ SCPreferencesAddValue             (
                FALSE if an error occurred.
  */
 Boolean
                FALSE if an error occurred.
  */
 Boolean
-SCPreferencesSetValue          (
-                               SCPreferencesRef        prefs,
-                               CFStringRef             key,
-                               CFPropertyListRef       value
-                               );
+SCPreferencesSetValue                  (
+                                       SCPreferencesRef        prefs,
+                                       CFStringRef             key,
+                                       CFPropertyListRef       value
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCPreferencesRemoveValue
 
 /*!
        @function SCPreferencesRemoveValue
@@ -363,12 +372,10 @@ SCPreferencesSetValue             (
                FALSE if the key did not exist or if an error occurred.
  */
 Boolean
                FALSE if the key did not exist or if an error occurred.
  */
 Boolean
-SCPreferencesRemoveValue       (
-                               SCPreferencesRef        prefs,
-                               CFStringRef             key
-                               );
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
+SCPreferencesRemoveValue               (
+                                       SCPreferencesRef        prefs,
+                                       CFStringRef             key
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCPreferencesSetCallback
 
 /*!
        @function SCPreferencesSetCallback
@@ -388,7 +395,7 @@ SCPreferencesSetCallback            (
                                        SCPreferencesRef        prefs,
                                        SCPreferencesCallBack   callout,
                                        SCPreferencesContext    *context
                                        SCPreferencesRef        prefs,
                                        SCPreferencesCallBack   callout,
                                        SCPreferencesContext    *context
-                                       )                               AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCPreferencesScheduleWithRunLoop
 
 /*!
        @function SCPreferencesScheduleWithRunLoop
@@ -408,7 +415,7 @@ SCPreferencesScheduleWithRunLoop    (
                                        SCPreferencesRef        prefs,
                                        CFRunLoopRef            runLoop,
                                        CFStringRef             runLoopMode
                                        SCPreferencesRef        prefs,
                                        CFRunLoopRef            runLoop,
                                        CFStringRef             runLoopMode
-                                       )                               AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCPreferencesUnscheduleFromRunLoop
 
 /*!
        @function SCPreferencesUnscheduleFromRunLoop
@@ -428,7 +435,24 @@ SCPreferencesUnscheduleFromRunLoop (
                                        SCPreferencesRef        prefs,
                                        CFRunLoopRef            runLoop,
                                        CFStringRef             runLoopMode
                                        SCPreferencesRef        prefs,
                                        CFRunLoopRef            runLoop,
                                        CFStringRef             runLoopMode
-                                       )                               AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
+
+#if    !TARGET_OS_IPHONE
+/*!
+       @function SCPreferencesSetDispatchQueue
+       @discussion Schedule commit and apply notifications for the specified
+               preferences session.
+       @param prefs The preferences session.
+       @param queue The dispatch queue to run the callback function on.
+       @result Returns TRUE if the notifications are successfully scheduled;
+               FALSE otherwise.
+ */
+Boolean
+SCPreferencesSetDispatchQueue          (
+                                        SCPreferencesRef       prefs,
+                                        dispatch_queue_t       queue
+                                        )                      __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA);
+#endif // !TARGET_OS_IPHONE
 
 /*!
        @function SCPreferencesSynchronize
 
 /*!
        @function SCPreferencesSynchronize
@@ -444,10 +468,9 @@ SCPreferencesUnscheduleFromRunLoop (
 void
 SCPreferencesSynchronize               (
                                        SCPreferencesRef        prefs
 void
 SCPreferencesSynchronize               (
                                        SCPreferencesRef        prefs
-                                       )                               AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
-
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/);
 
 __END_DECLS
 
 
 __END_DECLS
 
+#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
 #endif /* _SCPREFERENCES_H */
 #endif /* _SCPREFERENCES_H */
index fb95d008c6703d3ac76bd70fb97748310f3d6f2e..b86c07b97877efca0427757450ccc1a577380e7f 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2003-2005, 2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2007-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -31,6 +31,9 @@
 #include <CoreFoundation/CFRuntime.h>
 #include <SystemConfiguration/SCPreferences.h>
 #include <SystemConfiguration/SCDynamicStore.h>
 #include <CoreFoundation/CFRuntime.h>
 #include <SystemConfiguration/SCPreferences.h>
 #include <SystemConfiguration/SCDynamicStore.h>
+#if    !TARGET_OS_IPHONE
+#include <dispatch/dispatch.h>
+#endif // !TARGET_OS_IPHONE
 
 
 #define        PREFS_DEFAULT_DIR               CFSTR("/Library/Preferences/SystemConfiguration")
 
 
 #define        PREFS_DEFAULT_DIR               CFSTR("/Library/Preferences/SystemConfiguration")
@@ -65,6 +68,7 @@ typedef struct {
        Boolean                 locked;
        int                     lockFD;
        char                    *lockPath;
        Boolean                 locked;
        int                     lockFD;
        char                    *lockPath;
+       struct timeval          lockTime;
 
        /* configuration file signature */
        CFDataRef               signature;
 
        /* configuration file signature */
        CFDataRef               signature;
@@ -77,10 +81,14 @@ typedef struct {
        CFStringRef             sessionKeyApply;
 
        /* run loop source, callout, context, rl scheduling info */
        CFStringRef             sessionKeyApply;
 
        /* run loop source, callout, context, rl scheduling info */
+       Boolean                 scheduled;
        CFRunLoopSourceRef      rls;
        SCPreferencesCallBack   rlsFunction;
        SCPreferencesContext    rlsContext;
        CFMutableArrayRef       rlList;
        CFRunLoopSourceRef      rls;
        SCPreferencesCallBack   rlsFunction;
        SCPreferencesContext    rlsContext;
        CFMutableArrayRef       rlList;
+#if    !TARGET_OS_IPHONE
+       dispatch_queue_t        dispatchQueue;          // SCPreferencesSetDispatchQueue
+#endif // !TARGET_OS_IPHONE
 
        /* preferences */
        CFMutableDictionaryRef  prefs;
 
        /* preferences */
        CFMutableDictionaryRef  prefs;
@@ -99,10 +107,11 @@ typedef struct {
 
 /* Define signature data */
 typedef struct {
 
 /* Define signature data */
 typedef struct {
-       dev_t                   st_dev;         /* inode's device */
-       ino_t                   st_ino;         /* inode's number */
-       struct  timespec        st_mtimespec;   /* time of last data modification */
-       off_t                   st_size;        /* file size, in bytes */
+       int64_t         st_dev;         /* inode's device */
+       uint64_t        st_ino;         /* inode's number */
+       uint64_t        tv_sec;         /* time of last data modification */
+       uint64_t        tv_nsec;
+       off_t           st_size;        /* file size, in bytes */
 } SCPSignatureData, *SCPSignatureDataRef;
 
 
 } SCPSignatureData, *SCPSignatureDataRef;
 
 
index afdce8807637dcdb4ee6175bd725301d748febfe..c154f8d18ead657c05dacddc4eb41ecc312890db 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2006, 2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  * - created (for EAP)
  */
 
  * - created (for EAP)
  */
 
+#include <Availability.h>
+#include <TargetConditionals.h>
 #include <sys/param.h>
 #include <sys/param.h>
-
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFBundlePriv.h>       // for _CFBundleCopyMainBundleExecutableURL
 #include <SystemConfiguration/SCPrivate.h>     // for _SCErrorSet
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CFBundlePriv.h>       // for _CFBundleCopyMainBundleExecutableURL
 #include <SystemConfiguration/SCPrivate.h>     // for _SCErrorSet
-#include <Security/Security.h>
 #include "dy_framework.h"
 
 #include "SCPreferencesInternal.h"
 
 
 #include "dy_framework.h"
 
 #include "SCPreferencesInternal.h"
 
 
+#if    !TARGET_OS_IPHONE
 static CFDataRef
 copyMyExecutablePath(void)
 {
 static CFDataRef
 copyMyExecutablePath(void)
 {
@@ -265,11 +266,13 @@ _SCSecAccessCreateForExecutables(CFStringRef      label,
 
        return  access;
 }
 
        return  access;
 }
+#endif // !TARGET_OS_IPHONE
 
 
 SecKeychainRef
 _SCSecKeychainCopySystemKeychain(void)
 {
 
 
 SecKeychainRef
 _SCSecKeychainCopySystemKeychain(void)
 {
+#if    !TARGET_OS_IPHONE
        SecPreferencesDomain    domain;
        SecKeychainRef          keychain        = NULL;
        OSStatus                status;
        SecPreferencesDomain    domain;
        SecKeychainRef          keychain        = NULL;
        OSStatus                status;
@@ -302,9 +305,14 @@ _SCSecKeychainCopySystemKeychain(void)
        }
 
        return keychain;
        }
 
        return keychain;
+#else  // !TARGET_OS_IPHONE
+       _SCErrorSet(kSCStatusAccessError);
+       return NULL;
+#endif // !TARGET_OS_IPHONE
 }
 
 
 }
 
 
+#if    !TARGET_OS_IPHONE
 static OSStatus
 findKeychainItem(SecKeychainRef                keychain,
                 UInt32                 serviceNameLength,
 static OSStatus
 findKeychainItem(SecKeychainRef                keychain,
                 UInt32                 serviceNameLength,
@@ -333,12 +341,14 @@ findKeychainItem(SecKeychainRef           keychain,
 
        return status;
 }
 
        return status;
 }
+#endif // !TARGET_OS_IPHONE
 
 
 CFDataRef
 _SCSecKeychainPasswordItemCopy(SecKeychainRef  keychain,
                               CFStringRef      unique_id)
 {
 
 
 CFDataRef
 _SCSecKeychainPasswordItemCopy(SecKeychainRef  keychain,
                               CFStringRef      unique_id)
 {
+#if    !TARGET_OS_IPHONE
        SecKeychainItemRef      item                    = NULL;
        CFDataRef               keychain_password       = NULL;
        const char              *keychain_serviceName;
        SecKeychainItemRef      item                    = NULL;
        CFDataRef               keychain_password       = NULL;
        const char              *keychain_serviceName;
@@ -366,12 +376,17 @@ _SCSecKeychainPasswordItemCopy(SecKeychainRef     keychain,
        }
 
        return keychain_password;
        }
 
        return keychain_password;
+#else  // !TARGET_OS_IPHONE
+       _SCErrorSet(kSCStatusAccessError);
+       return NULL;
+#endif // !TARGET_OS_IPHONE
 }
 
 
 Boolean
 _SCSecKeychainPasswordItemExists(SecKeychainRef keychain, CFStringRef unique_id)
 {
 }
 
 
 Boolean
 _SCSecKeychainPasswordItemExists(SecKeychainRef keychain, CFStringRef unique_id)
 {
+#if    !TARGET_OS_IPHONE
        SecKeychainItemRef      item;
        const char              *keychain_serviceName;
        OSStatus                status;
        SecKeychainItemRef      item;
        const char              *keychain_serviceName;
        OSStatus                status;
@@ -389,12 +404,17 @@ _SCSecKeychainPasswordItemExists(SecKeychainRef keychain, CFStringRef unique_id)
 
        CFRelease(item);
        return TRUE;
 
        CFRelease(item);
        return TRUE;
+#else  // !TARGET_OS_IPHONE
+       _SCErrorSet(kSCStatusAccessError);
+       return FALSE;
+#endif // !TARGET_OS_IPHONE
 }
 
 
 Boolean
 _SCSecKeychainPasswordItemRemove(SecKeychainRef keychain, CFStringRef unique_id)
 {
 }
 
 
 Boolean
 _SCSecKeychainPasswordItemRemove(SecKeychainRef keychain, CFStringRef unique_id)
 {
+#if    !TARGET_OS_IPHONE
        SecKeychainItemRef      item;
        const char              *keychain_serviceName;
        OSStatus                status;
        SecKeychainItemRef      item;
        const char              *keychain_serviceName;
        OSStatus                status;
@@ -418,6 +438,10 @@ _SCSecKeychainPasswordItemRemove(SecKeychainRef keychain, CFStringRef unique_id)
        }
 
        return TRUE;
        }
 
        return TRUE;
+#else  // !TARGET_OS_IPHONE
+       _SCErrorSet(kSCStatusAccessError);
+       return FALSE;
+#endif // !TARGET_OS_IPHONE
 }
 
 
 }
 
 
@@ -430,6 +454,7 @@ _SCSecKeychainPasswordItemSet(SecKeychainRef        keychain,
                              CFDataRef         password,
                              CFDictionaryRef   options)
 {
                              CFDataRef         password,
                              CFDictionaryRef   options)
 {
+#if    !TARGET_OS_IPHONE
        SecAccessRef                    access                  = NULL;
        CFBooleanRef                    allowRoot               = NULL;
        CFArrayRef                      allowedExecutables      = NULL;
        SecAccessRef                    access                  = NULL;
        CFBooleanRef                    allowRoot               = NULL;
        CFArrayRef                      allowedExecutables      = NULL;
@@ -569,6 +594,10 @@ _SCSecKeychainPasswordItemSet(SecKeychainRef       keychain,
        }
 
        return TRUE;
        }
 
        return TRUE;
+#else  // !TARGET_OS_IPHONE
+       _SCErrorSet(kSCStatusAccessError);
+       return FALSE;
+#endif // !TARGET_OS_IPHONE
 }
 
 
 }
 
 
@@ -583,6 +612,7 @@ _SCSecKeychainPasswordItemSet(SecKeychainRef        keychain,
 #include <sys/errno.h>
 
 
 #include <sys/errno.h>
 
 
+#if    !TARGET_OS_IPHONE
 static CFDataRef
 __SCPreferencesSystemKeychainPasswordItemCopy_helper(SCPreferencesRef  prefs,
                                                     CFStringRef        unique_id)
 static CFDataRef
 __SCPreferencesSystemKeychainPasswordItemCopy_helper(SCPreferencesRef  prefs,
                                                     CFStringRef        unique_id)
@@ -639,12 +669,14 @@ __SCPreferencesSystemKeychainPasswordItemCopy_helper(SCPreferencesRef     prefs,
        _SCErrorSet(status);
        return NULL;
 }
        _SCErrorSet(status);
        return NULL;
 }
+#endif // !TARGET_OS_IPHONE
 
 
 CFDataRef
 _SCPreferencesSystemKeychainPasswordItemCopy(SCPreferencesRef  prefs,
                                             CFStringRef        unique_id)
 {
 
 
 CFDataRef
 _SCPreferencesSystemKeychainPasswordItemCopy(SCPreferencesRef  prefs,
                                             CFStringRef        unique_id)
 {
+#if    !TARGET_OS_IPHONE
        SecKeychainRef          keychain        = NULL;
        CFDataRef               password        = NULL;
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
        SecKeychainRef          keychain        = NULL;
        CFDataRef               password        = NULL;
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
@@ -652,12 +684,12 @@ _SCPreferencesSystemKeychainPasswordItemCopy(SCPreferencesRef     prefs,
        if (prefs == NULL) {
                /* sorry, you must provide a session */
                _SCErrorSet(kSCStatusNoPrefsSession);
        if (prefs == NULL) {
                /* sorry, you must provide a session */
                _SCErrorSet(kSCStatusNoPrefsSession);
-               return FALSE;
+               return NULL;
        }
 
        if (!isA_CFString(unique_id)) {
                _SCErrorSet(kSCStatusInvalidArgument);
        }
 
        if (!isA_CFString(unique_id)) {
                _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
+               return NULL;
        }
 
        if (prefsPrivate->authorizationData != NULL) {
        }
 
        if (prefsPrivate->authorizationData != NULL) {
@@ -676,6 +708,10 @@ _SCPreferencesSystemKeychainPasswordItemCopy(SCPreferencesRef      prefs,
 
        if (keychain != NULL)   CFRelease(keychain);
        return password;
 
        if (keychain != NULL)   CFRelease(keychain);
        return password;
+#else  // !TARGET_OS_IPHONE
+       _SCErrorSet(kSCStatusAccessError);
+       return NULL;
+#endif // !TARGET_OS_IPHONE
 }
 
 
 }
 
 
@@ -683,6 +719,7 @@ Boolean
 _SCPreferencesSystemKeychainPasswordItemExists(SCPreferencesRef        prefs,
                                               CFStringRef      unique_id)
 {
 _SCPreferencesSystemKeychainPasswordItemExists(SCPreferencesRef        prefs,
                                               CFStringRef      unique_id)
 {
+#if    !TARGET_OS_IPHONE
        SecKeychainRef          keychain        = NULL;
        Boolean                 ok              = FALSE;
 //     SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
        SecKeychainRef          keychain        = NULL;
        Boolean                 ok              = FALSE;
 //     SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
@@ -714,9 +751,14 @@ _SCPreferencesSystemKeychainPasswordItemExists(SCPreferencesRef    prefs,
 
        if (keychain != NULL)   CFRelease(keychain);
        return ok;
 
        if (keychain != NULL)   CFRelease(keychain);
        return ok;
+#else  // !TARGET_OS_IPHONE
+       _SCErrorSet(kSCStatusAccessError);
+       return FALSE;
+#endif // !TARGET_OS_IPHONE
 }
 
 
 }
 
 
+#if    !TARGET_OS_IPHONE
 static Boolean
 __SCPreferencesSystemKeychainPasswordItemRemove_helper(SCPreferencesRef        prefs,
                                                       CFStringRef      unique_id)
 static Boolean
 __SCPreferencesSystemKeychainPasswordItemRemove_helper(SCPreferencesRef        prefs,
                                                       CFStringRef      unique_id)
@@ -773,12 +815,14 @@ __SCPreferencesSystemKeychainPasswordItemRemove_helper(SCPreferencesRef   prefs,
        _SCErrorSet(status);
        return FALSE;
 }
        _SCErrorSet(status);
        return FALSE;
 }
+#endif // !TARGET_OS_IPHONE
 
 
 Boolean
 _SCPreferencesSystemKeychainPasswordItemRemove(SCPreferencesRef        prefs,
                                               CFStringRef      unique_id)
 {
 
 
 Boolean
 _SCPreferencesSystemKeychainPasswordItemRemove(SCPreferencesRef        prefs,
                                               CFStringRef      unique_id)
 {
+#if    !TARGET_OS_IPHONE
        SecKeychainRef          keychain        = NULL;
        Boolean                 ok              = FALSE;
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
        SecKeychainRef          keychain        = NULL;
        Boolean                 ok              = FALSE;
        SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
@@ -810,9 +854,14 @@ _SCPreferencesSystemKeychainPasswordItemRemove(SCPreferencesRef    prefs,
 
        if (keychain != NULL)   CFRelease(keychain);
        return ok;
 
        if (keychain != NULL)   CFRelease(keychain);
        return ok;
+#else  // !TARGET_OS_IPHONE
+       _SCErrorSet(kSCStatusAccessError);
+       return FALSE;
+#endif // !TARGET_OS_IPHONE
 }
 
 
 }
 
 
+#if    !TARGET_OS_IPHONE
 static Boolean
 __SCPreferencesSystemKeychainPasswordItemSet_helper(SCPreferencesRef   prefs,
                                                    CFStringRef         unique_id,
 static Boolean
 __SCPreferencesSystemKeychainPasswordItemSet_helper(SCPreferencesRef   prefs,
                                                    CFStringRef         unique_id,
@@ -948,6 +997,7 @@ __SCPreferencesSystemKeychainPasswordItemSet_helper(SCPreferencesRef        prefs,
        _SCErrorSet(status);
        return FALSE;
 }
        _SCErrorSet(status);
        return FALSE;
 }
+#endif // !TARGET_OS_IPHONE
 
 
 Boolean
 
 
 Boolean
@@ -959,6 +1009,7 @@ _SCPreferencesSystemKeychainPasswordItemSet(SCPreferencesRef       prefs,
                                            CFDataRef           password,
                                            CFDictionaryRef     options)
 {
                                            CFDataRef           password,
                                            CFDictionaryRef     options)
 {
+#if    !TARGET_OS_IPHONE
        SecKeychainRef          keychain                = NULL;
        Boolean                 ok                      = FALSE;
        SCPreferencesPrivateRef prefsPrivate            = (SCPreferencesPrivateRef)prefs;
        SecKeychainRef          keychain                = NULL;
        Boolean                 ok                      = FALSE;
        SCPreferencesPrivateRef prefsPrivate            = (SCPreferencesPrivateRef)prefs;
@@ -1007,4 +1058,8 @@ _SCPreferencesSystemKeychainPasswordItemSet(SCPreferencesRef      prefs,
 
        if (keychain != NULL)   CFRelease(keychain);
        return ok;
 
        if (keychain != NULL)   CFRelease(keychain);
        return ok;
+#else  // !TARGET_OS_IPHONE
+       _SCErrorSet(kSCStatusAccessError);
+       return FALSE;
+#endif // !TARGET_OS_IPHONE
 }
 }
index 76c574b334a961761eab7320bf6df150ad0777a4..c45f48ba8ac41f84ab50b469e6dc9fe800ce9dc2 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2006, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  * - routines to deal with keychain passwords
  */
 
  * - routines to deal with keychain passwords
  */
 
+#include <Availability.h>
+#include <TargetConditionals.h>
+#include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCPreferences.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCPreferences.h>
+#if    !TARGET_OS_IPHONE
 #include <Security/Security.h>
 #include <Security/Security.h>
-
-#include <AvailabilityMacros.h>
-#include <sys/cdefs.h>
+#else  // !TARGET_OS_IPHONE
+typedef struct OpaqueSecKeychainRef *SecKeychainRef;
+#endif // !TARGET_OS_IPHONE
 
 #pragma mark -
 #pragma mark Keychain helper APIs
 
 #pragma mark -
 #pragma mark Keychain helper APIs
 __BEGIN_DECLS
 
 SecKeychainRef
 __BEGIN_DECLS
 
 SecKeychainRef
-_SCSecKeychainCopySystemKeychain               (void);
+_SCSecKeychainCopySystemKeychain               (void)                                  __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 CFDataRef
 _SCSecKeychainPasswordItemCopy                 (SecKeychainRef         keychain,
 
 CFDataRef
 _SCSecKeychainPasswordItemCopy                 (SecKeychainRef         keychain,
-                                                CFStringRef            unique_id);
+                                                CFStringRef            unique_id)      __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 Boolean
 _SCSecKeychainPasswordItemExists               (SecKeychainRef         keychain,
 
 Boolean
 _SCSecKeychainPasswordItemExists               (SecKeychainRef         keychain,
-                                                CFStringRef            unique_id);
+                                                CFStringRef            unique_id)      __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 Boolean
 _SCSecKeychainPasswordItemRemove               (SecKeychainRef         keychain,
 
 Boolean
 _SCSecKeychainPasswordItemRemove               (SecKeychainRef         keychain,
-                                                CFStringRef            unique_id);
+                                                CFStringRef            unique_id)      __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 Boolean
 _SCSecKeychainPasswordItemSet                  (SecKeychainRef         keychain,
 
 Boolean
 _SCSecKeychainPasswordItemSet                  (SecKeychainRef         keychain,
@@ -66,7 +70,7 @@ _SCSecKeychainPasswordItemSet                 (SecKeychainRef         keychain,
                                                 CFStringRef            description,
                                                 CFStringRef            account,
                                                 CFDataRef              password,
                                                 CFStringRef            description,
                                                 CFStringRef            account,
                                                 CFDataRef              password,
-                                                CFDictionaryRef        options);
+                                                CFDictionaryRef        options)        __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 
 #pragma mark -
 
 
 #pragma mark -
@@ -75,15 +79,15 @@ _SCSecKeychainPasswordItemSet                       (SecKeychainRef         keychain,
 
 CFDataRef
 _SCPreferencesSystemKeychainPasswordItemCopy   (SCPreferencesRef       prefs,
 
 CFDataRef
 _SCPreferencesSystemKeychainPasswordItemCopy   (SCPreferencesRef       prefs,
-                                                CFStringRef            unique_id);
+                                                CFStringRef            unique_id)      __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 Boolean
 _SCPreferencesSystemKeychainPasswordItemExists (SCPreferencesRef       prefs,
 
 Boolean
 _SCPreferencesSystemKeychainPasswordItemExists (SCPreferencesRef       prefs,
-                                                CFStringRef            unique_id);
+                                                CFStringRef            unique_id)      __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 Boolean
 _SCPreferencesSystemKeychainPasswordItemRemove (SCPreferencesRef       prefs,
 
 Boolean
 _SCPreferencesSystemKeychainPasswordItemRemove (SCPreferencesRef       prefs,
-                                                CFStringRef            unique_id);
+                                                CFStringRef            unique_id)      __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 Boolean
 _SCPreferencesSystemKeychainPasswordItemSet    (SCPreferencesRef       prefs,
 
 Boolean
 _SCPreferencesSystemKeychainPasswordItemSet    (SCPreferencesRef       prefs,
@@ -92,7 +96,7 @@ _SCPreferencesSystemKeychainPasswordItemSet   (SCPreferencesRef       prefs,
                                                 CFStringRef            description,
                                                 CFStringRef            account,
                                                 CFDataRef              password,
                                                 CFStringRef            description,
                                                 CFStringRef            account,
                                                 CFDataRef              password,
-                                                CFDictionaryRef        options);
+                                                CFDictionaryRef        options)        __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 __END_DECLS
 
 
 __END_DECLS
 
index ba887c344befba5763b0e161cdfa4be02b6f5157..221ac57c57b12d4fcb4c5a5737a6a3360fb61a5c 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2005, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  */
 
 #ifndef _SCPREFERENCESPATH_H
  */
 
 #ifndef _SCPREFERENCESPATH_H
+#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS
+#include <SystemConfiguration/_SCPreferencesPath.h>
+#else  /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
 #define _SCPREFERENCESPATH_H
 
 #define _SCPREFERENCESPATH_H
 
+#include <Availability.h>
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCPreferences.h>
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCPreferences.h>
@@ -90,7 +94,7 @@ CFStringRef
 SCPreferencesPathCreateUniqueChild     (
                                        SCPreferencesRef        prefs,
                                        CFStringRef             prefix
 SCPreferencesPathCreateUniqueChild     (
                                        SCPreferencesRef        prefs,
                                        CFStringRef             prefix
-                                       );
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCPreferencesPathGetValue
 
 /*!
        @function SCPreferencesPathGetValue
@@ -105,7 +109,7 @@ CFDictionaryRef
 SCPreferencesPathGetValue              (
                                        SCPreferencesRef        prefs,
                                        CFStringRef             path
 SCPreferencesPathGetValue              (
                                        SCPreferencesRef        prefs,
                                        CFStringRef             path
-                                       );
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCPreferencesPathGetLink
 
 /*!
        @function SCPreferencesPathGetLink
@@ -120,7 +124,7 @@ CFStringRef
 SCPreferencesPathGetLink               (
                                        SCPreferencesRef        prefs,
                                        CFStringRef             path
 SCPreferencesPathGetLink               (
                                        SCPreferencesRef        prefs,
                                        CFStringRef             path
-                                       );
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCPreferencesPathSetValue
 
 /*!
        @function SCPreferencesPathSetValue
@@ -136,7 +140,7 @@ SCPreferencesPathSetValue           (
                                        SCPreferencesRef        prefs,
                                        CFStringRef             path,
                                        CFDictionaryRef         value
                                        SCPreferencesRef        prefs,
                                        CFStringRef             path,
                                        CFDictionaryRef         value
-                                       );
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCPreferencesPathSetLink
 
 /*!
        @function SCPreferencesPathSetLink
@@ -153,7 +157,7 @@ SCPreferencesPathSetLink            (
                                        SCPreferencesRef        prefs,
                                        CFStringRef             path,
                                        CFStringRef             link
                                        SCPreferencesRef        prefs,
                                        CFStringRef             path,
                                        CFStringRef             link
-                                       );
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCPreferencesPathRemoveValue
 
 /*!
        @function SCPreferencesPathRemoveValue
@@ -166,8 +170,9 @@ Boolean
 SCPreferencesPathRemoveValue           (
                                        SCPreferencesRef        prefs,
                                        CFStringRef             path
 SCPreferencesPathRemoveValue           (
                                        SCPreferencesRef        prefs,
                                        CFStringRef             path
-                                       );
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 __END_DECLS
 
 
 __END_DECLS
 
+#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
 #endif /* _SCPREFERENCESPATH_H */
 #endif /* _SCPREFERENCESPATH_H */
index 60b0dd58c77960bff29cc8dfd29d520537754556..e74945c7be85f3c431d757e0dd390e14123344d1 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004, 2005, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #ifndef _SCPREFERENCESPATHKEY_H
 #define _SCPREFERENCESPATHKEY_H
 
 #ifndef _SCPREFERENCESPATHKEY_H
 #define _SCPREFERENCESPATHKEY_H
 
-#include <AvailabilityMacros.h>
+#include <Availability.h>
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-
 /*!
        @header SCPreferencesPathKey
  */
 /*!
        @header SCPreferencesPathKey
  */
@@ -50,7 +48,7 @@ SCPreferencesPathKeyCreate                    (
                                                CFAllocatorRef  allocator,
                                                CFStringRef     fmt,
                                                ...
                                                CFAllocatorRef  allocator,
                                                CFStringRef     fmt,
                                                ...
-                                               )                               AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                               )                               __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
 
 /*!
        @function SCPreferencesPathKeyCreateNetworkServices
 
 /*!
        @function SCPreferencesPathKeyCreateNetworkServices
@@ -58,7 +56,7 @@ SCPreferencesPathKeyCreate                    (
 CFStringRef
 SCPreferencesPathKeyCreateNetworkServices      (
                                                CFAllocatorRef  allocator
 CFStringRef
 SCPreferencesPathKeyCreateNetworkServices      (
                                                CFAllocatorRef  allocator
-                                               )                               AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                               )                               __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
 
 /*!
        @function SCPreferencesPathKeyCreateNetworkServiceEntity
 
 /*!
        @function SCPreferencesPathKeyCreateNetworkServiceEntity
@@ -68,7 +66,7 @@ SCPreferencesPathKeyCreateNetworkServiceEntity        (
                                                CFAllocatorRef  allocator,
                                                CFStringRef     service,
                                                CFStringRef     entity
                                                CFAllocatorRef  allocator,
                                                CFStringRef     service,
                                                CFStringRef     entity
-                                               )                               AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                               )                               __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
 
 /*!
        @function SCPreferencesPathKeyCreateSets
 
 /*!
        @function SCPreferencesPathKeyCreateSets
@@ -76,7 +74,7 @@ SCPreferencesPathKeyCreateNetworkServiceEntity        (
 CFStringRef
 SCPreferencesPathKeyCreateSets                 (
                                                CFAllocatorRef  allocator
 CFStringRef
 SCPreferencesPathKeyCreateSets                 (
                                                CFAllocatorRef  allocator
-                                               )                               AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                               )                               __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
 
 /*!
        @function SCPreferencesPathKeyCreateSet
 
 /*!
        @function SCPreferencesPathKeyCreateSet
@@ -85,7 +83,7 @@ CFStringRef
 SCPreferencesPathKeyCreateSet                  (
                                                CFAllocatorRef  allocator,
                                                CFStringRef     set
 SCPreferencesPathKeyCreateSet                  (
                                                CFAllocatorRef  allocator,
                                                CFStringRef     set
-                                               )                               AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                               )                               __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
 
 /*!
        @function SCPreferencesPathKeyCreateSetNetworkInterfaceEntity
 
 /*!
        @function SCPreferencesPathKeyCreateSetNetworkInterfaceEntity
@@ -96,7 +94,7 @@ SCPreferencesPathKeyCreateSetNetworkInterfaceEntity(
                                                   CFStringRef  set,
                                                   CFStringRef  ifname,
                                                   CFStringRef  entity
                                                   CFStringRef  set,
                                                   CFStringRef  ifname,
                                                   CFStringRef  entity
-                                                  )                            AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                                  )                            __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
 
 /*!
        @function SCPreferencesPathKeyCreateSetNetworkGlobalEntity
 
 /*!
        @function SCPreferencesPathKeyCreateSetNetworkGlobalEntity
@@ -106,7 +104,7 @@ SCPreferencesPathKeyCreateSetNetworkGlobalEntity(
                                                CFAllocatorRef  allocator,
                                                CFStringRef     set,
                                                CFStringRef     entity
                                                CFAllocatorRef  allocator,
                                                CFStringRef     set,
                                                CFStringRef     entity
-                                               )                               AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                               )                               __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
 
 /*!
        @function SCPreferencesPathKeyCreateSetNetworkService
 
 /*!
        @function SCPreferencesPathKeyCreateSetNetworkService
@@ -116,7 +114,7 @@ SCPreferencesPathKeyCreateSetNetworkService     (
                                                CFAllocatorRef  allocator,
                                                CFStringRef     set,
                                                CFStringRef     service
                                                CFAllocatorRef  allocator,
                                                CFStringRef     set,
                                                CFStringRef     service
-                                               )                               AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                               )                               __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
 
 /*!
        @function SCPreferencesPathKeyCreateSetNetworkServiceEntity
 
 /*!
        @function SCPreferencesPathKeyCreateSetNetworkServiceEntity
@@ -127,10 +125,8 @@ SCPreferencesPathKeyCreateSetNetworkServiceEntity(
                                                 CFStringRef    set,
                                                 CFStringRef    service,
                                                 CFStringRef    entity
                                                 CFStringRef    set,
                                                 CFStringRef    service,
                                                 CFStringRef    entity
-                                                )                              AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+                                                )                              __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
 
 __END_DECLS
 
 
 __END_DECLS
 
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */
-
 #endif /* _SCPREFERENCESPATHKEY_H */
 #endif /* _SCPREFERENCESPATHKEY_H */
index 5710af16c1b1921b4880f6b2326a8ddf4c8a099c..7ed9bc618732e034eb4985d42cb56098649b9d4b 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2005, 2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2007, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -25,8 +25,8 @@
 #define _SCPREFERENCESPRIVATE_H
 
 
 #define _SCPREFERENCESPRIVATE_H
 
 
+#include <Availability.h>
 #include <sys/cdefs.h>
 #include <sys/cdefs.h>
-#include <AvailabilityMacros.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCPreferences.h>
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCPreferences.h>
 
@@ -70,7 +70,7 @@ SCDynamicStoreKeyCreatePreferences    (
                                        CFAllocatorRef          allocator,
                                        CFStringRef             prefsID,
                                        SCPreferencesKeyType    keyType
                                        CFAllocatorRef          allocator,
                                        CFStringRef             prefsID,
                                        SCPreferencesKeyType    keyType
-                                       )       AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4;
+                                       )       __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_4,__IPHONE_2_0,__IPHONE_2_0);
 
 __END_DECLS
 
 
 __END_DECLS
 
index 7449ee06edb9680a06b2f63e43cc0a7d94e69180..940c04aa69e637d29e8eecd9cbd1895f3b4c36cb 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2002, 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2002, 2004, 2005, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  */
 
 #ifndef _SCPREFERENCESSETSPECIFIC_H
  */
 
 #ifndef _SCPREFERENCESSETSPECIFIC_H
+#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS
+#include <SystemConfiguration/_SCPreferencesSetSpecific.h>
+#else  /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
 #define _SCPREFERENCESSETSPECIFIC_H
 
 #define _SCPREFERENCESSETSPECIFIC_H
 
+#include <Availability.h>
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCPreferences.h>
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SCPreferences.h>
@@ -61,7 +65,7 @@ SCPreferencesSetComputerName          (
                                        SCPreferencesRef        prefs,
                                        CFStringRef             name,
                                        CFStringEncoding        nameEncoding
                                        SCPreferencesRef        prefs,
                                        CFStringRef             name,
                                        CFStringEncoding        nameEncoding
-                                       );
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/);
 
 /*!
        @function SCPreferencesSetLocalHostName
 
 /*!
        @function SCPreferencesSetLocalHostName
@@ -82,8 +86,9 @@ Boolean
 SCPreferencesSetLocalHostName          (
                                        SCPreferencesRef        prefs,
                                        CFStringRef             name
 SCPreferencesSetLocalHostName          (
                                        SCPreferencesRef        prefs,
                                        CFStringRef             name
-                                       );
+                                       )                       __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/);
 
 __END_DECLS
 
 
 __END_DECLS
 
+#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
 #endif /* _SCPREFERENCESSETSPECIFIC_H */
 #endif /* _SCPREFERENCESSETSPECIFIC_H */
index 0741194a7e88069674ec204e322f386aa8850930..4fa55e934f3239d5eaf34944939f1b6ad9bbe330 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -26,6 +26,7 @@
 
 #include <sys/cdefs.h>
 #include <sys/socket.h>
 
 #include <sys/cdefs.h>
 #include <sys/socket.h>
+#include <asl.h>
 #include <sys/syslog.h>
 #include <mach/message.h>
 
 #include <sys/syslog.h>
 #include <mach/message.h>
 
  */
 
 /* framework variables */
  */
 
 /* framework variables */
-extern Boolean _sc_debug;      /* TRUE if debugging enabled */
-extern Boolean _sc_verbose;    /* TRUE if verbose logging enabled */
-extern Boolean _sc_log;        /* TRUE if SCLog() output goes to syslog */
+extern int     _sc_debug;      /* non-zero if debugging enabled */
+extern int     _sc_verbose;    /* non-zero if verbose logging enabled */
+extern int     _sc_log;        /* 0 if SC messages should be written to stdout/stderr,
+                                  1 if SC messages should be logged w/asl(3),
+                                  2 if SC messages should be written to stdout/stderr AND logged */
 
 /*!
        @group SCNetworkReachabilityCreateWithOptions #defines
 
 /*!
        @group SCNetworkReachabilityCreateWithOptions #defines
@@ -94,6 +97,13 @@ extern Boolean       _sc_log;        /* TRUE if SCLog() output goes to syslog */
  */
 #define kSCNetworkReachabilityOptionHints      CFSTR("hints")
 
  */
 #define kSCNetworkReachabilityOptionHints      CFSTR("hints")
 
+/*!
+       @constant kSCNetworkReachabilityOptionConnectionOnDemandByPass
+       @discussion A CFBoolean that indicates if we should bypass the VPNOnDemand
+               checks for this target.
+ */
+#define kSCNetworkReachabilityOptionConnectionOnDemandByPass   CFSTR("ConnectionOnDemandByPass")
+
 /*!
        @group
  */
 /*!
        @group
  */
@@ -260,6 +270,18 @@ void               _SC_sendMachMessage             (mach_port_t            port,
                                                 mach_msg_id_t          msg_id);
 
 
                                                 mach_msg_id_t          msg_id);
 
 
+/*!
+       @function _SCCopyDescription
+       @discussion Returns a formatted textual description of a CF object.
+       @param cf The CFType object (a generic reference of type CFTypeRef) from
+               which to derive a description.
+       @param formatOptions A dictionary containing formatting options for the object.
+       @result A string that contains a formatted description of cf.
+ */
+CFStringRef    _SCCopyDescription              (CFTypeRef              cf,
+                                                CFDictionaryRef        formatOptions);
+
+
 /*!
        @function SCLog
        @discussion Conditionally issue a log message.
 /*!
        @function SCLog
        @discussion Conditionally issue a log message.
@@ -274,6 +296,28 @@ void               SCLog                           (Boolean                condition,
                                                 CFStringRef            formatString,
                                                 ...);
 
                                                 CFStringRef            formatString,
                                                 ...);
 
+
+/*!
+       @function SCLOG
+       @discussion Issue a log message.
+       @param asl An asl client handle to be used for logging. If NULL, a shared
+               handle will be used.
+       @param msg An asl msg structure to be used for logging. If NULL, a default
+               asl msg will be used.
+       @param level A asl(3) logging priority. Passing the complement of a logging
+               priority (e.g. ~ASL_LEVEL_NOTICE) will result in log message lines
+               NOT being split by a "\n".
+       @param formatString The format string
+       @result The specified message will be written to the system message
+               logger (See syslogd(8)).
+ */
+void           SCLOG                           (aslclient              asl,
+                                                aslmsg                 msg,
+                                                int                    level,
+                                                CFStringRef            formatString,
+                                                ...);
+
+
 /*!
        @function SCPrint
        @discussion Conditionally issue a debug message.
 /*!
        @function SCPrint
        @discussion Conditionally issue a debug message.
@@ -302,6 +346,28 @@ void               SCTrace                         (Boolean                condition,
                                                 CFStringRef            formatString,
                                                 ...);
 
                                                 CFStringRef            formatString,
                                                 ...);
 
+/*!
+       @function SCNetworkReachabilityCopyOnDemandService
+       @discussion For target hosts that require an OnDemand connection, returns
+               the SCNetworkService associated with the connection and user
+               options to use with SCNetworkConnectionStart.
+       @result The SCNetworkService for the target; NULL if there is
+               no associated OnDemand service.
+ */
+SCNetworkServiceRef
+SCNetworkReachabilityCopyOnDemandService       (SCNetworkReachabilityRef       target,
+                                                CFDictionaryRef                *userOptions);
+
+/*!
+       @function SCNetworkReachabilityCopyResolvedAddress
+       @discussion Return the resolved addresses associated with the
+               target host.
+       @result A CFArray[CFData], where each CFData is a (struct sockaddr)
+ */
+CFArrayRef
+SCNetworkReachabilityCopyResolvedAddress       (SCNetworkReachabilityRef       target,
+                                                int                            *error_num);
+
 /*!
        @function SCNetworkReachabilityCreateWithOptions
        @discussion Creates a reference to a specified network host.  The
 /*!
        @function SCNetworkReachabilityCreateWithOptions
        @discussion Creates a reference to a specified network host.  The
@@ -321,6 +387,17 @@ SCNetworkReachabilityRef
 SCNetworkReachabilityCreateWithOptions         (CFAllocatorRef         allocator,
                                                 CFDictionaryRef        options);
 
 SCNetworkReachabilityCreateWithOptions         (CFAllocatorRef         allocator,
                                                 CFDictionaryRef        options);
 
+/*!
+       @function _SC_checkResolverReachabilityByAddress
+       @discussion Check the reachability of a reverse DNS query
+ */
+Boolean
+_SC_checkResolverReachabilityByAddress         (SCDynamicStoreRef              *storeP,
+                                                SCNetworkReachabilityFlags     *flags,
+                                                Boolean                        *haveDNS,
+                                                struct sockaddr                *sa);
+
+#if    !TARGET_OS_IPHONE
 /*
  * DOS encoding/codepage
  */
 /*
  * DOS encoding/codepage
  */
@@ -329,11 +406,7 @@ _SC_dos_encoding_and_codepage                      (CFStringEncoding       macEncoding,
                                                 UInt32                 macRegion,
                                                 CFStringEncoding       *dosEncoding,
                                                 UInt32                 *dosCodepage);
                                                 UInt32                 macRegion,
                                                 CFStringEncoding       *dosEncoding,
                                                 UInt32                 *dosCodepage);
-
-CFDataRef
-_SC_dos_copy_string                            (CFStringRef            str,
-                                                CFStringEncoding       dosEncoding,
-                                                UInt32                 dosCodepage);
+#endif // !TARGET_OS_IPHONE
 
 /*
  * object / CFRunLoop  management
 
 /*
  * object / CFRunLoop  management
@@ -389,6 +462,29 @@ _SC_CFEqual(CFTypeRef val1, CFTypeRef val2)
        return FALSE;
 }
 
        return FALSE;
 }
 
+/*
+ * debugging
+ */
+
+#ifdef DEBUG_MACH_PORT_ALLOCATIONS
+       #define __MACH_PORT_DEBUG(cond, str, port)              \
+       do {                                                    \
+               if (cond) _SC_logMachPortReferences(str, port); \
+       } while (0)
+#else  // DEBUG_MACH_PORT_ALLOCATIONS
+       #define __MACH_PORT_DEBUG(cond, str, port)
+#endif // DEBUG_MACH_PORT_ALLOCATIONS
+
+void
+_SC_logMachPortStatus                          (void);
+
+void
+_SC_logMachPortReferences                      (const char             *str,
+                                                mach_port_t            port);
+
+CFStringRef
+_SC_copyBacktrace                              (void);
+
 __END_DECLS
 
 #endif /* _SCPRIVATE_H */
 __END_DECLS
 
 #endif /* _SCPRIVATE_H */
index 6dbd370d70729229492630bd1575151998f25b46..8cfc5ffdf799084405fb1e797416ae2587bbdcbd 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -56,8 +56,6 @@ validate_proxy_content(CFMutableDictionaryRef proxies,
 {
        int             enabled = 0;
        CFNumberRef     num;
 {
        int             enabled = 0;
        CFNumberRef     num;
-       CFStringRef     host;
-       CFNumberRef     port    = NULL;
 
        num = CFDictionaryGetValue(proxies, proxy_enable);
        if (num != NULL) {
 
        num = CFDictionaryGetValue(proxies, proxy_enable);
        if (num != NULL) {
@@ -68,14 +66,20 @@ validate_proxy_content(CFMutableDictionaryRef       proxies,
                }
        }
 
                }
        }
 
-       host = CFDictionaryGetValue(proxies, proxy_host);
-       if (((enabled == 0) && (host != NULL)) ||
-           ((enabled != 0) && !isA_CFString(host))) {
-               // pass only valid proxy hosts and only when enabled
-               goto disable;
+       if (proxy_host != NULL) {
+               CFStringRef     host;
+
+               host = CFDictionaryGetValue(proxies, proxy_host);
+               if (((enabled == 0) && (host != NULL)) ||
+                   ((enabled != 0) && !isA_CFString(host))) {
+                       // pass only valid proxy hosts and only when enabled
+                       goto disable;
+               }
        }
 
        if (proxy_port != NULL) {
        }
 
        if (proxy_port != NULL) {
+               CFNumberRef     port;
+
                port = CFDictionaryGetValue(proxies, proxy_port);
                if (((enabled == 0) && (port != NULL)) ||
                    ((enabled != 0) && (port != NULL) && !isA_CFNumber(port))) {
                port = CFDictionaryGetValue(proxies, proxy_port);
                if (((enabled == 0) && (port != NULL)) ||
                    ((enabled != 0) && (port != NULL) && !isA_CFNumber(port))) {
@@ -107,7 +111,9 @@ validate_proxy_content(CFMutableDictionaryRef       proxies,
        num = CFNumberCreate(NULL, kCFNumberIntType, &enabled);
        CFDictionarySetValue(proxies, proxy_enable, num);
        CFRelease(num);
        num = CFNumberCreate(NULL, kCFNumberIntType, &enabled);
        CFDictionarySetValue(proxies, proxy_enable, num);
        CFRelease(num);
-       CFDictionaryRemoveValue(proxies, proxy_host);
+       if (proxy_host != NULL) {
+               CFDictionaryRemoveValue(proxies, proxy_host);
+       }
        if (proxy_port != NULL) {
                CFDictionaryRemoveValue(proxies, proxy_port);
        }
        if (proxy_port != NULL) {
                CFDictionaryRemoveValue(proxies, proxy_port);
        }
@@ -204,11 +210,17 @@ SCDynamicStoreCopyProxies(SCDynamicStoreRef store)
                               NULL,
                               NULL,
                               0);
                               NULL,
                               NULL,
                               0);
+       validate_proxy_content(newProxies,
+                              kSCPropNetProxiesProxyAutoDiscoveryEnable,
+                              NULL,
+                              NULL,
+                              NULL,
+                              0);
 
        // validate FTP passive setting
        num = CFDictionaryGetValue(newProxies, kSCPropNetProxiesFTPPassive);
        if (num != NULL) {
 
        // validate FTP passive setting
        num = CFDictionaryGetValue(newProxies, kSCPropNetProxiesFTPPassive);
        if (num != NULL) {
-               int     enabled;
+               int     enabled = 0;
 
                if (!isA_CFNumber(num) ||
                    !CFNumberGetValue(num, kCFNumberIntType, &enabled)) {
 
                if (!isA_CFNumber(num) ||
                    !CFNumberGetValue(num, kCFNumberIntType, &enabled)) {
@@ -222,23 +234,6 @@ SCDynamicStoreCopyProxies(SCDynamicStoreRef store)
                }
        }
 
                }
        }
 
-       // validate WPAD setting
-       num = CFDictionaryGetValue(newProxies, kSCPropNetProxiesProxyAutoDiscoveryEnable);
-       if (num != NULL) {
-               int     enabled;
-
-               if (!isA_CFNumber(num) ||
-                   !CFNumberGetValue(num, kCFNumberIntType, &enabled)) {
-                       // if we don't like the enabled key/value
-                       enabled = 0;
-                       num = CFNumberCreate(NULL, kCFNumberIntType, &enabled);
-                       CFDictionarySetValue(newProxies,
-                                            kSCPropNetProxiesProxyAutoDiscoveryEnable,
-                                            num);
-                       CFRelease(num);
-               }
-       }
-
        // validate proxy exception list
        array = CFDictionaryGetValue(newProxies, kSCPropNetProxiesExceptionsList);
        if (array != NULL) {
        // validate proxy exception list
        array = CFDictionaryGetValue(newProxies, kSCPropNetProxiesExceptionsList);
        if (array != NULL) {
index 177a5c93555016fb0aa4ad65f90b1cd8045289f4..ac8b474c32a21f10d7c8e1c2b5b98d2aa5bcf977 100644 (file)
@@ -3,6 +3,8 @@
  * DO NOT EDIT!
  */
 
  * DO NOT EDIT!
  */
 
+#include <Availability.h>
+#include <TargetConditionals.h>
 #include <CoreFoundation/CFString.h>
 
 const CFStringRef kSCResvLink                                      = CFSTR("__LINK__");
 #include <CoreFoundation/CFString.h>
 
 const CFStringRef kSCResvLink                                      = CFSTR("__LINK__");
@@ -25,7 +27,11 @@ const CFStringRef kSCCompSystem                                    = CFSTR("Syst
 const CFStringRef kSCCompUsers                                     = CFSTR("Users");
 const CFStringRef kSCCompAnyRegex                                  = CFSTR("[^/]+");
 const CFStringRef kSCEntNetAirPort                                 = CFSTR("AirPort");
 const CFStringRef kSCCompUsers                                     = CFSTR("Users");
 const CFStringRef kSCCompAnyRegex                                  = CFSTR("[^/]+");
 const CFStringRef kSCEntNetAirPort                                 = CFSTR("AirPort");
+
+#if !TARGET_OS_IPHONE
 const CFStringRef kSCEntNetAppleTalk                               = CFSTR("AppleTalk");
 const CFStringRef kSCEntNetAppleTalk                               = CFSTR("AppleTalk");
+#endif // !TARGET_OS_IPHONE
+
 const CFStringRef kSCEntNetDHCP                                    = CFSTR("DHCP");
 const CFStringRef kSCEntNetDNS                                     = CFSTR("DNS");
 const CFStringRef kSCEntNetEthernet                                = CFSTR("Ethernet");
 const CFStringRef kSCEntNetDHCP                                    = CFSTR("DHCP");
 const CFStringRef kSCEntNetDNS                                     = CFSTR("DNS");
 const CFStringRef kSCEntNetEthernet                                = CFSTR("Ethernet");
@@ -37,15 +43,27 @@ const CFStringRef kSCEntNetIPv6                                    = CFSTR("IPv6
 const CFStringRef kSCEntNetL2TP                                    = CFSTR("L2TP");
 const CFStringRef kSCEntNetLink                                    = CFSTR("Link");
 const CFStringRef kSCEntNetModem                                   = CFSTR("Modem");
 const CFStringRef kSCEntNetL2TP                                    = CFSTR("L2TP");
 const CFStringRef kSCEntNetLink                                    = CFSTR("Link");
 const CFStringRef kSCEntNetModem                                   = CFSTR("Modem");
+
+#if !TARGET_OS_IPHONE
 const CFStringRef kSCEntNetNetInfo                                 = CFSTR("NetInfo");
 const CFStringRef kSCEntNetNetInfo                                 = CFSTR("NetInfo");
+#endif // !TARGET_OS_IPHONE
+
 const CFStringRef kSCEntNetPPP                                     = CFSTR("PPP");
 const CFStringRef kSCEntNetPPPoE                                   = CFSTR("PPPoE");
 const CFStringRef kSCEntNetPPPSerial                               = CFSTR("PPPSerial");
 const CFStringRef kSCEntNetPPTP                                    = CFSTR("PPTP");
 const CFStringRef kSCEntNetProxies                                 = CFSTR("Proxies");
 const CFStringRef kSCEntNetPPP                                     = CFSTR("PPP");
 const CFStringRef kSCEntNetPPPoE                                   = CFSTR("PPPoE");
 const CFStringRef kSCEntNetPPPSerial                               = CFSTR("PPPSerial");
 const CFStringRef kSCEntNetPPTP                                    = CFSTR("PPTP");
 const CFStringRef kSCEntNetProxies                                 = CFSTR("Proxies");
+
+#if !TARGET_OS_IPHONE
 const CFStringRef kSCEntNetSMB                                     = CFSTR("SMB");
 const CFStringRef kSCEntNetSMB                                     = CFSTR("SMB");
+#endif // !TARGET_OS_IPHONE
+
 const CFStringRef kSCEntNet6to4                                    = CFSTR("6to4");
 const CFStringRef kSCEntNet6to4                                    = CFSTR("6to4");
+
+
 const CFStringRef kSCEntNetEAPOL                                   = CFSTR("EAPOL");
 const CFStringRef kSCEntNetEAPOL                                   = CFSTR("EAPOL");
+const CFStringRef kSCEntNetOnDemand                                = CFSTR("OnDemand");
+const CFStringRef kSCEntNetService                                 = CFSTR("__SERVICE__");
 const CFStringRef kSCPropNetOverridePrimary                        = CFSTR("OverridePrimary");
 const CFStringRef kSCPropNetServiceOrder                           = CFSTR("ServiceOrder");
 const CFStringRef kSCPropNetPPPOverridePrimary                     = CFSTR("PPPOverridePrimary");
 const CFStringRef kSCPropNetOverridePrimary                        = CFSTR("OverridePrimary");
 const CFStringRef kSCPropNetServiceOrder                           = CFSTR("ServiceOrder");
 const CFStringRef kSCPropNetPPPOverridePrimary                     = CFSTR("PPPOverridePrimary");
@@ -65,6 +83,8 @@ const CFStringRef kSCValNetAirPortJoinModeRanked                   = CFSTR("Rank
 const CFStringRef kSCValNetAirPortJoinModeRecent                   = CFSTR("Recent");
 const CFStringRef kSCValNetAirPortJoinModeStrongest                = CFSTR("Strongest");
 const CFStringRef kSCValNetAirPortAuthPasswordEncryptionKeychain   = CFSTR("Keychain");
 const CFStringRef kSCValNetAirPortJoinModeRecent                   = CFSTR("Recent");
 const CFStringRef kSCValNetAirPortJoinModeStrongest                = CFSTR("Strongest");
 const CFStringRef kSCValNetAirPortAuthPasswordEncryptionKeychain   = CFSTR("Keychain");
+
+#if !TARGET_OS_IPHONE
 const CFStringRef kSCPropNetAppleTalkComputerName                  = CFSTR("ComputerName");
 const CFStringRef kSCPropNetAppleTalkComputerNameEncoding          = CFSTR("ComputerNameEncoding");
 const CFStringRef kSCPropNetAppleTalkConfigMethod                  = CFSTR("ConfigMethod");
 const CFStringRef kSCPropNetAppleTalkComputerName                  = CFSTR("ComputerName");
 const CFStringRef kSCPropNetAppleTalkComputerNameEncoding          = CFSTR("ComputerNameEncoding");
 const CFStringRef kSCPropNetAppleTalkConfigMethod                  = CFSTR("ConfigMethod");
@@ -77,6 +97,10 @@ const CFStringRef kSCPropNetAppleTalkSeedZones                     = CFSTR("Seed
 const CFStringRef kSCValNetAppleTalkConfigMethodNode               = CFSTR("Node");
 const CFStringRef kSCValNetAppleTalkConfigMethodRouter             = CFSTR("Router");
 const CFStringRef kSCValNetAppleTalkConfigMethodSeedRouter         = CFSTR("SeedRouter");
 const CFStringRef kSCValNetAppleTalkConfigMethodNode               = CFSTR("Node");
 const CFStringRef kSCValNetAppleTalkConfigMethodRouter             = CFSTR("Router");
 const CFStringRef kSCValNetAppleTalkConfigMethodSeedRouter         = CFSTR("SeedRouter");
+#endif // !TARGET_OS_IPHONE
+
+
+
 const CFStringRef kSCPropNetDNSDomainName                          = CFSTR("DomainName");
 const CFStringRef kSCPropNetDNSOptions                             = CFSTR("Options");
 const CFStringRef kSCPropNetDNSSearchDomains                       = CFSTR("SearchDomains");
 const CFStringRef kSCPropNetDNSDomainName                          = CFSTR("DomainName");
 const CFStringRef kSCPropNetDNSOptions                             = CFSTR("Options");
 const CFStringRef kSCPropNetDNSSearchDomains                       = CFSTR("SearchDomains");
@@ -99,20 +123,36 @@ const CFStringRef kSCValNetInterfaceTypeEthernet                   = CFSTR("Ethe
 const CFStringRef kSCValNetInterfaceTypeFireWire                   = CFSTR("FireWire");
 const CFStringRef kSCValNetInterfaceTypePPP                        = CFSTR("PPP");
 const CFStringRef kSCValNetInterfaceType6to4                       = CFSTR("6to4");
 const CFStringRef kSCValNetInterfaceTypeFireWire                   = CFSTR("FireWire");
 const CFStringRef kSCValNetInterfaceTypePPP                        = CFSTR("PPP");
 const CFStringRef kSCValNetInterfaceType6to4                       = CFSTR("6to4");
+const CFStringRef kSCValNetInterfaceTypeIPSec                      = CFSTR("IPSec");
 const CFStringRef kSCValNetInterfaceSubTypePPPoE                   = CFSTR("PPPoE");
 const CFStringRef kSCValNetInterfaceSubTypePPPSerial               = CFSTR("PPPSerial");
 const CFStringRef kSCValNetInterfaceSubTypePPTP                    = CFSTR("PPTP");
 const CFStringRef kSCValNetInterfaceSubTypeL2TP                    = CFSTR("L2TP");
 const CFStringRef kSCValNetInterfaceSubTypePPPoE                   = CFSTR("PPPoE");
 const CFStringRef kSCValNetInterfaceSubTypePPPSerial               = CFSTR("PPPSerial");
 const CFStringRef kSCValNetInterfaceSubTypePPTP                    = CFSTR("PPTP");
 const CFStringRef kSCValNetInterfaceSubTypeL2TP                    = CFSTR("L2TP");
+const CFStringRef kSCPropNetIPSecAuthenticationMethod              = CFSTR("AuthenticationMethod");
+const CFStringRef kSCPropNetIPSecLocalCertificate                  = CFSTR("LocalCertificate");
 const CFStringRef kSCPropNetIPSecLocalIdentifier                   = CFSTR("LocalIdentifier");
 const CFStringRef kSCPropNetIPSecLocalIdentifierType               = CFSTR("LocalIdentifierType");
 const CFStringRef kSCPropNetIPSecLocalIdentifier                   = CFSTR("LocalIdentifier");
 const CFStringRef kSCPropNetIPSecLocalIdentifierType               = CFSTR("LocalIdentifierType");
-const CFStringRef kSCPropNetIPSecAuthenticationMethod              = CFSTR("AuthenticationMethod");
 const CFStringRef kSCPropNetIPSecSharedSecret                      = CFSTR("SharedSecret");
 const CFStringRef kSCPropNetIPSecSharedSecretEncryption            = CFSTR("SharedSecretEncryption");
 const CFStringRef kSCPropNetIPSecSharedSecret                      = CFSTR("SharedSecret");
 const CFStringRef kSCPropNetIPSecSharedSecretEncryption            = CFSTR("SharedSecretEncryption");
-const CFStringRef kSCPropNetIPSecLocalCertificate                  = CFSTR("LocalCertificate");
+const CFStringRef kSCPropNetIPSecConnectTime                       = CFSTR("ConnectTime");
+const CFStringRef kSCPropNetIPSecRemoteAddress                     = CFSTR("RemoteAddress");
+const CFStringRef kSCPropNetIPSecStatus                            = CFSTR("Status");
+const CFStringRef kSCPropNetIPSecXAuthEnabled                      = CFSTR("XAuthEnabled");
+const CFStringRef kSCPropNetIPSecXAuthName                         = CFSTR("XAuthName");
+const CFStringRef kSCPropNetIPSecXAuthPassword                     = CFSTR("XAuthPassword");
+const CFStringRef kSCPropNetIPSecXAuthPasswordEncryption           = CFSTR("XAuthPasswordEncryption");
 const CFStringRef kSCValNetIPSecAuthenticationMethodSharedSecret   = CFSTR("SharedSecret");
 const CFStringRef kSCValNetIPSecAuthenticationMethodCertificate    = CFSTR("Certificate");
 const CFStringRef kSCValNetIPSecAuthenticationMethodSharedSecret   = CFSTR("SharedSecret");
 const CFStringRef kSCValNetIPSecAuthenticationMethodCertificate    = CFSTR("Certificate");
-const CFStringRef kSCValNetIPSecSharedSecretEncryptionKeychain     = CFSTR("Keychain");
+const CFStringRef kSCValNetIPSecAuthenticationMethodHybrid         = CFSTR("Hybrid");
 const CFStringRef kSCValNetIPSecLocalIdentifierTypeKeyID           = CFSTR("KeyID");
 const CFStringRef kSCValNetIPSecLocalIdentifierTypeKeyID           = CFSTR("KeyID");
+const CFStringRef kSCValNetIPSecSharedSecretEncryptionKeychain     = CFSTR("Keychain");
+const CFStringRef kSCValNetIPSecXAuthPasswordEncryptionKeychain    = CFSTR("Keychain");
+const CFStringRef kSCValNetIPSecXAuthPasswordEncryptionPrompt      = CFSTR("Prompt");
+const CFStringRef kSCPropNetIPSecLastCause                         = CFSTR("LastCause");
+const CFStringRef kSCPropNetIPSecOnDemandEnabled                   = CFSTR("OnDemandEnabled");
+const CFStringRef kSCPropNetIPSecOnDemandMatchDomainsAlways        = CFSTR("OnDemandMatchDomainsAlways");
+const CFStringRef kSCPropNetIPSecOnDemandMatchDomainsOnRetry       = CFSTR("OnDemandMatchDomainsOnRetry");
+const CFStringRef kSCPropNetIPSecOnDemandMatchDomainsNever         = CFSTR("OnDemandMatchDomainsNever");
 const CFStringRef kSCPropNetIPv4Addresses                          = CFSTR("Addresses");
 const CFStringRef kSCPropNetIPv4ConfigMethod                       = CFSTR("ConfigMethod");
 const CFStringRef kSCPropNetIPv4DHCPClientID                       = CFSTR("DHCPClientID");
 const CFStringRef kSCPropNetIPv4Addresses                          = CFSTR("Addresses");
 const CFStringRef kSCPropNetIPv4ConfigMethod                       = CFSTR("ConfigMethod");
 const CFStringRef kSCPropNetIPv4DHCPClientID                       = CFSTR("DHCPClientID");
@@ -120,6 +160,7 @@ const CFStringRef kSCPropNetIPv4Router                             = CFSTR("Rout
 const CFStringRef kSCPropNetIPv4SubnetMasks                        = CFSTR("SubnetMasks");
 const CFStringRef kSCPropNetIPv4DestAddresses                      = CFSTR("DestAddresses");
 const CFStringRef kSCPropNetIPv4BroadcastAddresses                 = CFSTR("BroadcastAddresses");
 const CFStringRef kSCPropNetIPv4SubnetMasks                        = CFSTR("SubnetMasks");
 const CFStringRef kSCPropNetIPv4DestAddresses                      = CFSTR("DestAddresses");
 const CFStringRef kSCPropNetIPv4BroadcastAddresses                 = CFSTR("BroadcastAddresses");
+const CFStringRef kSCValNetIPv4ConfigMethodAutomatic               = CFSTR("Automatic");
 const CFStringRef kSCValNetIPv4ConfigMethodBOOTP                   = CFSTR("BOOTP");
 const CFStringRef kSCValNetIPv4ConfigMethodDHCP                    = CFSTR("DHCP");
 const CFStringRef kSCValNetIPv4ConfigMethodINFORM                  = CFSTR("INFORM");
 const CFStringRef kSCValNetIPv4ConfigMethodBOOTP                   = CFSTR("BOOTP");
 const CFStringRef kSCValNetIPv4ConfigMethodDHCP                    = CFSTR("DHCP");
 const CFStringRef kSCValNetIPv4ConfigMethodINFORM                  = CFSTR("INFORM");
@@ -162,6 +203,8 @@ const CFStringRef kSCPropNetModemSpeed                             = CFSTR("Spee
 const CFStringRef kSCValNetModemDialModeIgnoreDialTone             = CFSTR("IgnoreDialTone");
 const CFStringRef kSCValNetModemDialModeManual                     = CFSTR("Manual");
 const CFStringRef kSCValNetModemDialModeWaitForDialTone            = CFSTR("WaitForDialTone");
 const CFStringRef kSCValNetModemDialModeIgnoreDialTone             = CFSTR("IgnoreDialTone");
 const CFStringRef kSCValNetModemDialModeManual                     = CFSTR("Manual");
 const CFStringRef kSCValNetModemDialModeWaitForDialTone            = CFSTR("WaitForDialTone");
+
+#if !TARGET_OS_IPHONE
 const CFStringRef kSCPropNetNetInfoBindingMethods                  = CFSTR("BindingMethods");
 const CFStringRef kSCPropNetNetInfoServerAddresses                 = CFSTR("ServerAddresses");
 const CFStringRef kSCPropNetNetInfoServerTags                      = CFSTR("ServerTags");
 const CFStringRef kSCPropNetNetInfoBindingMethods                  = CFSTR("BindingMethods");
 const CFStringRef kSCPropNetNetInfoServerAddresses                 = CFSTR("ServerAddresses");
 const CFStringRef kSCPropNetNetInfoServerTags                      = CFSTR("ServerTags");
@@ -170,6 +213,8 @@ const CFStringRef kSCValNetNetInfoBindingMethodsBroadcast          = CFSTR("Broa
 const CFStringRef kSCValNetNetInfoBindingMethodsDHCP               = CFSTR("DHCP");
 const CFStringRef kSCValNetNetInfoBindingMethodsManual             = CFSTR("Manual");
 const CFStringRef kSCValNetNetInfoDefaultServerTag                 = CFSTR("network");
 const CFStringRef kSCValNetNetInfoBindingMethodsDHCP               = CFSTR("DHCP");
 const CFStringRef kSCValNetNetInfoBindingMethodsManual             = CFSTR("Manual");
 const CFStringRef kSCValNetNetInfoDefaultServerTag                 = CFSTR("network");
+#endif // !TARGET_OS_IPHONE
+
 const CFStringRef kSCPropNetPPPACSPEnabled                         = CFSTR("ACSPEnabled");
 const CFStringRef kSCPropNetPPPConnectTime                         = CFSTR("ConnectTime");
 const CFStringRef kSCPropNetPPPDeviceLastCause                     = CFSTR("DeviceLastCause");
 const CFStringRef kSCPropNetPPPACSPEnabled                         = CFSTR("ACSPEnabled");
 const CFStringRef kSCPropNetPPPConnectTime                         = CFSTR("ConnectTime");
 const CFStringRef kSCPropNetPPPDeviceLastCause                     = CFSTR("DeviceLastCause");
@@ -269,6 +314,13 @@ const CFStringRef kSCPropNetProxiesSOCKSProxy                      = CFSTR("SOCK
 const CFStringRef kSCPropNetProxiesProxyAutoConfigEnable           = CFSTR("ProxyAutoConfigEnable");
 const CFStringRef kSCPropNetProxiesProxyAutoConfigURLString        = CFSTR("ProxyAutoConfigURLString");
 const CFStringRef kSCPropNetProxiesProxyAutoDiscoveryEnable        = CFSTR("ProxyAutoDiscoveryEnable");
 const CFStringRef kSCPropNetProxiesProxyAutoConfigEnable           = CFSTR("ProxyAutoConfigEnable");
 const CFStringRef kSCPropNetProxiesProxyAutoConfigURLString        = CFSTR("ProxyAutoConfigURLString");
 const CFStringRef kSCPropNetProxiesProxyAutoDiscoveryEnable        = CFSTR("ProxyAutoDiscoveryEnable");
+const CFStringRef kSCPropNetServicePrimaryRank                     = CFSTR("PrimaryRank");
+const CFStringRef kSCPropNetServiceUserDefinedName                 = CFSTR("UserDefinedName");
+const CFStringRef kSCValNetServicePrimaryRankFirst                 = CFSTR("First");
+const CFStringRef kSCValNetServicePrimaryRankLast                  = CFSTR("Last");
+const CFStringRef kSCValNetServicePrimaryRankNever                 = CFSTR("Never");
+
+#if !TARGET_OS_IPHONE
 const CFStringRef kSCPropNetSMBNetBIOSName                         = CFSTR("NetBIOSName");
 const CFStringRef kSCPropNetSMBNetBIOSNodeType                     = CFSTR("NetBIOSNodeType");
 const CFStringRef kSCPropNetSMBNetBIOSScope                        = CFSTR("NetBIOSScope");
 const CFStringRef kSCPropNetSMBNetBIOSName                         = CFSTR("NetBIOSName");
 const CFStringRef kSCPropNetSMBNetBIOSNodeType                     = CFSTR("NetBIOSNodeType");
 const CFStringRef kSCPropNetSMBNetBIOSScope                        = CFSTR("NetBIOSScope");
@@ -278,7 +330,13 @@ const CFStringRef kSCValNetSMBNetBIOSNodeTypeBroadcast             = CFSTR("Broa
 const CFStringRef kSCValNetSMBNetBIOSNodeTypePeer                  = CFSTR("Peer");
 const CFStringRef kSCValNetSMBNetBIOSNodeTypeMixed                 = CFSTR("Mixed");
 const CFStringRef kSCValNetSMBNetBIOSNodeTypeHybrid                = CFSTR("Hybrid");
 const CFStringRef kSCValNetSMBNetBIOSNodeTypePeer                  = CFSTR("Peer");
 const CFStringRef kSCValNetSMBNetBIOSNodeTypeMixed                 = CFSTR("Mixed");
 const CFStringRef kSCValNetSMBNetBIOSNodeTypeHybrid                = CFSTR("Hybrid");
+#endif // !TARGET_OS_IPHONE
+
+
+#if !TARGET_OS_IPHONE
 const CFStringRef kSCEntUsersConsoleUser                           = CFSTR("ConsoleUser");
 const CFStringRef kSCEntUsersConsoleUser                           = CFSTR("ConsoleUser");
+#endif // !TARGET_OS_IPHONE
+
 const CFStringRef kSCPropSystemComputerName                        = CFSTR("ComputerName");
 const CFStringRef kSCPropSystemComputerNameEncoding                = CFSTR("ComputerNameEncoding");
 const CFStringRef kSCPropSystemComputerNameRegion                  = CFSTR("ComputerNameRegion");
 const CFStringRef kSCPropSystemComputerName                        = CFSTR("ComputerName");
 const CFStringRef kSCPropSystemComputerNameEncoding                = CFSTR("ComputerNameEncoding");
 const CFStringRef kSCPropSystemComputerNameRegion                  = CFSTR("ComputerNameRegion");
@@ -294,12 +352,20 @@ const CFStringRef kSCDynamicStorePropNetInterfaces                 = CFSTR("Inte
 const CFStringRef kSCDynamicStorePropNetPrimaryInterface           = CFSTR("PrimaryInterface");
 const CFStringRef kSCDynamicStorePropNetPrimaryService             = CFSTR("PrimaryService");
 const CFStringRef kSCDynamicStorePropNetServiceIDs                 = CFSTR("ServiceIDs");
 const CFStringRef kSCDynamicStorePropNetPrimaryInterface           = CFSTR("PrimaryInterface");
 const CFStringRef kSCDynamicStorePropNetPrimaryService             = CFSTR("PrimaryService");
 const CFStringRef kSCDynamicStorePropNetServiceIDs                 = CFSTR("ServiceIDs");
+
+#if !TARGET_OS_IPHONE
 const CFStringRef kSCPropVirtualNetworkInterfacesBondInterfaces    = CFSTR("Interfaces");
 const CFStringRef kSCPropVirtualNetworkInterfacesBondMode          = CFSTR("Mode");
 const CFStringRef kSCPropVirtualNetworkInterfacesBondOptions       = CFSTR("Options");
 const CFStringRef kSCPropVirtualNetworkInterfacesVLANInterface     = CFSTR("Interface");
 const CFStringRef kSCPropVirtualNetworkInterfacesVLANTag           = CFSTR("Tag");
 const CFStringRef kSCPropVirtualNetworkInterfacesVLANOptions       = CFSTR("Options");
 const CFStringRef kSCPropVirtualNetworkInterfacesBondInterfaces    = CFSTR("Interfaces");
 const CFStringRef kSCPropVirtualNetworkInterfacesBondMode          = CFSTR("Mode");
 const CFStringRef kSCPropVirtualNetworkInterfacesBondOptions       = CFSTR("Options");
 const CFStringRef kSCPropVirtualNetworkInterfacesVLANInterface     = CFSTR("Interface");
 const CFStringRef kSCPropVirtualNetworkInterfacesVLANTag           = CFSTR("Tag");
 const CFStringRef kSCPropVirtualNetworkInterfacesVLANOptions       = CFSTR("Options");
+#endif // !TARGET_OS_IPHONE
+
+
+#if !TARGET_OS_IPHONE
 const CFStringRef kSCPropUsersConsoleUserName                      = CFSTR("Name");
 const CFStringRef kSCPropUsersConsoleUserUID                       = CFSTR("UID");
 const CFStringRef kSCPropUsersConsoleUserGID                       = CFSTR("GID");
 const CFStringRef kSCPropUsersConsoleUserName                      = CFSTR("Name");
 const CFStringRef kSCPropUsersConsoleUserUID                       = CFSTR("UID");
 const CFStringRef kSCPropUsersConsoleUserGID                       = CFSTR("GID");
+#endif // !TARGET_OS_IPHONE
+
index 24fd3a789b86c8789272ea0fa9dbab5da9d8f4c3..5089ecac039603202eb61969e7e21d8018206f96 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -62,7 +62,6 @@
  * Network Entity Keys
  *
  *   kSCEntNetAirPort                                   "AirPort"                      CFDictionary
  * Network Entity Keys
  *
  *   kSCEntNetAirPort                                   "AirPort"                      CFDictionary
- *   kSCEntNetAppleTalk                                 "AppleTalk"                    CFDictionary
  *   kSCEntNetDHCP                                      "DHCP"                         CFDictionary
  *   kSCEntNetDNS                                       "DNS"                          CFDictionary
  *   kSCEntNetEthernet                                  "Ethernet"                     CFDictionary
  *   kSCEntNetDHCP                                      "DHCP"                         CFDictionary
  *   kSCEntNetDNS                                       "DNS"                          CFDictionary
  *   kSCEntNetEthernet                                  "Ethernet"                     CFDictionary
  *   --- kSCPropNetAirPortPasswordEncryption values ---
  *   kSCValNetAirPortAuthPasswordEncryptionKeychain     "Keychain"
  *
  *   --- kSCPropNetAirPortPasswordEncryption values ---
  *   kSCValNetAirPortAuthPasswordEncryptionKeychain     "Keychain"
  *
- * kSCEntNetAppleTalk Entity Keys
- *
- *   kSCPropNetAppleTalkComputerName                    "ComputerName"                 CFString
- *   kSCPropNetAppleTalkComputerNameEncoding            "ComputerNameEncoding"         CFNumber
- *   kSCPropNetAppleTalkConfigMethod                    "ConfigMethod"                 CFString
- *   kSCPropNetAppleTalkDefaultZone                     "DefaultZone"                  CFString
- *   kSCPropNetAppleTalkNetworkID                       "NetworkID"                    CFNumber
- *   kSCPropNetAppleTalkNetworkRange                    "NetworkRange"                 CFArray[CFNumber]
- *   kSCPropNetAppleTalkNodeID                          "NodeID"                       CFNumber
- *   kSCPropNetAppleTalkSeedNetworkRange                "SeedNetworkRange"             CFArray[CFNumber]
- *   kSCPropNetAppleTalkSeedZones                       "SeedZones"                    CFArray[CFString]
- *
- *   --- kSCPropNetAppleTalkConfigMethod values ---
- *   kSCValNetAppleTalkConfigMethodNode                 "Node"
- *   kSCValNetAppleTalkConfigMethodRouter               "Router"
- *   kSCValNetAppleTalkConfigMethodSeedRouter           "SeedRouter"
- *
  * kSCEntNetDNS Entity Keys
  *
  *   kSCPropNetDNSDomainName                            "DomainName"                   CFString
  * kSCEntNetDNS Entity Keys
  *
  *   kSCPropNetDNSDomainName                            "DomainName"                   CFString
  *   kSCValNetInterfaceTypeFireWire                     "FireWire"
  *   kSCValNetInterfaceTypePPP                          "PPP"
  *   kSCValNetInterfaceType6to4                         "6to4"
  *   kSCValNetInterfaceTypeFireWire                     "FireWire"
  *   kSCValNetInterfaceTypePPP                          "PPP"
  *   kSCValNetInterfaceType6to4                         "6to4"
+ *   kSCValNetInterfaceTypeIPSec                        "IPSec"
  *
  *   --- kSCPropNetServiceSubType values (for PPP) ---
  *   kSCValNetInterfaceSubTypePPPoE                     "PPPoE"
  *
  *   --- kSCPropNetServiceSubType values (for PPP) ---
  *   kSCValNetInterfaceSubTypePPPoE                     "PPPoE"
  *
  * kSCEntNetIPSec Entity Keys
  *
  *
  * kSCEntNetIPSec Entity Keys
  *
+ *   kSCPropNetIPSecAuthenticationMethod                "AuthenticationMethod"         CFString
+ *   kSCPropNetIPSecLocalCertificate                    "LocalCertificate"             CFData
  *   kSCPropNetIPSecLocalIdentifier                     "LocalIdentifier"              CFString
  *   kSCPropNetIPSecLocalIdentifierType                 "LocalIdentifierType"          CFString
  *   kSCPropNetIPSecLocalIdentifier                     "LocalIdentifier"              CFString
  *   kSCPropNetIPSecLocalIdentifierType                 "LocalIdentifierType"          CFString
- *   kSCPropNetIPSecAuthenticationMethod                "AuthenticationMethod"         CFString
  *   kSCPropNetIPSecSharedSecret                        "SharedSecret"                 CFString
  *   kSCPropNetIPSecSharedSecretEncryption              "SharedSecretEncryption"       CFString
  *   kSCPropNetIPSecSharedSecret                        "SharedSecret"                 CFString
  *   kSCPropNetIPSecSharedSecretEncryption              "SharedSecretEncryption"       CFString
- *   kSCPropNetIPSecLocalCertificate                    "LocalCertificate"             CFData
+ *   kSCPropNetIPSecConnectTime                         "ConnectTime"                  CFNumber
+ *   kSCPropNetIPSecRemoteAddress                       "RemoteAddress"                CFString
+ *   kSCPropNetIPSecStatus                              "Status"                       CFNumber
+ *   kSCPropNetIPSecXAuthEnabled                        "XAuthEnabled"                 CFNumber (0 or 1)
+ *   kSCPropNetIPSecXAuthName                           "XAuthName"                    CFString
+ *   kSCPropNetIPSecXAuthPassword                       "XAuthPassword"                CFString
+ *   kSCPropNetIPSecXAuthPasswordEncryption             "XAuthPasswordEncryption"      CFString
  *
  *   --- kSCPropNetIPSecAuthenticationMethod values ---
  *   kSCValNetIPSecAuthenticationMethodSharedSecret     "SharedSecret"
  *   kSCValNetIPSecAuthenticationMethodCertificate      "Certificate"
  *
  *   --- kSCPropNetIPSecAuthenticationMethod values ---
  *   kSCValNetIPSecAuthenticationMethodSharedSecret     "SharedSecret"
  *   kSCValNetIPSecAuthenticationMethodCertificate      "Certificate"
+ *   kSCValNetIPSecAuthenticationMethodHybrid           "Hybrid"
+ *
+ *   --- kSCPropNetIPSecLocalIdentifierType values ---
+ *   kSCValNetIPSecLocalIdentifierTypeKeyID             "KeyID"
  *
  *   --- kSCPropNetIPSecSharedSecretEncryption values ---
  *   kSCValNetIPSecSharedSecretEncryptionKeychain       "Keychain"
  *
  *
  *   --- kSCPropNetIPSecSharedSecretEncryption values ---
  *   kSCValNetIPSecSharedSecretEncryptionKeychain       "Keychain"
  *
- *   --- kSCPropNetIPSecLocalIdentifierType values ---
- *   kSCValNetIPSecLocalIdentifierTypeKeyID             "KeyID"
+ *   --- kSCPropNetIPSecXAuthPasswordEncryption values ---
+ *   kSCValNetIPSecXAuthPasswordEncryptionKeychain      "Keychain"
+ *   kSCValNetIPSecXAuthPasswordEncryptionPrompt        "Prompt"
  *
  * kSCEntNetIPv4 Entity Keys
  *
  *
  * kSCEntNetIPv4 Entity Keys
  *
  *   kSCPropNetIPv4BroadcastAddresses                   "BroadcastAddresses"           CFArray[CFString]
  *
  *   --- kSCPropNetIPv4ConfigMethod values ---
  *   kSCPropNetIPv4BroadcastAddresses                   "BroadcastAddresses"           CFArray[CFString]
  *
  *   --- kSCPropNetIPv4ConfigMethod values ---
+ *   kSCValNetIPv4ConfigMethodAutomatic                 "Automatic"
  *   kSCValNetIPv4ConfigMethodBOOTP                     "BOOTP"
  *   kSCValNetIPv4ConfigMethodDHCP                      "DHCP"
  *   kSCValNetIPv4ConfigMethodINFORM                    "INFORM"
  *   kSCValNetIPv4ConfigMethodBOOTP                     "BOOTP"
  *   kSCValNetIPv4ConfigMethodDHCP                      "DHCP"
  *   kSCValNetIPv4ConfigMethodINFORM                    "INFORM"
  */
 
 
  */
 
 
-#ifndef _SCSCHEMADEFINITIONS_H
-#define _SCSCHEMADEFINITIONS_H
+#ifndef        _SCSCHEMADEFINITIONS_H
+#ifdef USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS
+#include <SystemConfiguration/_SCSchemaDefinitions.h>
+#else  /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
+#define        _SCSCHEMADEFINITIONS_H
 
 /* -------------------- Macro declarations -------------------- */
 
 
 /* -------------------- Macro declarations -------------------- */
 
-#include <AvailabilityMacros.h>
+#include <Availability.h>
+#include <TargetConditionals.h>
 
 /*
  * let's "do the right thing" for those wishing to build for
  * Mac OS X 10.1.0 ... 10.2.x
  */
 
 /*
  * let's "do the right thing" for those wishing to build for
  * Mac OS X 10.1.0 ... 10.2.x
  */
-#if MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
+#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (__MAC_OS_X_VERSION_MIN_REQUIRED <= 1020) && !defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
   #ifndef SCSTR
     #include <CoreFoundation/CFString.h>
     #define SCSTR(s) CFSTR(s)
   #ifndef SCSTR
     #include <CoreFoundation/CFString.h>
     #define SCSTR(s) CFSTR(s)
     #define SC_SCHEMA_DECLARATION(k,q) extern NSString * k q;
   #endif
 #endif
     #define SC_SCHEMA_DECLARATION(k,q) extern NSString * k q;
   #endif
 #endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) && (MAC_OS_X_VERSION_MAX_ALLOWED <= 1040)
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) && (__MAC_OS_X_VERSION_MAX_ALLOWED <= 1040) && !defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
   #ifndef SCSTR
     #include <CoreFoundation/CFString.h>
     #define SCSTR(s) CFSTR(s)
   #ifndef SCSTR
     #include <CoreFoundation/CFString.h>
     #define SCSTR(s) CFSTR(s)
@@ -663,7 +663,7 @@ extern const CFStringRef kSCEntNetAirPort;
 
 /*!
   @const kSCEntNetAppleTalk
 
 /*!
   @const kSCEntNetAppleTalk
-  @availability Introduced in Mac OS X 10.1.
+  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6.
  */
 extern const CFStringRef kSCEntNetAppleTalk;
 
  */
 extern const CFStringRef kSCEntNetAppleTalk;
 
@@ -911,73 +911,73 @@ extern const CFStringRef kSCValNetAirPortAuthPasswordEncryptionKeychain;
 
 /*!
   @const kSCPropNetAppleTalkComputerName
 
 /*!
   @const kSCPropNetAppleTalkComputerName
-  @availability Introduced in Mac OS X 10.1.
+  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6.
  */
 extern const CFStringRef kSCPropNetAppleTalkComputerName;
 
 /*!
   @const kSCPropNetAppleTalkComputerNameEncoding
  */
 extern const CFStringRef kSCPropNetAppleTalkComputerName;
 
 /*!
   @const kSCPropNetAppleTalkComputerNameEncoding
-  @availability Introduced in Mac OS X 10.1.
+  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6.
  */
 extern const CFStringRef kSCPropNetAppleTalkComputerNameEncoding;
 
 /*!
   @const kSCPropNetAppleTalkConfigMethod
  */
 extern const CFStringRef kSCPropNetAppleTalkComputerNameEncoding;
 
 /*!
   @const kSCPropNetAppleTalkConfigMethod
-  @availability Introduced in Mac OS X 10.1.
+  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6.
  */
 extern const CFStringRef kSCPropNetAppleTalkConfigMethod;
 
 /*!
   @const kSCPropNetAppleTalkDefaultZone
  */
 extern const CFStringRef kSCPropNetAppleTalkConfigMethod;
 
 /*!
   @const kSCPropNetAppleTalkDefaultZone
-  @availability Introduced in Mac OS X 10.1.
+  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6.
  */
 extern const CFStringRef kSCPropNetAppleTalkDefaultZone;
 
 /*!
   @const kSCPropNetAppleTalkNetworkID
  */
 extern const CFStringRef kSCPropNetAppleTalkDefaultZone;
 
 /*!
   @const kSCPropNetAppleTalkNetworkID
-  @availability Introduced in Mac OS X 10.1.
+  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6.
  */
 extern const CFStringRef kSCPropNetAppleTalkNetworkID;
 
 /*!
   @const kSCPropNetAppleTalkNetworkRange
  */
 extern const CFStringRef kSCPropNetAppleTalkNetworkID;
 
 /*!
   @const kSCPropNetAppleTalkNetworkRange
-  @availability Introduced in Mac OS X 10.2.
+  @availability Introduced in Mac OS X 10.2, but later deprecated in Mac OS X 10.6.
  */
 extern const CFStringRef kSCPropNetAppleTalkNetworkRange;
 
 /*!
   @const kSCPropNetAppleTalkNodeID
  */
 extern const CFStringRef kSCPropNetAppleTalkNetworkRange;
 
 /*!
   @const kSCPropNetAppleTalkNodeID
-  @availability Introduced in Mac OS X 10.1.
+  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6.
  */
 extern const CFStringRef kSCPropNetAppleTalkNodeID;
 
 /*!
   @const kSCPropNetAppleTalkSeedNetworkRange
  */
 extern const CFStringRef kSCPropNetAppleTalkNodeID;
 
 /*!
   @const kSCPropNetAppleTalkSeedNetworkRange
-  @availability Introduced in Mac OS X 10.1.
+  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6.
  */
 extern const CFStringRef kSCPropNetAppleTalkSeedNetworkRange;
 
 /*!
   @const kSCPropNetAppleTalkSeedZones
  */
 extern const CFStringRef kSCPropNetAppleTalkSeedNetworkRange;
 
 /*!
   @const kSCPropNetAppleTalkSeedZones
-  @availability Introduced in Mac OS X 10.1.
+  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6.
  */
 extern const CFStringRef kSCPropNetAppleTalkSeedZones;
 
 /*!
   @const kSCValNetAppleTalkConfigMethodNode
  */
 extern const CFStringRef kSCPropNetAppleTalkSeedZones;
 
 /*!
   @const kSCValNetAppleTalkConfigMethodNode
-  @availability Introduced in Mac OS X 10.1.
+  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6.
  */
 extern const CFStringRef kSCValNetAppleTalkConfigMethodNode;
 
 /*!
   @const kSCValNetAppleTalkConfigMethodRouter
  */
 extern const CFStringRef kSCValNetAppleTalkConfigMethodNode;
 
 /*!
   @const kSCValNetAppleTalkConfigMethodRouter
-  @availability Introduced in Mac OS X 10.1.
+  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6.
  */
 extern const CFStringRef kSCValNetAppleTalkConfigMethodRouter;
 
 /*!
   @const kSCValNetAppleTalkConfigMethodSeedRouter
  */
 extern const CFStringRef kSCValNetAppleTalkConfigMethodRouter;
 
 /*!
   @const kSCValNetAppleTalkConfigMethodSeedRouter
-  @availability Introduced in Mac OS X 10.1.
+  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6.
  */
 extern const CFStringRef kSCValNetAppleTalkConfigMethodSeedRouter;
 
  */
 extern const CFStringRef kSCValNetAppleTalkConfigMethodSeedRouter;
 
@@ -1129,6 +1129,12 @@ extern const CFStringRef kSCValNetInterfaceTypePPP;
  */
 extern const CFStringRef kSCValNetInterfaceType6to4;
 
  */
 extern const CFStringRef kSCValNetInterfaceType6to4;
 
+/*!
+  @const kSCValNetInterfaceTypeIPSec
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCValNetInterfaceTypeIPSec;
+
 /*!
   @const kSCValNetInterfaceSubTypePPPoE
   @availability Introduced in Mac OS X 10.1.
 /*!
   @const kSCValNetInterfaceSubTypePPPoE
   @availability Introduced in Mac OS X 10.1.
@@ -1158,22 +1164,28 @@ extern const CFStringRef kSCValNetInterfaceSubTypeL2TP;
  */
 
 /*!
  */
 
 /*!
-  @const kSCPropNetIPSecLocalIdentifier
+  @const kSCPropNetIPSecAuthenticationMethod
   @availability Introduced in Mac OS X 10.5.
  */
   @availability Introduced in Mac OS X 10.5.
  */
-extern const CFStringRef kSCPropNetIPSecLocalIdentifier;
+extern const CFStringRef kSCPropNetIPSecAuthenticationMethod;
 
 /*!
 
 /*!
-  @const kSCPropNetIPSecLocalIdentifierType
+  @const kSCPropNetIPSecLocalCertificate
   @availability Introduced in Mac OS X 10.5.
  */
   @availability Introduced in Mac OS X 10.5.
  */
-extern const CFStringRef kSCPropNetIPSecLocalIdentifierType;
+extern const CFStringRef kSCPropNetIPSecLocalCertificate;
 
 /*!
 
 /*!
-  @const kSCPropNetIPSecAuthenticationMethod
+  @const kSCPropNetIPSecLocalIdentifier
   @availability Introduced in Mac OS X 10.5.
  */
   @availability Introduced in Mac OS X 10.5.
  */
-extern const CFStringRef kSCPropNetIPSecAuthenticationMethod;
+extern const CFStringRef kSCPropNetIPSecLocalIdentifier;
+
+/*!
+  @const kSCPropNetIPSecLocalIdentifierType
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCPropNetIPSecLocalIdentifierType;
 
 /*!
   @const kSCPropNetIPSecSharedSecret
 
 /*!
   @const kSCPropNetIPSecSharedSecret
@@ -1188,10 +1200,46 @@ extern const CFStringRef kSCPropNetIPSecSharedSecret;
 extern const CFStringRef kSCPropNetIPSecSharedSecretEncryption;
 
 /*!
 extern const CFStringRef kSCPropNetIPSecSharedSecretEncryption;
 
 /*!
-  @const kSCPropNetIPSecLocalCertificate
-  @availability Introduced in Mac OS X 10.5.
+  @const kSCPropNetIPSecConnectTime
+  @availability Introduced in Mac OS X 10.6.
  */
  */
-extern const CFStringRef kSCPropNetIPSecLocalCertificate;
+extern const CFStringRef kSCPropNetIPSecConnectTime;
+
+/*!
+  @const kSCPropNetIPSecRemoteAddress
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCPropNetIPSecRemoteAddress;
+
+/*!
+  @const kSCPropNetIPSecStatus
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCPropNetIPSecStatus;
+
+/*!
+  @const kSCPropNetIPSecXAuthEnabled
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCPropNetIPSecXAuthEnabled;
+
+/*!
+  @const kSCPropNetIPSecXAuthName
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCPropNetIPSecXAuthName;
+
+/*!
+  @const kSCPropNetIPSecXAuthPassword
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCPropNetIPSecXAuthPassword;
+
+/*!
+  @const kSCPropNetIPSecXAuthPasswordEncryption
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCPropNetIPSecXAuthPasswordEncryption;
 
 /*!
   @const kSCValNetIPSecAuthenticationMethodSharedSecret
 
 /*!
   @const kSCValNetIPSecAuthenticationMethodSharedSecret
@@ -1206,10 +1254,10 @@ extern const CFStringRef kSCValNetIPSecAuthenticationMethodSharedSecret;
 extern const CFStringRef kSCValNetIPSecAuthenticationMethodCertificate;
 
 /*!
 extern const CFStringRef kSCValNetIPSecAuthenticationMethodCertificate;
 
 /*!
-  @const kSCValNetIPSecSharedSecretEncryptionKeychain
+  @const kSCValNetIPSecAuthenticationMethodHybrid
   @availability Introduced in Mac OS X 10.5.
  */
   @availability Introduced in Mac OS X 10.5.
  */
-extern const CFStringRef kSCValNetIPSecSharedSecretEncryptionKeychain;
+extern const CFStringRef kSCValNetIPSecAuthenticationMethodHybrid;
 
 /*!
   @const kSCValNetIPSecLocalIdentifierTypeKeyID
 
 /*!
   @const kSCValNetIPSecLocalIdentifierTypeKeyID
@@ -1217,6 +1265,24 @@ extern const CFStringRef kSCValNetIPSecSharedSecretEncryptionKeychain;
  */
 extern const CFStringRef kSCValNetIPSecLocalIdentifierTypeKeyID;
 
  */
 extern const CFStringRef kSCValNetIPSecLocalIdentifierTypeKeyID;
 
+/*!
+  @const kSCValNetIPSecSharedSecretEncryptionKeychain
+  @availability Introduced in Mac OS X 10.5.
+ */
+extern const CFStringRef kSCValNetIPSecSharedSecretEncryptionKeychain;
+
+/*!
+  @const kSCValNetIPSecXAuthPasswordEncryptionKeychain
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCValNetIPSecXAuthPasswordEncryptionKeychain;
+
+/*!
+  @const kSCValNetIPSecXAuthPasswordEncryptionPrompt
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCValNetIPSecXAuthPasswordEncryptionPrompt;
+
 /*!
   @group kSCEntNetIPv4 Entity Keys
  */
 /*!
   @group kSCEntNetIPv4 Entity Keys
  */
@@ -1263,6 +1329,12 @@ extern const CFStringRef kSCPropNetIPv4DestAddresses;
  */
 extern const CFStringRef kSCPropNetIPv4BroadcastAddresses;
 
  */
 extern const CFStringRef kSCPropNetIPv4BroadcastAddresses;
 
+/*!
+  @const kSCValNetIPv4ConfigMethodAutomatic
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCValNetIPv4ConfigMethodAutomatic;
+
 /*!
   @const kSCValNetIPv4ConfigMethodBOOTP
   @availability Introduced in Mac OS X 10.1.
 /*!
   @const kSCValNetIPv4ConfigMethodBOOTP
   @availability Introduced in Mac OS X 10.1.
@@ -2315,2754 +2387,2333 @@ extern const CFStringRef kSCPropUsersConsoleUserGID;
 /* -------------------- Schema declarations -------------------- */
 
 
 /* -------------------- Schema declarations -------------------- */
 
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCResvLink, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCResvLink, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCResvLink                                                   \
          SC_SCHEMA_KV(kSCResvLink                                      \
                      ,"__LINK__"                                       \
                      ,CFString                                         )
 #endif
 
   #define kSCResvLink                                                   \
          SC_SCHEMA_KV(kSCResvLink                                      \
                      ,"__LINK__"                                       \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCResvInactive, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCResvInactive, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCResvInactive                                               \
          SC_SCHEMA_KV(kSCResvInactive                                  \
                      ,"__INACTIVE__"                                   \
                      ,                                                 )
 #endif
 
   #define kSCResvInactive                                               \
          SC_SCHEMA_KV(kSCResvInactive                                  \
                      ,"__INACTIVE__"                                   \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropInterfaceName, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropInterfaceName, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropInterfaceName                                          \
          SC_SCHEMA_KV(kSCPropInterfaceName                             \
                      ,"InterfaceName"                                  \
                      ,CFString                                         )
 #endif
 
   #define kSCPropInterfaceName                                          \
          SC_SCHEMA_KV(kSCPropInterfaceName                             \
                      ,"InterfaceName"                                  \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropMACAddress, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropMACAddress, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropMACAddress                                             \
          SC_SCHEMA_KV(kSCPropMACAddress                                \
                      ,"MACAddress"                                     \
                      ,CFString                                         )
 #endif
 
   #define kSCPropMACAddress                                             \
          SC_SCHEMA_KV(kSCPropMACAddress                                \
                      ,"MACAddress"                                     \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropUserDefinedName, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropUserDefinedName, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropUserDefinedName                                        \
          SC_SCHEMA_KV(kSCPropUserDefinedName                           \
                      ,"UserDefinedName"                                \
                      ,CFString                                         )
 #endif
 
   #define kSCPropUserDefinedName                                        \
          SC_SCHEMA_KV(kSCPropUserDefinedName                           \
                      ,"UserDefinedName"                                \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropVersion, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropVersion, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropVersion                                                \
          SC_SCHEMA_KV(kSCPropVersion                                   \
                      ,"Version"                                        \
                      ,CFString                                         )
 #endif
 
   #define kSCPropVersion                                                \
          SC_SCHEMA_KV(kSCPropVersion                                   \
                      ,"Version"                                        \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPrefCurrentSet, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPrefCurrentSet, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPrefCurrentSet                                             \
          SC_SCHEMA_KV(kSCPrefCurrentSet                                \
                      ,"CurrentSet"                                     \
                      ,CFString                                         )
 #endif
 
   #define kSCPrefCurrentSet                                             \
          SC_SCHEMA_KV(kSCPrefCurrentSet                                \
                      ,"CurrentSet"                                     \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPrefNetworkServices, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPrefNetworkServices, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPrefNetworkServices                                        \
          SC_SCHEMA_KV(kSCPrefNetworkServices                           \
                      ,"NetworkServices"                                \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCPrefNetworkServices                                        \
          SC_SCHEMA_KV(kSCPrefNetworkServices                           \
                      ,"NetworkServices"                                \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPrefSets, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPrefSets, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPrefSets                                                   \
          SC_SCHEMA_KV(kSCPrefSets                                      \
                      ,"Sets"                                           \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCPrefSets                                                   \
          SC_SCHEMA_KV(kSCPrefSets                                      \
                      ,"Sets"                                           \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPrefSystem, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPrefSystem, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPrefSystem                                                 \
          SC_SCHEMA_KV(kSCPrefSystem                                    \
                      ,"System"                                         \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCPrefSystem                                                 \
          SC_SCHEMA_KV(kSCPrefSystem                                    \
                      ,"System"                                         \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCCompNetwork, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCCompNetwork, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCCompNetwork                                                \
          SC_SCHEMA_KV(kSCCompNetwork                                   \
                      ,"Network"                                        \
                      ,                                                 )
 #endif
 
   #define kSCCompNetwork                                                \
          SC_SCHEMA_KV(kSCCompNetwork                                   \
                      ,"Network"                                        \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCCompService, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCCompService, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCCompService                                                \
          SC_SCHEMA_KV(kSCCompService                                   \
                      ,"Service"                                        \
                      ,                                                 )
 #endif
 
   #define kSCCompService                                                \
          SC_SCHEMA_KV(kSCCompService                                   \
                      ,"Service"                                        \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCCompGlobal, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCCompGlobal, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCCompGlobal                                                 \
          SC_SCHEMA_KV(kSCCompGlobal                                    \
                      ,"Global"                                         \
                      ,                                                 )
 #endif
 
   #define kSCCompGlobal                                                 \
          SC_SCHEMA_KV(kSCCompGlobal                                    \
                      ,"Global"                                         \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCCompHostNames, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCCompHostNames, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCCompHostNames                                              \
          SC_SCHEMA_KV(kSCCompHostNames                                 \
                      ,"HostNames"                                      \
                      ,                                                 )
 #endif
 
   #define kSCCompHostNames                                              \
          SC_SCHEMA_KV(kSCCompHostNames                                 \
                      ,"HostNames"                                      \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCCompInterface, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCCompInterface, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCCompInterface                                              \
          SC_SCHEMA_KV(kSCCompInterface                                 \
                      ,"Interface"                                      \
                      ,                                                 )
 #endif
 
   #define kSCCompInterface                                              \
          SC_SCHEMA_KV(kSCCompInterface                                 \
                      ,"Interface"                                      \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCCompSystem, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCCompSystem, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCCompSystem                                                 \
          SC_SCHEMA_KV(kSCCompSystem                                    \
                      ,"System"                                         \
                      ,                                                 )
 #endif
 
   #define kSCCompSystem                                                 \
          SC_SCHEMA_KV(kSCCompSystem                                    \
                      ,"System"                                         \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCCompUsers, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCCompUsers, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCCompUsers                                                  \
          SC_SCHEMA_KV(kSCCompUsers                                     \
                      ,"Users"                                          \
                      ,                                                 )
 #endif
 
   #define kSCCompUsers                                                  \
          SC_SCHEMA_KV(kSCCompUsers                                     \
                      ,"Users"                                          \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCCompAnyRegex, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCCompAnyRegex, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCCompAnyRegex                                               \
          SC_SCHEMA_KV(kSCCompAnyRegex                                  \
                      ,"[^/]+"                                          \
                      ,                                                 )
 #endif
 
   #define kSCCompAnyRegex                                               \
          SC_SCHEMA_KV(kSCCompAnyRegex                                  \
                      ,"[^/]+"                                          \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCEntNetAirPort, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCEntNetAirPort, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCEntNetAirPort                                              \
          SC_SCHEMA_KV(kSCEntNetAirPort                                 \
                      ,"AirPort"                                        \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNetAirPort                                              \
          SC_SCHEMA_KV(kSCEntNetAirPort                                 \
                      ,"AirPort"                                        \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCEntNetAppleTalk, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+#if !TARGET_OS_IPHONE
+
+  SC_SCHEMA_DECLARATION(kSCEntNetAppleTalk, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCEntNetAppleTalk                                            \
          SC_SCHEMA_KV(kSCEntNetAppleTalk                               \
                      ,"AppleTalk"                                      \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNetAppleTalk                                            \
          SC_SCHEMA_KV(kSCEntNetAppleTalk                               \
                      ,"AppleTalk"                                      \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCEntNetDHCP, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+#endif // !TARGET_OS_IPHONE
+
+  SC_SCHEMA_DECLARATION(kSCEntNetDHCP, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCEntNetDHCP                                                 \
          SC_SCHEMA_KV(kSCEntNetDHCP                                    \
                      ,"DHCP"                                           \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNetDHCP                                                 \
          SC_SCHEMA_KV(kSCEntNetDHCP                                    \
                      ,"DHCP"                                           \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCEntNetDNS, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCEntNetDNS, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCEntNetDNS                                                  \
          SC_SCHEMA_KV(kSCEntNetDNS                                     \
                      ,"DNS"                                            \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNetDNS                                                  \
          SC_SCHEMA_KV(kSCEntNetDNS                                     \
                      ,"DNS"                                            \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCEntNetEthernet, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCEntNetEthernet, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCEntNetEthernet                                             \
          SC_SCHEMA_KV(kSCEntNetEthernet                                \
                      ,"Ethernet"                                       \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNetEthernet                                             \
          SC_SCHEMA_KV(kSCEntNetEthernet                                \
                      ,"Ethernet"                                       \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCEntNetFireWire, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCEntNetFireWire, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCEntNetFireWire                                             \
          SC_SCHEMA_KV(kSCEntNetFireWire                                \
                      ,"FireWire"                                       \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNetFireWire                                             \
          SC_SCHEMA_KV(kSCEntNetFireWire                                \
                      ,"FireWire"                                       \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCEntNetInterface, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCEntNetInterface, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCEntNetInterface                                            \
          SC_SCHEMA_KV(kSCEntNetInterface                               \
                      ,"Interface"                                      \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNetInterface                                            \
          SC_SCHEMA_KV(kSCEntNetInterface                               \
                      ,"Interface"                                      \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCEntNetIPSec, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCEntNetIPSec, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCEntNetIPSec                                                \
          SC_SCHEMA_KV(kSCEntNetIPSec                                   \
                      ,"IPSec"                                          \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNetIPSec                                                \
          SC_SCHEMA_KV(kSCEntNetIPSec                                   \
                      ,"IPSec"                                          \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCEntNetIPv4, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCEntNetIPv4, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCEntNetIPv4                                                 \
          SC_SCHEMA_KV(kSCEntNetIPv4                                    \
                      ,"IPv4"                                           \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNetIPv4                                                 \
          SC_SCHEMA_KV(kSCEntNetIPv4                                    \
                      ,"IPv4"                                           \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCEntNetIPv6, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCEntNetIPv6, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCEntNetIPv6                                                 \
          SC_SCHEMA_KV(kSCEntNetIPv6                                    \
                      ,"IPv6"                                           \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNetIPv6                                                 \
          SC_SCHEMA_KV(kSCEntNetIPv6                                    \
                      ,"IPv6"                                           \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCEntNetL2TP, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCEntNetL2TP, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCEntNetL2TP                                                 \
          SC_SCHEMA_KV(kSCEntNetL2TP                                    \
                      ,"L2TP"                                           \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNetL2TP                                                 \
          SC_SCHEMA_KV(kSCEntNetL2TP                                    \
                      ,"L2TP"                                           \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCEntNetLink, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCEntNetLink, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCEntNetLink                                                 \
          SC_SCHEMA_KV(kSCEntNetLink                                    \
                      ,"Link"                                           \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNetLink                                                 \
          SC_SCHEMA_KV(kSCEntNetLink                                    \
                      ,"Link"                                           \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCEntNetModem, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCEntNetModem, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCEntNetModem                                                \
          SC_SCHEMA_KV(kSCEntNetModem                                   \
                      ,"Modem"                                          \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNetModem                                                \
          SC_SCHEMA_KV(kSCEntNetModem                                   \
                      ,"Modem"                                          \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCEntNetNetInfo, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+#if !TARGET_OS_IPHONE
+
+  SC_SCHEMA_DECLARATION(kSCEntNetNetInfo, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCEntNetNetInfo                                              \
          SC_SCHEMA_KV(kSCEntNetNetInfo                                 \
                      ,"NetInfo"                                        \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNetNetInfo                                              \
          SC_SCHEMA_KV(kSCEntNetNetInfo                                 \
                      ,"NetInfo"                                        \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCEntNetPPP, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+#endif // !TARGET_OS_IPHONE
+
+  SC_SCHEMA_DECLARATION(kSCEntNetPPP, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCEntNetPPP                                                  \
          SC_SCHEMA_KV(kSCEntNetPPP                                     \
                      ,"PPP"                                            \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNetPPP                                                  \
          SC_SCHEMA_KV(kSCEntNetPPP                                     \
                      ,"PPP"                                            \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCEntNetPPPoE, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCEntNetPPPoE, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCEntNetPPPoE                                                \
          SC_SCHEMA_KV(kSCEntNetPPPoE                                   \
                      ,"PPPoE"                                          \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNetPPPoE                                                \
          SC_SCHEMA_KV(kSCEntNetPPPoE                                   \
                      ,"PPPoE"                                          \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCEntNetPPPSerial, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCEntNetPPPSerial, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCEntNetPPPSerial                                            \
          SC_SCHEMA_KV(kSCEntNetPPPSerial                               \
                      ,"PPPSerial"                                      \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNetPPPSerial                                            \
          SC_SCHEMA_KV(kSCEntNetPPPSerial                               \
                      ,"PPPSerial"                                      \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCEntNetPPTP, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCEntNetPPTP, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCEntNetPPTP                                                 \
          SC_SCHEMA_KV(kSCEntNetPPTP                                    \
                      ,"PPTP"                                           \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNetPPTP                                                 \
          SC_SCHEMA_KV(kSCEntNetPPTP                                    \
                      ,"PPTP"                                           \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCEntNetProxies, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCEntNetProxies, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCEntNetProxies                                              \
          SC_SCHEMA_KV(kSCEntNetProxies                                 \
                      ,"Proxies"                                        \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNetProxies                                              \
          SC_SCHEMA_KV(kSCEntNetProxies                                 \
                      ,"Proxies"                                        \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCEntNetSMB, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+#if !TARGET_OS_IPHONE
+
+  SC_SCHEMA_DECLARATION(kSCEntNetSMB, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCEntNetSMB                                                  \
          SC_SCHEMA_KV(kSCEntNetSMB                                     \
                      ,"SMB"                                            \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNetSMB                                                  \
          SC_SCHEMA_KV(kSCEntNetSMB                                     \
                      ,"SMB"                                            \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCEntNet6to4, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+#endif // !TARGET_OS_IPHONE
+
+  SC_SCHEMA_DECLARATION(kSCEntNet6to4, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCEntNet6to4                                                 \
          SC_SCHEMA_KV(kSCEntNet6to4                                    \
                      ,"6to4"                                           \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNet6to4                                                 \
          SC_SCHEMA_KV(kSCEntNet6to4                                    \
                      ,"6to4"                                           \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetOverridePrimary, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetOverridePrimary, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetOverridePrimary                                     \
          SC_SCHEMA_KV(kSCPropNetOverridePrimary                        \
                      ,"OverridePrimary"                                \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetOverridePrimary                                     \
          SC_SCHEMA_KV(kSCPropNetOverridePrimary                        \
                      ,"OverridePrimary"                                \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetServiceOrder, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetServiceOrder, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetServiceOrder                                        \
          SC_SCHEMA_KV(kSCPropNetServiceOrder                           \
                      ,"ServiceOrder"                                   \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetServiceOrder                                        \
          SC_SCHEMA_KV(kSCPropNetServiceOrder                           \
                      ,"ServiceOrder"                                   \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPOverridePrimary, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPOverridePrimary, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPOverridePrimary                                  \
          SC_SCHEMA_KV(kSCPropNetPPPOverridePrimary                     \
                      ,"PPPOverridePrimary"                             \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPOverridePrimary                                  \
          SC_SCHEMA_KV(kSCPropNetPPPOverridePrimary                     \
                      ,"PPPOverridePrimary"                             \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetInterfaces, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetInterfaces, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetInterfaces                                          \
          SC_SCHEMA_KV(kSCPropNetInterfaces                             \
                      ,"Interfaces"                                     \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetInterfaces                                          \
          SC_SCHEMA_KV(kSCPropNetInterfaces                             \
                      ,"Interfaces"                                     \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetLocalHostName, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetLocalHostName, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetLocalHostName                                       \
          SC_SCHEMA_KV(kSCPropNetLocalHostName                          \
                      ,"LocalHostName"                                  \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetLocalHostName                                       \
          SC_SCHEMA_KV(kSCPropNetLocalHostName                          \
                      ,"LocalHostName"                                  \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetAirPortAllowNetCreation, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetAirPortAllowNetCreation, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetAirPortAllowNetCreation                             \
          SC_SCHEMA_KV(kSCPropNetAirPortAllowNetCreation                \
                      ,"AllowNetCreation"                               \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetAirPortAllowNetCreation                             \
          SC_SCHEMA_KV(kSCPropNetAirPortAllowNetCreation                \
                      ,"AllowNetCreation"                               \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetAirPortAuthPassword, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetAirPortAuthPassword, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetAirPortAuthPassword                                 \
          SC_SCHEMA_KV(kSCPropNetAirPortAuthPassword                    \
                      ,"AuthPassword"                                   \
                      ,CFData                                           )
 #endif
 
   #define kSCPropNetAirPortAuthPassword                                 \
          SC_SCHEMA_KV(kSCPropNetAirPortAuthPassword                    \
                      ,"AuthPassword"                                   \
                      ,CFData                                           )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetAirPortAuthPasswordEncryption, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetAirPortAuthPasswordEncryption, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetAirPortAuthPasswordEncryption                       \
          SC_SCHEMA_KV(kSCPropNetAirPortAuthPasswordEncryption          \
                      ,"AuthPasswordEncryption"                         \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetAirPortAuthPasswordEncryption                       \
          SC_SCHEMA_KV(kSCPropNetAirPortAuthPasswordEncryption          \
                      ,"AuthPasswordEncryption"                         \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetAirPortJoinMode, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetAirPortJoinMode, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetAirPortJoinMode                                     \
          SC_SCHEMA_KV(kSCPropNetAirPortJoinMode                        \
                      ,"JoinMode"                                       \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetAirPortJoinMode                                     \
          SC_SCHEMA_KV(kSCPropNetAirPortJoinMode                        \
                      ,"JoinMode"                                       \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetAirPortPowerEnabled, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetAirPortPowerEnabled, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetAirPortPowerEnabled                                 \
          SC_SCHEMA_KV(kSCPropNetAirPortPowerEnabled                    \
                      ,"PowerEnabled"                                   \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetAirPortPowerEnabled                                 \
          SC_SCHEMA_KV(kSCPropNetAirPortPowerEnabled                    \
                      ,"PowerEnabled"                                   \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetAirPortPreferredNetwork, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetAirPortPreferredNetwork, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetAirPortPreferredNetwork                             \
          SC_SCHEMA_KV(kSCPropNetAirPortPreferredNetwork                \
                      ,"PreferredNetwork"                               \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetAirPortPreferredNetwork                             \
          SC_SCHEMA_KV(kSCPropNetAirPortPreferredNetwork                \
                      ,"PreferredNetwork"                               \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetAirPortSavePasswords, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetAirPortSavePasswords, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetAirPortSavePasswords                                \
          SC_SCHEMA_KV(kSCPropNetAirPortSavePasswords                   \
                      ,"SavePasswords"                                  \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetAirPortSavePasswords                                \
          SC_SCHEMA_KV(kSCPropNetAirPortSavePasswords                   \
                      ,"SavePasswords"                                  \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetAirPortJoinModeAutomatic, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCValNetAirPortJoinModeAutomatic, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetAirPortJoinModeAutomatic                             \
          SC_SCHEMA_KV(kSCValNetAirPortJoinModeAutomatic                \
                      ,"Automatic"                                      \
                      ,                                                 )
 #endif
 
   #define kSCValNetAirPortJoinModeAutomatic                             \
          SC_SCHEMA_KV(kSCValNetAirPortJoinModeAutomatic                \
                      ,"Automatic"                                      \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetAirPortJoinModePreferred, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCValNetAirPortJoinModePreferred, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetAirPortJoinModePreferred                             \
          SC_SCHEMA_KV(kSCValNetAirPortJoinModePreferred                \
                      ,"Preferred"                                      \
                      ,                                                 )
 #endif
 
   #define kSCValNetAirPortJoinModePreferred                             \
          SC_SCHEMA_KV(kSCValNetAirPortJoinModePreferred                \
                      ,"Preferred"                                      \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCValNetAirPortJoinModeRanked, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+  SC_SCHEMA_DECLARATION(kSCValNetAirPortJoinModeRanked, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetAirPortJoinModeRanked                                \
          SC_SCHEMA_KV(kSCValNetAirPortJoinModeRanked                   \
                      ,"Ranked"                                         \
                      ,                                                 )
 #endif
 
   #define kSCValNetAirPortJoinModeRanked                                \
          SC_SCHEMA_KV(kSCValNetAirPortJoinModeRanked                   \
                      ,"Ranked"                                         \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetAirPortJoinModeRecent, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCValNetAirPortJoinModeRecent, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetAirPortJoinModeRecent                                \
          SC_SCHEMA_KV(kSCValNetAirPortJoinModeRecent                   \
                      ,"Recent"                                         \
                      ,                                                 )
 #endif
 
   #define kSCValNetAirPortJoinModeRecent                                \
          SC_SCHEMA_KV(kSCValNetAirPortJoinModeRecent                   \
                      ,"Recent"                                         \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetAirPortJoinModeStrongest, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCValNetAirPortJoinModeStrongest, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetAirPortJoinModeStrongest                             \
          SC_SCHEMA_KV(kSCValNetAirPortJoinModeStrongest                \
                      ,"Strongest"                                      \
                      ,                                                 )
 #endif
 
   #define kSCValNetAirPortJoinModeStrongest                             \
          SC_SCHEMA_KV(kSCValNetAirPortJoinModeStrongest                \
                      ,"Strongest"                                      \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetAirPortAuthPasswordEncryptionKeychain, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCValNetAirPortAuthPasswordEncryptionKeychain, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetAirPortAuthPasswordEncryptionKeychain                \
          SC_SCHEMA_KV(kSCValNetAirPortAuthPasswordEncryptionKeychain   \
                      ,"Keychain"                                       \
                      ,                                                 )
 #endif
 
   #define kSCValNetAirPortAuthPasswordEncryptionKeychain                \
          SC_SCHEMA_KV(kSCValNetAirPortAuthPasswordEncryptionKeychain   \
                      ,"Keychain"                                       \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkComputerName, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+#if !TARGET_OS_IPHONE
+
+  SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkComputerName, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCPropNetAppleTalkComputerName                               \
          SC_SCHEMA_KV(kSCPropNetAppleTalkComputerName                  \
                      ,"ComputerName"                                   \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetAppleTalkComputerName                               \
          SC_SCHEMA_KV(kSCPropNetAppleTalkComputerName                  \
                      ,"ComputerName"                                   \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkComputerNameEncoding, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkComputerNameEncoding, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCPropNetAppleTalkComputerNameEncoding                       \
          SC_SCHEMA_KV(kSCPropNetAppleTalkComputerNameEncoding          \
                      ,"ComputerNameEncoding"                           \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetAppleTalkComputerNameEncoding                       \
          SC_SCHEMA_KV(kSCPropNetAppleTalkComputerNameEncoding          \
                      ,"ComputerNameEncoding"                           \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkConfigMethod, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkConfigMethod, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCPropNetAppleTalkConfigMethod                               \
          SC_SCHEMA_KV(kSCPropNetAppleTalkConfigMethod                  \
                      ,"ConfigMethod"                                   \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetAppleTalkConfigMethod                               \
          SC_SCHEMA_KV(kSCPropNetAppleTalkConfigMethod                  \
                      ,"ConfigMethod"                                   \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkDefaultZone, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkDefaultZone, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCPropNetAppleTalkDefaultZone                                \
          SC_SCHEMA_KV(kSCPropNetAppleTalkDefaultZone                   \
                      ,"DefaultZone"                                    \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetAppleTalkDefaultZone                                \
          SC_SCHEMA_KV(kSCPropNetAppleTalkDefaultZone                   \
                      ,"DefaultZone"                                    \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkNetworkID, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkNetworkID, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCPropNetAppleTalkNetworkID                                  \
          SC_SCHEMA_KV(kSCPropNetAppleTalkNetworkID                     \
                      ,"NetworkID"                                      \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetAppleTalkNetworkID                                  \
          SC_SCHEMA_KV(kSCPropNetAppleTalkNetworkID                     \
                      ,"NetworkID"                                      \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkNetworkRange, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkNetworkRange, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2,__MAC_10_6,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020)
   #define kSCPropNetAppleTalkNetworkRange                               \
          SC_SCHEMA_KV(kSCPropNetAppleTalkNetworkRange                  \
                      ,"NetworkRange"                                   \
                      ,CFArray[CFNumber]                                )
 #endif
 
   #define kSCPropNetAppleTalkNetworkRange                               \
          SC_SCHEMA_KV(kSCPropNetAppleTalkNetworkRange                  \
                      ,"NetworkRange"                                   \
                      ,CFArray[CFNumber]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkNodeID, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkNodeID, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCPropNetAppleTalkNodeID                                     \
          SC_SCHEMA_KV(kSCPropNetAppleTalkNodeID                        \
                      ,"NodeID"                                         \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetAppleTalkNodeID                                     \
          SC_SCHEMA_KV(kSCPropNetAppleTalkNodeID                        \
                      ,"NodeID"                                         \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkSeedNetworkRange, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkSeedNetworkRange, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCPropNetAppleTalkSeedNetworkRange                           \
          SC_SCHEMA_KV(kSCPropNetAppleTalkSeedNetworkRange              \
                      ,"SeedNetworkRange"                               \
                      ,CFArray[CFNumber]                                )
 #endif
 
   #define kSCPropNetAppleTalkSeedNetworkRange                           \
          SC_SCHEMA_KV(kSCPropNetAppleTalkSeedNetworkRange              \
                      ,"SeedNetworkRange"                               \
                      ,CFArray[CFNumber]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkSeedZones, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetAppleTalkSeedZones, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCPropNetAppleTalkSeedZones                                  \
          SC_SCHEMA_KV(kSCPropNetAppleTalkSeedZones                     \
                      ,"SeedZones"                                      \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetAppleTalkSeedZones                                  \
          SC_SCHEMA_KV(kSCPropNetAppleTalkSeedZones                     \
                      ,"SeedZones"                                      \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetAppleTalkConfigMethodNode, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCValNetAppleTalkConfigMethodNode, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCValNetAppleTalkConfigMethodNode                            \
          SC_SCHEMA_KV(kSCValNetAppleTalkConfigMethodNode               \
                      ,"Node"                                           \
                      ,                                                 )
 #endif
 
   #define kSCValNetAppleTalkConfigMethodNode                            \
          SC_SCHEMA_KV(kSCValNetAppleTalkConfigMethodNode               \
                      ,"Node"                                           \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetAppleTalkConfigMethodRouter, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCValNetAppleTalkConfigMethodRouter, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCValNetAppleTalkConfigMethodRouter                          \
          SC_SCHEMA_KV(kSCValNetAppleTalkConfigMethodRouter             \
                      ,"Router"                                         \
                      ,                                                 )
 #endif
 
   #define kSCValNetAppleTalkConfigMethodRouter                          \
          SC_SCHEMA_KV(kSCValNetAppleTalkConfigMethodRouter             \
                      ,"Router"                                         \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetAppleTalkConfigMethodSeedRouter, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCValNetAppleTalkConfigMethodSeedRouter, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCValNetAppleTalkConfigMethodSeedRouter                      \
          SC_SCHEMA_KV(kSCValNetAppleTalkConfigMethodSeedRouter         \
                      ,"SeedRouter"                                     \
                      ,                                                 )
 #endif
 
   #define kSCValNetAppleTalkConfigMethodSeedRouter                      \
          SC_SCHEMA_KV(kSCValNetAppleTalkConfigMethodSeedRouter         \
                      ,"SeedRouter"                                     \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetDNSDomainName, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+#endif // !TARGET_OS_IPHONE
+
+  SC_SCHEMA_DECLARATION(kSCPropNetDNSDomainName, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetDNSDomainName                                       \
          SC_SCHEMA_KV(kSCPropNetDNSDomainName                          \
                      ,"DomainName"                                     \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetDNSDomainName                                       \
          SC_SCHEMA_KV(kSCPropNetDNSDomainName                          \
                      ,"DomainName"                                     \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCPropNetDNSOptions, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+  SC_SCHEMA_DECLARATION(kSCPropNetDNSOptions, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetDNSOptions                                          \
          SC_SCHEMA_KV(kSCPropNetDNSOptions                             \
                      ,"Options"                                        \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetDNSOptions                                          \
          SC_SCHEMA_KV(kSCPropNetDNSOptions                             \
                      ,"Options"                                        \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetDNSSearchDomains, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetDNSSearchDomains, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetDNSSearchDomains                                    \
          SC_SCHEMA_KV(kSCPropNetDNSSearchDomains                       \
                      ,"SearchDomains"                                  \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetDNSSearchDomains                                    \
          SC_SCHEMA_KV(kSCPropNetDNSSearchDomains                       \
                      ,"SearchDomains"                                  \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCPropNetDNSSearchOrder, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+  SC_SCHEMA_DECLARATION(kSCPropNetDNSSearchOrder, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetDNSSearchOrder                                      \
          SC_SCHEMA_KV(kSCPropNetDNSSearchOrder                         \
                      ,"SearchOrder"                                    \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetDNSSearchOrder                                      \
          SC_SCHEMA_KV(kSCPropNetDNSSearchOrder                         \
                      ,"SearchOrder"                                    \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetDNSServerAddresses, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetDNSServerAddresses, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetDNSServerAddresses                                  \
          SC_SCHEMA_KV(kSCPropNetDNSServerAddresses                     \
                      ,"ServerAddresses"                                \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetDNSServerAddresses                                  \
          SC_SCHEMA_KV(kSCPropNetDNSServerAddresses                     \
                      ,"ServerAddresses"                                \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCPropNetDNSServerPort, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+  SC_SCHEMA_DECLARATION(kSCPropNetDNSServerPort, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetDNSServerPort                                       \
          SC_SCHEMA_KV(kSCPropNetDNSServerPort                          \
                      ,"ServerPort"                                     \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetDNSServerPort                                       \
          SC_SCHEMA_KV(kSCPropNetDNSServerPort                          \
                      ,"ServerPort"                                     \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCPropNetDNSServerTimeout, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+  SC_SCHEMA_DECLARATION(kSCPropNetDNSServerTimeout, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetDNSServerTimeout                                    \
          SC_SCHEMA_KV(kSCPropNetDNSServerTimeout                       \
                      ,"ServerTimeout"                                  \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetDNSServerTimeout                                    \
          SC_SCHEMA_KV(kSCPropNetDNSServerTimeout                       \
                      ,"ServerTimeout"                                  \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetDNSSortList, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetDNSSortList, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetDNSSortList                                         \
          SC_SCHEMA_KV(kSCPropNetDNSSortList                            \
                      ,"SortList"                                       \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetDNSSortList                                         \
          SC_SCHEMA_KV(kSCPropNetDNSSortList                            \
                      ,"SortList"                                       \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCPropNetDNSSupplementalMatchDomains, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+  SC_SCHEMA_DECLARATION(kSCPropNetDNSSupplementalMatchDomains, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetDNSSupplementalMatchDomains                         \
          SC_SCHEMA_KV(kSCPropNetDNSSupplementalMatchDomains            \
                      ,"SupplementalMatchDomains"                       \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetDNSSupplementalMatchDomains                         \
          SC_SCHEMA_KV(kSCPropNetDNSSupplementalMatchDomains            \
                      ,"SupplementalMatchDomains"                       \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCPropNetDNSSupplementalMatchOrders, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+  SC_SCHEMA_DECLARATION(kSCPropNetDNSSupplementalMatchOrders, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetDNSSupplementalMatchOrders                          \
          SC_SCHEMA_KV(kSCPropNetDNSSupplementalMatchOrders             \
                      ,"SupplementalMatchOrders"                        \
                      ,CFArray[CFNumber]                                )
 #endif
 
   #define kSCPropNetDNSSupplementalMatchOrders                          \
          SC_SCHEMA_KV(kSCPropNetDNSSupplementalMatchOrders             \
                      ,"SupplementalMatchOrders"                        \
                      ,CFArray[CFNumber]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetEthernetMediaSubType, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetEthernetMediaSubType, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetEthernetMediaSubType                                \
          SC_SCHEMA_KV(kSCPropNetEthernetMediaSubType                   \
                      ,"MediaSubType"                                   \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetEthernetMediaSubType                                \
          SC_SCHEMA_KV(kSCPropNetEthernetMediaSubType                   \
                      ,"MediaSubType"                                   \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetEthernetMediaOptions, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetEthernetMediaOptions, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetEthernetMediaOptions                                \
          SC_SCHEMA_KV(kSCPropNetEthernetMediaOptions                   \
                      ,"MediaOptions"                                   \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetEthernetMediaOptions                                \
          SC_SCHEMA_KV(kSCPropNetEthernetMediaOptions                   \
                      ,"MediaOptions"                                   \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetEthernetMTU, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetEthernetMTU, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetEthernetMTU                                         \
          SC_SCHEMA_KV(kSCPropNetEthernetMTU                            \
                      ,"MTU"                                            \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetEthernetMTU                                         \
          SC_SCHEMA_KV(kSCPropNetEthernetMTU                            \
                      ,"MTU"                                            \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetInterfaceDeviceName, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetInterfaceDeviceName, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetInterfaceDeviceName                                 \
          SC_SCHEMA_KV(kSCPropNetInterfaceDeviceName                    \
                      ,"DeviceName"                                     \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetInterfaceDeviceName                                 \
          SC_SCHEMA_KV(kSCPropNetInterfaceDeviceName                    \
                      ,"DeviceName"                                     \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetInterfaceHardware, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetInterfaceHardware, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetInterfaceHardware                                   \
          SC_SCHEMA_KV(kSCPropNetInterfaceHardware                      \
                      ,"Hardware"                                       \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetInterfaceHardware                                   \
          SC_SCHEMA_KV(kSCPropNetInterfaceHardware                      \
                      ,"Hardware"                                       \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetInterfaceType, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetInterfaceType, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetInterfaceType                                       \
          SC_SCHEMA_KV(kSCPropNetInterfaceType                          \
                      ,"Type"                                           \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetInterfaceType                                       \
          SC_SCHEMA_KV(kSCPropNetInterfaceType                          \
                      ,"Type"                                           \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetInterfaceSubType, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetInterfaceSubType, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetInterfaceSubType                                    \
          SC_SCHEMA_KV(kSCPropNetInterfaceSubType                       \
                      ,"SubType"                                        \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetInterfaceSubType                                    \
          SC_SCHEMA_KV(kSCPropNetInterfaceSubType                       \
                      ,"SubType"                                        \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetInterfaceSupportsModemOnHold, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetInterfaceSupportsModemOnHold, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetInterfaceSupportsModemOnHold                        \
          SC_SCHEMA_KV(kSCPropNetInterfaceSupportsModemOnHold           \
                      ,"SupportsModemOnHold"                            \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetInterfaceSupportsModemOnHold                        \
          SC_SCHEMA_KV(kSCPropNetInterfaceSupportsModemOnHold           \
                      ,"SupportsModemOnHold"                            \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetInterfaceTypeEthernet, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCValNetInterfaceTypeEthernet, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetInterfaceTypeEthernet                                \
          SC_SCHEMA_KV(kSCValNetInterfaceTypeEthernet                   \
                      ,"Ethernet"                                       \
                      ,                                                 )
 #endif
 
   #define kSCValNetInterfaceTypeEthernet                                \
          SC_SCHEMA_KV(kSCValNetInterfaceTypeEthernet                   \
                      ,"Ethernet"                                       \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetInterfaceTypeFireWire, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCValNetInterfaceTypeFireWire, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetInterfaceTypeFireWire                                \
          SC_SCHEMA_KV(kSCValNetInterfaceTypeFireWire                   \
                      ,"FireWire"                                       \
                      ,                                                 )
 #endif
 
   #define kSCValNetInterfaceTypeFireWire                                \
          SC_SCHEMA_KV(kSCValNetInterfaceTypeFireWire                   \
                      ,"FireWire"                                       \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetInterfaceTypePPP, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCValNetInterfaceTypePPP, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetInterfaceTypePPP                                     \
          SC_SCHEMA_KV(kSCValNetInterfaceTypePPP                        \
                      ,"PPP"                                            \
                      ,                                                 )
 #endif
 
   #define kSCValNetInterfaceTypePPP                                     \
          SC_SCHEMA_KV(kSCValNetInterfaceTypePPP                        \
                      ,"PPP"                                            \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetInterfaceType6to4, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCValNetInterfaceType6to4, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetInterfaceType6to4                                    \
          SC_SCHEMA_KV(kSCValNetInterfaceType6to4                       \
                      ,"6to4"                                           \
                      ,                                                 )
 #endif
 
   #define kSCValNetInterfaceType6to4                                    \
          SC_SCHEMA_KV(kSCValNetInterfaceType6to4                       \
                      ,"6to4"                                           \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetInterfaceSubTypePPPoE, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
+  SC_SCHEMA_DECLARATION(kSCValNetInterfaceTypeIPSec, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
+  #define kSCValNetInterfaceTypeIPSec                                   \
+         SC_SCHEMA_KV(kSCValNetInterfaceTypeIPSec                      \
+                     ,"IPSec"                                          \
+                     ,                                                 )
 #endif
 #endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+
+  SC_SCHEMA_DECLARATION(kSCValNetInterfaceSubTypePPPoE, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetInterfaceSubTypePPPoE                                \
          SC_SCHEMA_KV(kSCValNetInterfaceSubTypePPPoE                   \
                      ,"PPPoE"                                          \
                      ,                                                 )
 #endif
 
   #define kSCValNetInterfaceSubTypePPPoE                                \
          SC_SCHEMA_KV(kSCValNetInterfaceSubTypePPPoE                   \
                      ,"PPPoE"                                          \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetInterfaceSubTypePPPSerial, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCValNetInterfaceSubTypePPPSerial, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetInterfaceSubTypePPPSerial                            \
          SC_SCHEMA_KV(kSCValNetInterfaceSubTypePPPSerial               \
                      ,"PPPSerial"                                      \
                      ,                                                 )
 #endif
 
   #define kSCValNetInterfaceSubTypePPPSerial                            \
          SC_SCHEMA_KV(kSCValNetInterfaceSubTypePPPSerial               \
                      ,"PPPSerial"                                      \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetInterfaceSubTypePPTP, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCValNetInterfaceSubTypePPTP, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetInterfaceSubTypePPTP                                 \
          SC_SCHEMA_KV(kSCValNetInterfaceSubTypePPTP                    \
                      ,"PPTP"                                           \
                      ,                                                 )
 #endif
 
   #define kSCValNetInterfaceSubTypePPTP                                 \
          SC_SCHEMA_KV(kSCValNetInterfaceSubTypePPTP                    \
                      ,"PPTP"                                           \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetInterfaceSubTypeL2TP, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCValNetInterfaceSubTypeL2TP, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetInterfaceSubTypeL2TP                                 \
          SC_SCHEMA_KV(kSCValNetInterfaceSubTypeL2TP                    \
                      ,"L2TP"                                           \
                      ,                                                 )
 #endif
 
   #define kSCValNetInterfaceSubTypeL2TP                                 \
          SC_SCHEMA_KV(kSCValNetInterfaceSubTypeL2TP                    \
                      ,"L2TP"                                           \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetIPSecLocalIdentifier, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecAuthenticationMethod, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
+  #define kSCPropNetIPSecAuthenticationMethod                           \
+         SC_SCHEMA_KV(kSCPropNetIPSecAuthenticationMethod              \
+                     ,"AuthenticationMethod"                           \
+                     ,CFString                                         )
 #endif
 #endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecLocalCertificate, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
+  #define kSCPropNetIPSecLocalCertificate                               \
+         SC_SCHEMA_KV(kSCPropNetIPSecLocalCertificate                  \
+                     ,"LocalCertificate"                               \
+                     ,CFData                                           )
+#endif
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecLocalIdentifier, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetIPSecLocalIdentifier                                \
          SC_SCHEMA_KV(kSCPropNetIPSecLocalIdentifier                   \
                      ,"LocalIdentifier"                                \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetIPSecLocalIdentifier                                \
          SC_SCHEMA_KV(kSCPropNetIPSecLocalIdentifier                   \
                      ,"LocalIdentifier"                                \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetIPSecLocalIdentifierType, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecLocalIdentifierType, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetIPSecLocalIdentifierType                            \
          SC_SCHEMA_KV(kSCPropNetIPSecLocalIdentifierType               \
                      ,"LocalIdentifierType"                            \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetIPSecLocalIdentifierType                            \
          SC_SCHEMA_KV(kSCPropNetIPSecLocalIdentifierType               \
                      ,"LocalIdentifierType"                            \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetIPSecAuthenticationMethod, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
-  #define kSCPropNetIPSecAuthenticationMethod                           \
-         SC_SCHEMA_KV(kSCPropNetIPSecAuthenticationMethod              \
-                     ,"AuthenticationMethod"                           \
-                     ,CFString                                         )
-#endif
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetIPSecSharedSecret, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecSharedSecret, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetIPSecSharedSecret                                   \
          SC_SCHEMA_KV(kSCPropNetIPSecSharedSecret                      \
                      ,"SharedSecret"                                   \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetIPSecSharedSecret                                   \
          SC_SCHEMA_KV(kSCPropNetIPSecSharedSecret                      \
                      ,"SharedSecret"                                   \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetIPSecSharedSecretEncryption, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecSharedSecretEncryption, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetIPSecSharedSecretEncryption                         \
          SC_SCHEMA_KV(kSCPropNetIPSecSharedSecretEncryption            \
                      ,"SharedSecretEncryption"                         \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetIPSecSharedSecretEncryption                         \
          SC_SCHEMA_KV(kSCPropNetIPSecSharedSecretEncryption            \
                      ,"SharedSecretEncryption"                         \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetIPSecLocalCertificate, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecConnectTime, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
+  #define kSCPropNetIPSecConnectTime                                    \
+         SC_SCHEMA_KV(kSCPropNetIPSecConnectTime                       \
+                     ,"ConnectTime"                                    \
+                     ,CFNumber                                         )
 #endif
 #endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
-  #define kSCPropNetIPSecLocalCertificate                               \
-         SC_SCHEMA_KV(kSCPropNetIPSecLocalCertificate                  \
-                     ,"LocalCertificate"                               \
-                     ,CFData                                           )
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecRemoteAddress, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
+  #define kSCPropNetIPSecRemoteAddress                                  \
+         SC_SCHEMA_KV(kSCPropNetIPSecRemoteAddress                     \
+                     ,"RemoteAddress"                                  \
+                     ,CFString                                         )
+#endif
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecStatus, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
+  #define kSCPropNetIPSecStatus                                         \
+         SC_SCHEMA_KV(kSCPropNetIPSecStatus                            \
+                     ,"Status"                                         \
+                     ,CFNumber                                         )
 #endif
 
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCValNetIPSecAuthenticationMethodSharedSecret, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecXAuthEnabled, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
+  #define kSCPropNetIPSecXAuthEnabled                                   \
+         SC_SCHEMA_KV(kSCPropNetIPSecXAuthEnabled                      \
+                     ,"XAuthEnabled"                                   \
+                     ,CFNumber (0 or 1)                                )
+#endif
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecXAuthName, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
+  #define kSCPropNetIPSecXAuthName                                      \
+         SC_SCHEMA_KV(kSCPropNetIPSecXAuthName                         \
+                     ,"XAuthName"                                      \
+                     ,CFString                                         )
+#endif
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecXAuthPassword, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
+  #define kSCPropNetIPSecXAuthPassword                                  \
+         SC_SCHEMA_KV(kSCPropNetIPSecXAuthPassword                     \
+                     ,"XAuthPassword"                                  \
+                     ,CFString                                         )
 #endif
 #endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecXAuthPasswordEncryption, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
+  #define kSCPropNetIPSecXAuthPasswordEncryption                        \
+         SC_SCHEMA_KV(kSCPropNetIPSecXAuthPasswordEncryption           \
+                     ,"XAuthPasswordEncryption"                        \
+                     ,CFString                                         )
+#endif
+
+  SC_SCHEMA_DECLARATION(kSCValNetIPSecAuthenticationMethodSharedSecret, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetIPSecAuthenticationMethodSharedSecret                \
          SC_SCHEMA_KV(kSCValNetIPSecAuthenticationMethodSharedSecret   \
                      ,"SharedSecret"                                   \
                      ,                                                 )
 #endif
 
   #define kSCValNetIPSecAuthenticationMethodSharedSecret                \
          SC_SCHEMA_KV(kSCValNetIPSecAuthenticationMethodSharedSecret   \
                      ,"SharedSecret"                                   \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCValNetIPSecAuthenticationMethodCertificate, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCValNetIPSecAuthenticationMethodCertificate, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetIPSecAuthenticationMethodCertificate                 \
          SC_SCHEMA_KV(kSCValNetIPSecAuthenticationMethodCertificate    \
                      ,"Certificate"                                    \
                      ,                                                 )
 #endif
 
   #define kSCValNetIPSecAuthenticationMethodCertificate                 \
          SC_SCHEMA_KV(kSCValNetIPSecAuthenticationMethodCertificate    \
                      ,"Certificate"                                    \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCValNetIPSecSharedSecretEncryptionKeychain, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+  SC_SCHEMA_DECLARATION(kSCValNetIPSecAuthenticationMethodHybrid, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
+  #define kSCValNetIPSecAuthenticationMethodHybrid                      \
+         SC_SCHEMA_KV(kSCValNetIPSecAuthenticationMethodHybrid         \
+                     ,"Hybrid"                                         \
+                     ,                                                 )
+#endif
+
+  SC_SCHEMA_DECLARATION(kSCValNetIPSecLocalIdentifierTypeKeyID, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
+  #define kSCValNetIPSecLocalIdentifierTypeKeyID                        \
+         SC_SCHEMA_KV(kSCValNetIPSecLocalIdentifierTypeKeyID           \
+                     ,"KeyID"                                          \
+                     ,                                                 )
 #endif
 #endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+
+  SC_SCHEMA_DECLARATION(kSCValNetIPSecSharedSecretEncryptionKeychain, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetIPSecSharedSecretEncryptionKeychain                  \
          SC_SCHEMA_KV(kSCValNetIPSecSharedSecretEncryptionKeychain     \
                      ,"Keychain"                                       \
                      ,                                                 )
 #endif
 
   #define kSCValNetIPSecSharedSecretEncryptionKeychain                  \
          SC_SCHEMA_KV(kSCValNetIPSecSharedSecretEncryptionKeychain     \
                      ,"Keychain"                                       \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCValNetIPSecLocalIdentifierTypeKeyID, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
-  #define kSCValNetIPSecLocalIdentifierTypeKeyID                        \
-         SC_SCHEMA_KV(kSCValNetIPSecLocalIdentifierTypeKeyID           \
-                     ,"KeyID"                                          \
+  SC_SCHEMA_DECLARATION(kSCValNetIPSecXAuthPasswordEncryptionKeychain, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
+  #define kSCValNetIPSecXAuthPasswordEncryptionKeychain                 \
+         SC_SCHEMA_KV(kSCValNetIPSecXAuthPasswordEncryptionKeychain    \
+                     ,"Keychain"                                       \
                      ,                                                 )
 #endif
 
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetIPv4Addresses, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
+  SC_SCHEMA_DECLARATION(kSCValNetIPSecXAuthPasswordEncryptionPrompt, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000)/*SPI*/
+  #define kSCValNetIPSecXAuthPasswordEncryptionPrompt                   \
+         SC_SCHEMA_KV(kSCValNetIPSecXAuthPasswordEncryptionPrompt      \
+                     ,"Prompt"                                         \
+                     ,                                                 )
 #endif
 #endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv4Addresses, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetIPv4Addresses                                       \
          SC_SCHEMA_KV(kSCPropNetIPv4Addresses                          \
                      ,"Addresses"                                      \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetIPv4Addresses                                       \
          SC_SCHEMA_KV(kSCPropNetIPv4Addresses                          \
                      ,"Addresses"                                      \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetIPv4ConfigMethod, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv4ConfigMethod, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetIPv4ConfigMethod                                    \
          SC_SCHEMA_KV(kSCPropNetIPv4ConfigMethod                       \
                      ,"ConfigMethod"                                   \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetIPv4ConfigMethod                                    \
          SC_SCHEMA_KV(kSCPropNetIPv4ConfigMethod                       \
                      ,"ConfigMethod"                                   \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetIPv4DHCPClientID, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv4DHCPClientID, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetIPv4DHCPClientID                                    \
          SC_SCHEMA_KV(kSCPropNetIPv4DHCPClientID                       \
                      ,"DHCPClientID"                                   \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetIPv4DHCPClientID                                    \
          SC_SCHEMA_KV(kSCPropNetIPv4DHCPClientID                       \
                      ,"DHCPClientID"                                   \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetIPv4Router, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv4Router, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetIPv4Router                                          \
          SC_SCHEMA_KV(kSCPropNetIPv4Router                             \
                      ,"Router"                                         \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetIPv4Router                                          \
          SC_SCHEMA_KV(kSCPropNetIPv4Router                             \
                      ,"Router"                                         \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetIPv4SubnetMasks, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv4SubnetMasks, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetIPv4SubnetMasks                                     \
          SC_SCHEMA_KV(kSCPropNetIPv4SubnetMasks                        \
                      ,"SubnetMasks"                                    \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetIPv4SubnetMasks                                     \
          SC_SCHEMA_KV(kSCPropNetIPv4SubnetMasks                        \
                      ,"SubnetMasks"                                    \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetIPv4DestAddresses, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv4DestAddresses, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetIPv4DestAddresses                                   \
          SC_SCHEMA_KV(kSCPropNetIPv4DestAddresses                      \
                      ,"DestAddresses"                                  \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetIPv4DestAddresses                                   \
          SC_SCHEMA_KV(kSCPropNetIPv4DestAddresses                      \
                      ,"DestAddresses"                                  \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetIPv4BroadcastAddresses, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv4BroadcastAddresses, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetIPv4BroadcastAddresses                              \
          SC_SCHEMA_KV(kSCPropNetIPv4BroadcastAddresses                 \
                      ,"BroadcastAddresses"                             \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetIPv4BroadcastAddresses                              \
          SC_SCHEMA_KV(kSCPropNetIPv4BroadcastAddresses                 \
                      ,"BroadcastAddresses"                             \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodBOOTP, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
+  SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodAutomatic, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
+  #define kSCValNetIPv4ConfigMethodAutomatic                            \
+         SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodAutomatic               \
+                     ,"Automatic"                                      \
+                     ,                                                 )
 #endif
 #endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+
+  SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodBOOTP, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetIPv4ConfigMethodBOOTP                                \
          SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodBOOTP                   \
                      ,"BOOTP"                                          \
                      ,                                                 )
 #endif
 
   #define kSCValNetIPv4ConfigMethodBOOTP                                \
          SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodBOOTP                   \
                      ,"BOOTP"                                          \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodDHCP, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodDHCP, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetIPv4ConfigMethodDHCP                                 \
          SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodDHCP                    \
                      ,"DHCP"                                           \
                      ,                                                 )
 #endif
 
   #define kSCValNetIPv4ConfigMethodDHCP                                 \
          SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodDHCP                    \
                      ,"DHCP"                                           \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodINFORM, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodINFORM, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetIPv4ConfigMethodINFORM                               \
          SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodINFORM                  \
                      ,"INFORM"                                         \
                      ,                                                 )
 #endif
 
   #define kSCValNetIPv4ConfigMethodINFORM                               \
          SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodINFORM                  \
                      ,"INFORM"                                         \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodLinkLocal, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodLinkLocal, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetIPv4ConfigMethodLinkLocal                            \
          SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodLinkLocal               \
                      ,"LinkLocal"                                      \
                      ,                                                 )
 #endif
 
   #define kSCValNetIPv4ConfigMethodLinkLocal                            \
          SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodLinkLocal               \
                      ,"LinkLocal"                                      \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodManual, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodManual, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetIPv4ConfigMethodManual                               \
          SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodManual                  \
                      ,"Manual"                                         \
                      ,                                                 )
 #endif
 
   #define kSCValNetIPv4ConfigMethodManual                               \
          SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodManual                  \
                      ,"Manual"                                         \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodPPP, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodPPP, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetIPv4ConfigMethodPPP                                  \
          SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodPPP                     \
                      ,"PPP"                                            \
                      ,                                                 )
 #endif
 
   #define kSCValNetIPv4ConfigMethodPPP                                  \
          SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodPPP                     \
                      ,"PPP"                                            \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetIPv6Addresses, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv6Addresses, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetIPv6Addresses                                       \
          SC_SCHEMA_KV(kSCPropNetIPv6Addresses                          \
                      ,"Addresses"                                      \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetIPv6Addresses                                       \
          SC_SCHEMA_KV(kSCPropNetIPv6Addresses                          \
                      ,"Addresses"                                      \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetIPv6ConfigMethod, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv6ConfigMethod, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetIPv6ConfigMethod                                    \
          SC_SCHEMA_KV(kSCPropNetIPv6ConfigMethod                       \
                      ,"ConfigMethod"                                   \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetIPv6ConfigMethod                                    \
          SC_SCHEMA_KV(kSCPropNetIPv6ConfigMethod                       \
                      ,"ConfigMethod"                                   \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetIPv6DestAddresses, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv6DestAddresses, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetIPv6DestAddresses                                   \
          SC_SCHEMA_KV(kSCPropNetIPv6DestAddresses                      \
                      ,"DestAddresses"                                  \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetIPv6DestAddresses                                   \
          SC_SCHEMA_KV(kSCPropNetIPv6DestAddresses                      \
                      ,"DestAddresses"                                  \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetIPv6Flags, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv6Flags, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetIPv6Flags                                           \
          SC_SCHEMA_KV(kSCPropNetIPv6Flags                              \
                      ,"Flags"                                          \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetIPv6Flags                                           \
          SC_SCHEMA_KV(kSCPropNetIPv6Flags                              \
                      ,"Flags"                                          \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetIPv6PrefixLength, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv6PrefixLength, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetIPv6PrefixLength                                    \
          SC_SCHEMA_KV(kSCPropNetIPv6PrefixLength                       \
                      ,"PrefixLength"                                   \
                      ,CFArray[CFNumber]                                )
 #endif
 
   #define kSCPropNetIPv6PrefixLength                                    \
          SC_SCHEMA_KV(kSCPropNetIPv6PrefixLength                       \
                      ,"PrefixLength"                                   \
                      ,CFArray[CFNumber]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetIPv6Router, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCPropNetIPv6Router, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetIPv6Router                                          \
          SC_SCHEMA_KV(kSCPropNetIPv6Router                             \
                      ,"Router"                                         \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetIPv6Router                                          \
          SC_SCHEMA_KV(kSCPropNetIPv6Router                             \
                      ,"Router"                                         \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetIPv6ConfigMethodAutomatic, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCValNetIPv6ConfigMethodAutomatic, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetIPv6ConfigMethodAutomatic                            \
          SC_SCHEMA_KV(kSCValNetIPv6ConfigMethodAutomatic               \
                      ,"Automatic"                                      \
                      ,                                                 )
 #endif
 
   #define kSCValNetIPv6ConfigMethodAutomatic                            \
          SC_SCHEMA_KV(kSCValNetIPv6ConfigMethodAutomatic               \
                      ,"Automatic"                                      \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetIPv6ConfigMethodManual, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCValNetIPv6ConfigMethodManual, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetIPv6ConfigMethodManual                               \
          SC_SCHEMA_KV(kSCValNetIPv6ConfigMethodManual                  \
                      ,"Manual"                                         \
                      ,                                                 )
 #endif
 
   #define kSCValNetIPv6ConfigMethodManual                               \
          SC_SCHEMA_KV(kSCValNetIPv6ConfigMethodManual                  \
                      ,"Manual"                                         \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetIPv6ConfigMethodRouterAdvertisement, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCValNetIPv6ConfigMethodRouterAdvertisement, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetIPv6ConfigMethodRouterAdvertisement                  \
          SC_SCHEMA_KV(kSCValNetIPv6ConfigMethodRouterAdvertisement     \
                      ,"RouterAdvertisement"                            \
                      ,                                                 )
 #endif
 
   #define kSCValNetIPv6ConfigMethodRouterAdvertisement                  \
          SC_SCHEMA_KV(kSCValNetIPv6ConfigMethodRouterAdvertisement     \
                      ,"RouterAdvertisement"                            \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetIPv6ConfigMethod6to4, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCValNetIPv6ConfigMethod6to4, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetIPv6ConfigMethod6to4                                 \
          SC_SCHEMA_KV(kSCValNetIPv6ConfigMethod6to4                    \
                      ,"6to4"                                           \
                      ,                                                 )
 #endif
 
   #define kSCValNetIPv6ConfigMethod6to4                                 \
          SC_SCHEMA_KV(kSCValNetIPv6ConfigMethod6to4                    \
                      ,"6to4"                                           \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNet6to4Relay, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCPropNet6to4Relay, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNet6to4Relay                                           \
          SC_SCHEMA_KV(kSCPropNet6to4Relay                              \
                      ,"Relay"                                          \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNet6to4Relay                                           \
          SC_SCHEMA_KV(kSCPropNet6to4Relay                              \
                      ,"Relay"                                          \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetLinkActive, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetLinkActive, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetLinkActive                                          \
          SC_SCHEMA_KV(kSCPropNetLinkActive                             \
                      ,"Active"                                         \
                      ,CFBoolean                                        )
 #endif
 
   #define kSCPropNetLinkActive                                          \
          SC_SCHEMA_KV(kSCPropNetLinkActive                             \
                      ,"Active"                                         \
                      ,CFBoolean                                        )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetLinkDetaching, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetLinkDetaching, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetLinkDetaching                                       \
          SC_SCHEMA_KV(kSCPropNetLinkDetaching                          \
                      ,"Detaching"                                      \
                      ,CFBoolean                                        )
 #endif
 
   #define kSCPropNetLinkDetaching                                       \
          SC_SCHEMA_KV(kSCPropNetLinkDetaching                          \
                      ,"Detaching"                                      \
                      ,CFBoolean                                        )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetModemAccessPointName, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropNetModemAccessPointName, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetModemAccessPointName                                \
          SC_SCHEMA_KV(kSCPropNetModemAccessPointName                   \
                      ,"AccessPointName"                                \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetModemAccessPointName                                \
          SC_SCHEMA_KV(kSCPropNetModemAccessPointName                   \
                      ,"AccessPointName"                                \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetModemConnectionPersonality, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropNetModemConnectionPersonality, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetModemConnectionPersonality                          \
          SC_SCHEMA_KV(kSCPropNetModemConnectionPersonality             \
                      ,"ConnectionPersonality"                          \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetModemConnectionPersonality                          \
          SC_SCHEMA_KV(kSCPropNetModemConnectionPersonality             \
                      ,"ConnectionPersonality"                          \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetModemConnectionScript, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetModemConnectionScript, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetModemConnectionScript                               \
          SC_SCHEMA_KV(kSCPropNetModemConnectionScript                  \
                      ,"ConnectionScript"                               \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetModemConnectionScript                               \
          SC_SCHEMA_KV(kSCPropNetModemConnectionScript                  \
                      ,"ConnectionScript"                               \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetModemConnectSpeed, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetModemConnectSpeed, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetModemConnectSpeed                                   \
          SC_SCHEMA_KV(kSCPropNetModemConnectSpeed                      \
                      ,"ConnectSpeed"                                   \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetModemConnectSpeed                                   \
          SC_SCHEMA_KV(kSCPropNetModemConnectSpeed                      \
                      ,"ConnectSpeed"                                   \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetModemDataCompression, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetModemDataCompression, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetModemDataCompression                                \
          SC_SCHEMA_KV(kSCPropNetModemDataCompression                   \
                      ,"DataCompression"                                \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetModemDataCompression                                \
          SC_SCHEMA_KV(kSCPropNetModemDataCompression                   \
                      ,"DataCompression"                                \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetModemDeviceContextID, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropNetModemDeviceContextID, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetModemDeviceContextID                                \
          SC_SCHEMA_KV(kSCPropNetModemDeviceContextID                   \
                      ,"DeviceContextID"                                \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetModemDeviceContextID                                \
          SC_SCHEMA_KV(kSCPropNetModemDeviceContextID                   \
                      ,"DeviceContextID"                                \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetModemDeviceModel, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropNetModemDeviceModel, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetModemDeviceModel                                    \
          SC_SCHEMA_KV(kSCPropNetModemDeviceModel                       \
                      ,"DeviceModel"                                    \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetModemDeviceModel                                    \
          SC_SCHEMA_KV(kSCPropNetModemDeviceModel                       \
                      ,"DeviceModel"                                    \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetModemDeviceVendor, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropNetModemDeviceVendor, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetModemDeviceVendor                                   \
          SC_SCHEMA_KV(kSCPropNetModemDeviceVendor                      \
                      ,"DeviceVendor"                                   \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetModemDeviceVendor                                   \
          SC_SCHEMA_KV(kSCPropNetModemDeviceVendor                      \
                      ,"DeviceVendor"                                   \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetModemDialMode, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetModemDialMode, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetModemDialMode                                       \
          SC_SCHEMA_KV(kSCPropNetModemDialMode                          \
                      ,"DialMode"                                       \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetModemDialMode                                       \
          SC_SCHEMA_KV(kSCPropNetModemDialMode                          \
                      ,"DialMode"                                       \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetModemErrorCorrection, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetModemErrorCorrection, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetModemErrorCorrection                                \
          SC_SCHEMA_KV(kSCPropNetModemErrorCorrection                   \
                      ,"ErrorCorrection"                                \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetModemErrorCorrection                                \
          SC_SCHEMA_KV(kSCPropNetModemErrorCorrection                   \
                      ,"ErrorCorrection"                                \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetModemHoldCallWaitingAudibleAlert, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetModemHoldCallWaitingAudibleAlert, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetModemHoldCallWaitingAudibleAlert                    \
          SC_SCHEMA_KV(kSCPropNetModemHoldCallWaitingAudibleAlert       \
                      ,"HoldCallWaitingAudibleAlert"                    \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetModemHoldCallWaitingAudibleAlert                    \
          SC_SCHEMA_KV(kSCPropNetModemHoldCallWaitingAudibleAlert       \
                      ,"HoldCallWaitingAudibleAlert"                    \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetModemHoldDisconnectOnAnswer, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetModemHoldDisconnectOnAnswer, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetModemHoldDisconnectOnAnswer                         \
          SC_SCHEMA_KV(kSCPropNetModemHoldDisconnectOnAnswer            \
                      ,"HoldDisconnectOnAnswer"                         \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetModemHoldDisconnectOnAnswer                         \
          SC_SCHEMA_KV(kSCPropNetModemHoldDisconnectOnAnswer            \
                      ,"HoldDisconnectOnAnswer"                         \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetModemHoldEnabled, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetModemHoldEnabled, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetModemHoldEnabled                                    \
          SC_SCHEMA_KV(kSCPropNetModemHoldEnabled                       \
                      ,"HoldEnabled"                                    \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetModemHoldEnabled                                    \
          SC_SCHEMA_KV(kSCPropNetModemHoldEnabled                       \
                      ,"HoldEnabled"                                    \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetModemHoldReminder, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetModemHoldReminder, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetModemHoldReminder                                   \
          SC_SCHEMA_KV(kSCPropNetModemHoldReminder                      \
                      ,"HoldReminder"                                   \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetModemHoldReminder                                   \
          SC_SCHEMA_KV(kSCPropNetModemHoldReminder                      \
                      ,"HoldReminder"                                   \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetModemHoldReminderTime, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetModemHoldReminderTime, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetModemHoldReminderTime                               \
          SC_SCHEMA_KV(kSCPropNetModemHoldReminderTime                  \
                      ,"HoldReminderTime"                               \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetModemHoldReminderTime                               \
          SC_SCHEMA_KV(kSCPropNetModemHoldReminderTime                  \
                      ,"HoldReminderTime"                               \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetModemNote, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetModemNote, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetModemNote                                           \
          SC_SCHEMA_KV(kSCPropNetModemNote                              \
                      ,"Note"                                           \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetModemNote                                           \
          SC_SCHEMA_KV(kSCPropNetModemNote                              \
                      ,"Note"                                           \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetModemPulseDial, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetModemPulseDial, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetModemPulseDial                                      \
          SC_SCHEMA_KV(kSCPropNetModemPulseDial                         \
                      ,"PulseDial"                                      \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetModemPulseDial                                      \
          SC_SCHEMA_KV(kSCPropNetModemPulseDial                         \
                      ,"PulseDial"                                      \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetModemSpeaker, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetModemSpeaker, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetModemSpeaker                                        \
          SC_SCHEMA_KV(kSCPropNetModemSpeaker                           \
                      ,"Speaker"                                        \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetModemSpeaker                                        \
          SC_SCHEMA_KV(kSCPropNetModemSpeaker                           \
                      ,"Speaker"                                        \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetModemSpeed, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetModemSpeed, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetModemSpeed                                          \
          SC_SCHEMA_KV(kSCPropNetModemSpeed                             \
                      ,"Speed"                                          \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetModemSpeed                                          \
          SC_SCHEMA_KV(kSCPropNetModemSpeed                             \
                      ,"Speed"                                          \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetModemDialModeIgnoreDialTone, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCValNetModemDialModeIgnoreDialTone, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetModemDialModeIgnoreDialTone                          \
          SC_SCHEMA_KV(kSCValNetModemDialModeIgnoreDialTone             \
                      ,"IgnoreDialTone"                                 \
                      ,                                                 )
 #endif
 
   #define kSCValNetModemDialModeIgnoreDialTone                          \
          SC_SCHEMA_KV(kSCValNetModemDialModeIgnoreDialTone             \
                      ,"IgnoreDialTone"                                 \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetModemDialModeManual, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCValNetModemDialModeManual, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetModemDialModeManual                                  \
          SC_SCHEMA_KV(kSCValNetModemDialModeManual                     \
                      ,"Manual"                                         \
                      ,                                                 )
 #endif
 
   #define kSCValNetModemDialModeManual                                  \
          SC_SCHEMA_KV(kSCValNetModemDialModeManual                     \
                      ,"Manual"                                         \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetModemDialModeWaitForDialTone, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCValNetModemDialModeWaitForDialTone, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetModemDialModeWaitForDialTone                         \
          SC_SCHEMA_KV(kSCValNetModemDialModeWaitForDialTone            \
                      ,"WaitForDialTone"                                \
                      ,                                                 )
 #endif
 
   #define kSCValNetModemDialModeWaitForDialTone                         \
          SC_SCHEMA_KV(kSCValNetModemDialModeWaitForDialTone            \
                      ,"WaitForDialTone"                                \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCPropNetNetInfoBindingMethods, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+#if !TARGET_OS_IPHONE
+
+  SC_SCHEMA_DECLARATION(kSCPropNetNetInfoBindingMethods, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCPropNetNetInfoBindingMethods                               \
          SC_SCHEMA_KV(kSCPropNetNetInfoBindingMethods                  \
                      ,"BindingMethods"                                 \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetNetInfoBindingMethods                               \
          SC_SCHEMA_KV(kSCPropNetNetInfoBindingMethods                  \
                      ,"BindingMethods"                                 \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCPropNetNetInfoServerAddresses, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetNetInfoServerAddresses, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCPropNetNetInfoServerAddresses                              \
          SC_SCHEMA_KV(kSCPropNetNetInfoServerAddresses                 \
                      ,"ServerAddresses"                                \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetNetInfoServerAddresses                              \
          SC_SCHEMA_KV(kSCPropNetNetInfoServerAddresses                 \
                      ,"ServerAddresses"                                \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCPropNetNetInfoServerTags, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetNetInfoServerTags, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCPropNetNetInfoServerTags                                   \
          SC_SCHEMA_KV(kSCPropNetNetInfoServerTags                      \
                      ,"ServerTags"                                     \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetNetInfoServerTags                                   \
          SC_SCHEMA_KV(kSCPropNetNetInfoServerTags                      \
                      ,"ServerTags"                                     \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCPropNetNetInfoBroadcastServerTag, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetNetInfoBroadcastServerTag, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCPropNetNetInfoBroadcastServerTag                           \
          SC_SCHEMA_KV(kSCPropNetNetInfoBroadcastServerTag              \
                      ,"BroadcastServerTag"                             \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetNetInfoBroadcastServerTag                           \
          SC_SCHEMA_KV(kSCPropNetNetInfoBroadcastServerTag              \
                      ,"BroadcastServerTag"                             \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCValNetNetInfoBindingMethodsBroadcast, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCValNetNetInfoBindingMethodsBroadcast, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCValNetNetInfoBindingMethodsBroadcast                       \
          SC_SCHEMA_KV(kSCValNetNetInfoBindingMethodsBroadcast          \
                      ,"Broadcast"                                      \
                      ,                                                 )
 #endif
 
   #define kSCValNetNetInfoBindingMethodsBroadcast                       \
          SC_SCHEMA_KV(kSCValNetNetInfoBindingMethodsBroadcast          \
                      ,"Broadcast"                                      \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCValNetNetInfoBindingMethodsDHCP, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCValNetNetInfoBindingMethodsDHCP, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCValNetNetInfoBindingMethodsDHCP                            \
          SC_SCHEMA_KV(kSCValNetNetInfoBindingMethodsDHCP               \
                      ,"DHCP"                                           \
                      ,                                                 )
 #endif
 
   #define kSCValNetNetInfoBindingMethodsDHCP                            \
          SC_SCHEMA_KV(kSCValNetNetInfoBindingMethodsDHCP               \
                      ,"DHCP"                                           \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCValNetNetInfoBindingMethodsManual, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCValNetNetInfoBindingMethodsManual, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCValNetNetInfoBindingMethodsManual                          \
          SC_SCHEMA_KV(kSCValNetNetInfoBindingMethodsManual             \
                      ,"Manual"                                         \
                      ,                                                 )
 #endif
 
   #define kSCValNetNetInfoBindingMethodsManual                          \
          SC_SCHEMA_KV(kSCValNetNetInfoBindingMethodsManual             \
                      ,"Manual"                                         \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCValNetNetInfoDefaultServerTag, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCValNetNetInfoDefaultServerTag, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCValNetNetInfoDefaultServerTag                              \
          SC_SCHEMA_KV(kSCValNetNetInfoDefaultServerTag                 \
                      ,"network"                                        \
                      ,                                                 )
 #endif
 
   #define kSCValNetNetInfoDefaultServerTag                              \
          SC_SCHEMA_KV(kSCValNetNetInfoDefaultServerTag                 \
                      ,"network"                                        \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPACSPEnabled, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+#endif // !TARGET_OS_IPHONE
+
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPACSPEnabled, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPACSPEnabled                                      \
          SC_SCHEMA_KV(kSCPropNetPPPACSPEnabled                         \
                      ,"ACSPEnabled"                                    \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPACSPEnabled                                      \
          SC_SCHEMA_KV(kSCPropNetPPPACSPEnabled                         \
                      ,"ACSPEnabled"                                    \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPConnectTime, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPConnectTime, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPConnectTime                                      \
          SC_SCHEMA_KV(kSCPropNetPPPConnectTime                         \
                      ,"ConnectTime"                                    \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetPPPConnectTime                                      \
          SC_SCHEMA_KV(kSCPropNetPPPConnectTime                         \
                      ,"ConnectTime"                                    \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPDeviceLastCause, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPDeviceLastCause, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPDeviceLastCause                                  \
          SC_SCHEMA_KV(kSCPropNetPPPDeviceLastCause                     \
                      ,"DeviceLastCause"                                \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetPPPDeviceLastCause                                  \
          SC_SCHEMA_KV(kSCPropNetPPPDeviceLastCause                     \
                      ,"DeviceLastCause"                                \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPDialOnDemand, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPDialOnDemand, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPDialOnDemand                                     \
          SC_SCHEMA_KV(kSCPropNetPPPDialOnDemand                        \
                      ,"DialOnDemand"                                   \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPDialOnDemand                                     \
          SC_SCHEMA_KV(kSCPropNetPPPDialOnDemand                        \
                      ,"DialOnDemand"                                   \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectOnFastUserSwitch, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectOnFastUserSwitch, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPDisconnectOnFastUserSwitch                       \
          SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnFastUserSwitch          \
                      ,"DisconnectOnFastUserSwitch"                     \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPDisconnectOnFastUserSwitch                       \
          SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnFastUserSwitch          \
                      ,"DisconnectOnFastUserSwitch"                     \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectOnIdle, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectOnIdle, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPDisconnectOnIdle                                 \
          SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnIdle                    \
                      ,"DisconnectOnIdle"                               \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPDisconnectOnIdle                                 \
          SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnIdle                    \
                      ,"DisconnectOnIdle"                               \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectOnIdleTimer, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectOnIdleTimer, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPDisconnectOnIdleTimer                            \
          SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnIdleTimer               \
                      ,"DisconnectOnIdleTimer"                          \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetPPPDisconnectOnIdleTimer                            \
          SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnIdleTimer               \
                      ,"DisconnectOnIdleTimer"                          \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectOnLogout, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectOnLogout, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPDisconnectOnLogout                               \
          SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnLogout                  \
                      ,"DisconnectOnLogout"                             \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPDisconnectOnLogout                               \
          SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnLogout                  \
                      ,"DisconnectOnLogout"                             \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectOnSleep, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectOnSleep, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPDisconnectOnSleep                                \
          SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnSleep                   \
                      ,"DisconnectOnSleep"                              \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPDisconnectOnSleep                                \
          SC_SCHEMA_KV(kSCPropNetPPPDisconnectOnSleep                   \
                      ,"DisconnectOnSleep"                              \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectTime, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPDisconnectTime, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPDisconnectTime                                   \
          SC_SCHEMA_KV(kSCPropNetPPPDisconnectTime                      \
                      ,"DisconnectTime"                                 \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetPPPDisconnectTime                                   \
          SC_SCHEMA_KV(kSCPropNetPPPDisconnectTime                      \
                      ,"DisconnectTime"                                 \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPIdleReminderTimer, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPIdleReminderTimer, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPIdleReminderTimer                                \
          SC_SCHEMA_KV(kSCPropNetPPPIdleReminderTimer                   \
                      ,"IdleReminderTimer"                              \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetPPPIdleReminderTimer                                \
          SC_SCHEMA_KV(kSCPropNetPPPIdleReminderTimer                   \
                      ,"IdleReminderTimer"                              \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPIdleReminder, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPIdleReminder, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPIdleReminder                                     \
          SC_SCHEMA_KV(kSCPropNetPPPIdleReminder                        \
                      ,"IdleReminder"                                   \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPIdleReminder                                     \
          SC_SCHEMA_KV(kSCPropNetPPPIdleReminder                        \
                      ,"IdleReminder"                                   \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPLastCause, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPLastCause, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPLastCause                                        \
          SC_SCHEMA_KV(kSCPropNetPPPLastCause                           \
                      ,"LastCause"                                      \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetPPPLastCause                                        \
          SC_SCHEMA_KV(kSCPropNetPPPLastCause                           \
                      ,"LastCause"                                      \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPLogfile, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPLogfile, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPLogfile                                          \
          SC_SCHEMA_KV(kSCPropNetPPPLogfile                             \
                      ,"Logfile"                                        \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetPPPLogfile                                          \
          SC_SCHEMA_KV(kSCPropNetPPPLogfile                             \
                      ,"Logfile"                                        \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPPlugins, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPPlugins, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPPlugins                                          \
          SC_SCHEMA_KV(kSCPropNetPPPPlugins                             \
                      ,"Plugins"                                        \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetPPPPlugins                                          \
          SC_SCHEMA_KV(kSCPropNetPPPPlugins                             \
                      ,"Plugins"                                        \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPRetryConnectTime, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPRetryConnectTime, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPRetryConnectTime                                 \
          SC_SCHEMA_KV(kSCPropNetPPPRetryConnectTime                    \
                      ,"RetryConnectTime"                               \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetPPPRetryConnectTime                                 \
          SC_SCHEMA_KV(kSCPropNetPPPRetryConnectTime                    \
                      ,"RetryConnectTime"                               \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPSessionTimer, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPSessionTimer, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPSessionTimer                                     \
          SC_SCHEMA_KV(kSCPropNetPPPSessionTimer                        \
                      ,"SessionTimer"                                   \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetPPPSessionTimer                                     \
          SC_SCHEMA_KV(kSCPropNetPPPSessionTimer                        \
                      ,"SessionTimer"                                   \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPStatus, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPStatus, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPStatus                                           \
          SC_SCHEMA_KV(kSCPropNetPPPStatus                              \
                      ,"Status"                                         \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetPPPStatus                                           \
          SC_SCHEMA_KV(kSCPropNetPPPStatus                              \
                      ,"Status"                                         \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPUseSessionTimer, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPUseSessionTimer, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPUseSessionTimer                                  \
          SC_SCHEMA_KV(kSCPropNetPPPUseSessionTimer                     \
                      ,"UseSessionTimer"                                \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPUseSessionTimer                                  \
          SC_SCHEMA_KV(kSCPropNetPPPUseSessionTimer                     \
                      ,"UseSessionTimer"                                \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPVerboseLogging, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPVerboseLogging, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPVerboseLogging                                   \
          SC_SCHEMA_KV(kSCPropNetPPPVerboseLogging                      \
                      ,"VerboseLogging"                                 \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPVerboseLogging                                   \
          SC_SCHEMA_KV(kSCPropNetPPPVerboseLogging                      \
                      ,"VerboseLogging"                                 \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthEAPPlugins, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthEAPPlugins, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPAuthEAPPlugins                                   \
          SC_SCHEMA_KV(kSCPropNetPPPAuthEAPPlugins                      \
                      ,"AuthEAPPlugins"                                 \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetPPPAuthEAPPlugins                                   \
          SC_SCHEMA_KV(kSCPropNetPPPAuthEAPPlugins                      \
                      ,"AuthEAPPlugins"                                 \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthName, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthName, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPAuthName                                         \
          SC_SCHEMA_KV(kSCPropNetPPPAuthName                            \
                      ,"AuthName"                                       \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetPPPAuthName                                         \
          SC_SCHEMA_KV(kSCPropNetPPPAuthName                            \
                      ,"AuthName"                                       \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthPassword, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthPassword, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPAuthPassword                                     \
          SC_SCHEMA_KV(kSCPropNetPPPAuthPassword                        \
                      ,"AuthPassword"                                   \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetPPPAuthPassword                                     \
          SC_SCHEMA_KV(kSCPropNetPPPAuthPassword                        \
                      ,"AuthPassword"                                   \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthPasswordEncryption, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthPasswordEncryption, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPAuthPasswordEncryption                           \
          SC_SCHEMA_KV(kSCPropNetPPPAuthPasswordEncryption              \
                      ,"AuthPasswordEncryption"                         \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetPPPAuthPasswordEncryption                           \
          SC_SCHEMA_KV(kSCPropNetPPPAuthPasswordEncryption              \
                      ,"AuthPasswordEncryption"                         \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthPrompt, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthPrompt, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPAuthPrompt                                       \
          SC_SCHEMA_KV(kSCPropNetPPPAuthPrompt                          \
                      ,"AuthPrompt"                                     \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetPPPAuthPrompt                                       \
          SC_SCHEMA_KV(kSCPropNetPPPAuthPrompt                          \
                      ,"AuthPrompt"                                     \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthProtocol, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPAuthProtocol, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPAuthProtocol                                     \
          SC_SCHEMA_KV(kSCPropNetPPPAuthProtocol                        \
                      ,"AuthProtocol"                                   \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetPPPAuthProtocol                                     \
          SC_SCHEMA_KV(kSCPropNetPPPAuthProtocol                        \
                      ,"AuthProtocol"                                   \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetPPPAuthPasswordEncryptionKeychain, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCValNetPPPAuthPasswordEncryptionKeychain, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetPPPAuthPasswordEncryptionKeychain                    \
          SC_SCHEMA_KV(kSCValNetPPPAuthPasswordEncryptionKeychain       \
                      ,"Keychain"                                       \
                      ,                                                 )
 #endif
 
   #define kSCValNetPPPAuthPasswordEncryptionKeychain                    \
          SC_SCHEMA_KV(kSCValNetPPPAuthPasswordEncryptionKeychain       \
                      ,"Keychain"                                       \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCValNetPPPAuthPasswordEncryptionToken, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCValNetPPPAuthPasswordEncryptionToken, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetPPPAuthPasswordEncryptionToken                       \
          SC_SCHEMA_KV(kSCValNetPPPAuthPasswordEncryptionToken          \
                      ,"Token"                                          \
                      ,                                                 )
 #endif
 
   #define kSCValNetPPPAuthPasswordEncryptionToken                       \
          SC_SCHEMA_KV(kSCValNetPPPAuthPasswordEncryptionToken          \
                      ,"Token"                                          \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetPPPAuthPromptBefore, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCValNetPPPAuthPromptBefore, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetPPPAuthPromptBefore                                  \
          SC_SCHEMA_KV(kSCValNetPPPAuthPromptBefore                     \
                      ,"Before"                                         \
                      ,CFString                                         )
 #endif
 
   #define kSCValNetPPPAuthPromptBefore                                  \
          SC_SCHEMA_KV(kSCValNetPPPAuthPromptBefore                     \
                      ,"Before"                                         \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetPPPAuthPromptAfter, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCValNetPPPAuthPromptAfter, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetPPPAuthPromptAfter                                   \
          SC_SCHEMA_KV(kSCValNetPPPAuthPromptAfter                      \
                      ,"After"                                          \
                      ,CFString                                         )
 #endif
 
   #define kSCValNetPPPAuthPromptAfter                                   \
          SC_SCHEMA_KV(kSCValNetPPPAuthPromptAfter                      \
                      ,"After"                                          \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetPPPAuthProtocolCHAP, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCValNetPPPAuthProtocolCHAP, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetPPPAuthProtocolCHAP                                  \
          SC_SCHEMA_KV(kSCValNetPPPAuthProtocolCHAP                     \
                      ,"CHAP"                                           \
                      ,CFString                                         )
 #endif
 
   #define kSCValNetPPPAuthProtocolCHAP                                  \
          SC_SCHEMA_KV(kSCValNetPPPAuthProtocolCHAP                     \
                      ,"CHAP"                                           \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetPPPAuthProtocolEAP, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCValNetPPPAuthProtocolEAP, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetPPPAuthProtocolEAP                                   \
          SC_SCHEMA_KV(kSCValNetPPPAuthProtocolEAP                      \
                      ,"EAP"                                            \
                      ,CFString                                         )
 #endif
 
   #define kSCValNetPPPAuthProtocolEAP                                   \
          SC_SCHEMA_KV(kSCValNetPPPAuthProtocolEAP                      \
                      ,"EAP"                                            \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetPPPAuthProtocolMSCHAP1, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCValNetPPPAuthProtocolMSCHAP1, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetPPPAuthProtocolMSCHAP1                               \
          SC_SCHEMA_KV(kSCValNetPPPAuthProtocolMSCHAP1                  \
                      ,"MSCHAP1"                                        \
                      ,CFString                                         )
 #endif
 
   #define kSCValNetPPPAuthProtocolMSCHAP1                               \
          SC_SCHEMA_KV(kSCValNetPPPAuthProtocolMSCHAP1                  \
                      ,"MSCHAP1"                                        \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetPPPAuthProtocolMSCHAP2, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCValNetPPPAuthProtocolMSCHAP2, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetPPPAuthProtocolMSCHAP2                               \
          SC_SCHEMA_KV(kSCValNetPPPAuthProtocolMSCHAP2                  \
                      ,"MSCHAP2"                                        \
                      ,CFString                                         )
 #endif
 
   #define kSCValNetPPPAuthProtocolMSCHAP2                               \
          SC_SCHEMA_KV(kSCValNetPPPAuthProtocolMSCHAP2                  \
                      ,"MSCHAP2"                                        \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetPPPAuthProtocolPAP, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCValNetPPPAuthProtocolPAP, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetPPPAuthProtocolPAP                                   \
          SC_SCHEMA_KV(kSCValNetPPPAuthProtocolPAP                      \
                      ,"PAP"                                            \
                      ,CFString                                         )
 #endif
 
   #define kSCValNetPPPAuthProtocolPAP                                   \
          SC_SCHEMA_KV(kSCValNetPPPAuthProtocolPAP                      \
                      ,"PAP"                                            \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPCommAlternateRemoteAddress, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPCommAlternateRemoteAddress, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPCommAlternateRemoteAddress                       \
          SC_SCHEMA_KV(kSCPropNetPPPCommAlternateRemoteAddress          \
                      ,"CommAlternateRemoteAddress"                     \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetPPPCommAlternateRemoteAddress                       \
          SC_SCHEMA_KV(kSCPropNetPPPCommAlternateRemoteAddress          \
                      ,"CommAlternateRemoteAddress"                     \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPCommConnectDelay, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPCommConnectDelay, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPCommConnectDelay                                 \
          SC_SCHEMA_KV(kSCPropNetPPPCommConnectDelay                    \
                      ,"CommConnectDelay"                               \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetPPPCommConnectDelay                                 \
          SC_SCHEMA_KV(kSCPropNetPPPCommConnectDelay                    \
                      ,"CommConnectDelay"                               \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPCommDisplayTerminalWindow, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPCommDisplayTerminalWindow, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPCommDisplayTerminalWindow                        \
          SC_SCHEMA_KV(kSCPropNetPPPCommDisplayTerminalWindow           \
                      ,"CommDisplayTerminalWindow"                      \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPCommDisplayTerminalWindow                        \
          SC_SCHEMA_KV(kSCPropNetPPPCommDisplayTerminalWindow           \
                      ,"CommDisplayTerminalWindow"                      \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPCommRedialCount, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPCommRedialCount, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPCommRedialCount                                  \
          SC_SCHEMA_KV(kSCPropNetPPPCommRedialCount                     \
                      ,"CommRedialCount"                                \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetPPPCommRedialCount                                  \
          SC_SCHEMA_KV(kSCPropNetPPPCommRedialCount                     \
                      ,"CommRedialCount"                                \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPCommRedialEnabled, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPCommRedialEnabled, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPCommRedialEnabled                                \
          SC_SCHEMA_KV(kSCPropNetPPPCommRedialEnabled                   \
                      ,"CommRedialEnabled"                              \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPCommRedialEnabled                                \
          SC_SCHEMA_KV(kSCPropNetPPPCommRedialEnabled                   \
                      ,"CommRedialEnabled"                              \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPCommRedialInterval, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPCommRedialInterval, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPCommRedialInterval                               \
          SC_SCHEMA_KV(kSCPropNetPPPCommRedialInterval                  \
                      ,"CommRedialInterval"                             \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetPPPCommRedialInterval                               \
          SC_SCHEMA_KV(kSCPropNetPPPCommRedialInterval                  \
                      ,"CommRedialInterval"                             \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPCommRemoteAddress, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPCommRemoteAddress, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPCommRemoteAddress                                \
          SC_SCHEMA_KV(kSCPropNetPPPCommRemoteAddress                   \
                      ,"CommRemoteAddress"                              \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetPPPCommRemoteAddress                                \
          SC_SCHEMA_KV(kSCPropNetPPPCommRemoteAddress                   \
                      ,"CommRemoteAddress"                              \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPCommTerminalScript, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPCommTerminalScript, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPCommTerminalScript                               \
          SC_SCHEMA_KV(kSCPropNetPPPCommTerminalScript                  \
                      ,"CommTerminalScript"                             \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetPPPCommTerminalScript                               \
          SC_SCHEMA_KV(kSCPropNetPPPCommTerminalScript                  \
                      ,"CommTerminalScript"                             \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPCommUseTerminalScript, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPCommUseTerminalScript, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPCommUseTerminalScript                            \
          SC_SCHEMA_KV(kSCPropNetPPPCommUseTerminalScript               \
                      ,"CommUseTerminalScript"                          \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPCommUseTerminalScript                            \
          SC_SCHEMA_KV(kSCPropNetPPPCommUseTerminalScript               \
                      ,"CommUseTerminalScript"                          \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPCCPEnabled, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPCCPEnabled, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPCCPEnabled                                       \
          SC_SCHEMA_KV(kSCPropNetPPPCCPEnabled                          \
                      ,"CCPEnabled"                                     \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPCCPEnabled                                       \
          SC_SCHEMA_KV(kSCPropNetPPPCCPEnabled                          \
                      ,"CCPEnabled"                                     \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPCCPMPPE40Enabled, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPCCPMPPE40Enabled, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPCCPMPPE40Enabled                                 \
          SC_SCHEMA_KV(kSCPropNetPPPCCPMPPE40Enabled                    \
                      ,"CCPMPPE40Enabled"                               \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPCCPMPPE40Enabled                                 \
          SC_SCHEMA_KV(kSCPropNetPPPCCPMPPE40Enabled                    \
                      ,"CCPMPPE40Enabled"                               \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPCCPMPPE128Enabled, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPCCPMPPE128Enabled, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPCCPMPPE128Enabled                                \
          SC_SCHEMA_KV(kSCPropNetPPPCCPMPPE128Enabled                   \
                      ,"CCPMPPE128Enabled"                              \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPCCPMPPE128Enabled                                \
          SC_SCHEMA_KV(kSCPropNetPPPCCPMPPE128Enabled                   \
                      ,"CCPMPPE128Enabled"                              \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPIPCPCompressionVJ, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPIPCPCompressionVJ, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPIPCPCompressionVJ                                \
          SC_SCHEMA_KV(kSCPropNetPPPIPCPCompressionVJ                   \
                      ,"IPCPCompressionVJ"                              \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPIPCPCompressionVJ                                \
          SC_SCHEMA_KV(kSCPropNetPPPIPCPCompressionVJ                   \
                      ,"IPCPCompressionVJ"                              \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPIPCPUsePeerDNS, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPIPCPUsePeerDNS, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPIPCPUsePeerDNS                                   \
          SC_SCHEMA_KV(kSCPropNetPPPIPCPUsePeerDNS                      \
                      ,"IPCPUsePeerDNS"                                 \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPIPCPUsePeerDNS                                   \
          SC_SCHEMA_KV(kSCPropNetPPPIPCPUsePeerDNS                      \
                      ,"IPCPUsePeerDNS"                                 \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPEchoEnabled, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPEchoEnabled, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPLCPEchoEnabled                                   \
          SC_SCHEMA_KV(kSCPropNetPPPLCPEchoEnabled                      \
                      ,"LCPEchoEnabled"                                 \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPLCPEchoEnabled                                   \
          SC_SCHEMA_KV(kSCPropNetPPPLCPEchoEnabled                      \
                      ,"LCPEchoEnabled"                                 \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPEchoFailure, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPEchoFailure, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPLCPEchoFailure                                   \
          SC_SCHEMA_KV(kSCPropNetPPPLCPEchoFailure                      \
                      ,"LCPEchoFailure"                                 \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetPPPLCPEchoFailure                                   \
          SC_SCHEMA_KV(kSCPropNetPPPLCPEchoFailure                      \
                      ,"LCPEchoFailure"                                 \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPEchoInterval, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPEchoInterval, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPLCPEchoInterval                                  \
          SC_SCHEMA_KV(kSCPropNetPPPLCPEchoInterval                     \
                      ,"LCPEchoInterval"                                \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetPPPLCPEchoInterval                                  \
          SC_SCHEMA_KV(kSCPropNetPPPLCPEchoInterval                     \
                      ,"LCPEchoInterval"                                \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPCompressionACField, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPCompressionACField, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPLCPCompressionACField                            \
          SC_SCHEMA_KV(kSCPropNetPPPLCPCompressionACField               \
                      ,"LCPCompressionACField"                          \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPLCPCompressionACField                            \
          SC_SCHEMA_KV(kSCPropNetPPPLCPCompressionACField               \
                      ,"LCPCompressionACField"                          \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPCompressionPField, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPCompressionPField, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPLCPCompressionPField                             \
          SC_SCHEMA_KV(kSCPropNetPPPLCPCompressionPField                \
                      ,"LCPCompressionPField"                           \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPLCPCompressionPField                             \
          SC_SCHEMA_KV(kSCPropNetPPPLCPCompressionPField                \
                      ,"LCPCompressionPField"                           \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPMRU, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPMRU, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPLCPMRU                                           \
          SC_SCHEMA_KV(kSCPropNetPPPLCPMRU                              \
                      ,"LCPMRU"                                         \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetPPPLCPMRU                                           \
          SC_SCHEMA_KV(kSCPropNetPPPLCPMRU                              \
                      ,"LCPMRU"                                         \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPMTU, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPMTU, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPLCPMTU                                           \
          SC_SCHEMA_KV(kSCPropNetPPPLCPMTU                              \
                      ,"LCPMTU"                                         \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetPPPLCPMTU                                           \
          SC_SCHEMA_KV(kSCPropNetPPPLCPMTU                              \
                      ,"LCPMTU"                                         \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPReceiveACCM, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPReceiveACCM, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPLCPReceiveACCM                                   \
          SC_SCHEMA_KV(kSCPropNetPPPLCPReceiveACCM                      \
                      ,"LCPReceiveACCM"                                 \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetPPPLCPReceiveACCM                                   \
          SC_SCHEMA_KV(kSCPropNetPPPLCPReceiveACCM                      \
                      ,"LCPReceiveACCM"                                 \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPTransmitACCM, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPLCPTransmitACCM, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPLCPTransmitACCM                                  \
          SC_SCHEMA_KV(kSCPropNetPPPLCPTransmitACCM                     \
                      ,"LCPTransmitACCM"                                \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetPPPLCPTransmitACCM                                  \
          SC_SCHEMA_KV(kSCPropNetPPPLCPTransmitACCM                     \
                      ,"LCPTransmitACCM"                                \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetL2TPIPSecSharedSecret, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCPropNetL2TPIPSecSharedSecret, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetL2TPIPSecSharedSecret                               \
          SC_SCHEMA_KV(kSCPropNetL2TPIPSecSharedSecret                  \
                      ,"IPSecSharedSecret"                              \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetL2TPIPSecSharedSecret                               \
          SC_SCHEMA_KV(kSCPropNetL2TPIPSecSharedSecret                  \
                      ,"IPSecSharedSecret"                              \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetL2TPIPSecSharedSecretEncryption, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCPropNetL2TPIPSecSharedSecretEncryption, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetL2TPIPSecSharedSecretEncryption                     \
          SC_SCHEMA_KV(kSCPropNetL2TPIPSecSharedSecretEncryption        \
                      ,"IPSecSharedSecretEncryption"                    \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetL2TPIPSecSharedSecretEncryption                     \
          SC_SCHEMA_KV(kSCPropNetL2TPIPSecSharedSecretEncryption        \
                      ,"IPSecSharedSecretEncryption"                    \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetL2TPTransport, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCPropNetL2TPTransport, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetL2TPTransport                                       \
          SC_SCHEMA_KV(kSCPropNetL2TPTransport                          \
                      ,"Transport"                                      \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetL2TPTransport                                       \
          SC_SCHEMA_KV(kSCPropNetL2TPTransport                          \
                      ,"Transport"                                      \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetL2TPIPSecSharedSecretEncryptionKeychain, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCValNetL2TPIPSecSharedSecretEncryptionKeychain, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetL2TPIPSecSharedSecretEncryptionKeychain              \
          SC_SCHEMA_KV(kSCValNetL2TPIPSecSharedSecretEncryptionKeychain \
                      ,"Keychain"                                       \
                      ,                                                 )
 #endif
 
   #define kSCValNetL2TPIPSecSharedSecretEncryptionKeychain              \
          SC_SCHEMA_KV(kSCValNetL2TPIPSecSharedSecretEncryptionKeychain \
                      ,"Keychain"                                       \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetL2TPTransportIP, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCValNetL2TPTransportIP, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetL2TPTransportIP                                      \
          SC_SCHEMA_KV(kSCValNetL2TPTransportIP                         \
                      ,"IP"                                             \
                      ,                                                 )
 #endif
 
   #define kSCValNetL2TPTransportIP                                      \
          SC_SCHEMA_KV(kSCValNetL2TPTransportIP                         \
                      ,"IP"                                             \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCValNetL2TPTransportIPSec, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)
+  SC_SCHEMA_DECLARATION(kSCValNetL2TPTransportIPSec, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetL2TPTransportIPSec                                   \
          SC_SCHEMA_KV(kSCValNetL2TPTransportIPSec                      \
                      ,"IPSec"                                          \
                      ,                                                 )
 #endif
 
   #define kSCValNetL2TPTransportIPSec                                   \
          SC_SCHEMA_KV(kSCValNetL2TPTransportIPSec                      \
                      ,"IPSec"                                          \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesExceptionsList, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesExceptionsList, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesExceptionsList                               \
          SC_SCHEMA_KV(kSCPropNetProxiesExceptionsList                  \
                      ,"ExceptionsList"                                 \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetProxiesExceptionsList                               \
          SC_SCHEMA_KV(kSCPropNetProxiesExceptionsList                  \
                      ,"ExceptionsList"                                 \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesExcludeSimpleHostnames, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesExcludeSimpleHostnames, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesExcludeSimpleHostnames                       \
          SC_SCHEMA_KV(kSCPropNetProxiesExcludeSimpleHostnames          \
                      ,"ExcludeSimpleHostnames"                         \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetProxiesExcludeSimpleHostnames                       \
          SC_SCHEMA_KV(kSCPropNetProxiesExcludeSimpleHostnames          \
                      ,"ExcludeSimpleHostnames"                         \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesFTPEnable, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesFTPEnable, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesFTPEnable                                    \
          SC_SCHEMA_KV(kSCPropNetProxiesFTPEnable                       \
                      ,"FTPEnable"                                      \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetProxiesFTPEnable                                    \
          SC_SCHEMA_KV(kSCPropNetProxiesFTPEnable                       \
                      ,"FTPEnable"                                      \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesFTPPassive, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesFTPPassive, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesFTPPassive                                   \
          SC_SCHEMA_KV(kSCPropNetProxiesFTPPassive                      \
                      ,"FTPPassive"                                     \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetProxiesFTPPassive                                   \
          SC_SCHEMA_KV(kSCPropNetProxiesFTPPassive                      \
                      ,"FTPPassive"                                     \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesFTPPort, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesFTPPort, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesFTPPort                                      \
          SC_SCHEMA_KV(kSCPropNetProxiesFTPPort                         \
                      ,"FTPPort"                                        \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetProxiesFTPPort                                      \
          SC_SCHEMA_KV(kSCPropNetProxiesFTPPort                         \
                      ,"FTPPort"                                        \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesFTPProxy, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesFTPProxy, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesFTPProxy                                     \
          SC_SCHEMA_KV(kSCPropNetProxiesFTPProxy                        \
                      ,"FTPProxy"                                       \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetProxiesFTPProxy                                     \
          SC_SCHEMA_KV(kSCPropNetProxiesFTPProxy                        \
                      ,"FTPProxy"                                       \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesGopherEnable, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesGopherEnable, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesGopherEnable                                 \
          SC_SCHEMA_KV(kSCPropNetProxiesGopherEnable                    \
                      ,"GopherEnable"                                   \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetProxiesGopherEnable                                 \
          SC_SCHEMA_KV(kSCPropNetProxiesGopherEnable                    \
                      ,"GopherEnable"                                   \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesGopherPort, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesGopherPort, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesGopherPort                                   \
          SC_SCHEMA_KV(kSCPropNetProxiesGopherPort                      \
                      ,"GopherPort"                                     \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetProxiesGopherPort                                   \
          SC_SCHEMA_KV(kSCPropNetProxiesGopherPort                      \
                      ,"GopherPort"                                     \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesGopherProxy, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesGopherProxy, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesGopherProxy                                  \
          SC_SCHEMA_KV(kSCPropNetProxiesGopherProxy                     \
                      ,"GopherProxy"                                    \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetProxiesGopherProxy                                  \
          SC_SCHEMA_KV(kSCPropNetProxiesGopherProxy                     \
                      ,"GopherProxy"                                    \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPEnable, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPEnable, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesHTTPEnable                                   \
          SC_SCHEMA_KV(kSCPropNetProxiesHTTPEnable                      \
                      ,"HTTPEnable"                                     \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetProxiesHTTPEnable                                   \
          SC_SCHEMA_KV(kSCPropNetProxiesHTTPEnable                      \
                      ,"HTTPEnable"                                     \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPPort, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPPort, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesHTTPPort                                     \
          SC_SCHEMA_KV(kSCPropNetProxiesHTTPPort                        \
                      ,"HTTPPort"                                       \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetProxiesHTTPPort                                     \
          SC_SCHEMA_KV(kSCPropNetProxiesHTTPPort                        \
                      ,"HTTPPort"                                       \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPProxy, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPProxy, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesHTTPProxy                                    \
          SC_SCHEMA_KV(kSCPropNetProxiesHTTPProxy                       \
                      ,"HTTPProxy"                                      \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetProxiesHTTPProxy                                    \
          SC_SCHEMA_KV(kSCPropNetProxiesHTTPProxy                       \
                      ,"HTTPProxy"                                      \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPSEnable, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPSEnable, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesHTTPSEnable                                  \
          SC_SCHEMA_KV(kSCPropNetProxiesHTTPSEnable                     \
                      ,"HTTPSEnable"                                    \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetProxiesHTTPSEnable                                  \
          SC_SCHEMA_KV(kSCPropNetProxiesHTTPSEnable                     \
                      ,"HTTPSEnable"                                    \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPSPort, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPSPort, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesHTTPSPort                                    \
          SC_SCHEMA_KV(kSCPropNetProxiesHTTPSPort                       \
                      ,"HTTPSPort"                                      \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetProxiesHTTPSPort                                    \
          SC_SCHEMA_KV(kSCPropNetProxiesHTTPSPort                       \
                      ,"HTTPSPort"                                      \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPSProxy, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesHTTPSProxy, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesHTTPSProxy                                   \
          SC_SCHEMA_KV(kSCPropNetProxiesHTTPSProxy                      \
                      ,"HTTPSProxy"                                     \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetProxiesHTTPSProxy                                   \
          SC_SCHEMA_KV(kSCPropNetProxiesHTTPSProxy                      \
                      ,"HTTPSProxy"                                     \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesRTSPEnable, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesRTSPEnable, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesRTSPEnable                                   \
          SC_SCHEMA_KV(kSCPropNetProxiesRTSPEnable                      \
                      ,"RTSPEnable"                                     \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetProxiesRTSPEnable                                   \
          SC_SCHEMA_KV(kSCPropNetProxiesRTSPEnable                      \
                      ,"RTSPEnable"                                     \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesRTSPPort, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesRTSPPort, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesRTSPPort                                     \
          SC_SCHEMA_KV(kSCPropNetProxiesRTSPPort                        \
                      ,"RTSPPort"                                       \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetProxiesRTSPPort                                     \
          SC_SCHEMA_KV(kSCPropNetProxiesRTSPPort                        \
                      ,"RTSPPort"                                       \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesRTSPProxy, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesRTSPProxy, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesRTSPProxy                                    \
          SC_SCHEMA_KV(kSCPropNetProxiesRTSPProxy                       \
                      ,"RTSPProxy"                                      \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetProxiesRTSPProxy                                    \
          SC_SCHEMA_KV(kSCPropNetProxiesRTSPProxy                       \
                      ,"RTSPProxy"                                      \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesSOCKSEnable, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesSOCKSEnable, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesSOCKSEnable                                  \
          SC_SCHEMA_KV(kSCPropNetProxiesSOCKSEnable                     \
                      ,"SOCKSEnable"                                    \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetProxiesSOCKSEnable                                  \
          SC_SCHEMA_KV(kSCPropNetProxiesSOCKSEnable                     \
                      ,"SOCKSEnable"                                    \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesSOCKSPort, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesSOCKSPort, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesSOCKSPort                                    \
          SC_SCHEMA_KV(kSCPropNetProxiesSOCKSPort                       \
                      ,"SOCKSPort"                                      \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropNetProxiesSOCKSPort                                    \
          SC_SCHEMA_KV(kSCPropNetProxiesSOCKSPort                       \
                      ,"SOCKSPort"                                      \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesSOCKSProxy, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesSOCKSProxy, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesSOCKSProxy                                   \
          SC_SCHEMA_KV(kSCPropNetProxiesSOCKSProxy                      \
                      ,"SOCKSProxy"                                     \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetProxiesSOCKSProxy                                   \
          SC_SCHEMA_KV(kSCPropNetProxiesSOCKSProxy                      \
                      ,"SOCKSProxy"                                     \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesProxyAutoConfigEnable, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesProxyAutoConfigEnable, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesProxyAutoConfigEnable                        \
          SC_SCHEMA_KV(kSCPropNetProxiesProxyAutoConfigEnable           \
                      ,"ProxyAutoConfigEnable"                          \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetProxiesProxyAutoConfigEnable                        \
          SC_SCHEMA_KV(kSCPropNetProxiesProxyAutoConfigEnable           \
                      ,"ProxyAutoConfigEnable"                          \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesProxyAutoConfigURLString, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesProxyAutoConfigURLString, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesProxyAutoConfigURLString                     \
          SC_SCHEMA_KV(kSCPropNetProxiesProxyAutoConfigURLString        \
                      ,"ProxyAutoConfigURLString"                       \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetProxiesProxyAutoConfigURLString                     \
          SC_SCHEMA_KV(kSCPropNetProxiesProxyAutoConfigURLString        \
                      ,"ProxyAutoConfigURLString"                       \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-  SC_SCHEMA_DECLARATION(kSCPropNetProxiesProxyAutoDiscoveryEnable, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+  SC_SCHEMA_DECLARATION(kSCPropNetProxiesProxyAutoDiscoveryEnable, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetProxiesProxyAutoDiscoveryEnable                     \
          SC_SCHEMA_KV(kSCPropNetProxiesProxyAutoDiscoveryEnable        \
                      ,"ProxyAutoDiscoveryEnable"                       \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetProxiesProxyAutoDiscoveryEnable                     \
          SC_SCHEMA_KV(kSCPropNetProxiesProxyAutoDiscoveryEnable        \
                      ,"ProxyAutoDiscoveryEnable"                       \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetSMBNetBIOSName, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+#if !TARGET_OS_IPHONE
+
+  SC_SCHEMA_DECLARATION(kSCPropNetSMBNetBIOSName, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetSMBNetBIOSName                                      \
          SC_SCHEMA_KV(kSCPropNetSMBNetBIOSName                         \
                      ,"NetBIOSName"                                    \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetSMBNetBIOSName                                      \
          SC_SCHEMA_KV(kSCPropNetSMBNetBIOSName                         \
                      ,"NetBIOSName"                                    \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetSMBNetBIOSNodeType, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropNetSMBNetBIOSNodeType, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetSMBNetBIOSNodeType                                  \
          SC_SCHEMA_KV(kSCPropNetSMBNetBIOSNodeType                     \
                      ,"NetBIOSNodeType"                                \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetSMBNetBIOSNodeType                                  \
          SC_SCHEMA_KV(kSCPropNetSMBNetBIOSNodeType                     \
                      ,"NetBIOSNodeType"                                \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetSMBNetBIOSScope, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropNetSMBNetBIOSScope, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetSMBNetBIOSScope                                     \
          SC_SCHEMA_KV(kSCPropNetSMBNetBIOSScope                        \
                      ,"NetBIOSScope"                                   \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetSMBNetBIOSScope                                     \
          SC_SCHEMA_KV(kSCPropNetSMBNetBIOSScope                        \
                      ,"NetBIOSScope"                                   \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetSMBWINSAddresses, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropNetSMBWINSAddresses, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetSMBWINSAddresses                                    \
          SC_SCHEMA_KV(kSCPropNetSMBWINSAddresses                       \
                      ,"WINSAddresses"                                  \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetSMBWINSAddresses                                    \
          SC_SCHEMA_KV(kSCPropNetSMBWINSAddresses                       \
                      ,"WINSAddresses"                                  \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetSMBWorkgroup, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropNetSMBWorkgroup, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetSMBWorkgroup                                        \
          SC_SCHEMA_KV(kSCPropNetSMBWorkgroup                           \
                      ,"Workgroup"                                      \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetSMBWorkgroup                                        \
          SC_SCHEMA_KV(kSCPropNetSMBWorkgroup                           \
                      ,"Workgroup"                                      \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCValNetSMBNetBIOSNodeTypeBroadcast, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCValNetSMBNetBIOSNodeTypeBroadcast, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetSMBNetBIOSNodeTypeBroadcast                          \
          SC_SCHEMA_KV(kSCValNetSMBNetBIOSNodeTypeBroadcast             \
                      ,"Broadcast"                                      \
                      ,                                                 )
 #endif
 
   #define kSCValNetSMBNetBIOSNodeTypeBroadcast                          \
          SC_SCHEMA_KV(kSCValNetSMBNetBIOSNodeTypeBroadcast             \
                      ,"Broadcast"                                      \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCValNetSMBNetBIOSNodeTypePeer, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCValNetSMBNetBIOSNodeTypePeer, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetSMBNetBIOSNodeTypePeer                               \
          SC_SCHEMA_KV(kSCValNetSMBNetBIOSNodeTypePeer                  \
                      ,"Peer"                                           \
                      ,                                                 )
 #endif
 
   #define kSCValNetSMBNetBIOSNodeTypePeer                               \
          SC_SCHEMA_KV(kSCValNetSMBNetBIOSNodeTypePeer                  \
                      ,"Peer"                                           \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCValNetSMBNetBIOSNodeTypeMixed, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCValNetSMBNetBIOSNodeTypeMixed, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetSMBNetBIOSNodeTypeMixed                              \
          SC_SCHEMA_KV(kSCValNetSMBNetBIOSNodeTypeMixed                 \
                      ,"Mixed"                                          \
                      ,                                                 )
 #endif
 
   #define kSCValNetSMBNetBIOSNodeTypeMixed                              \
          SC_SCHEMA_KV(kSCValNetSMBNetBIOSNodeTypeMixed                 \
                      ,"Mixed"                                          \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCValNetSMBNetBIOSNodeTypeHybrid, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCValNetSMBNetBIOSNodeTypeHybrid, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetSMBNetBIOSNodeTypeHybrid                             \
          SC_SCHEMA_KV(kSCValNetSMBNetBIOSNodeTypeHybrid                \
                      ,"Hybrid"                                         \
                      ,                                                 )
 #endif
 
   #define kSCValNetSMBNetBIOSNodeTypeHybrid                             \
          SC_SCHEMA_KV(kSCValNetSMBNetBIOSNodeTypeHybrid                \
                      ,"Hybrid"                                         \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCEntUsersConsoleUser, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+#endif // !TARGET_OS_IPHONE
+
+#if !TARGET_OS_IPHONE
+
+  SC_SCHEMA_DECLARATION(kSCEntUsersConsoleUser, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCEntUsersConsoleUser                                        \
          SC_SCHEMA_KV(kSCEntUsersConsoleUser                           \
                      ,"ConsoleUser"                                    \
                      ,                                                 )
 #endif
 
   #define kSCEntUsersConsoleUser                                        \
          SC_SCHEMA_KV(kSCEntUsersConsoleUser                           \
                      ,"ConsoleUser"                                    \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropSystemComputerName, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+#endif // !TARGET_OS_IPHONE
+
+  SC_SCHEMA_DECLARATION(kSCPropSystemComputerName, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropSystemComputerName                                     \
          SC_SCHEMA_KV(kSCPropSystemComputerName                        \
                      ,"ComputerName"                                   \
                      ,CFString                                         )
 #endif
 
   #define kSCPropSystemComputerName                                     \
          SC_SCHEMA_KV(kSCPropSystemComputerName                        \
                      ,"ComputerName"                                   \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropSystemComputerNameEncoding, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropSystemComputerNameEncoding, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropSystemComputerNameEncoding                             \
          SC_SCHEMA_KV(kSCPropSystemComputerNameEncoding                \
                      ,"ComputerNameEncoding"                           \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropSystemComputerNameEncoding                             \
          SC_SCHEMA_KV(kSCPropSystemComputerNameEncoding                \
                      ,"ComputerNameEncoding"                           \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCDynamicStoreDomainFile, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCDynamicStoreDomainFile, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCDynamicStoreDomainFile                                     \
          SC_SCHEMA_KV(kSCDynamicStoreDomainFile                        \
                      ,"File:"                                          \
                      ,                                                 )
 #endif
 
   #define kSCDynamicStoreDomainFile                                     \
          SC_SCHEMA_KV(kSCDynamicStoreDomainFile                        \
                      ,"File:"                                          \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCDynamicStoreDomainPlugin, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCDynamicStoreDomainPlugin, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCDynamicStoreDomainPlugin                                   \
          SC_SCHEMA_KV(kSCDynamicStoreDomainPlugin                      \
                      ,"Plugin:"                                        \
                      ,                                                 )
 #endif
 
   #define kSCDynamicStoreDomainPlugin                                   \
          SC_SCHEMA_KV(kSCDynamicStoreDomainPlugin                      \
                      ,"Plugin:"                                        \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCDynamicStoreDomainSetup, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCDynamicStoreDomainSetup, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCDynamicStoreDomainSetup                                    \
          SC_SCHEMA_KV(kSCDynamicStoreDomainSetup                       \
                      ,"Setup:"                                         \
                      ,                                                 )
 #endif
 
   #define kSCDynamicStoreDomainSetup                                    \
          SC_SCHEMA_KV(kSCDynamicStoreDomainSetup                       \
                      ,"Setup:"                                         \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCDynamicStoreDomainState, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCDynamicStoreDomainState, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCDynamicStoreDomainState                                    \
          SC_SCHEMA_KV(kSCDynamicStoreDomainState                       \
                      ,"State:"                                         \
                      ,                                                 )
 #endif
 
   #define kSCDynamicStoreDomainState                                    \
          SC_SCHEMA_KV(kSCDynamicStoreDomainState                       \
                      ,"State:"                                         \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCDynamicStoreDomainPrefs, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCDynamicStoreDomainPrefs, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCDynamicStoreDomainPrefs                                    \
          SC_SCHEMA_KV(kSCDynamicStoreDomainPrefs                       \
                      ,"Prefs:"                                         \
                      ,                                                 )
 #endif
 
   #define kSCDynamicStoreDomainPrefs                                    \
          SC_SCHEMA_KV(kSCDynamicStoreDomainPrefs                       \
                      ,"Prefs:"                                         \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCDynamicStorePropSetupCurrentSet, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCDynamicStorePropSetupCurrentSet, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCDynamicStorePropSetupCurrentSet                            \
          SC_SCHEMA_KV(kSCDynamicStorePropSetupCurrentSet               \
                      ,"CurrentSet"                                     \
                      ,CFString                                         )
 #endif
 
   #define kSCDynamicStorePropSetupCurrentSet                            \
          SC_SCHEMA_KV(kSCDynamicStorePropSetupCurrentSet               \
                      ,"CurrentSet"                                     \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCDynamicStorePropSetupLastUpdated, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCDynamicStorePropSetupLastUpdated, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCDynamicStorePropSetupLastUpdated                           \
          SC_SCHEMA_KV(kSCDynamicStorePropSetupLastUpdated              \
                      ,"LastUpdated"                                    \
                      ,                                                 )
 #endif
 
   #define kSCDynamicStorePropSetupLastUpdated                           \
          SC_SCHEMA_KV(kSCDynamicStorePropSetupLastUpdated              \
                      ,"LastUpdated"                                    \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCDynamicStorePropNetInterfaces, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCDynamicStorePropNetInterfaces, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCDynamicStorePropNetInterfaces                              \
          SC_SCHEMA_KV(kSCDynamicStorePropNetInterfaces                 \
                      ,"Interfaces"                                     \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCDynamicStorePropNetInterfaces                              \
          SC_SCHEMA_KV(kSCDynamicStorePropNetInterfaces                 \
                      ,"Interfaces"                                     \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCDynamicStorePropNetPrimaryInterface, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCDynamicStorePropNetPrimaryInterface, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCDynamicStorePropNetPrimaryInterface                        \
          SC_SCHEMA_KV(kSCDynamicStorePropNetPrimaryInterface           \
                      ,"PrimaryInterface"                               \
                      ,CFString                                         )
 #endif
 
   #define kSCDynamicStorePropNetPrimaryInterface                        \
          SC_SCHEMA_KV(kSCDynamicStorePropNetPrimaryInterface           \
                      ,"PrimaryInterface"                               \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCDynamicStorePropNetPrimaryService, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCDynamicStorePropNetPrimaryService, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCDynamicStorePropNetPrimaryService                          \
          SC_SCHEMA_KV(kSCDynamicStorePropNetPrimaryService             \
                      ,"PrimaryService"                                 \
                      ,CFString                                         )
 #endif
 
   #define kSCDynamicStorePropNetPrimaryService                          \
          SC_SCHEMA_KV(kSCDynamicStorePropNetPrimaryService             \
                      ,"PrimaryService"                                 \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCDynamicStorePropNetServiceIDs, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCDynamicStorePropNetServiceIDs, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCDynamicStorePropNetServiceIDs                              \
          SC_SCHEMA_KV(kSCDynamicStorePropNetServiceIDs                 \
                      ,"ServiceIDs"                                     \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCDynamicStorePropNetServiceIDs                              \
          SC_SCHEMA_KV(kSCDynamicStorePropNetServiceIDs                 \
                      ,"ServiceIDs"                                     \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropUsersConsoleUserName, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+#if !TARGET_OS_IPHONE
+
+  SC_SCHEMA_DECLARATION(kSCPropUsersConsoleUserName, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_4,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCPropUsersConsoleUserName                                   \
          SC_SCHEMA_KV(kSCPropUsersConsoleUserName                      \
                      ,"Name"                                           \
                      ,CFString                                         )
 #endif
 
   #define kSCPropUsersConsoleUserName                                   \
          SC_SCHEMA_KV(kSCPropUsersConsoleUserName                      \
                      ,"Name"                                           \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropUsersConsoleUserUID, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropUsersConsoleUserUID, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_4,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCPropUsersConsoleUserUID                                    \
          SC_SCHEMA_KV(kSCPropUsersConsoleUserUID                       \
                      ,"UID"                                            \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropUsersConsoleUserUID                                    \
          SC_SCHEMA_KV(kSCPropUsersConsoleUserUID                       \
                      ,"UID"                                            \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  SC_SCHEMA_DECLARATION(kSCPropUsersConsoleUserGID, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)
+  SC_SCHEMA_DECLARATION(kSCPropUsersConsoleUserGID, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_4,__IPHONE_NA,__IPHONE_NA))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)
   #define kSCPropUsersConsoleUserGID                                    \
          SC_SCHEMA_KV(kSCPropUsersConsoleUserGID                       \
                      ,"GID"                                            \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropUsersConsoleUserGID                                    \
          SC_SCHEMA_KV(kSCPropUsersConsoleUserGID                       \
                      ,"GID"                                            \
                      ,CFNumber                                         )
 #endif
 
-#endif /* _SCSCHEMADEFINITIONS_H */
+#endif // !TARGET_OS_IPHONE
+
+#endif /* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */
+#endif /* _SCSCHEMADEFINITIONS_H */
index 0f60ba395e9d6d0bbadd844d60c0e951a7829744..6da974704c5b6a465e4c99f4e85ffd57064bb9e1 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * Network Entity Keys
  *
  *
  * Network Entity Keys
  *
+ *   kSCEntNetCommCenter                                "com.apple.CommCenter"         CFDictionary
  *   kSCEntNetEAPOL                                     "EAPOL"                        CFDictionary
  *   kSCEntNetEAPOL                                     "EAPOL"                        CFDictionary
+ *   kSCEntNetOnDemand                                  "OnDemand"                     CFDictionary
+ *   kSCEntNetService                                   "__SERVICE__"                  CFDictionary
  *
  * kSCCompNetwork Properties
  *
  *   kSCPropNetIgnoreLinkStatus                         "IgnoreLinkStatus"             CFBoolean
  *
  *
  * kSCCompNetwork Properties
  *
  *   kSCPropNetIgnoreLinkStatus                         "IgnoreLinkStatus"             CFBoolean
  *
+ * kSCEntNetCommCenter Entity Keys
+ *
+ *   kSCPropNetCommCenterAllowNetworkAccess             "AllowNetworkAccess"           CFNumber (0 or 1)
+ *   kSCPropNetCommCenterAvailable                      "Available"                    CFNumber (0 or 1)
+ *
+ * kSCEntNetIPSec Entity Keys
+ *
+ *   kSCPropNetIPSecLastCause                           "LastCause"                    CFNumber
+ *
+ *   --- OnDemand: ---
+ *   kSCPropNetIPSecOnDemandEnabled                     "OnDemandEnabled"              CFNumber (0 or 1)
+ *   kSCPropNetIPSecOnDemandMatchDomainsAlways          "OnDemandMatchDomainsAlways"   CFArray[CFString]
+ *   kSCPropNetIPSecOnDemandMatchDomainsOnRetry         "OnDemandMatchDomainsOnRetry"  CFArray[CFString]
+ *   kSCPropNetIPSecOnDemandMatchDomainsNever           "OnDemandMatchDomainsNever"    CFArray[CFString]
+ *
  * kSCEntNetIPv4 Entity Keys
  *
  *   --- kSCPropNetIPv4ConfigMethod values ---
  * kSCEntNetIPv4 Entity Keys
  *
  *   --- kSCPropNetIPv4ConfigMethod values ---
  *   kSCValNetPPPOnDemandPriorityHigh                   "High"
  *   kSCValNetPPPOnDemandPriorityLow                    "Low"
  *
  *   kSCValNetPPPOnDemandPriorityHigh                   "High"
  *   kSCValNetPPPOnDemandPriorityLow                    "Low"
  *
+ * kSCEntNetService Entity Keys
+ *
+ *   kSCPropNetServicePrimaryRank                       "PrimaryRank"                  CFString
+ *   kSCPropNetServiceUserDefinedName                   "UserDefinedName"              CFString
+ *
+ *   --- kSCPropNetServicePrimaryRank values ---
+ *   kSCValNetServicePrimaryRankFirst                   "First"
+ *   kSCValNetServicePrimaryRankLast                    "Last"
+ *   kSCValNetServicePrimaryRankNever                   "Never"
+ *
  * kSCCompSystem Properties
  *
  *   kSCPropSystemComputerNameRegion                    "ComputerNameRegion"           CFNumber
  * kSCCompSystem Properties
  *
  *   kSCPropSystemComputerNameRegion                    "ComputerNameRegion"           CFNumber
@@ -109,12 +137,30 @@ extern const CFStringRef kSCPrefVirtualNetworkInterfaces;
   @group Network Entity Keys
  */
 
   @group Network Entity Keys
  */
 
+/*!
+  @const kSCEntNetCommCenter
+  @availability Introduced in iPhone OS 2.0.
+ */
+extern const CFStringRef kSCEntNetCommCenter;
+
 /*!
   @const kSCEntNetEAPOL
   @availability Introduced in Mac OS X 10.5.
  */
 extern const CFStringRef kSCEntNetEAPOL;
 
 /*!
   @const kSCEntNetEAPOL
   @availability Introduced in Mac OS X 10.5.
  */
 extern const CFStringRef kSCEntNetEAPOL;
 
+/*!
+  @const kSCEntNetOnDemand
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCEntNetOnDemand;
+
+/*!
+  @const kSCEntNetService
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCEntNetService;
+
 /*!
   @group kSCCompNetwork Properties
  */
 /*!
   @group kSCCompNetwork Properties
  */
@@ -125,6 +171,56 @@ extern const CFStringRef kSCEntNetEAPOL;
  */
 extern const CFStringRef kSCPropNetIgnoreLinkStatus;
 
  */
 extern const CFStringRef kSCPropNetIgnoreLinkStatus;
 
+/*!
+  @group kSCEntNetCommCenter Entity Keys
+ */
+
+/*!
+  @const kSCPropNetCommCenterAllowNetworkAccess
+  @availability Introduced in iPhone OS 2.0.
+ */
+extern const CFStringRef kSCPropNetCommCenterAllowNetworkAccess;
+
+/*!
+  @const kSCPropNetCommCenterAvailable
+  @availability Introduced in iPhone OS 2.0.
+ */
+extern const CFStringRef kSCPropNetCommCenterAvailable;
+
+/*!
+  @group kSCEntNetIPSec Entity Keys
+ */
+
+/*!
+  @const kSCPropNetIPSecLastCause
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCPropNetIPSecLastCause;
+
+/*!
+  @const kSCPropNetIPSecOnDemandEnabled
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCPropNetIPSecOnDemandEnabled;
+
+/*!
+  @const kSCPropNetIPSecOnDemandMatchDomainsAlways
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCPropNetIPSecOnDemandMatchDomainsAlways;
+
+/*!
+  @const kSCPropNetIPSecOnDemandMatchDomainsOnRetry
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCPropNetIPSecOnDemandMatchDomainsOnRetry;
+
+/*!
+  @const kSCPropNetIPSecOnDemandMatchDomainsNever
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCPropNetIPSecOnDemandMatchDomainsNever;
+
 /*!
   @group kSCEntNetIPv4 Entity Keys
  */
 /*!
   @group kSCEntNetIPv4 Entity Keys
  */
@@ -205,6 +301,40 @@ extern const CFStringRef kSCValNetPPPOnDemandPriorityHigh;
  */
 extern const CFStringRef kSCValNetPPPOnDemandPriorityLow;
 
  */
 extern const CFStringRef kSCValNetPPPOnDemandPriorityLow;
 
+/*!
+  @group kSCEntNetService Entity Keys
+ */
+
+/*!
+  @const kSCPropNetServicePrimaryRank
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCPropNetServicePrimaryRank;
+
+/*!
+  @const kSCPropNetServiceUserDefinedName
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCPropNetServiceUserDefinedName;
+
+/*!
+  @const kSCValNetServicePrimaryRankFirst
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCValNetServicePrimaryRankFirst;
+
+/*!
+  @const kSCValNetServicePrimaryRankLast
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCValNetServicePrimaryRankLast;
+
+/*!
+  @const kSCValNetServicePrimaryRankNever
+  @availability Introduced in Mac OS X 10.6.
+ */
+extern const CFStringRef kSCValNetServicePrimaryRankNever;
+
 /*!
   @group kSCCompSystem Properties
  */
 /*!
   @group kSCCompSystem Properties
  */
@@ -267,234 +397,290 @@ extern const CFStringRef kSCPropVirtualNetworkInterfacesVLANOptions;
 /* -------------------- Schema declarations -------------------- */
 
 
 /* -------------------- Schema declarations -------------------- */
 
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPrefVirtualNetworkInterfaces, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPrefVirtualNetworkInterfaces, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPrefVirtualNetworkInterfaces                               \
          SC_SCHEMA_KV(kSCPrefVirtualNetworkInterfaces                  \
                      ,"VirtualNetworkInterfaces"                       \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCPrefVirtualNetworkInterfaces                               \
          SC_SCHEMA_KV(kSCPrefVirtualNetworkInterfaces                  \
                      ,"VirtualNetworkInterfaces"                       \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCEntNetEAPOL, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+
+  SC_SCHEMA_DECLARATION(kSCEntNetEAPOL, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCEntNetEAPOL                                                \
          SC_SCHEMA_KV(kSCEntNetEAPOL                                   \
                      ,"EAPOL"                                          \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCEntNetEAPOL                                                \
          SC_SCHEMA_KV(kSCEntNetEAPOL                                   \
                      ,"EAPOL"                                          \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetIgnoreLinkStatus, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+  SC_SCHEMA_DECLARATION(kSCEntNetOnDemand, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000)/*SPI*/
+  #define kSCEntNetOnDemand                                             \
+         SC_SCHEMA_KV(kSCEntNetOnDemand                                \
+                     ,"OnDemand"                                       \
+                     ,CFDictionary                                     )
 #endif
 #endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+
+  SC_SCHEMA_DECLARATION(kSCEntNetService, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
+  #define kSCEntNetService                                              \
+         SC_SCHEMA_KV(kSCEntNetService                                 \
+                     ,"__SERVICE__"                                    \
+                     ,CFDictionary                                     )
+#endif
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIgnoreLinkStatus, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetIgnoreLinkStatus                                    \
          SC_SCHEMA_KV(kSCPropNetIgnoreLinkStatus                       \
                      ,"IgnoreLinkStatus"                               \
                      ,CFBoolean                                        )
 #endif
 
   #define kSCPropNetIgnoreLinkStatus                                    \
          SC_SCHEMA_KV(kSCPropNetIgnoreLinkStatus                       \
                      ,"IgnoreLinkStatus"                               \
                      ,CFBoolean                                        )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodFailover, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecLastCause, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000)/*SPI*/
+  #define kSCPropNetIPSecLastCause                                      \
+         SC_SCHEMA_KV(kSCPropNetIPSecLastCause                         \
+                     ,"LastCause"                                      \
+                     ,CFNumber                                         )
+#endif
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecOnDemandEnabled, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000)/*SPI*/
+  #define kSCPropNetIPSecOnDemandEnabled                                \
+         SC_SCHEMA_KV(kSCPropNetIPSecOnDemandEnabled                   \
+                     ,"OnDemandEnabled"                                \
+                     ,CFNumber (0 or 1)                                )
+#endif
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecOnDemandMatchDomainsAlways, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000)/*SPI*/
+  #define kSCPropNetIPSecOnDemandMatchDomainsAlways                     \
+         SC_SCHEMA_KV(kSCPropNetIPSecOnDemandMatchDomainsAlways        \
+                     ,"OnDemandMatchDomainsAlways"                     \
+                     ,CFArray[CFString]                                )
+#endif
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecOnDemandMatchDomainsOnRetry, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000)/*SPI*/
+  #define kSCPropNetIPSecOnDemandMatchDomainsOnRetry                    \
+         SC_SCHEMA_KV(kSCPropNetIPSecOnDemandMatchDomainsOnRetry       \
+                     ,"OnDemandMatchDomainsOnRetry"                    \
+                     ,CFArray[CFString]                                )
 #endif
 #endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+
+  SC_SCHEMA_DECLARATION(kSCPropNetIPSecOnDemandMatchDomainsNever, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000)/*SPI*/
+  #define kSCPropNetIPSecOnDemandMatchDomainsNever                      \
+         SC_SCHEMA_KV(kSCPropNetIPSecOnDemandMatchDomainsNever         \
+                     ,"OnDemandMatchDomainsNever"                      \
+                     ,CFArray[CFString]                                )
+#endif
+
+  SC_SCHEMA_DECLARATION(kSCValNetIPv4ConfigMethodFailover, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetIPv4ConfigMethodFailover                             \
          SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodFailover                \
                      ,"Failover"                                       \
                      ,                                                 )
 #endif
 
   #define kSCValNetIPv4ConfigMethodFailover                             \
          SC_SCHEMA_KV(kSCValNetIPv4ConfigMethodFailover                \
                      ,"Failover"                                       \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandDomains, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandDomains, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPOnDemandDomains                                  \
          SC_SCHEMA_KV(kSCPropNetPPPOnDemandDomains                     \
                      ,"OnDemandDomains"                                \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropNetPPPOnDemandDomains                                  \
          SC_SCHEMA_KV(kSCPropNetPPPOnDemandDomains                     \
                      ,"OnDemandDomains"                                \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandEnabled, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandEnabled, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPOnDemandEnabled                                  \
          SC_SCHEMA_KV(kSCPropNetPPPOnDemandEnabled                     \
                      ,"OnDemandEnabled"                                \
                      ,CFNumber (0 or 1)                                )
 #endif
 
   #define kSCPropNetPPPOnDemandEnabled                                  \
          SC_SCHEMA_KV(kSCPropNetPPPOnDemandEnabled                     \
                      ,"OnDemandEnabled"                                \
                      ,CFNumber (0 or 1)                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandHostName, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandHostName, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPOnDemandHostName                                 \
          SC_SCHEMA_KV(kSCPropNetPPPOnDemandHostName                    \
                      ,"OnDemandHostName"                               \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetPPPOnDemandHostName                                 \
          SC_SCHEMA_KV(kSCPropNetPPPOnDemandHostName                    \
                      ,"OnDemandHostName"                               \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandMode, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandMode, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPOnDemandMode                                     \
          SC_SCHEMA_KV(kSCPropNetPPPOnDemandMode                        \
                      ,"OnDemandMode"                                   \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetPPPOnDemandMode                                     \
          SC_SCHEMA_KV(kSCPropNetPPPOnDemandMode                        \
                      ,"OnDemandMode"                                   \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandPriority, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropNetPPPOnDemandPriority, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropNetPPPOnDemandPriority                                 \
          SC_SCHEMA_KV(kSCPropNetPPPOnDemandPriority                    \
                      ,"OnDemandPriority"                               \
                      ,CFString                                         )
 #endif
 
   #define kSCPropNetPPPOnDemandPriority                                 \
          SC_SCHEMA_KV(kSCPropNetPPPOnDemandPriority                    \
                      ,"OnDemandPriority"                               \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandModeAggressive, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandModeAggressive, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetPPPOnDemandModeAggressive                            \
          SC_SCHEMA_KV(kSCValNetPPPOnDemandModeAggressive               \
                      ,"Aggressive"                                     \
                      ,                                                 )
 #endif
 
   #define kSCValNetPPPOnDemandModeAggressive                            \
          SC_SCHEMA_KV(kSCValNetPPPOnDemandModeAggressive               \
                      ,"Aggressive"                                     \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandModeConservative, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandModeConservative, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetPPPOnDemandModeConservative                          \
          SC_SCHEMA_KV(kSCValNetPPPOnDemandModeConservative             \
                      ,"Conservative"                                   \
                      ,                                                 )
 #endif
 
   #define kSCValNetPPPOnDemandModeConservative                          \
          SC_SCHEMA_KV(kSCValNetPPPOnDemandModeConservative             \
                      ,"Conservative"                                   \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandModeCompatible, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandModeCompatible, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetPPPOnDemandModeCompatible                            \
          SC_SCHEMA_KV(kSCValNetPPPOnDemandModeCompatible               \
                      ,"Compatible"                                     \
                      ,                                                 )
 #endif
 
   #define kSCValNetPPPOnDemandModeCompatible                            \
          SC_SCHEMA_KV(kSCValNetPPPOnDemandModeCompatible               \
                      ,"Compatible"                                     \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandPriorityDefault, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandPriorityDefault, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetPPPOnDemandPriorityDefault                           \
          SC_SCHEMA_KV(kSCValNetPPPOnDemandPriorityDefault              \
                      ,"Default"                                        \
                      ,                                                 )
 #endif
 
   #define kSCValNetPPPOnDemandPriorityDefault                           \
          SC_SCHEMA_KV(kSCValNetPPPOnDemandPriorityDefault              \
                      ,"Default"                                        \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandPriorityHigh, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandPriorityHigh, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetPPPOnDemandPriorityHigh                              \
          SC_SCHEMA_KV(kSCValNetPPPOnDemandPriorityHigh                 \
                      ,"High"                                           \
                      ,                                                 )
 #endif
 
   #define kSCValNetPPPOnDemandPriorityHigh                              \
          SC_SCHEMA_KV(kSCValNetPPPOnDemandPriorityHigh                 \
                      ,"High"                                           \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandPriorityLow, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCValNetPPPOnDemandPriorityLow, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCValNetPPPOnDemandPriorityLow                               \
          SC_SCHEMA_KV(kSCValNetPPPOnDemandPriorityLow                  \
                      ,"Low"                                            \
                      ,                                                 )
 #endif
 
   #define kSCValNetPPPOnDemandPriorityLow                               \
          SC_SCHEMA_KV(kSCValNetPPPOnDemandPriorityLow                  \
                      ,"Low"                                            \
                      ,                                                 )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropSystemComputerNameRegion, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
+  SC_SCHEMA_DECLARATION(kSCPropNetServicePrimaryRank, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
+  #define kSCPropNetServicePrimaryRank                                  \
+         SC_SCHEMA_KV(kSCPropNetServicePrimaryRank                     \
+                     ,"PrimaryRank"                                    \
+                     ,CFString                                         )
+#endif
+
+  SC_SCHEMA_DECLARATION(kSCPropNetServiceUserDefinedName, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
+  #define kSCPropNetServiceUserDefinedName                              \
+         SC_SCHEMA_KV(kSCPropNetServiceUserDefinedName                 \
+                     ,"UserDefinedName"                                \
+                     ,CFString                                         )
+#endif
+
+  SC_SCHEMA_DECLARATION(kSCValNetServicePrimaryRankFirst, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
+  #define kSCValNetServicePrimaryRankFirst                              \
+         SC_SCHEMA_KV(kSCValNetServicePrimaryRankFirst                 \
+                     ,"First"                                          \
+                     ,                                                 )
+#endif
+
+  SC_SCHEMA_DECLARATION(kSCValNetServicePrimaryRankLast, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
+  #define kSCValNetServicePrimaryRankLast                               \
+         SC_SCHEMA_KV(kSCValNetServicePrimaryRankLast                  \
+                     ,"Last"                                           \
+                     ,                                                 )
+#endif
+
+  SC_SCHEMA_DECLARATION(kSCValNetServicePrimaryRankNever, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
+  #define kSCValNetServicePrimaryRankNever                              \
+         SC_SCHEMA_KV(kSCValNetServicePrimaryRankNever                 \
+                     ,"Never"                                          \
+                     ,                                                 )
 #endif
 #endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+
+  SC_SCHEMA_DECLARATION(kSCPropSystemComputerNameRegion, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropSystemComputerNameRegion                               \
          SC_SCHEMA_KV(kSCPropSystemComputerNameRegion                  \
                      ,"ComputerNameRegion"                             \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropSystemComputerNameRegion                               \
          SC_SCHEMA_KV(kSCPropSystemComputerNameRegion                  \
                      ,"ComputerNameRegion"                             \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropSystemHostName, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropSystemHostName, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropSystemHostName                                         \
          SC_SCHEMA_KV(kSCPropSystemHostName                            \
                      ,"HostName"                                       \
                      ,CFString                                         )
 #endif
 
   #define kSCPropSystemHostName                                         \
          SC_SCHEMA_KV(kSCPropSystemHostName                            \
                      ,"HostName"                                       \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesBondInterfaces, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+#if !TARGET_OS_IPHONE
+
+  SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesBondInterfaces, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropVirtualNetworkInterfacesBondInterfaces                 \
          SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesBondInterfaces    \
                      ,"Interfaces"                                     \
                      ,CFArray[CFString]                                )
 #endif
 
   #define kSCPropVirtualNetworkInterfacesBondInterfaces                 \
          SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesBondInterfaces    \
                      ,"Interfaces"                                     \
                      ,CFArray[CFString]                                )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesBondMode, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesBondMode, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropVirtualNetworkInterfacesBondMode                       \
          SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesBondMode          \
                      ,"Mode"                                           \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropVirtualNetworkInterfacesBondMode                       \
          SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesBondMode          \
                      ,"Mode"                                           \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesBondOptions, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesBondOptions, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropVirtualNetworkInterfacesBondOptions                    \
          SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesBondOptions       \
                      ,"Options"                                        \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCPropVirtualNetworkInterfacesBondOptions                    \
          SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesBondOptions       \
                      ,"Options"                                        \
                      ,CFDictionary                                     )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesVLANInterface, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesVLANInterface, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropVirtualNetworkInterfacesVLANInterface                  \
          SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesVLANInterface     \
                      ,"Interface"                                      \
                      ,CFString                                         )
 #endif
 
   #define kSCPropVirtualNetworkInterfacesVLANInterface                  \
          SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesVLANInterface     \
                      ,"Interface"                                      \
                      ,CFString                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesVLANTag, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesVLANTag, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropVirtualNetworkInterfacesVLANTag                        \
          SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesVLANTag           \
                      ,"Tag"                                            \
                      ,CFNumber                                         )
 #endif
 
   #define kSCPropVirtualNetworkInterfacesVLANTag                        \
          SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesVLANTag           \
                      ,"Tag"                                            \
                      ,CFNumber                                         )
 #endif
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
-  SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesVLANOptions, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
-#endif
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)
+  SC_SCHEMA_DECLARATION(kSCPropVirtualNetworkInterfacesVLANOptions, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))
+#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/
   #define kSCPropVirtualNetworkInterfacesVLANOptions                    \
          SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesVLANOptions       \
                      ,"Options"                                        \
                      ,CFDictionary                                     )
 #endif
 
   #define kSCPropVirtualNetworkInterfacesVLANOptions                    \
          SC_SCHEMA_KV(kSCPropVirtualNetworkInterfacesVLANOptions       \
                      ,"Options"                                        \
                      ,CFDictionary                                     )
 #endif
 
+#endif // !TARGET_OS_IPHONE
+
 #endif /* _SCSCHEMADEFINITIONSPRIVATE_H */
 #endif /* _SCSCHEMADEFINITIONSPRIVATE_H */
index 74cbf3b9e1ceaeba7931af1d4f6af656d2992aff..044107f3028632964bba5763dbb6aa88cd9da1f1 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006, 2008, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -24,6 +24,7 @@
 #ifndef _SYSTEMCONFIGURATION_H
 #define _SYSTEMCONFIGURATION_H
 
 #ifndef _SYSTEMCONFIGURATION_H
 #define _SYSTEMCONFIGURATION_H
 
+#include <Availability.h>
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 
 #include <sys/cdefs.h>
 #include <CoreFoundation/CoreFoundation.h>
 
@@ -66,6 +67,7 @@
        @constant kSCStatusReachabilityUnknown
                A determination could not be made regarding the reachability
                of the specified nodename or address.
        @constant kSCStatusReachabilityUnknown
                A determination could not be made regarding the reachability
                of the specified nodename or address.
+       @constant kSCStatusConnectionNoService  Network service for connection not available
 */
 enum {
        /*
 */
 enum {
        /*
@@ -100,7 +102,13 @@ enum {
        /*
         * SCNetwork error codes
         */
        /*
         * SCNetwork error codes
         */
-       kSCStatusReachabilityUnknown            = 4001  /* Network reachability cannot be determined */
+       kSCStatusReachabilityUnknown            = 4001, /* Network reachability cannot be determined */
+       /*
+        * SCNetworkConnection error codes
+        */
+#if    (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)
+       kSCStatusConnectionNoService            = 5001  /* Network service for connection not available */
+#endif
 };
 
 
 };
 
 
@@ -130,7 +138,7 @@ enum {
        @discussion CFError domain associated with errors reported by
                the SystemConfiguration.framework.
  */
        @discussion CFError domain associated with errors reported by
                the SystemConfiguration.framework.
  */
-extern const CFStringRef       kCFErrorDomainSystemConfiguration       AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+extern const CFStringRef       kCFErrorDomainSystemConfiguration       __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 __BEGIN_DECLS
 
 
 __BEGIN_DECLS
 
@@ -140,7 +148,7 @@ __BEGIN_DECLS
                as the result of calling a System Configuration framework API.
        @result Returns the last error encountered.
  */
                as the result of calling a System Configuration framework API.
        @result Returns the last error encountered.
  */
-CFErrorRef     SCCopyLastError         (void);
+CFErrorRef     SCCopyLastError         (void)                          __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
 
 /*!
        @function SCError
 
 /*!
        @function SCError
@@ -148,7 +156,7 @@ CFErrorRef  SCCopyLastError         (void);
                as the result of calling a System Configuration framework API.
        @result Returns the last error encountered.
  */
                as the result of calling a System Configuration framework API.
        @result Returns the last error encountered.
  */
-int            SCError                 (void);
+int            SCError                 (void)                          __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0);
 
 /*!
        @function SCErrorString
 
 /*!
        @function SCErrorString
@@ -157,7 +165,7 @@ int         SCError                 (void);
        @param status The SCDynamicStoreStatus to be returned.
        @result Returns a pointer to the error message string.
  */
        @param status The SCDynamicStoreStatus to be returned.
        @result Returns a pointer to the error message string.
  */
-const char *   SCErrorString           (int    status);
+const char *   SCErrorString           (int    status)                 __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0);
 
 __END_DECLS
 
 
 __END_DECLS
 
index 564458944d83a877b09a01a6f472235749bac9b0..ed8bd369f54d45f258de0ea9fadbed341c80f9e3 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2003-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2003-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -54,8 +54,6 @@
 #include <net/if_vlan_var.h>
 #include <net/if_types.h>
 
 #include <net/if_vlan_var.h>
 #include <net/if_types.h>
 
-#include <SystemConfiguration/VLANConfiguration.h>
-
 /* ---------- VLAN support ---------- */
 
 static int
 /* ---------- VLAN support ---------- */
 
 static int
@@ -747,15 +745,22 @@ SCVLANInterfaceSetPhysicalInterfaceAndTag(SCVLANInterfaceRef vlan, SCNetworkInte
        }
 
        if (ok) {
        }
 
        if (ok) {
+               SCNetworkInterfacePrivateRef    newInterface;
+               CFTypeRef                       save;
+
                // set physical interface
                // set physical interface
-               if (interfacePrivate->vlan.interface != NULL)
-                       CFRelease(interfacePrivate->vlan.interface);
-               interfacePrivate->vlan.interface = CFRetain(physical);
+               newInterface = __SCNetworkInterfaceCreateCopy(NULL,
+                                                             physical,
+                                                             interfacePrivate->prefs,
+                                                             interfacePrivate->serviceID);
+               save = interfacePrivate->vlan.interface;
+               interfacePrivate->vlan.interface = (SCNetworkInterfaceRef)newInterface;
+               if (save != NULL) CFRelease(save);
 
                // set tag
 
                // set tag
-               if (interfacePrivate->vlan.tag != NULL)
-                       CFRelease(interfacePrivate->vlan.tag);
+               save = interfacePrivate->vlan.tag;
                interfacePrivate->vlan.tag = CFRetain(tag);
                interfacePrivate->vlan.tag = CFRetain(tag);
+               if (save != NULL) CFRelease(save);
        }
 
        return ok;
        }
 
        return ok;
@@ -1136,1153 +1141,3 @@ _SCVLANInterfaceUpdateConfiguration(SCPreferencesRef prefs)
 
        return ok;
 }
 
        return ok;
 }
-
-
-#pragma mark -
-#pragma mark Deprecated SPIs (remove when no longer referenced)
-
-
-/* ---------- VLAN "device" ---------- */
-
-Boolean
-IsVLANSupported(CFStringRef device)
-{
-       return __SCNetworkInterfaceSupportsVLAN(device);
-}
-
-/* ---------- VLANInterface ---------- */
-
-typedef struct {
-
-       /* base CFType information */
-       CFRuntimeBase                   cfBase;
-
-       /* vlan interface configuration */
-       CFStringRef                     ifname;         // e.g. vlan0, vlan1, ...
-       CFStringRef                     device;         // e.g. en0, en1, ...
-       CFNumberRef                     tag;            // e.g. 1 <= tag <= 4094
-       CFDictionaryRef                 options;        // e.g. UserDefinedName
-
-} VLANInterfacePrivate, * VLANInterfacePrivateRef;
-
-
-static CFStringRef     __VLANInterfaceCopyDescription  (CFTypeRef cf);
-static void            __VLANInterfaceDeallocate       (CFTypeRef cf);
-static Boolean         __VLANInterfaceEqual            (CFTypeRef cf1, CFTypeRef cf2);
-
-
-static const CFRuntimeClass __VLANInterfaceClass = {
-       0,                                      // version
-       "VLANInterface",                        // className
-       NULL,                                   // init
-       NULL,                                   // copy
-       __VLANInterfaceDeallocate,              // dealloc
-       __VLANInterfaceEqual,                   // equal
-       NULL,                                   // hash
-       NULL,                                   // copyFormattingDesc
-       __VLANInterfaceCopyDescription          // copyDebugDesc
-};
-
-
-static CFTypeID                __kVLANInterfaceTypeID  = _kCFRuntimeNotATypeID;
-
-
-static pthread_once_t  vlanInterface_init      = PTHREAD_ONCE_INIT;
-
-
-static CFStringRef
-__VLANInterfaceCopyDescription(CFTypeRef cf)
-{
-       CFAllocatorRef          allocator       = CFGetAllocator(cf);
-       CFMutableStringRef      result;
-       VLANInterfacePrivateRef vlanPrivate     = (VLANInterfacePrivateRef)cf;
-
-       result = CFStringCreateMutable(allocator, 0);
-       CFStringAppendFormat(result, NULL, CFSTR("<VLANInterface %p [%p]> {"), cf, allocator);
-       CFStringAppendFormat(result, NULL, CFSTR("if = %@"), vlanPrivate->ifname);
-       CFStringAppendFormat(result, NULL, CFSTR(", device = %@"), vlanPrivate->device);
-       CFStringAppendFormat(result, NULL, CFSTR(", tag = %@"), vlanPrivate->tag);
-       if (vlanPrivate->options != NULL) {
-               CFStringAppendFormat(result, NULL, CFSTR(", options = %@"), vlanPrivate->options);
-       }
-       CFStringAppendFormat(result, NULL, CFSTR("}"));
-
-       return result;
-}
-
-
-static void
-__VLANInterfaceDeallocate(CFTypeRef cf)
-{
-       VLANInterfacePrivateRef vlanPrivate     = (VLANInterfacePrivateRef)cf;
-
-       /* release resources */
-
-       CFRelease(vlanPrivate->ifname);
-       CFRelease(vlanPrivate->device);
-       CFRelease(vlanPrivate->tag);
-       if (vlanPrivate->options)       CFRelease(vlanPrivate->options);
-
-       return;
-}
-
-
-static Boolean
-__VLANInterfaceEquiv(CFTypeRef cf1, CFTypeRef cf2)
-{
-       VLANInterfacePrivateRef vlan1   = (VLANInterfacePrivateRef)cf1;
-       VLANInterfacePrivateRef vlan2   = (VLANInterfacePrivateRef)cf2;
-
-       if (vlan1 == vlan2)
-               return TRUE;
-
-       if (!CFEqual(vlan1->ifname, vlan2->ifname))
-               return FALSE;   // if not the same interface
-
-       if (!CFEqual(vlan1->device, vlan2->device))
-               return FALSE;   // if not the same device
-
-       if (!CFEqual(vlan1->tag, vlan2->tag))
-               return FALSE;   // if not the same tag
-
-       return TRUE;
-}
-
-
-static Boolean
-__VLANInterfaceEqual(CFTypeRef cf1, CFTypeRef cf2)
-{
-       VLANInterfacePrivateRef vlan1   = (VLANInterfacePrivateRef)cf1;
-       VLANInterfacePrivateRef vlan2   = (VLANInterfacePrivateRef)cf2;
-
-       if (!__VLANInterfaceEquiv(vlan1, vlan2))
-               return FALSE;   // if not the same VLAN interface/device/tag
-
-       if (vlan1->options != vlan2->options) {
-               // if the options may differ
-               if ((vlan1->options != NULL) && (vlan2->options != NULL)) {
-                       // if both VLANs have options
-                       if (!CFEqual(vlan1->options, vlan2->options)) {
-                               // if the options are not equal
-                               return FALSE;
-                       }
-               } else {
-                       // if only one VLAN has options
-                       return FALSE;
-               }
-       }
-
-       return TRUE;
-}
-
-
-static void
-__VLANInterfaceInitialize(void)
-{
-       __kVLANInterfaceTypeID = _CFRuntimeRegisterClass(&__VLANInterfaceClass);
-       return;
-}
-
-
-static __inline__ CFTypeRef
-isA_VLANInterface(CFTypeRef obj)
-{
-       return (isA_CFType(obj, VLANInterfaceGetTypeID()));
-}
-
-
-CFTypeID
-VLANInterfaceGetTypeID(void)
-{
-       pthread_once(&vlanInterface_init, __VLANInterfaceInitialize);   /* initialize runtime */
-       return __kVLANInterfaceTypeID;
-}
-
-
-static VLANInterfaceRef
-__VLANInterfaceCreatePrivate(CFAllocatorRef    allocator,
-                            CFStringRef        ifname,
-                            CFStringRef        device,
-                            CFNumberRef        tag,
-                            CFDictionaryRef    options)
-{
-       VLANInterfacePrivateRef         vlanPrivate;
-       uint32_t                        size;
-
-       /* initialize runtime */
-       pthread_once(&vlanInterface_init, __VLANInterfaceInitialize);
-
-       /* allocate vlan */
-       size        = sizeof(VLANInterfacePrivate) - sizeof(CFRuntimeBase);
-       vlanPrivate = (VLANInterfacePrivateRef)_CFRuntimeCreateInstance(allocator,
-                                                                       __kVLANInterfaceTypeID,
-                                                                       size,
-                                                                       NULL);
-       if (!vlanPrivate) {
-               return NULL;
-       }
-
-       /* establish the vlan */
-
-       vlanPrivate->ifname  = CFStringCreateCopy(allocator, ifname);
-       vlanPrivate->device  = CFStringCreateCopy(allocator, device);
-       vlanPrivate->tag     = CFRetain(tag);
-       if (options != NULL) {
-               vlanPrivate->options = CFDictionaryCreateCopy(allocator, options);
-       } else {
-               vlanPrivate->options = NULL;
-       }
-
-       return (VLANInterfaceRef)vlanPrivate;
-}
-
-
-CFStringRef
-VLANInterfaceGetInterface(VLANInterfaceRef vlan)
-{
-       VLANInterfacePrivateRef vlanPrivate     = (VLANInterfacePrivateRef)vlan;
-       CFStringRef             vlan_if         = NULL;
-
-       if (isA_VLANInterface(vlan)) {
-               vlan_if = vlanPrivate->ifname;
-       }
-
-       return vlan_if;
-}
-
-
-CFStringRef
-VLANInterfaceGetDevice(VLANInterfaceRef        vlan)
-{
-       VLANInterfacePrivateRef vlanPrivate     = (VLANInterfacePrivateRef)vlan;
-       CFStringRef             vlan_device     = NULL;
-
-       if (isA_VLANInterface(vlan)) {
-               vlan_device = vlanPrivate->device;
-       }
-
-       return vlan_device;
-}
-
-
-static void
-VLANInterfaceSetDevice(VLANInterfaceRef        vlan, CFStringRef newDevice)
-{
-       VLANInterfacePrivateRef vlanPrivate     = (VLANInterfacePrivateRef)vlan;
-
-       if (isA_VLANInterface(vlan)) {
-               CFAllocatorRef  allocator       = CFGetAllocator(vlan);
-
-               CFRelease(vlanPrivate->device);
-               vlanPrivate->device = CFStringCreateCopy(allocator, newDevice);
-       }
-
-       return;
-}
-
-
-CFNumberRef
-VLANInterfaceGetTag(VLANInterfaceRef vlan)
-{
-       VLANInterfacePrivateRef vlanPrivate     = (VLANInterfacePrivateRef)vlan;
-       CFNumberRef             vlan_tag        = NULL;
-
-       if (isA_VLANInterface(vlan)) {
-               vlan_tag = vlanPrivate->tag;
-       }
-
-       return vlan_tag;
-}
-
-
-static void
-VLANInterfaceSetTag(VLANInterfaceRef vlan, CFNumberRef newTag)
-{
-       VLANInterfacePrivateRef vlanPrivate     = (VLANInterfacePrivateRef)vlan;
-
-       if (isA_VLANInterface(vlan)) {
-               CFRelease(vlanPrivate->tag);
-               vlanPrivate->tag = CFRetain(newTag);
-       }
-
-       return;
-}
-
-
-CFDictionaryRef
-VLANInterfaceGetOptions(VLANInterfaceRef vlan)
-{
-       VLANInterfacePrivateRef vlanPrivate     = (VLANInterfacePrivateRef)vlan;
-       CFDictionaryRef         vlan_options    = NULL;
-
-       if (isA_VLANInterface(vlan)) {
-               vlan_options = vlanPrivate->options;
-       }
-
-       return vlan_options;
-}
-
-
-static void
-VLANInterfaceSetOptions(VLANInterfaceRef vlan, CFDictionaryRef newOptions)
-{
-       VLANInterfacePrivateRef vlanPrivate     = (VLANInterfacePrivateRef)vlan;
-
-       if (isA_VLANInterface(vlan)) {
-               CFAllocatorRef  allocator       = CFGetAllocator(vlan);
-
-               if (vlanPrivate->options)       CFRelease(vlanPrivate->options);
-               if (newOptions != NULL) {
-                       vlanPrivate->options = CFDictionaryCreateCopy(allocator, newOptions);
-               } else {
-                       vlanPrivate->options = NULL;
-               }
-       }
-
-       return;
-}
-
-
-/* ---------- VLANPreferences ---------- */
-
-typedef struct {
-
-       /* base CFType information */
-       CFRuntimeBase                   cfBase;
-
-       /* lock */
-       pthread_mutex_t                 lock;
-
-       /* underlying preferences */
-       SCPreferencesRef                prefs;
-
-       /* base VLANs (before any commits) */
-       CFArrayRef                      vlBase;
-
-} VLANPreferencesPrivate, * VLANPreferencesPrivateRef;
-
-
-static CFStringRef     __VLANPreferencesCopyDescription        (CFTypeRef cf);
-static void            __VLANPreferencesDeallocate             (CFTypeRef cf);
-
-
-static const CFRuntimeClass __VLANPreferencesClass = {
-       0,                                      // version
-       "VLANPreferences",                      // className
-       NULL,                                   // init
-       NULL,                                   // copy
-       __VLANPreferencesDeallocate,            // dealloc
-       NULL,                                   // equal
-       NULL,                                   // hash
-       NULL,                                   // copyFormattingDesc
-       __VLANPreferencesCopyDescription        // copyDebugDesc
-};
-
-
-static CFTypeID                __kVLANPreferencesTypeID        = _kCFRuntimeNotATypeID;
-
-
-static pthread_once_t  vlanPreferences_init            = PTHREAD_ONCE_INIT;
-
-
-static CFStringRef
-__VLANPreferencesCopyDescription(CFTypeRef cf)
-{
-       CFAllocatorRef                  allocator       = CFGetAllocator(cf);
-       CFIndex                         i;
-       CFArrayRef                      keys;
-       CFIndex                         n;
-       VLANPreferencesPrivateRef       prefsPrivate    = (VLANPreferencesPrivateRef)cf;
-       CFMutableStringRef              result;
-
-       result = CFStringCreateMutable(allocator, 0);
-       CFStringAppendFormat(result, NULL, CFSTR("<VLANPreferences %p [%p]> {"), cf, allocator);
-
-       keys = SCPreferencesCopyKeyList(prefsPrivate->prefs);
-       n = CFArrayGetCount(keys);
-       for (i = 0; i < n; i++) {
-               CFStringRef             key;
-               CFPropertyListRef       val;
-
-               key = CFArrayGetValueAtIndex(keys, i);
-               val = SCPreferencesGetValue(prefsPrivate->prefs, key);
-
-               CFStringAppendFormat(result, NULL, CFSTR("%@ : %@"), key, val);
-       }
-       CFRelease(keys);
-
-       CFStringAppendFormat(result, NULL, CFSTR(" }"));
-
-       return result;
-}
-
-
-#define N_QUICK        8
-
-
-static void
-__VLANPreferencesDeallocate(CFTypeRef cf)
-{
-       VLANPreferencesPrivateRef       prefsPrivate    = (VLANPreferencesPrivateRef)cf;
-
-       /* release resources */
-
-       pthread_mutex_destroy(&prefsPrivate->lock);
-
-       if (prefsPrivate->prefs)        CFRelease(prefsPrivate->prefs);
-       if (prefsPrivate->vlBase)       CFRelease(prefsPrivate->vlBase);
-
-       return;
-}
-
-
-static void
-__VLANPreferencesInitialize(void)
-{
-       __kVLANPreferencesTypeID = _CFRuntimeRegisterClass(&__VLANPreferencesClass);
-       return;
-}
-
-
-static __inline__ CFTypeRef
-isA_VLANPreferences(CFTypeRef obj)
-{
-       return (isA_CFType(obj, VLANPreferencesGetTypeID()));
-}
-
-
-CFArrayRef
-_VLANPreferencesCopyActiveInterfaces()
-{
-       CFArrayCallBacks        callbacks;
-       struct ifaddrs          *ifap;
-       struct ifaddrs          *ifp;
-       int                     s;
-       CFMutableArrayRef       vlans   = NULL;
-
-       if (getifaddrs(&ifap) == -1) {
-               SCLog(TRUE, LOG_ERR, CFSTR("getifaddrs() failed: %s"), strerror(errno));
-               _SCErrorSet(kSCStatusFailed);
-               return NULL;
-       }
-
-       s = inet_dgram_socket();
-       if (s == -1) {
-               _SCErrorSet(errno);
-               goto done;
-       }
-
-       callbacks = kCFTypeArrayCallBacks;
-       callbacks.equal = __VLANInterfaceEquiv;
-       vlans = CFArrayCreateMutable(NULL, 0, &callbacks);
-
-       for (ifp = ifap; ifp != NULL; ifp = ifp->ifa_next) {
-               switch (ifp->ifa_addr->sa_family) {
-                       case AF_LINK : {
-                               CFStringRef             device;
-                               struct if_data          *if_data;
-                               struct ifreq            ifr;
-                               CFNumberRef             tag;
-                               VLANInterfaceRef        vlan;
-                               CFStringRef             vlan_if;
-                               char                    vlr_parent[IFNAMSIZ + 1];
-                               int                     vlr_tag;
-                               struct vlanreq          vreq;
-
-                               if_data = (struct if_data *)ifp->ifa_data;
-                               if (if_data == NULL) {
-                                       break;  // if no interface data
-                               }
-
-                               if (if_data->ifi_type != IFT_L2VLAN) {
-                                       break;  // if not VLAN
-                               }
-
-                               bzero(&ifr, sizeof(ifr));
-                               bzero(&vreq, sizeof(vreq));
-                               strncpy(ifr.ifr_name, ifp->ifa_name, sizeof(ifr.ifr_name));
-                               ifr.ifr_data = (caddr_t)&vreq;
-
-                               if (ioctl(s, SIOCGIFVLAN, (caddr_t)&ifr) == -1) {
-                                       SCLog(TRUE, LOG_ERR, CFSTR("ioctl() failed: %s"), strerror(errno));
-                                       CFRelease(vlans);
-                                       vlans = NULL;
-                                       _SCErrorSet(kSCStatusFailed);
-                                       goto done;
-                               }
-                               vlr_tag = vreq.vlr_tag;
-                               bzero(&vlr_parent, sizeof(vlr_parent));
-                               bcopy(vreq.vlr_parent, vlr_parent, IFNAMSIZ);
-
-                               vlan_if = CFStringCreateWithCString(NULL, ifp->ifa_name, kCFStringEncodingASCII);
-                               device  = CFStringCreateWithCString(NULL, vlr_parent, kCFStringEncodingASCII);
-                               tag     = CFNumberCreate(NULL, kCFNumberIntType, &vlr_tag);
-                               vlan    = __VLANInterfaceCreatePrivate(NULL, vlan_if, device, tag, NULL);
-                               CFArrayAppendValue(vlans, vlan);
-                               CFRelease(vlan_if);
-                               CFRelease(device);
-                               CFRelease(tag);
-                               CFRelease(vlan);
-                               break;
-                       }
-
-                       default :
-                               break;
-               }
-       }
-
-    done :
-
-       (void) close(s);
-       freeifaddrs(ifap);
-       return vlans;
-}
-
-
-static CFIndex
-findVLAN(CFArrayRef vlans, CFStringRef device, CFNumberRef tag)
-{
-       CFIndex found   = kCFNotFound;
-       CFIndex i;
-       CFIndex n;
-
-       n = isA_CFArray(vlans) ? CFArrayGetCount(vlans) : 0;
-       for (i = 0; i < n; i++) {
-               CFDictionaryRef vlan_dict;
-               CFStringRef     vlan_device;
-               CFStringRef     vlan_if;
-               CFNumberRef     vlan_tag;
-
-               vlan_dict = CFArrayGetValueAtIndex(vlans, i);
-               if (!isA_CFDictionary(vlan_dict)) {
-                       continue;       // if the prefs are confused
-               }
-
-               vlan_if = CFDictionaryGetValue(vlan_dict, __kVLANInterface_interface);
-               if (!isA_CFString(vlan_if)) {
-                       continue;       // if the prefs are confused
-               }
-
-               vlan_device = CFDictionaryGetValue(vlan_dict, __kVLANInterface_device);
-               if (isA_CFString(vlan_device)) {
-                       if (!CFEqual(device, vlan_device)) {
-                               continue;       // if not a match
-                       }
-               }
-
-               vlan_tag = CFDictionaryGetValue(vlan_dict, __kVLANInterface_tag);
-               if (isA_CFNumber(vlan_tag)) {
-                       if (!CFEqual(tag, vlan_tag)) {
-                               continue;       // if not a match
-                       }
-               }
-
-               // if we have found a match
-               found = i;
-               break;
-       }
-
-       return found;
-}
-
-
-static void
-setConfigurationChanged(VLANPreferencesRef prefs)
-{
-       VLANPreferencesPrivateRef       prefsPrivate    = (VLANPreferencesPrivateRef)prefs;
-
-       /*
-        * to facilitate device configuration we will take
-        * a snapshot of the VLAN preferences before any
-        * changes are made.  Then, when the changes are
-        * applied we can compare what we had to what we
-        * want and configured the system accordingly.
-        */
-       if (prefsPrivate->vlBase == NULL) {
-               prefsPrivate->vlBase = VLANPreferencesCopyInterfaces(prefs);
-       }
-
-       return;
-}
-
-
-CFTypeID
-VLANPreferencesGetTypeID(void)
-{
-       pthread_once(&vlanPreferences_init, __VLANPreferencesInitialize);       /* initialize runtime */
-       return __kVLANPreferencesTypeID;
-}
-
-
-VLANPreferencesRef
-VLANPreferencesCreate(CFAllocatorRef allocator)
-{
-       CFBundleRef                     bundle;
-       CFStringRef                     bundleID        = NULL;
-       CFStringRef                     name            = CFSTR("VLANConfiguration");
-       VLANPreferencesPrivateRef       prefsPrivate;
-       uint32_t                        size;
-
-       /* initialize runtime */
-       pthread_once(&vlanPreferences_init, __VLANPreferencesInitialize);
-
-       /* allocate preferences */
-       size         = sizeof(VLANPreferencesPrivate) - sizeof(CFRuntimeBase);
-       prefsPrivate = (VLANPreferencesPrivateRef)_CFRuntimeCreateInstance(allocator,
-                                                                          __kVLANPreferencesTypeID,
-                                                                          size,
-                                                                          NULL);
-       if (prefsPrivate == NULL) {
-               return NULL;
-       }
-
-       /* establish the prefs */
-
-       pthread_mutex_init(&prefsPrivate->lock, NULL);
-
-       bundle = CFBundleGetMainBundle();
-       if (bundle) {
-               bundleID = CFBundleGetIdentifier(bundle);
-               if (bundleID) {
-                       CFRetain(bundleID);
-               } else {
-                       CFURLRef        url;
-
-                       url = CFBundleCopyExecutableURL(bundle);
-                       if (url) {
-                               bundleID = CFURLCopyPath(url);
-                               CFRelease(url);
-                       }
-               }
-       }
-
-       if (bundleID) {
-               CFStringRef     fullName;
-
-               if (CFEqual(bundleID, CFSTR("/"))) {
-                       CFRelease(bundleID);
-                       bundleID = CFStringCreateWithFormat(allocator, NULL, CFSTR("(%d)"), getpid());
-               }
-
-               fullName = CFStringCreateWithFormat(allocator, NULL, CFSTR("%@:%@"), bundleID, name);
-               name = fullName;
-               CFRelease(bundleID);
-       } else {
-               CFRetain(name);
-       }
-
-       prefsPrivate->prefs = SCPreferencesCreate(allocator, name, VLAN_PREFERENCES_ID);
-       CFRelease(name);
-
-       prefsPrivate->vlBase = NULL;
-
-       return (VLANPreferencesRef)prefsPrivate;
-}
-
-
-CFArrayRef
-VLANPreferencesCopyInterfaces(VLANPreferencesRef prefs)
-{
-       CFAllocatorRef                  allocator;
-       CFArrayCallBacks                callbacks;
-       CFIndex                         i;
-       CFIndex                         n;
-       VLANPreferencesPrivateRef       prefsPrivate    = (VLANPreferencesPrivateRef)prefs;
-       CFMutableArrayRef               result;
-       CFArrayRef                      vlans;
-
-       if (!isA_VLANPreferences(prefs)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return NULL;
-       }
-
-       allocator = CFGetAllocator(prefs);
-       callbacks = kCFTypeArrayCallBacks;
-       callbacks.equal = __VLANInterfaceEquiv;
-       result = CFArrayCreateMutable(allocator, 0, &callbacks);
-
-       vlans = SCPreferencesGetValue(prefsPrivate->prefs, VLAN_PREFERENCES_VLANS);
-       n = isA_CFArray(vlans) ? CFArrayGetCount(vlans) : 0;
-       for (i = 0; i < n; i++) {
-               CFDictionaryRef         vlan_dict;
-               CFStringRef             device;
-               CFDictionaryRef         options;
-               CFNumberRef             tag;
-               VLANInterfaceRef        vlan;
-               CFStringRef             vlan_if;
-
-               vlan_dict = CFArrayGetValueAtIndex(vlans, i);
-               if (!isA_CFDictionary(vlan_dict)) {
-                       continue;       // if the prefs are confused
-               }
-
-               vlan_if = CFDictionaryGetValue(vlan_dict, __kVLANInterface_interface);
-               if (!isA_CFString(vlan_if)) {
-                       continue;       // if the prefs are confused
-               }
-
-
-               device = CFDictionaryGetValue(vlan_dict, __kVLANInterface_device);
-               if (!isA_CFString(device)) {
-                       continue;       // if the prefs are confused
-               }
-
-               tag = CFDictionaryGetValue(vlan_dict, __kVLANInterface_tag);
-               if (!isA_CFNumber(tag)) {
-                       continue;       // if the prefs are confused
-               }
-
-               options = CFDictionaryGetValue(vlan_dict, __kVLANInterface_options);
-               if ((options != NULL) && !isA_CFDictionary(options)) {
-                       continue;       // if the prefs are confused
-               }
-
-               vlan = __VLANInterfaceCreatePrivate(allocator, vlan_if, device, tag, options);
-               CFArrayAppendValue(result, vlan);
-               CFRelease(vlan);
-       }
-
-       return result;
-}
-
-
-VLANInterfaceRef
-VLANPreferencesAddInterface(VLANPreferencesRef prefs,
-                           CFStringRef         device,
-                           CFNumberRef         tag,
-                           CFDictionaryRef     options)
-{
-       CFArrayRef                      active_vlans;
-       CFAllocatorRef                  allocator;
-       CFArrayRef                      config_vlans;
-       CFIndex                         dup_if;
-       CFIndex                         i;
-       CFIndex                         nActive;
-       CFIndex                         nConfig;
-       VLANInterfaceRef                newVlan         = NULL;
-       VLANPreferencesPrivateRef       prefsPrivate    = (VLANPreferencesPrivateRef)prefs;
-
-       if (!isA_VLANPreferences(prefs)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return NULL;
-       }
-
-       if (!isA_CFString(device)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return NULL;
-       }
-
-       if (isA_CFNumber(tag)) {
-               int     tag_val;
-
-               CFNumberGetValue(tag, kCFNumberIntType, &tag_val);
-               if ((tag_val < 1) || (tag_val > 4094)) {
-                       _SCErrorSet(kSCStatusInvalidArgument);
-                       return NULL;
-               }
-       } else {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return NULL;
-       }
-
-       if ((options != NULL) && !isA_CFDictionary(options)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return NULL;
-       }
-
-       pthread_mutex_lock(&prefsPrivate->lock);
-
-       /* get "configured" VLANs (and check to ensure we are not creating a duplicate) */
-       config_vlans = SCPreferencesGetValue(prefsPrivate->prefs, VLAN_PREFERENCES_VLANS);
-       nConfig      = isA_CFArray(config_vlans) ? CFArrayGetCount(config_vlans) : 0;
-
-       dup_if = findVLAN(config_vlans, device, tag);
-       if (dup_if != kCFNotFound) {
-               // sorry, you can't add a vlan using the same device/tag */
-               _SCErrorSet(kSCStatusKeyExists);
-               goto done;
-       }
-
-       /* get "active" VLANs */
-       active_vlans = _VLANPreferencesCopyActiveInterfaces();
-       nActive      = isA_CFArray(active_vlans) ? CFArrayGetCount(active_vlans) : 0;
-
-       /* create a new vlan using an unused interface name */
-       allocator = CFGetAllocator(prefs);
-
-       for (i = 0; newVlan == NULL; i++) {
-               CFIndex                 j;
-               CFMutableDictionaryRef  newDict;
-               CFMutableArrayRef       newVlans;
-               CFStringRef             vlan_if;
-
-               vlan_if = CFStringCreateWithFormat(allocator, NULL, CFSTR("vlan%d"), i);
-
-               for (j = 0; j < nActive; j++) {
-                       CFStringRef             active_if;
-                       VLANInterfaceRef        active_vlan;
-
-                       active_vlan = CFArrayGetValueAtIndex(active_vlans, j);
-                       active_if   = VLANInterfaceGetInterface(active_vlan);
-
-                       if (CFEqual(vlan_if, active_if)) {
-                               goto next_if;   // if VLAN interface name not available
-                       }
-               }
-
-               for (j = 0; j < nConfig; j++) {
-                       CFDictionaryRef config;
-                       CFStringRef     config_if;
-
-                       config = CFArrayGetValueAtIndex(config_vlans, j);
-                       if (!isA_CFDictionary(config)) {
-                               continue;       // if the prefs are confused
-                       }
-
-                       config_if = CFDictionaryGetValue(config, __kVLANInterface_interface);
-                       if (!isA_CFString(config_if)) {
-                               continue;       // if the prefs are confused
-                       }
-
-                       if (CFEqual(vlan_if, config_if)) {
-                               goto next_if;   // if VLAN interface name not available
-                       }
-               }
-
-               /* create the vlan */
-
-               newDict = CFDictionaryCreateMutable(allocator,
-                                                   0,
-                                                   &kCFTypeDictionaryKeyCallBacks,
-                                                   &kCFTypeDictionaryValueCallBacks);
-               CFDictionaryAddValue(newDict, __kVLANInterface_interface, vlan_if);
-               CFDictionaryAddValue(newDict, __kVLANInterface_device,    device);
-               CFDictionaryAddValue(newDict, __kVLANInterface_tag,       tag);
-               if (options != NULL) {
-                       CFDictionaryAddValue(newDict, __kVLANInterface_options, options);
-               }
-
-               /* create the accessor handle to be returned */
-
-               newVlan = __VLANInterfaceCreatePrivate(allocator, vlan_if, device, tag, options);
-
-               /* yes, we're going to be changing the configuration */
-               setConfigurationChanged(prefs);
-
-               /* save in the prefs */
-
-               if (nConfig == 0) {
-                       newVlans = CFArrayCreateMutable(allocator, 0, &kCFTypeArrayCallBacks);
-               } else {
-                       newVlans = CFArrayCreateMutableCopy(allocator, 0, config_vlans);
-               }
-               CFArrayAppendValue(newVlans, newDict);
-               CFRelease(newDict);
-
-               (void) SCPreferencesSetValue(prefsPrivate->prefs, VLAN_PREFERENCES_VLANS, newVlans);
-               CFRelease(newVlans);
-
-           next_if :
-               CFRelease(vlan_if);
-       }
-
-       CFRelease(active_vlans);
-
-    done :
-
-       pthread_mutex_unlock(&prefsPrivate->lock);
-
-       return (VLANInterfaceRef) newVlan;
-}
-
-
-Boolean
-VLANPreferencesUpdateInterface(VLANPreferencesRef      prefs,
-                              VLANInterfaceRef         vlan,
-                              CFStringRef              newDevice,
-                              CFNumberRef              newTag,
-                              CFDictionaryRef          newOptions)
-{
-       CFAllocatorRef                  allocator;
-       CFIndex                         cur_if;
-       CFIndex                         dup_if;
-       CFMutableDictionaryRef          newDict;
-       CFMutableArrayRef               newVlans;
-       Boolean                         ok              = FALSE;
-       VLANPreferencesPrivateRef       prefsPrivate    = (VLANPreferencesPrivateRef)prefs;
-       CFArrayRef                      vlans;
-       CFStringRef                     vlan_if;
-
-       if (!isA_VLANPreferences(prefs)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       if (!isA_VLANInterface(vlan)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       if ((newDevice != NULL) && !isA_CFString(newDevice)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       if (newTag != NULL) {
-               if (isA_CFNumber(newTag)) {
-                       int     tag_val;
-
-                       CFNumberGetValue(newTag, kCFNumberIntType, &tag_val);
-                       if ((tag_val < 1) || (tag_val > 4094)) {
-                               _SCErrorSet(kSCStatusInvalidArgument);
-                               return FALSE;
-                       }
-               } else {
-                       _SCErrorSet(kSCStatusInvalidArgument);
-                       return FALSE;
-               }
-       }
-
-       if ((newOptions != NULL)
-           && !isA_CFDictionary(newOptions) && (newOptions != (CFDictionaryRef)kCFNull)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       pthread_mutex_lock(&prefsPrivate->lock);
-
-       vlan_if = VLANInterfaceGetInterface(vlan);
-
-       vlans = SCPreferencesGetValue(prefsPrivate->prefs, VLAN_PREFERENCES_VLANS);
-       if (!isA_CFArray(vlans)) {
-               goto done;      // if the prefs are confused
-       }
-
-       cur_if = findVLAN(vlans,
-                         VLANInterfaceGetDevice(vlan),
-                         VLANInterfaceGetTag   (vlan));
-       if (cur_if == kCFNotFound) {
-               _SCErrorSet(kSCStatusNoKey);
-               goto done;
-       }
-
-       dup_if = findVLAN(vlans,
-                         newDevice != NULL ? newDevice : VLANInterfaceGetDevice(vlan),
-                         newTag    != NULL ? newTag    : VLANInterfaceGetTag   (vlan));
-       if (dup_if != kCFNotFound) {
-               // if the same device/tag has already been defined
-               if (cur_if != dup_if) {
-                       /*
-                        * sorry, you can't update another vlan that is using
-                        * the same device/tag
-                        */
-                       _SCErrorSet(kSCStatusKeyExists);
-                       goto done;
-               }
-       }
-
-       /* update the vlan */
-
-       if (newDevice != NULL) {
-               VLANInterfaceSetDevice(vlan, newDevice);
-       } else {
-               newDevice = VLANInterfaceGetDevice(vlan);
-       }
-
-       if (newTag != NULL) {
-               VLANInterfaceSetTag(vlan, newTag);
-       } else {
-               newTag = VLANInterfaceGetTag(vlan);
-       }
-
-       if (newOptions != NULL) {
-               if (newOptions != (CFDictionaryRef)kCFNull) {
-                       VLANInterfaceSetOptions(vlan, newOptions);
-               } else {
-                       VLANInterfaceSetOptions(vlan, NULL);
-                       newOptions = NULL;
-               }
-       } else {
-               newOptions = VLANInterfaceGetOptions(vlan);
-       }
-
-       /* update the prefs */
-
-       allocator = CFGetAllocator(prefs);
-       newDict = CFDictionaryCreateMutable(allocator,
-                                           0,
-                                           &kCFTypeDictionaryKeyCallBacks,
-                                           &kCFTypeDictionaryValueCallBacks);
-       CFDictionaryAddValue(newDict, __kVLANInterface_interface, vlan_if);
-       CFDictionaryAddValue(newDict, __kVLANInterface_device,    newDevice);
-       CFDictionaryAddValue(newDict, __kVLANInterface_tag,       newTag);
-       if (newOptions != NULL) {
-               CFDictionaryAddValue(newDict, __kVLANInterface_options, newOptions);
-       }
-
-       /* yes, we're going to be changing the configuration */
-       setConfigurationChanged(prefs);
-
-       /* update the prefs */
-
-       newVlans = CFArrayCreateMutableCopy(allocator, 0, vlans);
-       CFArraySetValueAtIndex(newVlans, cur_if, newDict);
-       CFRelease(newDict);
-
-       (void) SCPreferencesSetValue(prefsPrivate->prefs, VLAN_PREFERENCES_VLANS, newVlans);
-       CFRelease(newVlans);
-
-       ok = TRUE;
-
-    done :
-
-       pthread_mutex_unlock(&prefsPrivate->lock);
-
-       return ok;
-}
-
-
-Boolean
-VLANPreferencesRemoveInterface(VLANPreferencesRef      prefs,
-                              VLANInterfaceRef         vlan)
-{
-       CFAllocatorRef                  allocator;
-       CFIndex                         cur_if;
-       CFMutableArrayRef               newVlans;
-       Boolean                         ok              = FALSE;
-       VLANPreferencesPrivateRef       prefsPrivate    = (VLANPreferencesPrivateRef)prefs;
-       CFArrayRef                      vlans;
-
-       if (!isA_VLANPreferences(prefs)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       if (!isA_VLANInterface(vlan)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       pthread_mutex_lock(&prefsPrivate->lock);
-
-       vlans = SCPreferencesGetValue(prefsPrivate->prefs, VLAN_PREFERENCES_VLANS);
-       if (!isA_CFArray(vlans)) {
-               _SCErrorSet(kSCStatusNoKey);
-               goto done;      // if the prefs are confused
-       }
-
-       cur_if = findVLAN(vlans,
-                         VLANInterfaceGetDevice(vlan),
-                         VLANInterfaceGetTag   (vlan));
-       if (cur_if == kCFNotFound) {
-               _SCErrorSet(kSCStatusNoKey);
-               goto done;
-       }
-
-       /* yes, we're going to be changing the configuration */
-       setConfigurationChanged(prefs);
-
-       /* remove the vlan */
-
-       allocator = CFGetAllocator(prefs);
-       newVlans = CFArrayCreateMutableCopy(allocator, 0, vlans);
-       CFArrayRemoveValueAtIndex(newVlans, cur_if);
-
-       (void) SCPreferencesSetValue(prefsPrivate->prefs, VLAN_PREFERENCES_VLANS, newVlans);
-       CFRelease(newVlans);
-
-       ok = TRUE;
-
-    done :
-
-       pthread_mutex_unlock(&prefsPrivate->lock);
-
-       return ok;
-}
-
-
-Boolean
-VLANPreferencesCommitChanges(VLANPreferencesRef        prefs)
-{
-       Boolean                         ok              = FALSE;
-       VLANPreferencesPrivateRef       prefsPrivate    = (VLANPreferencesPrivateRef)prefs;
-
-       if (!isA_VLANPreferences(prefs)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       ok = SCPreferencesCommitChanges(prefsPrivate->prefs);
-       if (!ok) {
-               return ok;
-       }
-
-       if (prefsPrivate->vlBase != NULL)  {
-               CFRelease(prefsPrivate->vlBase);
-               prefsPrivate->vlBase = NULL;
-       }
-
-       return TRUE;
-}
-
-
-Boolean
-_VLANPreferencesUpdateConfiguration(VLANPreferencesRef prefs)
-{
-       return TRUE;
-}
-
-
-Boolean
-VLANPreferencesApplyChanges(VLANPreferencesRef prefs)
-{
-       SCPreferencesRef                defaultPrefs;
-       Boolean                         ok              = FALSE;
-       VLANPreferencesPrivateRef       prefsPrivate    = (VLANPreferencesPrivateRef)prefs;
-
-       if (!isA_VLANPreferences(prefs)) {
-               _SCErrorSet(kSCStatusInvalidArgument);
-               return FALSE;
-       }
-
-       pthread_mutex_lock(&prefsPrivate->lock);
-
-       /* apply the preferences */
-       ok = SCPreferencesApplyChanges(prefsPrivate->prefs);
-       if (!ok) {
-               goto done;
-       }
-
-       /* apply the VLAN configuration */
-       defaultPrefs = SCPreferencesCreate(NULL, CFSTR("VLANPreferencesApplyChanges"), NULL);
-       {
-               /*
-                * Note: In an ideal world, we'd simply call SCPreferencesApplyChanges()
-                *       Unfortunately, it's possible that the caller (e.g NetworkCfgTool)
-                *       is holding the lock on the default prefs and since "Apply" attempts
-                *       to grab the lock we could end up in a deadlock situation.
-                */
-#include "SCPreferencesInternal.h"
-               SCPreferencesPrivateRef         defaultPrefsPrivate;
-
-               defaultPrefsPrivate = (SCPreferencesPrivateRef)defaultPrefs;
-
-               pthread_mutex_lock(&defaultPrefsPrivate->lock);
-               if (defaultPrefsPrivate->session == NULL) {
-                       __SCPreferencesAddSession(defaultPrefs);
-               }
-               pthread_mutex_unlock(&defaultPrefsPrivate->lock);
-
-               ok = SCDynamicStoreNotifyValue(defaultPrefsPrivate->session, defaultPrefsPrivate->sessionKeyApply);
-       }
-       CFRelease(defaultPrefs);
-       if (!ok) {
-               goto done;
-       }
-
-    done :
-
-       pthread_mutex_unlock(&prefsPrivate->lock);
-
-       return ok;
-}
diff --git a/SystemConfiguration.fproj/VLANConfiguration.h b/SystemConfiguration.fproj/VLANConfiguration.h
deleted file mode 100644 (file)
index 00890a1..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2003-2006 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-#ifndef _VLANCONFIGURATION_H
-#define _VLANCONFIGURATION_H
-
-#include <AvailabilityMacros.h>
-#include <sys/cdefs.h>
-#include <CoreFoundation/CoreFoundation.h>
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-
-/*!
-       @header VLANConfiguration
-*/
-
-typedef const struct __VLANInterface *         VLANInterfaceRef;
-
-typedef const struct __VLANPreferences *       VLANPreferencesRef;
-
-
-__BEGIN_DECLS
-
-// ----------
-
-Boolean
-IsVLANSupported                        (CFStringRef            device)         AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // e.g. "en0", "en1", ...
-
-// ----------
-
-CFTypeID
-VLANInterfaceGetTypeID         (void)                                  AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-CFStringRef
-VLANInterfaceGetInterface      (VLANInterfaceRef       vlan)           AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // returns "vlan0", "vlan1", ...
-
-CFStringRef
-VLANInterfaceGetDevice         (VLANInterfaceRef       vlan)           AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // returns "en0", "en1, ...
-
-CFNumberRef
-VLANInterfaceGetTag            (VLANInterfaceRef       vlan)           AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // returns 1 <= tag <= 4094
-
-CFDictionaryRef
-VLANInterfaceGetOptions                (VLANInterfaceRef       vlan)           AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // e.g. UserDefinedName, ...
-
-// ----------
-
-CFTypeID
-VLANPreferencesGetTypeID       (void)                                  AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-VLANPreferencesRef
-VLANPreferencesCreate          (CFAllocatorRef         allocator)      AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-CFArrayRef /* of VLANInterfaceRef's */
-VLANPreferencesCopyInterfaces  (VLANPreferencesRef     prefs)          AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-VLANInterfaceRef
-VLANPreferencesAddInterface    (VLANPreferencesRef     prefs,
-                                CFStringRef            device,         // e.g. "en0", "en1", ...
-                                CFNumberRef            tag,            // e.g. 1 <= tag <= 4094
-                                CFDictionaryRef        options)        AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;      // e.g. UserDefinedName, ...
-
-Boolean
-VLANPreferencesUpdateInterface (VLANPreferencesRef     prefs,
-                                VLANInterfaceRef       vlan,
-                                CFStringRef            newDevice,
-                                CFNumberRef            newTag,
-                                CFDictionaryRef        newOptions)     AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-Boolean
-VLANPreferencesRemoveInterface (VLANPreferencesRef     prefs,
-                                VLANInterfaceRef       vlan)           AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-Boolean
-VLANPreferencesCommitChanges   (VLANPreferencesRef     prefs)          AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-Boolean
-VLANPreferencesApplyChanges    (VLANPreferencesRef     prefs)          AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
-
-// ----------
-
-__END_DECLS
-
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */
-
-#endif /* _VLANCONFIGURATION_H */
index a9f67a21cab8351890dc462a5e7801801a48aa3c..a3a63cadd499440c5eb046117ea36dfe34c22386 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2003, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003, 2005, 2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -33,6 +33,9 @@
 #define mig_external __private_extern__
 
 /* Turn MIG type checking on by default */
 #define mig_external __private_extern__
 
 /* Turn MIG type checking on by default */
+#ifdef __MigTypeCheck
+#undef __MigTypeCheck
+#endif
 #define __MigTypeCheck 1
 
 /*
 #define __MigTypeCheck 1
 
 /*
index 421361dcfe8519717fe31d078e7151694072b69b..9763e5b7857c7b0905972e74a8f845ec79c52acf 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -252,6 +252,8 @@ _IOServiceMatching(const char *name)
        return dyfunc ? dyfunc(name) : NULL;
 }
 
        return dyfunc ? dyfunc(name) : NULL;
 }
 
+#if    !TARGET_OS_IPHONE
+
 static void *
 __loadSecurity(void) {
        static void *image = NULL;
 static void *
 __loadSecurity(void) {
        static void *image = NULL;
@@ -477,3 +479,4 @@ _SecTrustedApplicationCreateFromPath(const char *path, SecTrustedApplicationRef
        return dyfunc ? dyfunc(path, app) : -1;
 }
 
        return dyfunc ? dyfunc(path, app) : -1;
 }
 
+#endif // !TARGET_OS_IPHONE
index e96845deb3a99d660716272f8250c0acff68bf72..cb5f201ae26b91110cd5fe073cdf4429eefb0533 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2002-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #ifndef _DY_FRAMEWORK_H
 #define _DY_FRAMEWORK_H
 
 #ifndef _DY_FRAMEWORK_H
 #define _DY_FRAMEWORK_H
 
+#include <Availability.h>
+#include <TargetConditionals.h>
 #include <sys/cdefs.h>
 #include <mach/mach.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <IOKit/IOKitLib.h>
 #include <sys/cdefs.h>
 #include <mach/mach.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <IOKit/IOKitLib.h>
+
+#if    !TARGET_OS_IPHONE
 #include <Security/Security.h>
 #include <Security/Security.h>
+#endif // !TARGET_OS_IPHONE
 
 __BEGIN_DECLS
 
 
 __BEGIN_DECLS
 
@@ -154,6 +159,8 @@ _IOServiceMatching                  (
 #pragma mark -
 #pragma mark Security.framework APIs
 
 #pragma mark -
 #pragma mark Security.framework APIs
 
+#if    !TARGET_OS_IPHONE
+
 OSStatus
 _AuthorizationMakeExternalForm         (
                                        AuthorizationRef                authorization,
 OSStatus
 _AuthorizationMakeExternalForm         (
                                        AuthorizationRef                authorization,
@@ -286,7 +293,9 @@ _SecTrustedApplicationCreateFromPath        (
                                        );
 #define SecTrustedApplicationCreateFromPath _SecTrustedApplicationCreateFromPath
 
                                        );
 #define SecTrustedApplicationCreateFromPath _SecTrustedApplicationCreateFromPath
 
+#endif // !TARGET_OS_IPHONE
+
 __END_DECLS
 
 __END_DECLS
 
-#endif /* _DY_FRAMEWORK_H */
+#endif // _DY_FRAMEWORK_H
 
 
index 102d693eea96d52de8404fcb03d04880b68838d5..dd435d5b2f96354d6f10d033b3171bf527ebbd71 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -59,7 +59,7 @@
 
 char copyright_string[] =
 "/*\n"
 
 char copyright_string[] =
 "/*\n"
-" * Copyright (c) 2000-2007 Apple Inc. All rights reserved.\n"
+" * Copyright (c) 2000-2009 Apple Inc. All rights reserved.\n"
 " *\n"
 " * @APPLE_LICENSE_HEADER_START@\n"
 " * \n"
 " *\n"
 " * @APPLE_LICENSE_HEADER_START@\n"
 " * \n"
@@ -83,18 +83,27 @@ char copyright_string[] =
 
 
 typedef enum {
 
 
 typedef enum {
+       DEFINE,
+       DEFINE_PRIVATE,
        COMMENT,
        GROUP,
        SC_10_1,
        COMMENT,
        GROUP,
        SC_10_1,
-       SC_10_1_10_4,   // deprecated in 10.4
-       SC_10_1_10_5,   // deprecated in 10.5
        SC_10_2,
        SC_10_3,
        SC_10_2,
        SC_10_3,
+       SC_10_1_10_4,   // deprecated in 10.4
        SC_10_4,
        SC_10_4,
+       SC_10_1_10_5,   // deprecated in 10.5
        SC_10_5,
        SC_10_5,
+       SC_10_1_10_6,   // deprecated in 10.6
+       SC_10_2_10_6,   // deprecated in 10.6
+       SC_10_6_IPHONE_2_0,
+       SC_10_6_IPHONE_3_0,
        COMMENT_PRIVATE,
        GROUP_PRIVATE,
        SC_10_5_PRIVATE,
        COMMENT_PRIVATE,
        GROUP_PRIVATE,
        SC_10_5_PRIVATE,
+       SC_10_6_IPHONE_2_0_PRIVATE,
+       SC_10_6_IPHONE_3_0_PRIVATE,
+       SC_IPHONE_2_0_PRIVATE,
        COMMENT_DEPRECATED,
        GROUP_DEPRECATED,
        END
        COMMENT_DEPRECATED,
        GROUP_DEPRECATED,
        END
@@ -142,6 +151,7 @@ typedef enum {
 #define ALERT                  "Alert"
 #define ALLOWNETCREATION       "AllowNetCreation"
 #define ALTERNATEREMOTEADDRESS "AlternateRemoteAddress"
 #define ALERT                  "Alert"
 #define ALLOWNETCREATION       "AllowNetCreation"
 #define ALTERNATEREMOTEADDRESS "AlternateRemoteAddress"
+#define ALWAYS                 "Always"
 #define ANYREGEX               "AnyRegex"
 #define APPLETALK              "AppleTalk"
 #define AUTH                   "Auth"
 #define ANYREGEX               "AnyRegex"
 #define APPLETALK              "AppleTalk"
 #define AUTH                   "Auth"
@@ -259,7 +269,6 @@ typedef enum {
 #define MEDIA                  "Media"
 #define MIXED                  "Mixed"
 #define MODEL                  "Model"
 #define MEDIA                  "Media"
 #define MIXED                  "Mixed"
 #define MODEL                  "Model"
-#define OPTIONS                        "Options"
 #define MODE                   "Mode"
 #define MODEM                  "Modem"
 #define MPPE40                 "MPPE40"
 #define MODE                   "Mode"
 #define MODEM                  "Modem"
 #define MPPE40                 "MPPE40"
@@ -275,10 +284,13 @@ typedef enum {
 #define NETWORKID              "NetworkID"
 #define NETWORKRANGE           "NetworkRange"
 #define NETWORKSERVICES                "NetworkServices"
 #define NETWORKID              "NetworkID"
 #define NETWORKRANGE           "NetworkRange"
 #define NETWORKSERVICES                "NetworkServices"
+#define NEVER                  "Never"
 #define NODE                   "Node"
 #define NODEID                 "NodeID"
 #define NOTE                   "Note"
 #define ONDEMAND               "OnDemand"
 #define NODE                   "Node"
 #define NODEID                 "NodeID"
 #define NOTE                   "Note"
 #define ONDEMAND               "OnDemand"
+#define ONRETRY                        "OnRetry"
+#define OPTIONS                        "Options"
 #define ORDER                  "Order"
 #define ORDERS                 "Orders"
 #define OVERRIDEPRIMARY                "OverridePrimary"
 #define ORDER                  "Order"
 #define ORDERS                 "Orders"
 #define OVERRIDEPRIMARY                "OverridePrimary"
@@ -299,6 +311,7 @@ typedef enum {
 #define PREFIXLENGTH           "PrefixLength"
 #define PREFS                  "Prefs"
 #define PRIMARYINTERFACE       "PrimaryInterface"
 #define PREFIXLENGTH           "PrefixLength"
 #define PREFS                  "Prefs"
 #define PRIMARYINTERFACE       "PrimaryInterface"
+#define PRIMARYRANK            "PrimaryRank"
 #define PRIMARYSERVICE         "PrimaryService"
 #define PRIORITY               "Priority"
 #define PROMPT                 "Prompt"
 #define PRIMARYSERVICE         "PrimaryService"
 #define PRIORITY               "Priority"
 #define PROMPT                 "Prompt"
@@ -371,6 +384,8 @@ typedef enum {
 #define WAITFORDIALTONE                "WaitForDialTone"
 #define WINS                   "WINS"
 #define WORKGROUP              "Workgroup"
 #define WAITFORDIALTONE                "WaitForDialTone"
 #define WINS                   "WINS"
 #define WORKGROUP              "Workgroup"
+#define XAUTH                  "XAuth"
+
 
 typedef struct {
     int                                control;
 
 typedef struct {
     int                                control;
@@ -427,7 +442,9 @@ static schemaDefinition names[] = {
   { GROUP, NETENT, "Network Entity Keys", NULL, NULL },
 
     { SC_10_1, NETENT, AIRPORT, NULL, CFDICTIONARY },
   { GROUP, NETENT, "Network Entity Keys", NULL, NULL },
 
     { SC_10_1, NETENT, AIRPORT, NULL, CFDICTIONARY },
-    { SC_10_1, NETENT, APPLETALK, NULL, CFDICTIONARY },
+    { DEFINE, "#if", "!TARGET_OS_IPHONE", NULL, NULL },
+    { SC_10_1_10_6, NETENT, APPLETALK, NULL, CFDICTIONARY },
+    { DEFINE, "#endif", "// !TARGET_OS_IPHONE", NULL, NULL },
     { SC_10_1, NETENT, DHCP, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, DNS, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, ETHERNET, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, DHCP, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, DNS, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, ETHERNET, NULL, CFDICTIONARY },
@@ -439,19 +456,25 @@ static schemaDefinition names[] = {
     { SC_10_3, NETENT, L2TP, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, LINK, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, MODEM, NULL, CFDICTIONARY },
     { SC_10_3, NETENT, L2TP, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, LINK, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, MODEM, NULL, CFDICTIONARY },
+    { DEFINE, "#if", "!TARGET_OS_IPHONE", NULL, NULL },
     { SC_10_1_10_5, NETENT, NETINFO, NULL, CFDICTIONARY },
     { SC_10_1_10_5, NETENT, NETINFO, NULL, CFDICTIONARY },
+    { DEFINE, "#endif", "// !TARGET_OS_IPHONE", NULL, NULL },
     { SC_10_1, NETENT, PPP, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, PPPOE, NULL, CFDICTIONARY },
     { SC_10_3, NETENT, PPPSERIAL, NULL, CFDICTIONARY },
     { SC_10_3, NETENT, PPTP, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, PROXIES, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, PPP, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, PPPOE, NULL, CFDICTIONARY },
     { SC_10_3, NETENT, PPPSERIAL, NULL, CFDICTIONARY },
     { SC_10_3, NETENT, PPTP, NULL, CFDICTIONARY },
     { SC_10_1, NETENT, PROXIES, NULL, CFDICTIONARY },
+    { DEFINE, "#if", "!TARGET_OS_IPHONE", NULL, NULL },
     { SC_10_5, NETENT, SMB, NULL, CFDICTIONARY },
     { SC_10_5, NETENT, SMB, NULL, CFDICTIONARY },
+    { DEFINE, "#endif", "// !TARGET_OS_IPHONE", NULL, NULL },
     { SC_10_3, NETENT, STF, NULL, CFDICTIONARY },
     { COMMENT, "", NULL, NULL, NULL },
 
   { GROUP_PRIVATE, NETENT, "Network Entity Keys", NULL, NULL },
 
     { SC_10_5_PRIVATE, NETENT, EAPOL, NULL, CFDICTIONARY },
     { SC_10_3, NETENT, STF, NULL, CFDICTIONARY },
     { COMMENT, "", NULL, NULL, NULL },
 
   { GROUP_PRIVATE, NETENT, "Network Entity Keys", NULL, NULL },
 
     { SC_10_5_PRIVATE, NETENT, EAPOL, NULL, CFDICTIONARY },
+    { SC_10_6_IPHONE_3_0_PRIVATE, NETENT, ONDEMAND, NULL, CFDICTIONARY },
+    { SC_10_6_IPHONE_2_0_PRIVATE, NETENT, SERVICE, "__SERVICE__", CFDICTIONARY },
     { COMMENT_PRIVATE, "", NULL, NULL, NULL },
 
   { GROUP, NETPROP, KEY_PREFIX COMP NETWORK " Properties", NULL, NULL },
     { COMMENT_PRIVATE, "", NULL, NULL, NULL },
 
   { GROUP, NETPROP, KEY_PREFIX COMP NETWORK " Properties", NULL, NULL },
@@ -497,23 +520,26 @@ static schemaDefinition names[] = {
     { SC_10_3, NETVAL AIRPORT AUTH PASSWORD ENCRYPTION, KEYCHAIN, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
 
     { SC_10_3, NETVAL AIRPORT AUTH PASSWORD ENCRYPTION, KEYCHAIN, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
 
-  { GROUP, NETPROP APPLETALK, KEY_PREFIX NETENT APPLETALK " Entity Keys", NULL, NULL },
-
-    { SC_10_1, NETPROP APPLETALK, COMPUTERNAME, NULL, CFSTRING },
-    { SC_10_1, NETPROP APPLETALK, COMPUTERNAME ENCODING, NULL, CFNUMBER },
-    { SC_10_1, NETPROP APPLETALK, CONFIGMETHOD, NULL, CFSTRING },
-    { SC_10_1, NETPROP APPLETALK, DEFAULTZONE, NULL, CFSTRING },
-    { SC_10_1, NETPROP APPLETALK, NETWORKID, NULL, CFNUMBER },
-    { SC_10_2, NETPROP APPLETALK, NETWORKRANGE, NULL, CFARRAY_CFNUMBER },
-    { SC_10_1, NETPROP APPLETALK, NODEID, NULL, CFNUMBER },
-    { SC_10_1, NETPROP APPLETALK, SEEDNETWORKRANGE, NULL, CFARRAY_CFNUMBER },
-    { SC_10_1, NETPROP APPLETALK, SEEDZONES, NULL, CFARRAY_CFSTRING },
-    { COMMENT, "", NULL, NULL, NULL },
-    { COMMENT, "--- " KEY_PREFIX NETPROP APPLETALK CONFIGMETHOD " values ---", NULL, NULL, NULL },
-    { SC_10_1, NETVAL APPLETALK CONFIGMETHOD, NODE, NULL, NULL },
-    { SC_10_1, NETVAL APPLETALK CONFIGMETHOD, ROUTER, NULL, NULL },
-    { SC_10_1, NETVAL APPLETALK CONFIGMETHOD, SEEDROUTER, NULL, NULL },
-    { COMMENT, "", NULL, NULL, NULL },
+  { GROUP_DEPRECATED, NETPROP APPLETALK, KEY_PREFIX NETENT APPLETALK " Entity Keys", NULL, NULL },
+
+    { DEFINE, "#if", "!TARGET_OS_IPHONE", NULL, NULL },
+    { SC_10_1_10_6, NETPROP APPLETALK, COMPUTERNAME, NULL, CFSTRING },
+    { SC_10_1_10_6, NETPROP APPLETALK, COMPUTERNAME ENCODING, NULL, CFNUMBER },
+    { SC_10_1_10_6, NETPROP APPLETALK, CONFIGMETHOD, NULL, CFSTRING },
+    { SC_10_1_10_6, NETPROP APPLETALK, DEFAULTZONE, NULL, CFSTRING },
+    { SC_10_1_10_6, NETPROP APPLETALK, NETWORKID, NULL, CFNUMBER },
+    { SC_10_2_10_6, NETPROP APPLETALK, NETWORKRANGE, NULL, CFARRAY_CFNUMBER },
+    { SC_10_1_10_6, NETPROP APPLETALK, NODEID, NULL, CFNUMBER },
+    { SC_10_1_10_6, NETPROP APPLETALK, SEEDNETWORKRANGE, NULL, CFARRAY_CFNUMBER },
+    { SC_10_1_10_6, NETPROP APPLETALK, SEEDZONES, NULL, CFARRAY_CFSTRING },
+    { COMMENT_DEPRECATED, "", NULL, NULL, NULL },
+    { COMMENT_DEPRECATED, "--- " KEY_PREFIX NETPROP APPLETALK CONFIGMETHOD " values ---", NULL, NULL, NULL },
+    { SC_10_1_10_6, NETVAL APPLETALK CONFIGMETHOD, NODE, NULL, NULL },
+    { SC_10_1_10_6, NETVAL APPLETALK CONFIGMETHOD, ROUTER, NULL, NULL },
+    { SC_10_1_10_6, NETVAL APPLETALK CONFIGMETHOD, SEEDROUTER, NULL, NULL },
+    { DEFINE, "#endif", "// !TARGET_OS_IPHONE", NULL, NULL },
+    { COMMENT_DEPRECATED, "", NULL, NULL, NULL },
+
 
   { GROUP, NETPROP DNS, KEY_PREFIX NETENT DNS " Entity Keys", NULL, NULL },
 
 
   { GROUP, NETPROP DNS, KEY_PREFIX NETENT DNS " Entity Keys", NULL, NULL },
 
@@ -554,6 +580,7 @@ static schemaDefinition names[] = {
     { SC_10_3, NETVAL INTERFACE TYPE, FIREWIRE, NULL, NULL },
     { SC_10_1, NETVAL INTERFACE TYPE, PPP, NULL, NULL },
     { SC_10_3, NETVAL INTERFACE TYPE, STF, NULL, NULL },
     { SC_10_3, NETVAL INTERFACE TYPE, FIREWIRE, NULL, NULL },
     { SC_10_1, NETVAL INTERFACE TYPE, PPP, NULL, NULL },
     { SC_10_3, NETVAL INTERFACE TYPE, STF, NULL, NULL },
+    { SC_10_6_IPHONE_2_0, NETVAL INTERFACE TYPE, IPSEC, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
     { COMMENT, "--- " KEY_PREFIX NETPROP SERVICE SUBTYPE " values (for " PPP ") ---", NULL, NULL, NULL },
     { SC_10_1, NETVAL INTERFACE SUBTYPE, PPPOE, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
     { COMMENT, "--- " KEY_PREFIX NETPROP SERVICE SUBTYPE " values (for " PPP ") ---", NULL, NULL, NULL },
     { SC_10_1, NETVAL INTERFACE SUBTYPE, PPPOE, NULL, NULL },
@@ -564,24 +591,47 @@ static schemaDefinition names[] = {
 
   { GROUP, NETPROP IPSEC, KEY_PREFIX NETENT IPSEC " Entity Keys", NULL, NULL },
 
 
   { GROUP, NETPROP IPSEC, KEY_PREFIX NETENT IPSEC " Entity Keys", NULL, NULL },
 
+    { SC_10_5, NETPROP IPSEC, AUTHENTICATIONMETHOD, NULL, CFSTRING },
+    { SC_10_5, NETPROP IPSEC, LOCALCERTIFICATE, NULL, CFDATA },
     { SC_10_5, NETPROP IPSEC, LOCALIDENTIFIER, NULL, CFSTRING },
     { SC_10_5, NETPROP IPSEC, LOCALIDENTIFIER TYPE, NULL, CFSTRING },
     { SC_10_5, NETPROP IPSEC, LOCALIDENTIFIER, NULL, CFSTRING },
     { SC_10_5, NETPROP IPSEC, LOCALIDENTIFIER TYPE, NULL, CFSTRING },
-    { SC_10_5, NETPROP IPSEC, AUTHENTICATIONMETHOD, NULL, CFSTRING },
     { SC_10_5, NETPROP IPSEC, SHAREDSECRET, NULL, CFSTRING },
     { SC_10_5, NETPROP IPSEC, SHAREDSECRET ENCRYPTION, NULL, CFSTRING },
     { SC_10_5, NETPROP IPSEC, SHAREDSECRET, NULL, CFSTRING },
     { SC_10_5, NETPROP IPSEC, SHAREDSECRET ENCRYPTION, NULL, CFSTRING },
-    { SC_10_5, NETPROP IPSEC, LOCALCERTIFICATE, NULL, CFDATA },
+    { SC_10_6_IPHONE_2_0, NETPROP IPSEC, CONNECTTIME, NULL, CFNUMBER },
+    { SC_10_6_IPHONE_2_0, NETPROP IPSEC, REMOTEADDRESS, NULL, CFSTRING },
+    { SC_10_6_IPHONE_2_0, NETPROP IPSEC, STATUS, STATUS, CFNUMBER },
+    { SC_10_6_IPHONE_2_0, NETPROP IPSEC, XAUTH ENABLED, NULL, CFNUMBER_BOOL },
+    { SC_10_6_IPHONE_2_0, NETPROP IPSEC, XAUTH NAME, NULL, CFSTRING },
+    { SC_10_6_IPHONE_2_0, NETPROP IPSEC, XAUTH PASSWORD, NULL, CFSTRING },
+    { SC_10_6_IPHONE_2_0, NETPROP IPSEC, XAUTH PASSWORD ENCRYPTION, NULL, CFSTRING },
     { COMMENT, "", NULL, NULL, NULL },
     { COMMENT, "--- " KEY_PREFIX NETPROP IPSEC AUTHENTICATIONMETHOD " values ---", NULL, NULL, NULL },
     { SC_10_5, NETVAL IPSEC AUTHENTICATIONMETHOD, SHAREDSECRET, NULL, NULL },
     { SC_10_5, NETVAL IPSEC AUTHENTICATIONMETHOD, CERTIFICATE, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
     { COMMENT, "--- " KEY_PREFIX NETPROP IPSEC AUTHENTICATIONMETHOD " values ---", NULL, NULL, NULL },
     { SC_10_5, NETVAL IPSEC AUTHENTICATIONMETHOD, SHAREDSECRET, NULL, NULL },
     { SC_10_5, NETVAL IPSEC AUTHENTICATIONMETHOD, CERTIFICATE, NULL, NULL },
+    { SC_10_5, NETVAL IPSEC AUTHENTICATIONMETHOD, HYBRID, NULL, NULL },
+    { COMMENT, "", NULL, NULL, NULL },
+    { COMMENT, "--- " KEY_PREFIX NETPROP IPSEC LOCALIDENTIFIER TYPE " values ---", NULL, NULL, NULL },
+    { SC_10_5, NETVAL IPSEC LOCALIDENTIFIER TYPE, KEYID, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
     { COMMENT, "--- " KEY_PREFIX NETPROP IPSEC SHAREDSECRET ENCRYPTION " values ---", NULL, NULL, NULL },
     { SC_10_5, NETVAL IPSEC SHAREDSECRET ENCRYPTION, KEYCHAIN, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
     { COMMENT, "--- " KEY_PREFIX NETPROP IPSEC SHAREDSECRET ENCRYPTION " values ---", NULL, NULL, NULL },
     { SC_10_5, NETVAL IPSEC SHAREDSECRET ENCRYPTION, KEYCHAIN, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
-    { COMMENT, "--- " KEY_PREFIX NETPROP IPSEC LOCALIDENTIFIER TYPE " values ---", NULL, NULL, NULL },
-    { SC_10_5, NETVAL IPSEC LOCALIDENTIFIER TYPE, KEYID, NULL, NULL },
+    { COMMENT, "--- " KEY_PREFIX NETPROP IPSEC XAUTH PASSWORD ENCRYPTION " values ---", NULL, NULL, NULL },
+    { SC_10_6_IPHONE_2_0, NETVAL IPSEC XAUTH PASSWORD ENCRYPTION, KEYCHAIN, NULL, NULL },
+    { SC_10_6_IPHONE_3_0, NETVAL IPSEC XAUTH PASSWORD ENCRYPTION, PROMPT, NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
 
     { COMMENT, "", NULL, NULL, NULL },
 
+  { GROUP_PRIVATE, NETPROP IPSEC, KEY_PREFIX NETENT IPSEC " Entity Keys", NULL, NULL },
+
+    { SC_10_6_IPHONE_3_0_PRIVATE, NETPROP IPSEC, LAST CAUSE, NULL, CFNUMBER },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+    { COMMENT_PRIVATE, "--- " ONDEMAND ": ---", NULL, NULL, NULL },
+    { SC_10_6_IPHONE_3_0_PRIVATE, NETPROP IPSEC, ONDEMAND ENABLED, NULL, CFNUMBER_BOOL },
+    { SC_10_6_IPHONE_3_0_PRIVATE, NETPROP IPSEC, ONDEMAND MATCH DOMAINS ALWAYS, NULL, CFARRAY_CFSTRING },
+    { SC_10_6_IPHONE_3_0_PRIVATE, NETPROP IPSEC, ONDEMAND MATCH DOMAINS ONRETRY, NULL, CFARRAY_CFSTRING },
+    { SC_10_6_IPHONE_3_0_PRIVATE, NETPROP IPSEC, ONDEMAND MATCH DOMAINS NEVER, NULL, CFARRAY_CFSTRING },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+
   { GROUP, NETPROP IPV4, KEY_PREFIX NETENT IPV4 " Entity Keys", NULL, NULL },
 
     { SC_10_1, NETPROP IPV4, ADDRESSES, NULL, CFARRAY_CFSTRING },
   { GROUP, NETPROP IPV4, KEY_PREFIX NETENT IPV4 " Entity Keys", NULL, NULL },
 
     { SC_10_1, NETPROP IPV4, ADDRESSES, NULL, CFARRAY_CFSTRING },
@@ -593,6 +643,7 @@ static schemaDefinition names[] = {
     { SC_10_1, NETPROP IPV4, BROADCAST ADDRESSES, NULL, CFARRAY_CFSTRING },
     { COMMENT, "", NULL, NULL, NULL },
     { COMMENT, "--- " KEY_PREFIX NETPROP IPV4 CONFIGMETHOD " values ---", NULL, NULL, NULL },
     { SC_10_1, NETPROP IPV4, BROADCAST ADDRESSES, NULL, CFARRAY_CFSTRING },
     { COMMENT, "", NULL, NULL, NULL },
     { COMMENT, "--- " KEY_PREFIX NETPROP IPV4 CONFIGMETHOD " values ---", NULL, NULL, NULL },
+    { SC_10_6_IPHONE_2_0, NETVAL IPV4 CONFIGMETHOD, AUTOMATIC, NULL, NULL },
     { SC_10_1, NETVAL IPV4 CONFIGMETHOD, BOOTP, NULL, NULL },
     { SC_10_1, NETVAL IPV4 CONFIGMETHOD, DHCP, NULL, NULL },
     { SC_10_1, NETVAL IPV4 CONFIGMETHOD, INFORM, NULL, NULL },
     { SC_10_1, NETVAL IPV4 CONFIGMETHOD, BOOTP, NULL, NULL },
     { SC_10_1, NETVAL IPV4 CONFIGMETHOD, DHCP, NULL, NULL },
     { SC_10_1, NETVAL IPV4 CONFIGMETHOD, INFORM, NULL, NULL },
@@ -663,6 +714,7 @@ static schemaDefinition names[] = {
 
   { GROUP_DEPRECATED, NETPROP NETINFO, KEY_PREFIX NETENT NETINFO " Entity Keys", NULL, NULL },
 
 
   { GROUP_DEPRECATED, NETPROP NETINFO, KEY_PREFIX NETENT NETINFO " Entity Keys", NULL, NULL },
 
+    { DEFINE, "#if", "!TARGET_OS_IPHONE", NULL, NULL },
     { SC_10_1_10_5, NETPROP NETINFO, BINDINGMETHODS, NULL, CFSTRING },
     { SC_10_1_10_5, NETPROP NETINFO, SERVER ADDRESSES, NULL, CFARRAY_CFSTRING },
     { SC_10_1_10_5, NETPROP NETINFO, SERVER TAGS, NULL, CFARRAY_CFSTRING },
     { SC_10_1_10_5, NETPROP NETINFO, BINDINGMETHODS, NULL, CFSTRING },
     { SC_10_1_10_5, NETPROP NETINFO, SERVER ADDRESSES, NULL, CFARRAY_CFSTRING },
     { SC_10_1_10_5, NETPROP NETINFO, SERVER TAGS, NULL, CFARRAY_CFSTRING },
@@ -675,6 +727,7 @@ static schemaDefinition names[] = {
     { COMMENT_DEPRECATED, "", NULL, NULL, NULL },
     { COMMENT_DEPRECATED, "--- " KEY_PREFIX NETPROP NETINFO BROADCAST SERVER TAG " default value ---", NULL, NULL, NULL },
     { SC_10_1_10_5, NETVAL NETINFO, DEFAULT SERVER TAG, "network", NULL },
     { COMMENT_DEPRECATED, "", NULL, NULL, NULL },
     { COMMENT_DEPRECATED, "--- " KEY_PREFIX NETPROP NETINFO BROADCAST SERVER TAG " default value ---", NULL, NULL, NULL },
     { SC_10_1_10_5, NETVAL NETINFO, DEFAULT SERVER TAG, "network", NULL },
+    { DEFINE, "#endif", "// !TARGET_OS_IPHONE", NULL, NULL },
     { COMMENT_DEPRECATED, "", NULL, NULL, NULL },
 
   { GROUP, NETPROP PPP, KEY_PREFIX NETENT PPP " Entity Keys", NULL, NULL },
     { COMMENT_DEPRECATED, "", NULL, NULL, NULL },
 
   { GROUP, NETPROP PPP, KEY_PREFIX NETENT PPP " Entity Keys", NULL, NULL },
@@ -765,7 +818,12 @@ static schemaDefinition names[] = {
     { COMMENT_PRIVATE, "--- " ONDEMAND ": ---", NULL, NULL, NULL },
     { SC_10_5_PRIVATE, NETPROP PPP, ONDEMAND DOMAINS, NULL, CFARRAY_CFSTRING },
     { SC_10_5_PRIVATE, NETPROP PPP, ONDEMAND ENABLED, NULL, CFNUMBER_BOOL },
     { COMMENT_PRIVATE, "--- " ONDEMAND ": ---", NULL, NULL, NULL },
     { SC_10_5_PRIVATE, NETPROP PPP, ONDEMAND DOMAINS, NULL, CFARRAY_CFSTRING },
     { SC_10_5_PRIVATE, NETPROP PPP, ONDEMAND ENABLED, NULL, CFNUMBER_BOOL },
-    { SC_10_5_PRIVATE, NETPROP PPP, ONDEMAND HOSTNAME, NULL, CFSTRING },
+    { SC_10_5_PRIVATE, NETPROP PPP, ONDEMAND HOSTNAME, NULL, CFSTRING },    // DEPRECATED, use kSCNetworkConnectionSelectionOptionOnDemandHostName
+#ifdef NOTYET
+    { SC_10_6_IPHONE_3_0_PRIVATE, NETPROP PPP, ONDEMAND MATCH DOMAINS ALWAYS, NULL, CFARRAY_CFSTRING },
+    { SC_10_6_IPHONE_3_0_PRIVATE, NETPROP PPP, ONDEMAND MATCH DOMAINS ONRETRY, NULL, CFARRAY_CFSTRING },
+    { SC_10_6_IPHONE_3_0_PRIVATE, NETPROP PPP, ONDEMAND MATCH DOMAINS NEVER, NULL, CFARRAY_CFSTRING },
+#endif // NOTYET
     { SC_10_5_PRIVATE, NETPROP PPP, ONDEMAND MODE, NULL, CFSTRING },
     { SC_10_5_PRIVATE, NETPROP PPP, ONDEMAND PRIORITY, NULL, CFSTRING },
     { COMMENT_PRIVATE, "", NULL, NULL, NULL },
     { SC_10_5_PRIVATE, NETPROP PPP, ONDEMAND MODE, NULL, CFSTRING },
     { SC_10_5_PRIVATE, NETPROP PPP, ONDEMAND PRIORITY, NULL, CFSTRING },
     { COMMENT_PRIVATE, "", NULL, NULL, NULL },
@@ -837,8 +895,20 @@ static schemaDefinition names[] = {
     { SC_10_4, NETPROP PROXIES, PROXY AUTODISCOVERY ENABLE, NULL, CFNUMBER_BOOL },
     { COMMENT, "", NULL, NULL, NULL },
 
     { SC_10_4, NETPROP PROXIES, PROXY AUTODISCOVERY ENABLE, NULL, CFNUMBER_BOOL },
     { COMMENT, "", NULL, NULL, NULL },
 
+  { GROUP_PRIVATE, NETPROP SERVICE, KEY_PREFIX NETENT SERVICE " Entity Keys", NULL, NULL },
+    
+    { SC_10_6_IPHONE_2_0_PRIVATE, NETPROP SERVICE, PRIMARYRANK, NULL, CFSTRING },
+    { SC_10_6_IPHONE_2_0_PRIVATE, NETPROP SERVICE, USERDEFINEDNAME, NULL, CFSTRING },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+    { COMMENT_PRIVATE, "--- " KEY_PREFIX NETPROP SERVICE PRIMARYRANK " values ---", NULL, NULL, NULL },
+    { SC_10_6_IPHONE_2_0_PRIVATE, NETVAL SERVICE PRIMARYRANK, FIRST, NULL },
+    { SC_10_6_IPHONE_2_0_PRIVATE, NETVAL SERVICE PRIMARYRANK, LAST, NULL },
+    { SC_10_6_IPHONE_2_0_PRIVATE, NETVAL SERVICE PRIMARYRANK, NEVER, NULL },
+    { COMMENT_PRIVATE, "", NULL, NULL, NULL },
+
   { GROUP, NETPROP SMB, KEY_PREFIX NETENT SMB " Entity Keys", NULL, NULL },
 
   { GROUP, NETPROP SMB, KEY_PREFIX NETENT SMB " Entity Keys", NULL, NULL },
 
+    { DEFINE, "#if", "!TARGET_OS_IPHONE", NULL, NULL },
     { SC_10_5, NETPROP SMB, NETBIOS NAME, NULL, CFSTRING },
     { SC_10_5, NETPROP SMB, NETBIOS NODE TYPE, NULL, CFSTRING },
     { SC_10_5, NETPROP SMB, NETBIOS SCOPE, NULL, CFSTRING },
     { SC_10_5, NETPROP SMB, NETBIOS NAME, NULL, CFSTRING },
     { SC_10_5, NETPROP SMB, NETBIOS NODE TYPE, NULL, CFSTRING },
     { SC_10_5, NETPROP SMB, NETBIOS SCOPE, NULL, CFSTRING },
@@ -850,11 +920,14 @@ static schemaDefinition names[] = {
     { SC_10_5, NETVAL SMB NETBIOS NODE TYPE, PEER, NULL },
     { SC_10_5, NETVAL SMB NETBIOS NODE TYPE, MIXED, NULL },
     { SC_10_5, NETVAL SMB NETBIOS NODE TYPE, HYBRID, NULL },
     { SC_10_5, NETVAL SMB NETBIOS NODE TYPE, PEER, NULL },
     { SC_10_5, NETVAL SMB NETBIOS NODE TYPE, MIXED, NULL },
     { SC_10_5, NETVAL SMB NETBIOS NODE TYPE, HYBRID, NULL },
+    { DEFINE, "#endif", "// !TARGET_OS_IPHONE", NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
 
   { GROUP, USERSENT CONSOLEUSER, KEY_PREFIX COMP USERS " Entity Keys", NULL, NULL },
 
     { COMMENT, "", NULL, NULL, NULL },
 
   { GROUP, USERSENT CONSOLEUSER, KEY_PREFIX COMP USERS " Entity Keys", NULL, NULL },
 
+    { DEFINE, "#if", "!TARGET_OS_IPHONE", NULL, NULL },
     { SC_10_1, USERSENT, CONSOLEUSER, NULL, NULL },
     { SC_10_1, USERSENT, CONSOLEUSER, NULL, NULL },
+    { DEFINE, "#endif", "// !TARGET_OS_IPHONE", NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
 
   { GROUP, SYSTEMPROP COMPUTERNAME, KEY_PREFIX COMP SYSTEM " Properties", NULL, NULL },
     { COMMENT, "", NULL, NULL, NULL },
 
   { GROUP, SYSTEMPROP COMPUTERNAME, KEY_PREFIX COMP SYSTEM " Properties", NULL, NULL },
@@ -894,6 +967,7 @@ static schemaDefinition names[] = {
 
   { GROUP_PRIVATE, VIRTUALNETWORKINTERFACES, "Virtual Network Interface Keys", NULL, NULL },
 
 
   { GROUP_PRIVATE, VIRTUALNETWORKINTERFACES, "Virtual Network Interface Keys", NULL, NULL },
 
+    { DEFINE_PRIVATE, "#if", "!TARGET_OS_IPHONE", NULL, NULL },
     { SC_10_5_PRIVATE, VIRTUALPROP BOND, INTERFACES, NULL, CFARRAY_CFSTRING },
     { SC_10_5_PRIVATE, VIRTUALPROP BOND, MODE, NULL, CFNUMBER },
     { SC_10_5_PRIVATE, VIRTUALPROP BOND, OPTIONS, NULL, CFDICTIONARY },
     { SC_10_5_PRIVATE, VIRTUALPROP BOND, INTERFACES, NULL, CFARRAY_CFSTRING },
     { SC_10_5_PRIVATE, VIRTUALPROP BOND, MODE, NULL, CFNUMBER },
     { SC_10_5_PRIVATE, VIRTUALPROP BOND, OPTIONS, NULL, CFDICTIONARY },
@@ -901,13 +975,16 @@ static schemaDefinition names[] = {
     { SC_10_5_PRIVATE, VIRTUALPROP VLAN, INTERFACE, NULL, CFSTRING },
     { SC_10_5_PRIVATE, VIRTUALPROP VLAN, TAG, NULL, CFNUMBER },
     { SC_10_5_PRIVATE, VIRTUALPROP VLAN, OPTIONS, NULL, CFDICTIONARY },
     { SC_10_5_PRIVATE, VIRTUALPROP VLAN, INTERFACE, NULL, CFSTRING },
     { SC_10_5_PRIVATE, VIRTUALPROP VLAN, TAG, NULL, CFNUMBER },
     { SC_10_5_PRIVATE, VIRTUALPROP VLAN, OPTIONS, NULL, CFDICTIONARY },
+    { DEFINE_PRIVATE, "#endif", "// !TARGET_OS_IPHONE", NULL, NULL },
 //  { COMMENT_PRIVATE, "", NULL, NULL, NULL },
 
 //{ GROUP, "DEPRECATED", "Deprecated schema definition keys", NULL, NULL },
 
 //  { COMMENT_PRIVATE, "", NULL, NULL, NULL },
 
 //{ GROUP, "DEPRECATED", "Deprecated schema definition keys", NULL, NULL },
 
+    { DEFINE, "#if", "!TARGET_OS_IPHONE", NULL, NULL },
     { SC_10_1_10_4, USERSPROP CONSOLEUSER, NAME, NULL, CFSTRING },
     { SC_10_1_10_4, USERSPROP CONSOLEUSER, UID, NULL, CFNUMBER },
     { SC_10_1_10_4, USERSPROP CONSOLEUSER, GID, NULL, CFNUMBER },
     { SC_10_1_10_4, USERSPROP CONSOLEUSER, NAME, NULL, CFSTRING },
     { SC_10_1_10_4, USERSPROP CONSOLEUSER, UID, NULL, CFNUMBER },
     { SC_10_1_10_4, USERSPROP CONSOLEUSER, GID, NULL, CFNUMBER },
+    { DEFINE, "#endif", "// !TARGET_OS_IPHONE", NULL, NULL },
 //  { COMMENT, "", NULL, NULL, NULL },
 
     { END, NULL, NULL, NULL, NULL },
 //  { COMMENT, "", NULL, NULL, NULL },
 
     { END, NULL, NULL, NULL, NULL },
@@ -964,6 +1041,13 @@ print_comment(schemaDefinition *def)
        return;
 }
 
        return;
 }
 
+void
+print_define(schemaDefinition *def)
+{
+       printf("%s %s\n", def->prefix, def->key);
+       return;
+}
+
 void
 print_headerdoc(schemaDefinition *def)
 {
 void
 print_headerdoc(schemaDefinition *def)
 {
@@ -989,22 +1073,39 @@ print_headerdoc(schemaDefinition *def)
            case SC_10_2:
                printf("  @availability Introduced in Mac OS X 10.2.\n");
                break;
            case SC_10_2:
                printf("  @availability Introduced in Mac OS X 10.2.\n");
                break;
-           case SC_10_1_10_4:
-               printf("  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.4.\n");
-               break;
-           case SC_10_1_10_5:
-               printf("  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.5.\n");
-               break;
            case SC_10_3:
                printf("  @availability Introduced in Mac OS X 10.3.\n");
                break;
            case SC_10_3:
                printf("  @availability Introduced in Mac OS X 10.3.\n");
                break;
+           case SC_10_1_10_4:
+               printf("  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.4.\n");
+               break;
            case SC_10_4:
                printf("  @availability Introduced in Mac OS X 10.4.\n");
                break;
            case SC_10_4:
                printf("  @availability Introduced in Mac OS X 10.4.\n");
                break;
+           case SC_10_1_10_5:
+               printf("  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.5.\n");
+               break;
            case SC_10_5:
            case SC_10_5_PRIVATE:
                printf("  @availability Introduced in Mac OS X 10.5.\n");
                break;
            case SC_10_5:
            case SC_10_5_PRIVATE:
                printf("  @availability Introduced in Mac OS X 10.5.\n");
                break;
+           case SC_10_1_10_6:
+               printf("  @availability Introduced in Mac OS X 10.1, but later deprecated in Mac OS X 10.6.\n");
+               break;
+           case SC_10_2_10_6:
+               printf("  @availability Introduced in Mac OS X 10.2, but later deprecated in Mac OS X 10.6.\n");
+               break;
+           case SC_10_6_IPHONE_2_0:
+           case SC_10_6_IPHONE_2_0_PRIVATE:
+               printf("  @availability Introduced in Mac OS X 10.6.\n");
+               break;
+           case SC_10_6_IPHONE_3_0:
+           case SC_10_6_IPHONE_3_0_PRIVATE:
+               printf("  @availability Introduced in Mac OS X 10.6.\n");
+               break;
+           case SC_IPHONE_2_0_PRIVATE:
+               printf("  @availability Introduced in iPhone OS 2.0.\n");
+               break;
        }
        printf(" */\n");
        printf("extern const CFStringRef %s;\n", kbuf);
        }
        printf(" */\n");
        printf("extern const CFStringRef %s;\n", kbuf);
@@ -1030,66 +1131,88 @@ print_hfile(schemaDefinition *def)
 
        switch (def->control) {
            case SC_10_1:
 
        switch (def->control) {
            case SC_10_1:
-               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030\n");
-               printf("  " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER)\n", kbuf);
-               printf("#endif\n");
+               printf("  " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0/*SPI*/))\n", kbuf);
                break;
            case SC_10_2:
                break;
            case SC_10_2:
-               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030\n");
-               printf("  " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)\n", kbuf);
-               printf("#endif\n");
+               printf("  " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0/*SPI*/))\n", kbuf);
                break;
            case SC_10_3:
                break;
            case SC_10_3:
-               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030\n");
-               printf("  " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER)\n", kbuf);
-               printf("#endif\n");
+               printf("  " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0/*SPI*/))\n", kbuf);
                break;
            case SC_10_1_10_4:
                break;
            case SC_10_1_10_4:
-               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030\n");
-               printf("  " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4)\n", kbuf);
-               printf("#endif\n");
-               break;
-           case SC_10_1_10_5:
-               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040\n");
-               printf("  " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5)\n", kbuf);
-               printf("#endif\n");
+               printf("  " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_4,__IPHONE_NA,__IPHONE_NA))\n", kbuf);
                break;
            case SC_10_4:
                break;
            case SC_10_4:
-               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040\n");
-               printf("  " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER)\n", kbuf);
-               printf("#endif\n");
+               printf("  " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0/*SPI*/))\n", kbuf);
+               break;
+           case SC_10_1_10_5:
+               printf("  " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA))\n", kbuf);
                break;
            case SC_10_5:
            case SC_10_5_PRIVATE:
                break;
            case SC_10_5:
            case SC_10_5_PRIVATE:
-               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050\n");
-               printf("  " SC_SCHEMA_DECLARATION "(%s, AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)\n", kbuf);
-               printf("#endif\n");
+               printf("  " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0/*SPI*/))\n", kbuf);
+               break;
+           case SC_10_1_10_6:
+               printf("  " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA))\n", kbuf);
+               break;
+           case SC_10_2_10_6:
+               printf("  " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2,__MAC_10_6,__IPHONE_NA,__IPHONE_NA))\n", kbuf);
+               break;
+           case SC_10_6_IPHONE_2_0:
+           case SC_10_6_IPHONE_2_0_PRIVATE:
+               printf("  " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0/*SPI*/))\n", kbuf);
+               break;
+           case SC_10_6_IPHONE_3_0:
+           case SC_10_6_IPHONE_3_0_PRIVATE:
+               printf("  " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0/*SPI*/))\n", kbuf);
+               break;
+           case SC_IPHONE_2_0_PRIVATE:
+               printf("  " SC_SCHEMA_DECLARATION "(%s, __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_2_0/*SPI*/))\n", kbuf);
                break;
            default:
                break;
            default:
-               printf("#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030\n");
                printf("  " SC_SCHEMA_DECLARATION "(%s,)\n", kbuf);
                printf("  " SC_SCHEMA_DECLARATION "(%s,)\n", kbuf);
-               printf("#endif\n");
                break;
        }
 
        switch (def->control) {
            case SC_10_1:
                break;
        }
 
        switch (def->control) {
            case SC_10_1:
-           case SC_10_1_10_4:
-           case SC_10_1_10_5:
-               printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1010)\n");
+               printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/\n");
                break;
            case SC_10_2:
                break;
            case SC_10_2:
-               printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)\n");
+               printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/\n");
                break;
            case SC_10_3:
                break;
            case SC_10_3:
-               printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1030)\n");
+               printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/\n");
+               break;
+           case SC_10_1_10_4:
+               printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)\n");
                break;
            case SC_10_4:
                break;
            case SC_10_4:
-               printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)\n");
+               printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1040) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/\n");
+               break;
+           case SC_10_1_10_5:
+               printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)\n");
                break;
            case SC_10_5:
            case SC_10_5_PRIVATE:
                break;
            case SC_10_5:
            case SC_10_5_PRIVATE:
-               printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)\n");
+               printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/\n");
+               break;
+           case SC_10_1_10_6:
+               printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010)\n");
+               break;
+           case SC_10_2_10_6:
+               printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1020)\n");
+               break;
+           case SC_10_6_IPHONE_2_0:
+           case SC_10_6_IPHONE_2_0_PRIVATE:
+               printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/\n");
+               break;
+           case SC_10_6_IPHONE_3_0:
+           case SC_10_6_IPHONE_3_0_PRIVATE:
+               printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000)/*SPI*/\n");
+               break;
+           case SC_IPHONE_2_0_PRIVATE:
+               printf("#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 20000)/*SPI*/\n");
                break;
        }
 
                break;
        }
 
@@ -1104,13 +1227,20 @@ print_hfile(schemaDefinition *def)
 
        switch (def->control) {
            case SC_10_1:
 
        switch (def->control) {
            case SC_10_1:
-           case SC_10_1_10_4:
-           case SC_10_1_10_5:
            case SC_10_2:
            case SC_10_3:
            case SC_10_2:
            case SC_10_3:
+           case SC_10_1_10_4:
            case SC_10_4:
            case SC_10_4:
+           case SC_10_1_10_5:
            case SC_10_5:
            case SC_10_5_PRIVATE:
            case SC_10_5:
            case SC_10_5_PRIVATE:
+           case SC_10_1_10_6:
+           case SC_10_2_10_6:
+           case SC_10_6_IPHONE_2_0:
+           case SC_10_6_IPHONE_3_0:
+           case SC_10_6_IPHONE_2_0_PRIVATE:
+           case SC_10_6_IPHONE_3_0_PRIVATE:
+           case SC_IPHONE_2_0_PRIVATE:
                printf("#endif\n");
                break;
        }
                printf("#endif\n");
                break;
        }
@@ -1163,6 +1293,48 @@ dump_names(int type)
                break;
            }
 
                break;
            }
 
+           case DEFINE: {
+               switch (type) {
+                   case gen_hfile_e:
+                       printf("\n");
+                       print_define(&names[i]);
+                       break;
+                   case gen_cfile_e:
+                       if ((strcmp(names[i].prefix, "#if") == 0) ||
+                           (strcmp(names[i].prefix, "#ifdef") == 0) ||
+                           (strcmp(names[i].prefix, "#ifndef") == 0))
+                           printf("\n");
+                       print_define(&names[i]);
+                       if (strcmp(names[i].prefix, "#endif") == 0)
+                           printf("\n");
+                       break;
+                   default:
+                       break;
+               }
+               break;
+           }
+
+           case DEFINE_PRIVATE: {
+               switch (type) {
+                   case gen_hfile_private_e:
+                       printf("\n");
+                       print_define(&names[i]);
+                       break;
+                   case gen_cfile_e:
+                       if ((strcmp(names[i].prefix, "#if") == 0) ||
+                           (strcmp(names[i].prefix, "#ifdef") == 0) ||
+                           (strcmp(names[i].prefix, "#ifndef") == 0))
+                           printf("\n");
+                       print_define(&names[i]);
+                       if (strcmp(names[i].prefix, "#endif") == 0)
+                           printf("\n");
+                       break;
+                   default:
+                       break;
+               }
+               break;
+           }
+                   
            case GROUP:
            case GROUP_DEPRECATED: {
                switch (type) {
            case GROUP:
            case GROUP_DEPRECATED: {
                switch (type) {
@@ -1222,9 +1394,14 @@ dump_names(int type)
                        switch (names[i].control) {
                            case SC_10_1_10_4:
                            case SC_10_1_10_5:
                        switch (names[i].control) {
                            case SC_10_1_10_4:
                            case SC_10_1_10_5:
+                           case SC_10_1_10_6:
+                           case SC_10_2_10_6:
                                // don't report deprecated keys
                                break;
                            case SC_10_5_PRIVATE:
                                // don't report deprecated keys
                                break;
                            case SC_10_5_PRIVATE:
+                           case SC_10_6_IPHONE_2_0_PRIVATE:
+                           case SC_10_6_IPHONE_3_0_PRIVATE:
+                           case SC_IPHONE_2_0_PRIVATE:
                                // don't report private definitions
                                break;
                            default:
                                // don't report private definitions
                                break;
                            default:
@@ -1236,9 +1413,14 @@ dump_names(int type)
                        switch (names[i].control) {
                            case SC_10_1_10_4:
                            case SC_10_1_10_5:
                        switch (names[i].control) {
                            case SC_10_1_10_4:
                            case SC_10_1_10_5:
+                           case SC_10_1_10_6:
+                           case SC_10_2_10_6:
                                // don't report deprecated keys
                                break;
                            case SC_10_5_PRIVATE:
                                // don't report deprecated keys
                                break;
                            case SC_10_5_PRIVATE:
+                           case SC_10_6_IPHONE_2_0_PRIVATE:
+                           case SC_10_6_IPHONE_3_0_PRIVATE:
+                           case SC_IPHONE_2_0_PRIVATE:
                                print_comment(&names[i]);
                                break;
                            default:
                                print_comment(&names[i]);
                                break;
                            default:
@@ -1250,8 +1432,11 @@ dump_names(int type)
                    case gen_headerdoc_e:
                        switch (names[i].control) {
                            case SC_10_5_PRIVATE:
                    case gen_headerdoc_e:
                        switch (names[i].control) {
                            case SC_10_5_PRIVATE:
-                               break;
+                           case SC_10_6_IPHONE_2_0_PRIVATE:
+                           case SC_10_6_IPHONE_3_0_PRIVATE:
+                           case SC_IPHONE_2_0_PRIVATE:
                                // don't report private definitions
                                // don't report private definitions
+                               break;
                            default:
                                print_headerdoc(&names[i]);
                                break;
                            default:
                                print_headerdoc(&names[i]);
                                break;
@@ -1260,6 +1445,9 @@ dump_names(int type)
                    case gen_headerdoc_private_e:
                        switch (names[i].control) {
                            case SC_10_5_PRIVATE:
                    case gen_headerdoc_private_e:
                        switch (names[i].control) {
                            case SC_10_5_PRIVATE:
+                           case SC_10_6_IPHONE_2_0_PRIVATE:
+                           case SC_10_6_IPHONE_3_0_PRIVATE:
+                           case SC_IPHONE_2_0_PRIVATE:
                                print_headerdoc(&names[i]);
                                break;
                            default:
                                print_headerdoc(&names[i]);
                                break;
                            default:
@@ -1271,6 +1459,9 @@ dump_names(int type)
                    case gen_hfile_e:
                        switch (names[i].control) {
                            case SC_10_5_PRIVATE:
                    case gen_hfile_e:
                        switch (names[i].control) {
                            case SC_10_5_PRIVATE:
+                           case SC_10_6_IPHONE_2_0_PRIVATE:
+                           case SC_10_6_IPHONE_3_0_PRIVATE:
+                           case SC_IPHONE_2_0_PRIVATE:
                                break;
                                // don't report private definitions
                            default:
                                break;
                                // don't report private definitions
                            default:
@@ -1281,6 +1472,9 @@ dump_names(int type)
                    case gen_hfile_private_e:
                        switch (names[i].control) {
                            case SC_10_5_PRIVATE:
                    case gen_hfile_private_e:
                        switch (names[i].control) {
                            case SC_10_5_PRIVATE:
+                           case SC_10_6_IPHONE_2_0_PRIVATE:
+                           case SC_10_6_IPHONE_3_0_PRIVATE:
+                           case SC_IPHONE_2_0_PRIVATE:
                                print_hfile(&names[i]);
                                break;
                            default:
                                print_hfile(&names[i]);
                                break;
                            default:
@@ -1325,39 +1519,7 @@ main(int argc, char * argv[])
     if (argc >= 2)
        type = argv[1];
 
     if (argc >= 2)
        type = argv[1];
 
-    if (strcmp(type, "header-x") == 0) {
-       printf("%s\n", copyright_string);
-       printf("/*\n * This file is automatically generated\n * DO NOT EDIT!\n */\n\n");
-
-       printf("/*\n");
-       printf(" * Note: For Cocoa/Obj-C/Foundation programs accessing these preference\n");
-       printf(" *       keys you may want to consider the following:\n");
-       printf(" *\n");
-       printf(" *       #define SCSTR(s) (NSString *)CFSTR(s)\n");
-       printf(" *       #import <SystemConfiguration/SystemConfiguration.h>\n");
-       printf(" */\n\n");
-
-       printf("#ifndef _SCSCHEMADEFINITIONS_10_1_H\n#define _SCSCHEMADEFINITIONS_10_1_H\n\n");
-
-       printf("#warning USE OF THIS HEADER HAS BEEN DEPRECATED\n");
-
-       printf("#ifndef _SCSCHEMADEFINITIONS_H\n");
-       printf("#warning Please #include <SystemConfiguration/SystemConfiguration.h> instead\n");
-       printf("#warning of including this file directly.\n");
-       printf("#include <SystemConfiguration/SCSchemaDefinitions.h>\n");
-       printf("#endif\n\n");
-
-//     printf("#ifndef  SCSTR\n");
-//     printf("#include <CoreFoundation/CFString.h>\n");
-//     printf("#define  SCSTR(s) CFSTR(s)\n");
-//     printf("#endif\n\n");
-//
-//     dump_names(gen_header_e);
-//     printf("\n");
-
-       printf("#endif /* _SCSCHEMADEFINITIONS_10_1_H */\n");
-    }
-    else if (strcmp(type, "header") == 0) {
+    if (strcmp(type, "header") == 0) {
        printf("%s\n", copyright_string);
        printf("/*\n * This file is automatically generated\n * DO NOT EDIT!\n */\n\n");
 
        printf("%s\n", copyright_string);
        printf("/*\n * This file is automatically generated\n * DO NOT EDIT!\n */\n\n");
 
@@ -1402,18 +1564,25 @@ main(int argc, char * argv[])
        printf(" *       \"" SC_SCHEMA_DECLARATION "\" and \"" SC_SCHEMA_KV "\" macros\n");
        printf(" */\n\n\n");
 
        printf(" *       \"" SC_SCHEMA_DECLARATION "\" and \"" SC_SCHEMA_KV "\" macros\n");
        printf(" */\n\n\n");
 
-       printf("#ifndef _SCSCHEMADEFINITIONS_H\n#define _SCSCHEMADEFINITIONS_H\n\n");
+       printf("#ifndef\t_SCSCHEMADEFINITIONS_H\n");
+       printf("#ifdef\tUSE_SYSTEMCONFIGURATION_PRIVATE_HEADERS\n");
+       printf("#include <SystemConfiguration/_SCSchemaDefinitions.h>\n");
+       printf("#else\t/* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */\n");
+       printf("#define\t_SCSCHEMADEFINITIONS_H\n");
+       printf("\n");
 
        printf("/* -------------------- Macro declarations -------------------- */\n\n");
 
 
        printf("/* -------------------- Macro declarations -------------------- */\n\n");
 
-       printf("#include <AvailabilityMacros.h>\n\n");
+       printf("#include <Availability.h>\n");
+       printf("#include <TargetConditionals.h>\n");
+       printf("\n");
 
        printf("/*\n");
        printf(" * let's \"do the right thing\" for those wishing to build for\n");
        printf(" * Mac OS X 10.1.0 ... 10.2.x\n");
        printf(" */\n");
 
 
        printf("/*\n");
        printf(" * let's \"do the right thing\" for those wishing to build for\n");
        printf(" * Mac OS X 10.1.0 ... 10.2.x\n");
        printf(" */\n");
 
-       printf("#if MAC_OS_X_VERSION_MIN_REQUIRED <= 1020\n");
+       printf("#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (__MAC_OS_X_VERSION_MIN_REQUIRED <= 1020) && !defined(__IPHONE_OS_VERSION_MIN_REQUIRED)\n");
        printf("  #ifndef SCSTR\n");
        printf("    #include <CoreFoundation/CFString.h>\n");
        printf("    #define SCSTR(s) CFSTR(s)\n");
        printf("  #ifndef SCSTR\n");
        printf("    #include <CoreFoundation/CFString.h>\n");
        printf("    #define SCSTR(s) CFSTR(s)\n");
@@ -1447,7 +1616,7 @@ main(int argc, char * argv[])
        printf("#endif\n");
 
        // The SCSTR() macro should only be availble for Mac OS X 10.1.0 ... 10.4.x
        printf("#endif\n");
 
        // The SCSTR() macro should only be availble for Mac OS X 10.1.0 ... 10.4.x
-       printf("#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) && (MAC_OS_X_VERSION_MAX_ALLOWED <= 1040)\n");
+       printf("#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1010) && (__MAC_OS_X_VERSION_MAX_ALLOWED <= 1040) && !defined(__IPHONE_OS_VERSION_MIN_REQUIRED)\n");
        printf("  #ifndef SCSTR\n");
        printf("    #include <CoreFoundation/CFString.h>\n");
        printf("    #define SCSTR(s) CFSTR(s)\n");
        printf("  #ifndef SCSTR\n");
        printf("    #include <CoreFoundation/CFString.h>\n");
        printf("    #define SCSTR(s) CFSTR(s)\n");
@@ -1467,7 +1636,8 @@ main(int argc, char * argv[])
        dump_names(gen_hfile_e);
        printf("\n");
 
        dump_names(gen_hfile_e);
        printf("\n");
 
-       printf("#endif /* _SCSCHEMADEFINITIONS_H */\n");
+       printf("#endif\t/* USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS */\n");
+       printf("#endif\t/* _SCSCHEMADEFINITIONS_H */\n");
     }
     else if (strcmp(type, "private") == 0) {
        printf("%s\n", copyright_string);
     }
     else if (strcmp(type, "private") == 0) {
        printf("%s\n", copyright_string);
@@ -1477,7 +1647,9 @@ main(int argc, char * argv[])
        dump_names(gen_comments_private_e);
        printf(" */\n\n\n");
 
        dump_names(gen_comments_private_e);
        printf(" */\n\n\n");
 
-       printf("#ifndef _SCSCHEMADEFINITIONSPRIVATE_H\n#define _SCSCHEMADEFINITIONSPRIVATE_H\n\n");
+       printf("#ifndef _SCSCHEMADEFINITIONSPRIVATE_H\n");
+       printf("#define _SCSCHEMADEFINITIONSPRIVATE_H\n");
+       printf("\n");
 
        printf("/* -------------------- Macro declarations -------------------- */\n\n");
 
 
        printf("/* -------------------- Macro declarations -------------------- */\n\n");
 
@@ -1504,6 +1676,8 @@ main(int argc, char * argv[])
        printf(" * DO NOT EDIT!\n");
        printf(" */\n");
        printf("\n");
        printf(" * DO NOT EDIT!\n");
        printf(" */\n");
        printf("\n");
+       printf("#include <Availability.h>\n");
+       printf("#include <TargetConditionals.h>\n");
        printf("#include <CoreFoundation/CFString.h>\n");
        printf("\n");
        dump_names(gen_cfile_e);
        printf("#include <CoreFoundation/CFString.h>\n");
        printf("\n");
        dump_names(gen_cfile_e);
index 3fe56db0b2835a43a8c09a203dfaed30ae6a254c..638008f408f34ae330c29e0bc3b0cd0de56cd551 100644 (file)
@@ -31,6 +31,7 @@
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <sys/un.h>
 #include <sys/wait.h>
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <sys/wait.h>
 
 #include <CoreFoundation/CoreFoundation.h>
@@ -51,203 +52,46 @@ __private_extern__
 int
 _SCHelperOpen(CFDataRef authorizationData)
 {
 int
 _SCHelperOpen(CFDataRef authorizationData)
 {
-       sigset_t                        block;
-       sigset_t                        block_old;
-       CFBundleRef                     bundle;
-       int                             comm[2]         = { -1, -1 };
-       int                             exit_status     = 0;
-       struct sigaction                ignore;
-       struct sigaction                int_old;
-       Boolean                         ok              = FALSE;
-       char                            path[MAXPATHLEN]= { 0 };
-       pid_t                           pid1;
-       struct sigaction                quit_old;
-       uint32_t                        status          = 0;
-       CFURLRef                        url             = NULL;
-       static int                      yes             = 1;
-
-       // get CFBundleRef for SystemConfiguration.framework
-       bundle = _SC_CFBundleGet();
-       if (bundle != NULL) {
-               url = CFBundleCopyResourceURL(bundle, CFSTR(HELPER), NULL, NULL);
-       }
-
-       if (url != NULL) {
-               if (!CFURLGetFileSystemRepresentation(url, TRUE, (UInt8 *)path, sizeof(path))) {
-                       path[0] = 0;
-               }
-               CFRelease(url);
-       }
-
-       // create tool<-->helper communications socket
-       if (socketpair(AF_UNIX, SOCK_STREAM, 0, comm) == -1) {
-               perror("_SCHelperOpen socketpair() failed");
+       Boolean                 ok;
+       int                     sock;
+       struct sockaddr_un      sun;
+       uint32_t                status  = 0;
+       static int              yes     = 1;
+
+       if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
+               perror("_SCHelperOpen socket() failed");
                return -1;
        }
 
                return -1;
        }
 
-       // ignore SIGINT, SIGQUIT
-       ignore.sa_handler = SIG_IGN;
-       ignore.sa_flags   = 0;
-       (void)sigemptyset(&ignore.sa_mask);
-       (void)sigaction(SIGINT , &ignore, &int_old );
-       (void)sigaction(SIGQUIT, &ignore, &quit_old);
-
-       // block SIGCHLD
-       (void)sigemptyset(&block);
-       (void)sigaddset(&block, SIGCHLD);
-       (void)sigprocmask(SIG_BLOCK, &block, &block_old);
-
-       // fork
-       pid1 = fork();
-       if (pid1 == -1) {               // if error
-               perror("_SCHelperOpen fork() failed");
-               goto done;
-       } else if (pid1 == 0) {         // if [first] child
-               int     i;
-               pid_t   pid2;
-
-               // make sure that we don't step on syslog's FD (if open)
-               closelog();
-
-               // set stdin, stdout, stderr (and close other FD's)
-               if (comm[0] != STDIN_FILENO) {
-                       (void)dup2(comm[0], STDIN_FILENO);
-               }
-
-               if (comm[0] != STDOUT_FILENO) {
-                       (void)dup2(comm[0], STDOUT_FILENO);
-               }
-
-               (void)close(STDERR_FILENO);
-               (void)open(_PATH_CONSOLE, O_WRONLY, 0);
-
-               for (i = getdtablesize() - 1; i > STDERR_FILENO; i--) {
-                       (void)close(i);
-               }
-
-               pid2 = vfork();
-               if (pid2 == -1) {               // if error
-                       int     err     = errno;
-
-                       perror("_SCHelperOpen vfork() failed\n");
-                       (void)__SCHelper_txMessage(STDOUT_FILENO, err, NULL);
-                       _exit(err);
-               } else if (pid2 == 0) {         // if [second] child
-                       char            *env;
-                       int             err     = ENOENT;
-                       size_t          len;
-
-                       // restore signal processing
-                       (void)sigaction(SIGINT , &int_old , NULL);
-                       (void)sigaction(SIGQUIT, &quit_old, NULL);
-                       (void)sigprocmask(SIG_SETMASK, &block_old, NULL);
-
-                       if (path[0] != 0) {
-                               (void)execl(path, path, NULL);
-                               err = errno;
-                       }
-
-                       // if appropriate (e.g. when debugging), try a bit harder
-
-                       env = getenv("DYLD_FRAMEWORK_PATH");
-                       len = (env != NULL) ? strlen(env) : 0;
-
-                       // trim any trailing slashes
-                       while ((len > 1) && (env[len - 1] == '/')) {
-                               len--;
-                       }
-
-                       // if DYLD_FRAMEWORK_PATH is ".../xxx~sym" than try ".../xxx~sym/SCHelper"
-                       if ((len > SUFFIX_SYM_LEN) &&
-                           (strncmp(&env[len - SUFFIX_SYM_LEN], SUFFIX_SYM, SUFFIX_SYM_LEN) == 0) &&
-                           ((len + 1 + HELPER_LEN) < MAXPATHLEN)) {
-                               char            path[MAXPATHLEN];
-
-                               strlcpy(path, env, sizeof(path));
-                               strlcpy(&path[len], "/", sizeof(path) - (len - 1));
-                               strlcat(&path[len], HELPER, sizeof(path) - len);
-
-                               (void)execl(path, path, NULL);
-                               err = errno;
-                       }
-
-                       // if SCHelper could not be started
-                       (void)__SCHelper_txMessage(STDOUT_FILENO, err, NULL);
-                       _exit(err != 0 ? err : ENOENT);
-               }
-
-               // [first] child
-               _exit(0);
-       }
-
-       if (wait4(pid1, &exit_status, 0, NULL) == -1) {
-               perror("_SCHelperOpen wait4() failed");
-               goto done;
-       }
-
-       if (WIFEXITED(exit_status)) {
-               if (WEXITSTATUS(exit_status) != 0) {
-                       SCLog(TRUE, LOG_INFO,
-                             CFSTR("could not start \"" HELPER "[1]\", exited w/status = %d"),
-                             WEXITSTATUS(exit_status));
-                       goto done;
-               }
-       } else if (WIFSIGNALED(exit_status)) {
-               SCLog(TRUE, LOG_INFO,
-                     CFSTR("could not start \"" HELPER "[1]\", terminated w/signal = %d"),
-                     WTERMSIG(exit_status));
-               goto done;
-       } else {
-               SCLog(TRUE, LOG_INFO,
-                     CFSTR("could not start \"" HELPER "[1]\", exit_status = %x"),
-                     exit_status);
-               goto done;
+       sun.sun_family = AF_UNIX;
+       strlcpy(sun.sun_path, "/var/run/SCHelper", sizeof(sun.sun_path));
+       if (connect(sock, (struct sockaddr *)&sun, sizeof(sun)) == -1) {
+               perror("_SCHelperOpen connect() failed");
+               close(sock);
+               return -1;
        }
 
        }
 
-       (void)close(comm[0]);
-       comm[0] = -1;
-
-       if (setsockopt(comm[1], SOL_SOCKET, SO_NOSIGPIPE, (const void *)&yes, sizeof(yes)) == -1) {
+       if (setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, (const void *)&yes, sizeof(yes)) == -1) {
                perror("_SCHelperOpen setsockopt() failed");
                perror("_SCHelperOpen setsockopt() failed");
-               goto done;
+               close(sock);
+               return -1;
        }
 
        }
 
-       ok = __SCHelper_rxMessage(comm[1], &status, NULL);
+       ok = _SCHelperExec(sock, SCHELPER_MSG_AUTH, authorizationData, &status, NULL);
        if (!ok) {
        if (!ok) {
-               SCLog(TRUE, LOG_INFO, CFSTR("could not start \"" HELPER "\", no status available"));
-               goto done;
+               SCLog(TRUE, LOG_INFO, CFSTR("_SCHelperOpen: could not send authorization"));
+               close(sock);
+               return -1;
        }
 
        ok = (status == 0);
        if (!ok) {
                SCLog(TRUE, LOG_INFO, CFSTR("could not start \"" HELPER "\", status = %u"), status);
        }
 
        ok = (status == 0);
        if (!ok) {
                SCLog(TRUE, LOG_INFO, CFSTR("could not start \"" HELPER "\", status = %u"), status);
-               goto done;
-       }
-
-       ok = _SCHelperExec(comm[1], SCHELPER_MSG_AUTH, authorizationData, &status, NULL);
-       if (!ok) {
-               SCLog(TRUE, LOG_INFO, CFSTR("_SCHelperOpen: could not send authorization"));
-               goto done;
-       }
-
-    done :
-
-       // restore signal processing
-       (void)sigaction(SIGINT , &int_old , NULL);
-       (void)sigaction(SIGQUIT, &quit_old, NULL);
-       (void)sigprocmask(SIG_SETMASK, &block_old, NULL);
-
-       if (comm[0] > 0) {
-               (void)close(comm[0]);
-//             comm[0] = -1;
-       }
-
-       if (!ok) {
-               (void)close(comm[1]);
-               comm[1] = -1;
+               close(sock);
+               return -1;
        }
 
        }
 
-       return comm[1];
+       return sock;
 }
 
 
 }
 
 
index 3fb24bb28eb12825eb4e065fa5fa8c2bfcabb8c5..74d78eb1b631e8a40bd45d947b775a3f4613faed 100644 (file)
@@ -25,7 +25,9 @@
 #define _SCHELPER_CLIENT_H
 
 #include <sys/cdefs.h>
 #define _SCHELPER_CLIENT_H
 
 #include <sys/cdefs.h>
-#include <Security/Security.h>
+#include <Availability.h>
+#include <TargetConditionals.h>
+#include <CoreFoundation/CoreFoundation.h>
 
 #define kSCKeychainOptionsAccount              CFSTR("Account")                // CFString
 #define kSCKeychainOptionsDescription          CFSTR("Description")            // CFString
 
 #define kSCKeychainOptionsAccount              CFSTR("Account")                // CFString
 #define kSCKeychainOptionsDescription          CFSTR("Description")            // CFString
@@ -51,11 +53,13 @@ enum {
        // SCNetworkConfiguration
        SCHELPER_MSG_INTERFACE_REFRESH  = 200,
 
        // SCNetworkConfiguration
        SCHELPER_MSG_INTERFACE_REFRESH  = 200,
 
+#if    !TARGET_OS_IPHONE
        // "System" Keychain
        SCHELPER_MSG_KEYCHAIN_COPY      = 300,
        SCHELPER_MSG_KEYCHAIN_EXISTS,
        SCHELPER_MSG_KEYCHAIN_REMOVE,
        SCHELPER_MSG_KEYCHAIN_SET,
        // "System" Keychain
        SCHELPER_MSG_KEYCHAIN_COPY      = 300,
        SCHELPER_MSG_KEYCHAIN_EXISTS,
        SCHELPER_MSG_KEYCHAIN_REMOVE,
        SCHELPER_MSG_KEYCHAIN_SET,
+#endif // !TARGET_OS_IPHONE
 
        // miscellaneous
        SCHELPER_MSG_EXIT               = 9999
 
        // miscellaneous
        SCHELPER_MSG_EXIT               = 9999
index 7a8ca555c4ca953b13005935d8a6196ec3d5539b..cdf3fd3dae78c501e7c8d5d3f4de5abcf71d9368 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2005-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  */
 
 #include <stdlib.h>
  */
 
 #include <stdlib.h>
+#include <getopt.h>
 #include <unistd.h>
 #include <sys/types.h>
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <unistd.h>
 #include <sys/types.h>
 
 #include <CoreFoundation/CoreFoundation.h>
+#include <CoreFoundation/CFRuntime.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
-#include <Security/Security.h>
+#include <SystemConfiguration/SCValidation.h>
+#include <pthread.h>
+#include <sysexits.h>
 
 #include "SCPreferencesInternal.h"
 #include "SCHelper_client.h"
 #include "helper_comm.h"
 
 
 
 #include "SCPreferencesInternal.h"
 #include "SCHelper_client.h"
 #include "helper_comm.h"
 
 
-static AuthorizationRef        authorization   = NULL;
-static SCPreferencesRef        prefs           = NULL;
+#if    TARGET_OS_IPHONE
+#include <grp.h>
+
+__private_extern__ int
+getgrnam_r(const char *name, __unused struct group *grp, __unused char *buf, __unused size_t bufsize, struct group **grpP)
+{
+       *grpP = getgrnam(name);
+       return (*grpP == NULL) ? -1 : 0;
+}
+#endif // TARGET_OS_IPHONE
+
+
+#pragma mark -
+#pragma mark Session managment
+
+
+typedef const struct __SCHelperSession * SCHelperSessionRef;
+
+typedef struct {
+
+       // base CFType information
+       CFRuntimeBase           cfBase;
+
+       // authorization
+       AuthorizationRef        authorization;
+#if    TARGET_OS_IPHONE
+       uid_t                   peer_euid;
+       gid_t                   peer_egid;
+#endif // TARGET_OS_IPHONE
+
+       // preferences
+       SCPreferencesRef        prefs;
+
+} SCHelperSessionPrivate, *SCHelperSessionPrivateRef;
+
+
+static AuthorizationRef
+__SCHelperSessionGetAuthorization(SCHelperSessionRef session)
+{
+       SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)session;
+
+       return sessionPrivate->authorization;
+}
+
+
+static Boolean
+__SCHelperSessionSetAuthorization(SCHelperSessionRef session, CFTypeRef authorizationData)
+{
+       Boolean                         ok              = TRUE;
+       SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)session;
+
+#if    !TARGET_OS_IPHONE
+       if (sessionPrivate->authorization != NULL) {
+               AuthorizationFree(sessionPrivate->authorization, kAuthorizationFlagDefaults);
+//             AuthorizationFree(sessionPrivate->authorization, kAuthorizationFlagDestroyRights);
+               sessionPrivate->authorization = NULL;
+       }
+
+       if (isA_CFData(authorizationData)) {
+               AuthorizationExternalForm       extForm;
+
+               if (CFDataGetLength(authorizationData) == sizeof(extForm.bytes)) {
+                       OSStatus        err;
+
+                       bcopy(CFDataGetBytePtr(authorizationData), extForm.bytes, sizeof(extForm.bytes));
+                       err = AuthorizationCreateFromExternalForm(&extForm,
+                                                                 &sessionPrivate->authorization);
+                       if (err != errAuthorizationSuccess) {
+                               SCLog(TRUE, LOG_ERR,
+                                     CFSTR("AuthorizationCreateFromExternalForm() failed: status = %d"),
+                                     (int)err);
+                               sessionPrivate->authorization = NULL;
+                               ok = FALSE;
+                       }
+               }
+       }
+#else  // !TARGET_OS_IPHONE
+       if (sessionPrivate->authorization != NULL) {
+               CFRelease(sessionPrivate->authorization);
+               sessionPrivate->authorization = NULL;
+       }
+
+       if (isA_CFString(authorizationData)) {
+               sessionPrivate->authorization = (void *)CFRetain(authorizationData);
+       }
+#endif // !TARGET_OS_IPHONE
+
+       return ok;
+}
+
+
+#if    TARGET_OS_IPHONE
+static void
+__SCHelperSessionGetCredentials(SCHelperSessionRef session, uid_t *euid, gid_t *egid)
+{
+       SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)session;
+
+       if (euid != NULL) *euid = sessionPrivate->peer_euid;
+       if (egid != NULL) *egid = sessionPrivate->peer_egid;
+       return;
+}
+
+
+static Boolean
+__SCHelperSessionSetCredentials(SCHelperSessionRef session, uid_t euid, gid_t egid)
+{
+       SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)session;
+
+       sessionPrivate->peer_euid = euid;
+       sessionPrivate->peer_egid = egid;
+       return TRUE;
+}
+#endif // TARGET_OS_IPHONE
+
+static SCPreferencesRef
+__SCHelperSessionGetPreferences(SCHelperSessionRef session)
+{
+       SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)session;
+
+       return sessionPrivate->prefs;
+}
+
+
+static Boolean
+__SCHelperSessionSetPreferences(SCHelperSessionRef session, SCPreferencesRef prefs)
+{
+       SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)session;
+
+       if (prefs != NULL) {
+               CFRetain(prefs);
+       }
+       if (sessionPrivate->prefs != NULL) {
+               CFRelease(sessionPrivate->prefs);
+       }
+       sessionPrivate->prefs = prefs;
+
+       return TRUE;
+}
+
+
+static CFStringRef     __SCHelperSessionCopyDescription        (CFTypeRef cf);
+static void            __SCHelperSessionDeallocate             (CFTypeRef cf);
+
+
+static CFTypeID                __kSCHelperSessionTypeID        = _kCFRuntimeNotATypeID;
+static Boolean         debug                           = FALSE;
+static pthread_once_t  initialized                     = PTHREAD_ONCE_INIT;
+static CFRunLoopRef    main_runLoop                    = NULL;
+static CFMutableSetRef sessions                        = NULL;
+static int             sessions_closed                 = 0;    // count of sessions recently closed
+static pthread_mutex_t sessions_lock                   = PTHREAD_MUTEX_INITIALIZER;
+
+
+static const CFRuntimeClass __SCHelperSessionClass = {
+       0,                                      // version
+       "SCHelperSession",                      // className
+       NULL,                                   // init
+       NULL,                                   // copy
+       __SCHelperSessionDeallocate,            // dealloc
+       NULL,                                   // equal
+       NULL,                                   // hash
+       NULL,                                   // copyFormattingDesc
+       __SCHelperSessionCopyDescription        // copyDebugDesc
+};
+
+
+static CFStringRef
+__SCHelperSessionCopyDescription(CFTypeRef cf)
+{
+       CFAllocatorRef                  allocator       = CFGetAllocator(cf);
+       CFMutableStringRef              result;
+       SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)cf;
+
+       result = CFStringCreateMutable(allocator, 0);
+       CFStringAppendFormat(result, NULL, CFSTR("<SCHelperSession %p [%p]> {"), cf, allocator);
+       CFStringAppendFormat(result, NULL, CFSTR("authorization = %p"), sessionPrivate->authorization);
+       CFStringAppendFormat(result, NULL, CFSTR(", prefs = %p"), sessionPrivate->prefs);
+       CFStringAppendFormat(result, NULL, CFSTR("}"));
+
+       return result;
+}
+
+
+static void
+__SCHelperSessionDeallocate(CFTypeRef cf)
+{
+       SCHelperSessionPrivateRef       sessionPrivate  = (SCHelperSessionPrivateRef)cf;
+
+       // release resources
+       __SCHelperSessionSetAuthorization((SCHelperSessionRef)sessionPrivate, NULL);
+       __SCHelperSessionSetPreferences  ((SCHelperSessionRef)sessionPrivate, NULL);
+
+       // we no longer need/want to track this session
+       pthread_mutex_lock(&sessions_lock);
+       CFSetRemoveValue(sessions, sessionPrivate);
+       sessions_closed++;
+       pthread_mutex_unlock(&sessions_lock);
+       CFRunLoopWakeUp(main_runLoop);
+
+       return;
+}
+
+
+static void
+__SCHelperSessionInitialize(void)
+{
+       __kSCHelperSessionTypeID = _CFRuntimeRegisterClass(&__SCHelperSessionClass);
+       return;
+}
+
+
+static SCHelperSessionRef
+__SCHelperSessionCreate(CFAllocatorRef allocator)
+{
+       SCHelperSessionPrivateRef       sessionPrivate;
+       uint32_t                        size;
+
+       /* initialize runtime */
+       pthread_once(&initialized, __SCHelperSessionInitialize);
+
+       /* allocate session */
+       size           = sizeof(SCHelperSessionPrivate) - sizeof(CFRuntimeBase);
+       sessionPrivate = (SCHelperSessionPrivateRef)_CFRuntimeCreateInstance(allocator,
+                                                                           __kSCHelperSessionTypeID,
+                                                                           size,
+                                                                           NULL);
+       if (sessionPrivate == NULL) {
+               return NULL;
+       }
+
+       sessionPrivate->authorization   = NULL;
+#if    TARGET_OS_IPHONE
+       sessionPrivate->peer_euid       = 0;
+       sessionPrivate->peer_egid       = 0;
+#endif // TARGET_OS_IPHONE
+       sessionPrivate->prefs           = NULL;
+
+       // keep track this session
+       pthread_mutex_lock(&sessions_lock);
+       if (sessions == NULL) {
+               sessions = CFSetCreateMutable(NULL, 0, NULL);   // create a non-retaining set
+       }
+       CFSetAddValue(sessions, sessionPrivate);
+       pthread_mutex_unlock(&sessions_lock);
+
+       return (SCHelperSessionRef)sessionPrivate;
+}
+
+
+#pragma mark -
+#pragma mark Helpers
 
 
 /*
 
 
 /*
@@ -46,8 +299,9 @@ static SCPreferencesRef      prefs           = NULL;
  *   (out) reply  = N/A
  */
 static Boolean
  *   (out) reply  = N/A
  */
 static Boolean
-do_Exit(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+do_Exit(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 {
 {
+       *status = -1;
        return FALSE;
 }
 
        return FALSE;
 }
 
@@ -59,38 +313,40 @@ do_Exit(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
  *   (out) reply  = N/A
  */
 static Boolean
  *   (out) reply  = N/A
  */
 static Boolean
-do_Auth(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+do_Auth(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 {
 {
-       if (authorization != NULL) {
-               AuthorizationFree(authorization, kAuthorizationFlagDefaults);
-//             AuthorizationFree(authorization, kAuthorizationFlagDestroyRights);
-               authorization = NULL;
-       }
+       Boolean ok;
 
 
-       if (data != NULL) {
-               AuthorizationExternalForm       extForm;
+#if    !TARGET_OS_IPHONE
 
 
-               if (CFDataGetLength(data) == sizeof(extForm.bytes)) {
-                       OSStatus        err;
+       ok = __SCHelperSessionSetAuthorization(session, data);
 
 
-                       bcopy(CFDataGetBytePtr(data), extForm.bytes, sizeof(extForm.bytes));
-                       err = AuthorizationCreateFromExternalForm(&extForm, &authorization);
-                       if (err != errAuthorizationSuccess) {
-                               SCLog(TRUE, LOG_ERR,
-                                     CFSTR("AuthorizationCreateFromExternalForm() failed: status = %d"),
-                                     (int)err);
-                       }
-               }
+#else  //!TARGET_OS_IPHONE
 
 
-               CFRelease(data);
+       CFStringRef     authorizationInfo       = NULL;
+
+       if ((data != NULL) && !_SCUnserializeString(&authorizationInfo, data, NULL, 0)) {
+               return FALSE;
        }
 
        }
 
-       *status = (authorization != NULL) ? 0 : 1;
+       if (!isA_CFString(authorizationInfo)) {
+               if (authorizationInfo != NULL) CFRelease(authorizationInfo);
+               return FALSE;
+       }
+
+       ok = __SCHelperSessionSetAuthorization(session, authorizationInfo);
+       if (authorizationInfo != NULL) CFRelease(authorizationInfo);
+
+#endif // !TARGET_OS_IPHONE
 
 
+       *status = ok ? 0 : 1;
        return TRUE;
 }
 
 
        return TRUE;
 }
 
 
+#if    !TARGET_OS_IPHONE
+
+
 /*
  * SCHELPER_MSG_KEYCHAIN_COPY
  *   (in)  data   = unique_id
 /*
  * SCHELPER_MSG_KEYCHAIN_COPY
  *   (in)  data   = unique_id
@@ -98,9 +354,10 @@ do_Auth(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
  *   (out) reply  = password
  */
 static Boolean
  *   (out) reply  = password
  */
 static Boolean
-do_keychain_copy(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+do_keychain_copy(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 {
 {
-       CFStringRef     unique_id       = NULL;
+       SCPreferencesRef        prefs;
+       CFStringRef             unique_id       = NULL;
 
        if ((data != NULL) && !_SCUnserializeString(&unique_id, data, NULL, 0)) {
                return FALSE;
 
        if ((data != NULL) && !_SCUnserializeString(&unique_id, data, NULL, 0)) {
                return FALSE;
@@ -110,6 +367,7 @@ do_keychain_copy(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
                return FALSE;
        }
 
                return FALSE;
        }
 
+       prefs = __SCHelperSessionGetPreferences(session);
        *reply = _SCPreferencesSystemKeychainPasswordItemCopy(prefs, unique_id);
        CFRelease(unique_id);
        if (*reply == NULL) {
        *reply = _SCPreferencesSystemKeychainPasswordItemCopy(prefs, unique_id);
        CFRelease(unique_id);
        if (*reply == NULL) {
@@ -127,22 +385,24 @@ do_keychain_copy(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
  *   (out) reply  = N/A
  */
 static Boolean
  *   (out) reply  = N/A
  */
 static Boolean
-do_keychain_exists(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+do_keychain_exists(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 {
 {
-       Boolean         ok;
-       CFStringRef     unique_id       = NULL;
+       Boolean                 ok;
+       SCPreferencesRef        prefs;
+       CFStringRef             unique_id       = NULL;
 
        if ((data != NULL) && !_SCUnserializeString(&unique_id, data, NULL, 0)) {
                return FALSE;
        }
 
        if (!isA_CFString(unique_id)) {
 
        if ((data != NULL) && !_SCUnserializeString(&unique_id, data, NULL, 0)) {
                return FALSE;
        }
 
        if (!isA_CFString(unique_id)) {
+               if (unique_id != NULL) CFRelease(unique_id);
                return FALSE;
        }
 
                return FALSE;
        }
 
+       prefs = __SCHelperSessionGetPreferences(session);
        ok = _SCPreferencesSystemKeychainPasswordItemExists(prefs, unique_id);
        CFRelease(unique_id);
        ok = _SCPreferencesSystemKeychainPasswordItemExists(prefs, unique_id);
        CFRelease(unique_id);
-
        if (!ok) {
                *status = SCError();
        }
        if (!ok) {
                *status = SCError();
        }
@@ -158,22 +418,24 @@ do_keychain_exists(void *info, CFDataRef data, uint32_t *status, CFDataRef *repl
  *   (out) reply  = N/A
  */
 static Boolean
  *   (out) reply  = N/A
  */
 static Boolean
-do_keychain_remove(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+do_keychain_remove(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 {
 {
-       Boolean         ok;
-       CFStringRef     unique_id       = NULL;
+       Boolean                 ok;
+       SCPreferencesRef        prefs;
+       CFStringRef             unique_id       = NULL;
 
        if ((data != NULL) && !_SCUnserializeString(&unique_id, data, NULL, 0)) {
                return FALSE;
        }
 
        if (!isA_CFString(unique_id)) {
 
        if ((data != NULL) && !_SCUnserializeString(&unique_id, data, NULL, 0)) {
                return FALSE;
        }
 
        if (!isA_CFString(unique_id)) {
+               if (unique_id != NULL) CFRelease(unique_id);
                return FALSE;
        }
 
                return FALSE;
        }
 
+       prefs = __SCHelperSessionGetPreferences(session);
        ok = _SCPreferencesSystemKeychainPasswordItemRemove(prefs, unique_id);
        CFRelease(unique_id);
        ok = _SCPreferencesSystemKeychainPasswordItemRemove(prefs, unique_id);
        CFRelease(unique_id);
-
        if (!ok) {
                *status = SCError();
        }
        if (!ok) {
                *status = SCError();
        }
@@ -189,22 +451,24 @@ do_keychain_remove(void *info, CFDataRef data, uint32_t *status, CFDataRef *repl
  *   (out) reply  = N/A
  */
 static Boolean
  *   (out) reply  = N/A
  */
 static Boolean
-do_keychain_set(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+do_keychain_set(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 {
 {
-       CFStringRef     account;
-       CFStringRef     description;
-       CFArrayRef      executablePaths = NULL;
-       CFStringRef     label;
-       Boolean         ok;
-       CFDictionaryRef options         = NULL;
-       CFDataRef       password;
-       CFStringRef     unique_id;
+       CFStringRef             account;
+       CFStringRef             description;
+       CFArrayRef              executablePaths = NULL;
+       CFStringRef             label;
+       Boolean                 ok;
+       CFDictionaryRef         options         = NULL;
+       CFDataRef               password;
+       SCPreferencesRef        prefs;
+       CFStringRef             unique_id;
 
        if ((data != NULL) && !_SCUnserialize((CFPropertyListRef *)&options, data, NULL, 0)) {
                return FALSE;
        }
 
        if (!isA_CFDictionary(options)) {
 
        if ((data != NULL) && !_SCUnserialize((CFPropertyListRef *)&options, data, NULL, 0)) {
                return FALSE;
        }
 
        if (!isA_CFDictionary(options)) {
+               if (options != NULL) CFRelease(options);
                return FALSE;
        }
 
                return FALSE;
        }
 
@@ -247,6 +511,7 @@ do_keychain_set(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
        account     = CFDictionaryGetValue(options, kSCKeychainOptionsAccount);
        password    = CFDictionaryGetValue(options, kSCKeychainOptionsPassword);
 
        account     = CFDictionaryGetValue(options, kSCKeychainOptionsAccount);
        password    = CFDictionaryGetValue(options, kSCKeychainOptionsPassword);
 
+       prefs = __SCHelperSessionGetPreferences(session);
        ok = _SCPreferencesSystemKeychainPasswordItemSet(prefs,
                                                         unique_id,
                                                         label,
        ok = _SCPreferencesSystemKeychainPasswordItemSet(prefs,
                                                         unique_id,
                                                         label,
@@ -255,7 +520,6 @@ do_keychain_set(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
                                                         password,
                                                         options);
        CFRelease(options);
                                                         password,
                                                         options);
        CFRelease(options);
-
        if (!ok) {
                *status = SCError();
        }
        if (!ok) {
                *status = SCError();
        }
@@ -264,6 +528,9 @@ do_keychain_set(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 }
 
 
 }
 
 
+#endif // !TARGET_OS_IPHONE
+
+
 /*
  * SCHELPER_MSG_INTERFACE_REFRESH
  *   (in)  data   = ifName
 /*
  * SCHELPER_MSG_INTERFACE_REFRESH
  *   (in)  data   = ifName
@@ -271,7 +538,7 @@ do_keychain_set(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
  *   (out) reply  = N/A
  */
 static Boolean
  *   (out) reply  = N/A
  */
 static Boolean
-do_interface_refresh(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+do_interface_refresh(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 {
        CFStringRef     ifName  = NULL;
        Boolean         ok;
 {
        CFStringRef     ifName  = NULL;
        Boolean         ok;
@@ -283,12 +550,12 @@ do_interface_refresh(void *info, CFDataRef data, uint32_t *status, CFDataRef *re
 
        if (!isA_CFString(ifName)) {
                SCLog(TRUE, LOG_ERR, CFSTR("interface name not valid"));
 
        if (!isA_CFString(ifName)) {
                SCLog(TRUE, LOG_ERR, CFSTR("interface name not valid"));
+               if (ifName != NULL) CFRelease(ifName);
                return FALSE;
        }
 
        ok = _SCNetworkInterfaceForceConfigurationRefresh(ifName);
        CFRelease(ifName);
                return FALSE;
        }
 
        ok = _SCNetworkInterfaceForceConfigurationRefresh(ifName);
        CFRelease(ifName);
-
        if (!ok) {
                *status = SCError();
        }
        if (!ok) {
                *status = SCError();
        }
@@ -304,23 +571,73 @@ do_interface_refresh(void *info, CFDataRef data, uint32_t *status, CFDataRef *re
  *   (out) reply  = N/A
  */
 static Boolean
  *   (out) reply  = N/A
  */
 static Boolean
-do_prefs_Open(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+do_prefs_Open(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 {
 {
-       CFStringRef     prefsID = NULL;
+       CFStringRef             name;
+       CFNumberRef             pid;
+       SCPreferencesRef        prefs           = __SCHelperSessionGetPreferences(session);
+       CFDictionaryRef         prefsInfo       = NULL;
+       CFStringRef             prefsID;
+       CFStringRef             prefsName;
 
        if (prefs != NULL) {
                return FALSE;
        }
 
 
        if (prefs != NULL) {
                return FALSE;
        }
 
-       if ((data != NULL) && !_SCUnserializeString(&prefsID, data, NULL, 0)) {
-               SCLog(TRUE, LOG_ERR, CFSTR("prefsID not valid"));
+       if ((data != NULL) && !_SCUnserialize((CFPropertyListRef *)&prefsInfo, data, NULL, 0)) {
+               SCLog(TRUE, LOG_ERR, CFSTR("data not valid, %@"), data);
                return FALSE;
        }
 
                return FALSE;
        }
 
-       prefs = SCPreferencesCreate(NULL, CFSTR("SCHelper"), prefsID);
-       if (prefsID != NULL) CFRelease(prefsID);
+       if ((prefsInfo == NULL) || !isA_CFDictionary(prefsInfo)) {
+               SCLog(TRUE, LOG_ERR, CFSTR("info not valid"));
+               if (prefsInfo != NULL) CFRelease(prefsInfo);
+               return FALSE;
+       }
 
 
-       if (prefs == NULL) {
+       // get [optional] prefsID
+       prefsID = CFDictionaryGetValue(prefsInfo, CFSTR("prefsID"));
+       prefsID = isA_CFString(prefsID);
+       if (prefsID != NULL) {
+               if (CFStringHasPrefix(prefsID, CFSTR("/")) ||
+                   CFStringHasPrefix(prefsID, CFSTR("../")) ||
+                   CFStringHasSuffix(prefsID, CFSTR("/..")) ||
+                   (CFStringFind(prefsID, CFSTR("/../"), 0).location != kCFNotFound)) {
+                       // if we're trying to escape from the preferences directory
+                       SCLog(TRUE, LOG_ERR, CFSTR("prefsID (%@) not valid"), prefsID);
+                       CFRelease(prefsInfo);
+                       *status = kSCStatusInvalidArgument;
+                       return TRUE;
+               }
+       }
+
+       // get preferences session "name"
+       name = CFDictionaryGetValue(prefsInfo, CFSTR("name"));
+       if (!isA_CFString(name)) {
+               SCLog(TRUE, LOG_ERR, CFSTR("session \"name\" not valid"));
+               CFRelease(prefsInfo);
+               return FALSE;
+       }
+
+       // get PID of caller
+       pid = CFDictionaryGetValue(prefsInfo, CFSTR("PID"));
+       if (!isA_CFNumber(pid)) {
+               SCLog(TRUE, LOG_ERR, CFSTR("PID not valid"));
+               CFRelease(prefsInfo);
+               return FALSE;
+       }
+
+       // build [helper] preferences "name" (used for debugging) and estabish
+       // a preferences session.
+       prefsName = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@:%@"), pid, name);
+       prefs = SCPreferencesCreate(NULL, prefsName, prefsID);
+       CFRelease(prefsName);
+       CFRelease(prefsInfo);
+
+       __SCHelperSessionSetPreferences(session, prefs);
+       if (prefs != NULL) {
+               CFRelease(prefs);
+       } else {
                *status = SCError();
        }
 
                *status = SCError();
        }
 
@@ -335,10 +652,10 @@ do_prefs_Open(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
  *   (out) reply  = current signature + current preferences
  */
 static Boolean
  *   (out) reply  = current signature + current preferences
  */
 static Boolean
-do_prefs_Access(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+do_prefs_Access(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 {
        Boolean                 ok;
 {
        Boolean                 ok;
-       SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+       SCPreferencesRef        prefs           = __SCHelperSessionGetPreferences(session);
        CFDataRef               signature;
 
        if (prefs == NULL) {
        CFDataRef               signature;
 
        if (prefs == NULL) {
@@ -347,9 +664,10 @@ do_prefs_Access(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 
        signature = SCPreferencesGetSignature(prefs);
        if (signature != NULL) {
 
        signature = SCPreferencesGetSignature(prefs);
        if (signature != NULL) {
-               const void *    dictKeys[2];
-               const void *    dictVals[2];
-               CFDictionaryRef replyDict;
+               const void *            dictKeys[2];
+               const void *            dictVals[2];
+               SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+               CFDictionaryRef         replyDict;
 
                dictKeys[0] = CFSTR("signature");
                dictVals[0] = signature;
 
                dictKeys[0] = CFSTR("signature");
                dictVals[0] = signature;
@@ -384,11 +702,12 @@ do_prefs_Access(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
  *   (out) reply  = N/A
  */
 static Boolean
  *   (out) reply  = N/A
  */
 static Boolean
-do_prefs_Lock(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+do_prefs_Lock(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 {
 {
-       CFDataRef       clientSignature = (CFDataRef)data;
-       Boolean         ok;
-       Boolean         wait            = (info == (void *)FALSE) ? FALSE : TRUE;
+       CFDataRef               clientSignature = (CFDataRef)data;
+       Boolean                 ok;
+       SCPreferencesRef        prefs           = __SCHelperSessionGetPreferences(session);
+       Boolean                 wait            = (info == (void *)FALSE) ? FALSE : TRUE;
 
        if (prefs == NULL) {
                return FALSE;
 
        if (prefs == NULL) {
                return FALSE;
@@ -421,16 +740,18 @@ do_prefs_Lock(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
  *   (out) reply  = new signature
  */
 static Boolean
  *   (out) reply  = new signature
  */
 static Boolean
-do_prefs_Commit(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+do_prefs_Commit(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 {
        Boolean                 ok;
 {
        Boolean                 ok;
-       SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+       SCPreferencesRef        prefs   = __SCHelperSessionGetPreferences(session);
 
        if (prefs == NULL) {
                return FALSE;
        }
 
        if (data != NULL) {
 
        if (prefs == NULL) {
                return FALSE;
        }
 
        if (data != NULL) {
+               SCPreferencesPrivateRef prefsPrivate    = (SCPreferencesPrivateRef)prefs;
+
                if (prefsPrivate->prefs != NULL) {
                        CFRelease(prefsPrivate->prefs);
                }
                if (prefsPrivate->prefs != NULL) {
                        CFRelease(prefsPrivate->prefs);
                }
@@ -463,9 +784,10 @@ do_prefs_Commit(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
  *   (out) reply  = N/A
  */
 static Boolean
  *   (out) reply  = N/A
  */
 static Boolean
-do_prefs_Apply(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+do_prefs_Apply(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 {
 {
-       Boolean ok;
+       Boolean                 ok;
+       SCPreferencesRef        prefs   = __SCHelperSessionGetPreferences(session);
 
        if (prefs == NULL) {
                return FALSE;
 
        if (prefs == NULL) {
                return FALSE;
@@ -487,9 +809,10 @@ do_prefs_Apply(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
  *   (out) reply  = N/A
  */
 static Boolean
  *   (out) reply  = N/A
  */
 static Boolean
-do_prefs_Unlock(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+do_prefs_Unlock(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 {
 {
-       Boolean ok;
+       Boolean                 ok;
+       SCPreferencesRef        prefs   = __SCHelperSessionGetPreferences(session);
 
        if (prefs == NULL) {
                return FALSE;
 
        if (prefs == NULL) {
                return FALSE;
@@ -511,15 +834,16 @@ do_prefs_Unlock(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
  *   (out) reply  = N/A
  */
 static Boolean
  *   (out) reply  = N/A
  */
 static Boolean
-do_prefs_Close(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+do_prefs_Close(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 {
 {
+       SCPreferencesRef        prefs   = __SCHelperSessionGetPreferences(session);
+
        if (prefs == NULL) {
                return FALSE;
        }
 
        if (prefs == NULL) {
                return FALSE;
        }
 
-       CFRelease(prefs);
-       prefs = NULL;
-
+       __SCHelperSessionSetPreferences(session, NULL);
+       *status = -1;
        return TRUE;
 }
 
        return TRUE;
 }
 
@@ -531,21 +855,30 @@ do_prefs_Close(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
  *   (out) reply  = N/A
  */
 static Boolean
  *   (out) reply  = N/A
  */
 static Boolean
-do_prefs_Synchronize(void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
+do_prefs_Synchronize(SCHelperSessionRef session, void *info, CFDataRef data, uint32_t *status, CFDataRef *reply)
 {
 {
+       SCPreferencesRef        prefs   = __SCHelperSessionGetPreferences(session);
+
        if (prefs == NULL) {
                return FALSE;
        }
        if (prefs == NULL) {
                return FALSE;
        }
-       
+
        SCPreferencesSynchronize(prefs);
        *status = kSCStatusOK;
        return TRUE;
 }
 
 
        SCPreferencesSynchronize(prefs);
        *status = kSCStatusOK;
        return TRUE;
 }
 
 
+#pragma mark -
+#pragma mark Process commands
+
+
 static Boolean
 static Boolean
-hasAuthorization()
+hasAuthorization(SCHelperSessionRef session)
 {
 {
+       AuthorizationRef        authorization   = __SCHelperSessionGetAuthorization(session);
+
+#if    !TARGET_OS_IPHONE
        AuthorizationFlags      flags;
        AuthorizationItem       items[1];
        AuthorizationRights     rights;
        AuthorizationFlags      flags;
        AuthorizationItem       items[1];
        AuthorizationRights     rights;
@@ -577,16 +910,49 @@ hasAuthorization()
        if (status != errAuthorizationSuccess) {
                return FALSE;
        }
        if (status != errAuthorizationSuccess) {
                return FALSE;
        }
+#else  // !TARGET_OS_IPHONE
+       uid_t   peer_euid;
+       gid_t   peer_egid;
 
 
-if (items[0].flags != 0) SCLog(TRUE, LOG_DEBUG, CFSTR("***** success w/flags (%u) != 0"), items[0].flags);
+       if (authorization == NULL) {
+               return FALSE;
+       }
+
+       __SCHelperSessionGetCredentials(session, &peer_euid, &peer_egid);
+       if ((peer_euid != 0) && (peer_egid != 0)) {
+               static gid_t    mobile_gid      = -1;
+
+               /*
+                * if peer is not user "root" nor group "wheel" then
+                * we check to see if we are one of the authorized
+                * callers.
+                */
+               if (mobile_gid == -1) {
+                       char            buffer[1024];
+                       struct group    grp;
+                       struct group    *grpP;
+
+                       if (getgrnam_r("mobile", &grp, buffer, sizeof(buffer), &grpP) == 0) {
+                               mobile_gid = grpP->gr_gid;
+                       }
+               }
+
+               if (peer_egid != mobile_gid) {
+                       return FALSE;
+               }
+       }
+#endif // !TARGET_OS_IPHONE
+
+//     if (items[0].flags != 0) SCLog(TRUE, LOG_DEBUG, CFSTR("***** success w/flags (%u) != 0"), items[0].flags);
        return TRUE;
 }
 
 
        return TRUE;
 }
 
 
-typedef Boolean (*helperFunction)      (void           *info,
-                                        CFDataRef      data,
-                                        uint32_t       *status,
-                                        CFDataRef      *reply);
+typedef Boolean (*helperFunction)      (SCHelperSessionRef     session,
+                                        void                   *info,
+                                        CFDataRef              data,
+                                        uint32_t               *status,
+                                        CFDataRef              *reply);
 
 
 static const struct helper {
 
 
 static const struct helper {
@@ -610,10 +976,12 @@ static const struct helper {
 
        { SCHELPER_MSG_INTERFACE_REFRESH,       "INTERFACE refresh",    TRUE,   do_interface_refresh    , NULL          },
 
 
        { SCHELPER_MSG_INTERFACE_REFRESH,       "INTERFACE refresh",    TRUE,   do_interface_refresh    , NULL          },
 
+#if    !TARGET_OS_IPHONE
        { SCHELPER_MSG_KEYCHAIN_COPY,           "KEYCHAIN copy",        TRUE,   do_keychain_copy        , NULL          },
        { SCHELPER_MSG_KEYCHAIN_EXISTS,         "KEYCHAIN exists",      TRUE,   do_keychain_exists      , NULL          },
        { SCHELPER_MSG_KEYCHAIN_REMOVE,         "KEYCHAIN remove",      TRUE,   do_keychain_remove      , NULL          },
        { SCHELPER_MSG_KEYCHAIN_SET,            "KEYCHAIN set",         TRUE,   do_keychain_set         , NULL          },
        { SCHELPER_MSG_KEYCHAIN_COPY,           "KEYCHAIN copy",        TRUE,   do_keychain_copy        , NULL          },
        { SCHELPER_MSG_KEYCHAIN_EXISTS,         "KEYCHAIN exists",      TRUE,   do_keychain_exists      , NULL          },
        { SCHELPER_MSG_KEYCHAIN_REMOVE,         "KEYCHAIN remove",      TRUE,   do_keychain_remove      , NULL          },
        { SCHELPER_MSG_KEYCHAIN_SET,            "KEYCHAIN set",         TRUE,   do_keychain_set         , NULL          },
+#endif // !TARGET_OS_IPHONE
 
        { SCHELPER_MSG_EXIT,                    "EXIT",                 FALSE,  do_Exit                 , NULL          }
 };
 
        { SCHELPER_MSG_EXIT,                    "EXIT",                 FALSE,  do_Exit                 , NULL          }
 };
@@ -621,7 +989,7 @@ static const struct helper {
 
 
 static int
 
 
 static int
-findHelper(command)
+findHelper(uint32_t command)
 {
        int     i;
 
 {
        int     i;
 
@@ -635,88 +1003,324 @@ findHelper(command)
 }
 
 
 }
 
 
-int
-main(int argc, char **argv)
+static Boolean
+process_command(SCHelperSessionRef session, int fd, int *err)
 {
 {
-       int             err     = 0;
-       Boolean         ok      = TRUE;
+       uint32_t        command = 0;
+       CFDataRef       data    = NULL;
+       int             i;
+       Boolean         ok      = FALSE;
+       CFDataRef       reply   = NULL;
+       uint32_t        status  = kSCStatusOK;
+
+       if (!__SCHelper_rxMessage(fd, &command, &data)) {
+               SCLog(TRUE, LOG_ERR, CFSTR("no command"));
+               *err = EIO;
+               goto done;
+       }
 
 
-       openlog("SCHelper", LOG_CONS|LOG_PID, LOG_DAEMON);
+       i = findHelper(command);
+       if (i == -1) {
+               SCLog(TRUE, LOG_ERR, CFSTR("received unknown command : %u"), command);
+               *err = EINVAL;
+               goto done;
+       }
 
 
-       if (geteuid() != 0) {
-               (void)__SCHelper_txMessage(STDOUT_FILENO, EACCES, NULL);
-               exit(EACCES);
+       SCLog(debug, LOG_DEBUG,
+             CFSTR("processing command \"%s\"%s"),
+             helpers[i].commandName,
+             (data != NULL) ? " w/data" : "");
+
+       if (helpers[i].needsAuthorization && !hasAuthorization(session)) {
+               SCLog(debug, LOG_DEBUG,
+                     CFSTR("command \"%s\" : not authorized"),
+                     helpers[i].commandName);
+               status = kSCStatusAccessError;
        }
 
        }
 
-       // send "we are here" message
-       if (!__SCHelper_txMessage(STDOUT_FILENO, 0, NULL)) {
-               exit(EIO);
+       if (status == kSCStatusOK) {
+               ok = (*helpers[i].func)(session, helpers[i].info, data, &status, &reply);
        }
 
        }
 
-       while (ok) {
-               uint32_t        command;
-               CFDataRef       data;
-               int             i;
-               CFDataRef       reply;
-               uint32_t        status;
+       if ((status != -1) || (reply != NULL)) {
+               SCLog(debug, LOG_DEBUG,
+                     CFSTR("sending status %u%s"),
+                     status,
+                     (reply != NULL) ? " w/reply" : "");
 
 
-               command = 0;
-               data    = NULL;
-               if (!__SCHelper_rxMessage(STDIN_FILENO, &command, &data)) {
-                       SCLog(TRUE, LOG_ERR, CFSTR("no command"));
-                       err = EIO;
-                       break;
+               if (!__SCHelper_txMessage(fd, status, reply)) {
+                       *err = EIO;
+                       ok = FALSE;
+                       goto done;
                }
                }
+       }
 
 
-               i = findHelper(command);
-               if (i == -1) {
-                       SCLog(TRUE, LOG_ERR, CFSTR("received unknown command : %u"), command);
-                       err = EINVAL;
-                       break;
-               }
+    done :
 
 
-               SCLog(TRUE, LOG_DEBUG,
-                     CFSTR("processing command \"%s\"%s"),
-                     helpers[i].commandName,
-                     (data != NULL) ? " w/data" : "");
+       if (data != NULL) {
+               CFRelease(data);
+       }
 
 
-               status = kSCStatusOK;
-               reply  = NULL;
+       if (reply != NULL) {
+               CFRelease(reply);
+       }
 
 
-               if (helpers[i].needsAuthorization && !hasAuthorization()) {
-                       SCLog(TRUE, LOG_DEBUG,
-                             CFSTR("command \"%s\" : not authorized"),
-                             helpers[i].commandName);
-                       status = kSCStatusAccessError;
-               }
+       return ok;
+}
 
 
-               if (status == kSCStatusOK) {
-                       ok = (*helpers[i].func)(helpers[i].info, data, &status, &reply);
-               }
 
 
-               SCLog(TRUE, LOG_DEBUG,
-                     CFSTR("sending status %u%s"),
-                     status,
-                     (reply != NULL) ? " w/reply" : "");
+#pragma mark -
+#pragma mark Main loop
+
+
+static void
+readCallback(CFSocketRef               s,
+            CFSocketCallBackType       callbackType,
+            CFDataRef                  address,
+            const void                 *data,
+            void                       *info)
+{
+       CFSocketNativeHandle    fd;
+       int                     err     = 0;
+       Boolean                 ok;
+       SCHelperSessionRef      session = (SCHelperSessionRef)info;
+
+       if (callbackType != kCFSocketReadCallBack) {
+               SCLog(TRUE, LOG_ERR, CFSTR("readCallback w/callbackType = %d"), callbackType);
+               return;
+       }
+
+       fd = CFSocketGetNative(s);
+       ok = process_command(session, fd, &err);
+       if (!ok) {
+               SCLog(debug, LOG_DEBUG, CFSTR("per-session socket : invalidate fd %d"), fd);
+               CFSocketInvalidate(s);
+       }
+
+       return;
+}
+
+
+static void *
+newHelper(void *arg)
+{
+       CFSocketContext         context = { 0, NULL, CFRetain, CFRelease, CFCopyDescription };
+       CFSocketNativeHandle    fd      = (CFSocketNativeHandle)(intptr_t)arg;
+       CFRunLoopSourceRef      rls;
+       SCHelperSessionRef      session;
+       CFSocketRef             sock;
+
+#if    TARGET_OS_IPHONE
+       uid_t                   peer_euid;
+       gid_t                   peer_egid;
+#endif // TARGET_OS_IPHONE
+
+       session = __SCHelperSessionCreate(NULL);
+#if    TARGET_OS_IPHONE
+       if (getpeereid(fd, &peer_euid, &peer_egid) == 0) {
+               __SCHelperSessionSetCredentials(session, peer_euid, peer_egid);
+       } else {
+               SCLog(TRUE, LOG_ERR, CFSTR("getpeereid() failed: %s"), strerror(errno));
+       }
+#endif // TARGET_OS_IPHONE
+
+       context.info = (void *)session;
+       sock = CFSocketCreateWithNative(NULL,
+                                       fd,
+                                       kCFSocketReadCallBack,
+                                       readCallback,
+                                       &context);
+       CFRelease(session);
+
+       rls = CFSocketCreateRunLoopSource(NULL, sock, 0);
+       CFRelease(sock);
+
+       CFRunLoopAddSource(CFRunLoopGetCurrent(), rls, kCFRunLoopDefaultMode);
+       CFRelease(rls);
+
+       CFRunLoopRun();
+       return NULL;
+}
+
+
+static void
+acceptCallback(CFSocketRef             s,
+              CFSocketCallBackType     callbackType,
+              CFDataRef                address,
+              const void               *data,
+              void                     *info)
+{
+       CFSocketNativeHandle    fd;
+       pthread_attr_t          tattr;
+       pthread_t               tid;
+       static int              yes     = 1;
+
+       if (callbackType != kCFSocketAcceptCallBack) {
+               SCLog(TRUE, LOG_ERR, CFSTR("acceptCallback w/callbackType = %d"), callbackType);
+               return;
+       }
+
+       if ((data == NULL) ||
+           ((fd = *((CFSocketNativeHandle *)data)) == -1)) {
+               SCLog(TRUE, LOG_ERR, CFSTR("accept w/no FD"));
+               return;
+       }
+
+       if (setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, (const void *)&yes, sizeof(yes)) == -1) {
+               SCLog(TRUE, LOG_ERR, CFSTR("setsockopt(SO_NOSIGPIPE) failed: %s"), strerror(errno));
+               return;
+       }
+
+       // start per-session thread
+       pthread_attr_init(&tattr);
+       pthread_attr_setscope(&tattr, PTHREAD_SCOPE_SYSTEM);
+       pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED);
+       pthread_attr_setstacksize(&tattr, 96 * 1024);   // each thread gets a 96K stack
+       pthread_create(&tid, &tattr, newHelper, (void *)(intptr_t)fd);
+       pthread_attr_destroy(&tattr);
 
 
-               if (!__SCHelper_txMessage(STDOUT_FILENO, status, reply)) {
-                       err = EIO;
-                       break;
+       return;
+}
+
+
+#include <launch.h>
+
+
+static const struct option longopts[] = {
+       { "debug",      no_argument,    0,      'd'     },
+       { 0,            0,              0,      0       }
+};
+
+
+int
+main(int argc, char **argv)
+{
+       Boolean                 done    = FALSE;
+       int                     err     = 0;
+       int                     i;
+       launch_data_t           l_listeners;
+       launch_data_t           l_msg;
+       launch_data_t           l_reply;
+       launch_data_t           l_sockets;
+       launch_data_type_t      l_type;
+       int                     n       = 0;
+       extern int              optind;
+       int                     opt;
+       int                     opti;
+
+       openlog("SCHelper", LOG_CONS|LOG_PID, LOG_DAEMON);
+
+       // process any arguments
+       while ((opt = getopt_long(argc, argv, "d", longopts, &opti)) != -1) {
+               switch(opt) {
+                       case 'd':
+                               debug = TRUE;
+                               break;
+                       case 0 :
+//                             if (strcmp(longopts[opti].name, "debug") == 1) {
+//                             }
+                               break;
+                       case '?':
+                       default :
+                               SCLog(TRUE, LOG_ERR,
+                                     CFSTR("ignoring unknown or ambiguous command line option"));
+                               break;
                }
                }
+       }
+//     argc -= optind;
+//     argv += optind;
 
 
-               if (reply != NULL) {
-                       CFRelease(reply);
+       if (geteuid() != 0) {
+               SCLog(TRUE, LOG_ERR, CFSTR("%s"), strerror(EACCES));
+               exit(EACCES);
+       }
+
+       main_runLoop = CFRunLoopGetCurrent();
+
+       l_msg = launch_data_new_string(LAUNCH_KEY_CHECKIN);
+       l_reply = launch_msg(l_msg);
+       launch_data_free(l_msg);
+       l_type = (l_reply != NULL) ? launch_data_get_type(l_reply) : 0;
+       if (l_type != LAUNCH_DATA_DICTIONARY) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("SCHelper: error w/launchd " LAUNCH_KEY_CHECKIN " dictionary (%p, %d)"),
+                     l_reply,
+                     l_type);
+               err = 1;
+               goto done;
+       }
+
+       l_sockets = launch_data_dict_lookup(l_reply, LAUNCH_JOBKEY_SOCKETS);
+       l_type = (l_sockets != NULL) ? launch_data_get_type(l_sockets) : 0;
+       if (l_type != LAUNCH_DATA_DICTIONARY) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("SCHelper: error w/" LAUNCH_JOBKEY_SOCKETS " (%p, %d)"),
+                     l_sockets,
+                     l_type);
+               err = 1;
+               goto done;
+       }
+
+       l_listeners = launch_data_dict_lookup(l_sockets, "Listeners");
+       l_type = (l_listeners != NULL) ? launch_data_get_type(l_listeners) : 0;
+       if (l_type != LAUNCH_DATA_ARRAY) {
+               SCLog(TRUE, LOG_ERR, CFSTR("SCHelper: error w/Listeners (%p, %d)"),
+                     l_listeners,
+                     l_type);
+               goto done;
+       }
+
+       n = launch_data_array_get_count(l_listeners);
+       for (i = 0; i < n; i++) {
+               CFSocketNativeHandle    fd;
+               launch_data_t           l_fd;
+               CFRunLoopSourceRef      rls;
+               CFSocketRef             sock;
+
+               l_fd = launch_data_array_get_index(l_listeners, i);
+               l_type = (l_fd != NULL) ? launch_data_get_type(l_fd) : 0;
+               if (l_type != LAUNCH_DATA_FD) {
+                       SCLog(TRUE, LOG_ERR, CFSTR("SCHelper: error w/Listeners[%d] (%p, %d)"),
+                             i,
+                             l_fd,
+                             l_type);
+                       err = 1;
+                       goto done;
                }
                }
+
+               fd = launch_data_get_fd(l_fd);
+               sock = CFSocketCreateWithNative(NULL,
+                                               fd,
+                                               kCFSocketAcceptCallBack,
+                                               acceptCallback,
+                                               NULL);
+               rls = CFSocketCreateRunLoopSource(NULL, sock, 0);
+               CFRunLoopAddSource(main_runLoop, rls, kCFRunLoopDefaultMode);
+               CFRelease(rls);
+               CFRelease(sock);
        }
 
        }
 
-       if (prefs != NULL) {
-               CFRelease(prefs);
+    done :
+
+       if (l_reply != NULL) launch_data_free(l_reply);
+
+       if ((err != 0) || (n == 0)) {
+               exit(err);
        }
 
        }
 
-       if (authorization != NULL) {
-               AuthorizationFree(authorization, kAuthorizationFlagDefaults);
-//             AuthorizationFree(authorization, kAuthorizationFlagDestroyRights);
+       while (!done) {
+               SInt32  rlStatus;
+
+               rlStatus = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 15.0, TRUE);
+               if (rlStatus == kCFRunLoopRunTimedOut) {
+                       pthread_mutex_lock(&sessions_lock);
+                       done = ((sessions != NULL) &&
+                               (CFSetGetCount(sessions) == 0) &&
+                               (sessions_closed == 0));
+                       sessions_closed = 0;
+                       pthread_mutex_unlock(&sessions_lock);
+               }
        }
 
        }
 
-       exit(err);
+       exit(EX_OK);
 }
 }
diff --git a/SystemConfiguration.fproj/helper/com.apple.SCHelper-embedded.plist b/SystemConfiguration.fproj/helper/com.apple.SCHelper-embedded.plist
new file mode 100644 (file)
index 0000000..023d9b4
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>Label</key>
+       <string>com.apple.SCHelper</string>
+       <key>Program</key>
+       <string>/System/Library/Frameworks/SystemConfiguration.framework/SCHelper</string>
+       <key>Sockets</key>
+       <dict>
+               <key>Listeners</key>
+               <dict>
+                       <key>SockFamily</key>
+                       <string>Unix</string>
+                       <key>SockPathMode</key>
+                       <integer>438</integer>
+                       <key>SockPathName</key>
+                       <string>/var/run/SCHelper</string>
+               </dict>
+       </dict>
+</dict>
+</plist>
diff --git a/SystemConfiguration.fproj/helper/com.apple.SCHelper.plist b/SystemConfiguration.fproj/helper/com.apple.SCHelper.plist
new file mode 100644 (file)
index 0000000..10dd6df
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>Label</key>
+       <string>com.apple.SCHelper</string>
+       <key>Program</key>
+       <string>/System/Library/Frameworks/SystemConfiguration.framework/Resources/SCHelper</string>
+       <key>Sockets</key>
+       <dict>
+               <key>Listeners</key>
+               <dict>
+                       <key>SockFamily</key>
+                       <string>Unix</string>
+                       <key>SockPathMode</key>
+                       <integer>438</integer>
+                       <key>SockPathName</key>
+                       <string>/var/run/SCHelper</string>
+               </dict>
+       </dict>
+</dict>
+</plist>
diff --git a/SystemConfiguration.fproj/update-headers b/SystemConfiguration.fproj/update-headers
new file mode 100755 (executable)
index 0000000..62838ac
--- /dev/null
@@ -0,0 +1,130 @@
+#!/usr/bin/perl
+
+if (!$ENV{"INSTALL_DIR"} or !$ENV{"PUBLIC_HEADERS_FOLDER_PATH"} or !$ENV{"PRIVATE_HEADERS_FOLDER_PATH"}) {
+       die "Cannot update headers, missing ENV vars\n";
+}
+
+$DO_SPLIT = ($#ARGV >= 0 and $ARGV[0] eq "split");
+
+$API_BASE = $ENV{"INSTALL_DIR"} . "/" . $ENV{"PUBLIC_HEADERS_FOLDER_PATH"};
+$SPI_BASE = $ENV{"INSTALL_DIR"} . "/" . $ENV{"PRIVATE_HEADERS_FOLDER_PATH"};
+
+sub clean_INC {
+       my ($inc) = @_;
+
+       $inc =~ s/#ifdef\s+USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS\s*.*?\n#include\s+<SystemConfiguration\/.*?>.*?\n#else.*?\n//;
+       $inc =~ s/#endif\s+.*?USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS.*?\n//;
+       
+       return $inc;
+}
+
+sub clean_API {
+       my ($api) = @_;
+       my ($api_new);
+
+       $api_new = $DO_SPLIT ? $api : clean_INC($api);
+       $api_new =~ s/(__MAC)_\w+\/\*SPI\*\//\1_NA/g;
+       $api_new =~ s/(\(__MAC_OS_X_VERSION_MIN_REQUIRED >= \d+\)\/\*SPI\*\/ \|\| )//g;
+       $api_new =~ s/(__IPHONE)_\w+\/\*SPI\*\//\1_NA/g;
+       $api_new =~ s/( \|\| \(__IPHONE_OS_VERSION_MIN_REQUIRED >= \d+\))\/\*SPI\*\///g;
+
+       return $api_new;
+}
+
+sub clean_SPI {
+       my ($spi) = @_;
+       my ($spi_new);
+
+       $spi_new = clean_INC($spi);
+       $spi_new =~ s/(__MAC_\w+)\/\*SPI\*\//\1/g;
+       $api_new =~ s/(\(__MAC_OS_X_VERSION_MIN_REQUIRED >= \d+\))\/\*SPI\*\/( \|\| )/\1\2/g;
+       $spi_new =~ s/(__IPHONE_\w+)\/\*SPI\*\//\1/g;
+       $spi_new =~ s/( \|\| )(\(__IPHONE_OS_VERSION_MIN_REQUIRED >= \d+\))\/\*SPI\*\//\1\2/g;
+
+       return $spi_new;
+}
+
+#
+# Update .../PrivateHeaders
+#
+
+opendir(HEADERS, $SPI_BASE);
+@headers = readdir(HEADERS);
+closedir(HEADERS);
+
+undef $/;
+for (@headers) {
+       next if ($_ eq '.');
+       next if ($_ eq '..');
+
+       $spi_header = $_;
+       $spi_path = $SPI_BASE . "/" . $spi_header;
+       next if (! -f $spi_path);
+
+       open(SPI, "<", $spi_path);
+       $spi = <SPI>;
+       close(SPI);
+
+       $spi_new = clean_SPI($spi);
+       if ($spi ne $spi_new) {
+#              printf "cleaning .../PrivateHeaders/%s\n", $spi_header;
+               open(SPI, ">", $spi_path);
+               print SPI $spi_new;
+               close(SPI);
+       }
+}
+$/ = "\n";
+
+#
+# Update .../Headers
+#
+
+opendir(HEADERS, $API_BASE);
+@headers = readdir(HEADERS);
+closedir(HEADERS);
+
+undef $/;
+for (@headers) {
+       next if ($_ eq '.');
+       next if ($_ eq '..');
+
+       $api_header = $_;
+       $api_path = $API_BASE . "/" . $api_header;
+       next if (! -f $api_path);
+
+       open(API, "<", $api_path);
+       $api = <API>;
+       close(API);
+
+       $api_new = clean_API($api);
+       if ($api ne $api_new) {
+#              printf "cleaning .../Headers/%s\n", $api_header;
+               open(API, ">", $api_path);
+               print API $api_new;
+               close(API);
+
+               if ($DO_SPLIT) {
+                       $spi_new = clean_SPI($api);
+                       if ($api_new ne $spi_new) {
+                               if ((($spi_header) = ($api =~ /#ifdef\s+USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS\s*.*?\n#include\s+<SystemConfiguration\/(.*?\.h)>\s*.*?\n/))) {
+                                       if ($api_header eq $spi_header) {
+                                               die "API & SPI header not unique: $api_header\n";
+                                       }
+                               } else {
+                                       die "Header missing #ifdef/#else/#endif: $api_header\n";
+#                                      $spi_header = $api_header;
+#                                      $spi_header =~ s/\.h$/PRIVATE.h/;
+                               }
+
+#                              printf "  adding .../PrivateHeaders/%s\n", $spi_header;
+                               $spi_path = $SPI_BASE . "/" . $spi_header;
+                               open(SPI, ">", $spi_path);
+                               print SPI $spi_new;
+                               close(SPI);
+                       }
+               }
+       }
+}
+$/ = "\n";
+
+exit 0;
index 87b8ade62e9c944a7dddd8266c66f8059db4adc5..7a8b0840499d70e1a05e854961d2af7fe2393457 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2003-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -271,7 +271,7 @@ _removeWatcher(CFNumberRef sessionNum, CFStringRef watchedKey)
 
 __private_extern__
 void
 
 __private_extern__
 void
-pushNotifications()
+pushNotifications(FILE *_configd_trace)
 {
        const void                      **sessionsToNotify;
        CFIndex                         notifyCnt;
 {
        const void                      **sessionsToNotify;
        CFIndex                         notifyCnt;
@@ -300,13 +300,15 @@ pushNotifications()
                        /*
                         * Post notification as mach message
                         */
                        /*
                         * Post notification as mach message
                         */
-#ifdef DEBUG
-                       if (_configd_verbose) {
-                               SCLog(TRUE, LOG_DEBUG, CFSTR("sending mach message notification."));
-                               SCLog(TRUE, LOG_DEBUG, CFSTR("  port  = %d"), storePrivate->notifyPort);
-                               SCLog(TRUE, LOG_DEBUG, CFSTR("  msgid = %d"), storePrivate->notifyPortIdentifier);
+                       if (_configd_trace != NULL) {
+                               SCTrace(TRUE, _configd_trace,
+                                       CFSTR("%s : %5d : port = %d, msgid = %d\n"),
+                                       "-->port",
+                                       storePrivate->server,
+                                       storePrivate->notifyPort,
+                                       storePrivate->notifyPortIdentifier);
                        }
                        }
-#endif /* DEBUG */
+
                        _SC_sendMachMessage(storePrivate->notifyPort, storePrivate->notifyPortIdentifier);
                }
 
                        _SC_sendMachMessage(storePrivate->notifyPort, storePrivate->notifyPortIdentifier);
                }
 
@@ -314,13 +316,14 @@ pushNotifications()
                    (storePrivate->notifyFile >= 0)) {
                        ssize_t         written;
 
                    (storePrivate->notifyFile >= 0)) {
                        ssize_t         written;
 
-#ifdef DEBUG
-                       if (_configd_verbose) {
-                               SCLog(TRUE, LOG_DEBUG, CFSTR("sending (UNIX domain) socket notification"));
-                               SCLog(TRUE, LOG_DEBUG, CFSTR("  fd    = %d"), storePrivate->notifyFile);
-                               SCLog(TRUE, LOG_DEBUG, CFSTR("  msgid = %d"), storePrivate->notifyFileIdentifier);
+                       if (_configd_trace != NULL) {
+                               SCTrace(TRUE, _configd_trace,
+                                       CFSTR("%s : %5d : fd = %d, msgid = %d\n"),
+                                       "-->fd  ",
+                                       storePrivate->server,
+                                       storePrivate->notifyFile,
+                                       storePrivate->notifyFileIdentifier);
                        }
                        }
-#endif /* DEBUG */
 
                        written = write(storePrivate->notifyFile,
                                        &storePrivate->notifyFileIdentifier,
 
                        written = write(storePrivate->notifyFile,
                                        &storePrivate->notifyFileIdentifier,
@@ -357,33 +360,39 @@ pushNotifications()
                         */
                        status = pid_for_task(storePrivate->notifySignalTask, &pid);
                        if (status == KERN_SUCCESS) {
                         */
                        status = pid_for_task(storePrivate->notifySignalTask, &pid);
                        if (status == KERN_SUCCESS) {
-#ifdef DEBUG
-                               if (_configd_verbose) {
-                                       SCLog(TRUE, LOG_DEBUG, CFSTR("sending signal notification"));
-                                       SCLog(TRUE, LOG_DEBUG, CFSTR("  pid    = %d"), pid);
-                                       SCLog(TRUE, LOG_DEBUG, CFSTR("  signal = %d"), storePrivate->notifySignal);
+                               if (_configd_trace != NULL) {
+                                       SCTrace(TRUE, _configd_trace,
+                                               CFSTR("%s : %5d : pid = %d, signal = sig%s (%d)\n"),
+                                               "-->sig ",
+                                               storePrivate->server,
+                                               pid,
+                                               sys_signame[storePrivate->notifySignal],
+                                               storePrivate->notifySignal);
                                }
                                }
-#endif /* DEBUG */
+
                                if (kill(pid, storePrivate->notifySignal) != 0) {
                                if (kill(pid, storePrivate->notifySignal) != 0) {
-#ifdef DEBUG
-                                       SCLog(_configd_verbose, LOG_DEBUG, CFSTR("could not send signal: %s"), strerror(errno));
-#endif /* DEBUG */
-                                       status = KERN_FAILURE;
+                                       if (errno != ESRCH) {
+                                               SCLog(TRUE, LOG_ERR,
+                                                     CFSTR("could not send sig%s to PID %d: %s"),
+                                                     sys_signame[storePrivate->notifySignal],
+                                                     pid,
+                                                     strerror(errno));
+                                       }
                                }
                        } else {
                                mach_port_type_t        pt;
 
                                }
                        } else {
                                mach_port_type_t        pt;
 
-                               if ((mach_port_type(mach_task_self(), storePrivate->notifySignalTask, &pt) == KERN_SUCCESS) &&
-                                   (pt & MACH_PORT_TYPE_DEAD_NAME)) {
-                                       SCLog(_configd_verbose, LOG_DEBUG, CFSTR("could not send signal, process died"));
+                               __MACH_PORT_DEBUG(TRUE, "*** pushNotifications pid_for_task failed: releasing task", storePrivate->notifySignalTask);
+                               if (mach_port_type(mach_task_self(), storePrivate->notifySignalTask, &pt) == KERN_SUCCESS) {
+                                       if ((pt & MACH_PORT_TYPE_DEAD_NAME) != 0) {
+                                               SCLog(TRUE, LOG_ERR, CFSTR("pushNotifications pid_for_task() failed: %s"), mach_error_string(status));
+                                       }
                                } else {
                                } else {
-                                       SCLog(_configd_verbose, LOG_DEBUG, CFSTR("could not send signal: %s"), mach_error_string(status));
+                                       SCLog(TRUE, LOG_ERR, CFSTR("pushNotifications mach_port_type() failed: %s"), mach_error_string(status));
                                }
                                }
-                       }
 
 
-                       if (status != KERN_SUCCESS) {
                                /* don't bother with any more attempts */
                                /* don't bother with any more attempts */
-                               (void) mach_port_destroy(mach_task_self(), storePrivate->notifySignalTask);
+                               (void) mach_port_deallocate(mach_task_self(), storePrivate->notifySignalTask);
                                storePrivate->notifySignal     = 0;
                                storePrivate->notifySignalTask = TASK_NULL;
                        }
                                storePrivate->notifySignal     = 0;
                                storePrivate->notifySignalTask = TASK_NULL;
                        }
index 56abe72c8f8e971f92113116b240f72b343f2cba..4b0ea50b511a79aa184ac8a8840c5efdad9b09cf 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2003, 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003, 2004, 2006, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -187,7 +187,7 @@ __SCDynamicStoreCopyNotifiedKeys    (SCDynamicStoreRef      store,
 int
 __SCDynamicStoreNotifyMachPort         (SCDynamicStoreRef      store,
                                         mach_msg_id_t          msgid,
 int
 __SCDynamicStoreNotifyMachPort         (SCDynamicStoreRef      store,
                                         mach_msg_id_t          msgid,
-                                        mach_port_t            *port);
+                                        mach_port_t            port);
 
 int
 __SCDynamicStoreNotifyFileDescriptor   (SCDynamicStoreRef      store,
 
 int
 __SCDynamicStoreNotifyFileDescriptor   (SCDynamicStoreRef      store,
@@ -214,7 +214,7 @@ _removeWatcher                              (CFNumberRef            sessionNum,
                                         CFStringRef            watchedKey);
 
 void
                                         CFStringRef            watchedKey);
 
 void
-pushNotifications                      (void);
+pushNotifications                      (FILE                   *_configd_trace);
 
 __END_DECLS
 
 
 __END_DECLS
 
index 87bfe7b4e2521343ed46654b1771cc5f23d15323..e1a0168f88131367faa086936205d92f282a28b3 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2003, 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003, 2004, 2006, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -115,7 +115,7 @@ _configadd(mach_port_t                      server,
 {
        CFStringRef             key             = NULL;         /* key  (un-serialized) */
        CFDataRef               data            = NULL;         /* data (un-serialized) */
 {
        CFStringRef             key             = NULL;         /* key  (un-serialized) */
        CFDataRef               data            = NULL;         /* data (un-serialized) */
-       serverSessionRef        mySession       = getSession(server);
+       serverSessionRef        mySession;
 
        *sc_status = kSCStatusOK;
 
 
        *sc_status = kSCStatusOK;
 
@@ -139,6 +139,7 @@ _configadd(mach_port_t                      server,
                goto done;
        }
 
                goto done;
        }
 
+       mySession = getSession(server);
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
@@ -171,7 +172,7 @@ _configadd_s(mach_port_t            server,
 {
        CFDataRef                       data            = NULL;         /* data (un-serialized) */
        CFStringRef                     key             = NULL;         /* key  (un-serialized) */
 {
        CFDataRef                       data            = NULL;         /* data (un-serialized) */
        CFStringRef                     key             = NULL;         /* key  (un-serialized) */
-       serverSessionRef                mySession       = getSession(server);
+       serverSessionRef                mySession;
        SCDynamicStorePrivateRef        storePrivate;
        Boolean                         useSessionKeys;
 
        SCDynamicStorePrivateRef        storePrivate;
        Boolean                         useSessionKeys;
 
@@ -196,6 +197,7 @@ _configadd_s(mach_port_t            server,
                goto done;
        }
 
                goto done;
        }
 
+       mySession = getSession(server);
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
index 1e0942b5120a4678facdc6571cc2f0a77d8b56ed..5b817f2e0e9d989b327eca59cb8d25e0b45aaeae 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2003, 2004, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003, 2004, 2006-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -125,6 +125,7 @@ __SCDynamicStoreClose(SCDynamicStoreRef *store, Boolean internal)
        removeAllKeys(*store, TRUE);    // patterns
 
        /* Remove/cancel any outstanding notification requests. */
        removeAllKeys(*store, TRUE);    // patterns
 
        /* Remove/cancel any outstanding notification requests. */
+       __MACH_PORT_DEBUG(storePrivate->notifyPort != MACH_PORT_NULL, "*** __SCDynamicStoreClose", storePrivate->notifyPort);
        (void) __SCDynamicStoreNotifyCancel(*store);
 
        /* Remove any session keys */
        (void) __SCDynamicStoreNotifyCancel(*store);
 
        /* Remove any session keys */
@@ -182,9 +183,13 @@ __SCDynamicStoreClose(SCDynamicStoreRef *store, Boolean internal)
        if (mySession->serverRunLoopSource) {
                CFRunLoopSourceInvalidate(mySession->serverRunLoopSource);
                CFRelease(mySession->serverRunLoopSource);
        if (mySession->serverRunLoopSource) {
                CFRunLoopSourceInvalidate(mySession->serverRunLoopSource);
                CFRelease(mySession->serverRunLoopSource);
+               mySession->serverRunLoopSource = NULL;
+       }
+       if (mySession->serverPort != NULL) {
+               CFMachPortInvalidate(mySession->serverPort);
+               CFRelease(mySession->serverPort);
+               mySession->serverPort = NULL;
        }
        }
-       CFMachPortInvalidate(mySession->serverPort);
-       CFRelease(mySession->serverPort);
 
        storePrivate->server = MACH_PORT_NULL;
        CFRelease(*store);
 
        storePrivate->server = MACH_PORT_NULL;
        CFRelease(*store);
@@ -208,16 +213,24 @@ _configclose(mach_port_t server, int *sc_status)
        /*
         * Close the session.
         */
        /*
         * Close the session.
         */
+       __MACH_PORT_DEBUG(TRUE, "*** _configclose", server);
        *sc_status = __SCDynamicStoreClose(&mySession->store, FALSE);
        if (*sc_status != kSCStatusOK) {
        *sc_status = __SCDynamicStoreClose(&mySession->store, FALSE);
        if (*sc_status != kSCStatusOK) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("_configclose __SCDynamicStoreClose() failed, status = %s"),
+                     SCErrorString(*sc_status));
                return KERN_SUCCESS;
        }
                return KERN_SUCCESS;
        }
+       __MACH_PORT_DEBUG(TRUE, "*** _configclose (after __SCDynamicStoreClose)", server);
 
        /*
 
        /*
-        * Remove send and receive right
+        * Remove our receive right.
+        *
+        * Note: there is no need to cancel the notification request because the
+        *       kernel will have no way to deliver the notification once the
+        *       receive right has been removed.
         */
         */
-       mach_port_mod_refs(mach_task_self(), mySession->key, MACH_PORT_RIGHT_SEND   , -1);
-       mach_port_mod_refs(mach_task_self(), mySession->key, MACH_PORT_RIGHT_RECEIVE, -1);
+       (void) mach_port_mod_refs(mach_task_self(), server, MACH_PORT_RIGHT_RECEIVE, -1);
 
        /*
         * Remove the session entry.
 
        /*
         * Remove the session entry.
index 52525e36a5b3688edee5dee9b8529c1b013d229b..13bc53f6402389d9bdbc2b92a1fae6c4240a64b8 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -77,7 +77,7 @@ _configget(mach_port_t                        server,
 )
 {
        CFStringRef             key             = NULL;         /* key  (un-serialized) */
 )
 {
        CFStringRef             key             = NULL;         /* key  (un-serialized) */
-       serverSessionRef        mySession       = getSession(server);
+       serverSessionRef        mySession;
        Boolean                 ok;
        CFDataRef               value;
 
        Boolean                 ok;
        CFDataRef               value;
 
@@ -95,6 +95,7 @@ _configget(mach_port_t                        server,
                goto done;
        }
 
                goto done;
        }
 
+       mySession = getSession(server);
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
@@ -235,7 +236,7 @@ _configget_m(mach_port_t            server,
 {
        CFDictionaryRef         dict            = NULL; /* keys/values (un-serialized) */
        CFArrayRef              keys            = NULL; /* keys (un-serialized) */
 {
        CFDictionaryRef         dict            = NULL; /* keys/values (un-serialized) */
        CFArrayRef              keys            = NULL; /* keys (un-serialized) */
-       serverSessionRef        mySession       = getSession(server);
+       serverSessionRef        mySession;
        Boolean                 ok;
        CFArrayRef              patterns        = NULL; /* patterns (un-serialized) */
 
        Boolean                 ok;
        CFArrayRef              patterns        = NULL; /* patterns (un-serialized) */
 
@@ -272,6 +273,7 @@ _configget_m(mach_port_t            server,
                goto done;
        }
 
                goto done;
        }
 
+       mySession = getSession(server);
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
index 9201f65be00f054df300db9fb448763dc3d0057d..cbc7e36cb782bbdd86f4f6cd029e8e3576a3253f 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -108,7 +108,7 @@ _configlist(mach_port_t                     server,
 )
 {
        CFStringRef             key             = NULL;         /* key  (un-serialized) */
 )
 {
        CFStringRef             key             = NULL;         /* key  (un-serialized) */
-       serverSessionRef        mySession       = getSession(server);
+       serverSessionRef        mySession;
        Boolean                 ok;
        CFArrayRef              subKeys;                        /* array of CFStringRef's */
 
        Boolean                 ok;
        CFArrayRef              subKeys;                        /* array of CFStringRef's */
 
@@ -126,6 +126,7 @@ _configlist(mach_port_t                     server,
                goto done;
        }
 
                goto done;
        }
 
+       mySession = getSession(server);
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
index 9ed185ba37b1eb781dda13bed20a7c32b412ca7a..29b9726347a02c411b7c3a3576d634d97da2e4b7 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2003, 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003, 2004, 2006, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -58,7 +58,7 @@ __SCDynamicStoreLock(SCDynamicStoreRef store, Boolean recursive)
 
        /* check credentials */
        mySession = getSession(storePrivate->server);
 
        /* check credentials */
        mySession = getSession(storePrivate->server);
-       if (mySession->callerEUID != 0) {
+       if (!hasWriteAccess(mySession)) {
                return kSCStatusAccessError;
        }
 
                return kSCStatusAccessError;
        }
 
index 26fb1f412e34adda7eb4617f5ab7c66806bdff85..ab26edf50593c2dde2428e9895bb4288788ca4cc 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -98,7 +98,7 @@ _confignotify(mach_port_t             server,
 )
 {
        CFStringRef             key             = NULL;         /* key  (un-serialized) */
 )
 {
        CFStringRef             key             = NULL;         /* key  (un-serialized) */
-       serverSessionRef        mySession       = getSession(server);
+       serverSessionRef        mySession;
 
        /* un-serialize the key */
        if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) {
 
        /* un-serialize the key */
        if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) {
@@ -111,6 +111,7 @@ _confignotify(mach_port_t           server,
                goto done;
        }
 
                goto done;
        }
 
+       mySession = getSession(server);
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
index 1d40698a6385cb3c762d51894e4595626cdd73af..5f70aeb5338c17b6751e544c984670c0299e8eb5 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -163,19 +163,10 @@ _configopen(mach_port_t                   server,
         */
        mySession = addSession(MACH_PORT_NULL, openMPCopyDescription);
        *newServer = mySession->key;
         */
        mySession = addSession(MACH_PORT_NULL, openMPCopyDescription);
        *newServer = mySession->key;
+       __MACH_PORT_DEBUG(TRUE, "*** _configopen (after addSession)", *newServer);
 
 
-       /*
-        * get the credentials associated with the caller.
-        */
-       audit_token_to_au32(audit_token,
-                           NULL,                       // auidp
-                           &mySession->callerEUID,     // euid
-                           NULL,                       // egid
-                           NULL,                       // ruid
-                           NULL,                       // rgid
-                           NULL,                       // pid
-                           NULL,                       // asid
-                           NULL);                      // tid
+       /* save the audit_token in case we need to check the callers credentials */
+       mySession->auditToken = audit_token;
 
        /* Create and add a run loop source for the port */
        mySession->serverRunLoopSource = CFMachPortCreateRunLoopSource(NULL, mySession->serverPort, 0);
 
        /* Create and add a run loop source for the port */
        mySession->serverRunLoopSource = CFMachPortCreateRunLoopSource(NULL, mySession->serverPort, 0);
@@ -195,6 +186,7 @@ _configopen(mach_port_t                     server,
 
        /*
         * Make the server port accessible to the framework routines.
 
        /*
         * Make the server port accessible to the framework routines.
+        * ... and be sure to clear before calling CFRelease(store)
         */
        storePrivate->server = *newServer;
 
         */
        storePrivate->server = *newServer;
 
@@ -214,18 +206,17 @@ _configopen(mach_port_t                   server,
                                                MACH_MSG_TYPE_MAKE_SEND_ONCE,
                                                &oldNotify);
        if (status != KERN_SUCCESS) {
                                                MACH_MSG_TYPE_MAKE_SEND_ONCE,
                                                &oldNotify);
        if (status != KERN_SUCCESS) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("_configopen() mach_port_request_notification() failed: %s"), mach_error_string(status));
+               SCLog(TRUE, LOG_ERR, CFSTR("_configopen() mach_port_request_notification() failed: %s"), mach_error_string(status));
                cleanupSession(*newServer);
                *newServer = MACH_PORT_NULL;
                *sc_status = kSCStatusFailed;
                goto done;
        }
                cleanupSession(*newServer);
                *newServer = MACH_PORT_NULL;
                *sc_status = kSCStatusFailed;
                goto done;
        }
+       __MACH_PORT_DEBUG(TRUE, "*** _configopen (after mach_port_request_notification)", *newServer);
 
 
-#ifdef DEBUG
        if (oldNotify != MACH_PORT_NULL) {
        if (oldNotify != MACH_PORT_NULL) {
-               SCLog(TRUE, LOG_ERR, CFSTR("_configopen(): why is oldNotify != MACH_PORT_NULL?"));
+               SCLog(TRUE, LOG_ERR, CFSTR("_configopen(): oldNotify != MACH_PORT_NULL"));
        }
        }
-#endif /* DEBUG */
 
        /*
         * Save the name of the calling application / plug-in with the session data.
 
        /*
         * Save the name of the calling application / plug-in with the session data.
@@ -245,6 +236,12 @@ _configopen(mach_port_t                    server,
        CFRelease(newInfo);
        CFRelease(sessionKey);
 
        CFRelease(newInfo);
        CFRelease(sessionKey);
 
+       /*
+        * Note: at this time we should be holding ONE send right and
+        *       ONE receive right to the server.  The send right is
+        *       moved to the caller.
+        */
+
     done :
 
        if (name != NULL)       CFRelease(name);
     done :
 
        if (name != NULL)       CFRelease(name);
index 33e8b5792f74e96a183b61e63e36a320ef123d57..9bb06b88a33ba67124f01e23fb610185fbb602a5 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -137,7 +137,7 @@ _configremove(mach_port_t           server,
 )
 {
        CFStringRef             key             = NULL;         /* key  (un-serialized) */
 )
 {
        CFStringRef             key             = NULL;         /* key  (un-serialized) */
-       serverSessionRef        mySession       = getSession(server);
+       serverSessionRef        mySession;
 
        /* un-serialize the key */
        if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) {
 
        /* un-serialize the key */
        if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) {
@@ -150,6 +150,7 @@ _configremove(mach_port_t           server,
                goto done;
        }
 
                goto done;
        }
 
+       mySession = getSession(server);
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
index 3fda0fe243d087a4af90160464a3a290ad502163..a15b3ece0ba2f8f0ad40d9d4a7e795a6317b4097 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -234,7 +234,7 @@ _configset(mach_port_t                      server,
 {
        CFDataRef               data            = NULL; /* data (un-serialized) */
        CFStringRef             key             = NULL; /* key  (un-serialized) */
 {
        CFDataRef               data            = NULL; /* data (un-serialized) */
        CFStringRef             key             = NULL; /* key  (un-serialized) */
-       serverSessionRef        mySession       = getSession(server);
+       serverSessionRef        mySession;
 
        *sc_status = kSCStatusOK;
 
 
        *sc_status = kSCStatusOK;
 
@@ -257,6 +257,7 @@ _configset(mach_port_t                      server,
                goto done;
        }
 
                goto done;
        }
 
+       mySession = getSession(server);
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
@@ -397,7 +398,7 @@ _configset_m(mach_port_t            server,
             int                        *sc_status)
 {
        CFDictionaryRef         dict            = NULL;         /* key/value dictionary (un-serialized) */
             int                        *sc_status)
 {
        CFDictionaryRef         dict            = NULL;         /* key/value dictionary (un-serialized) */
-       serverSessionRef        mySession       = getSession(server);
+       serverSessionRef        mySession;
        CFArrayRef              notify          = NULL;         /* keys to notify (un-serialized) */
        CFArrayRef              remove          = NULL;         /* keys to remove (un-serialized) */
 
        CFArrayRef              notify          = NULL;         /* keys to notify (un-serialized) */
        CFArrayRef              remove          = NULL;         /* keys to remove (un-serialized) */
 
@@ -443,6 +444,7 @@ _configset_m(mach_port_t            server,
                goto done;
        }
 
                goto done;
        }
 
+       mySession = getSession(server);
        if (mySession == NULL) {
                /* you must have an open session to play */
                *sc_status = kSCStatusNoStoreSession;
        if (mySession == NULL) {
                /* you must have an open session to play */
                *sc_status = kSCStatusNoStoreSession;
index 242f8ef71586e390e201bc9d7ce4146f569e33f7..fb301310330a580afd0bff7e064974d8ac69f504 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006, 2008, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -39,7 +39,7 @@ int
 __SCDynamicStoreTouchValue(SCDynamicStoreRef store, CFStringRef key)
 {
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
 __SCDynamicStoreTouchValue(SCDynamicStoreRef store, CFStringRef key)
 {
        SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)store;
-       int                             sc_status;
+       int                             sc_status       = kSCStatusOK;
        CFDataRef                       value;
 
        if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
        CFDataRef                       value;
 
        if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
@@ -105,7 +105,7 @@ __SCDynamicStoreTouchValue(SCDynamicStoreRef store, CFStringRef key)
         */
        __SCDynamicStoreUnlock(store, TRUE);
 
         */
        __SCDynamicStoreUnlock(store, TRUE);
 
-       return kSCStatusOK;
+       return sc_status;
 }
 
 
 }
 
 
@@ -118,7 +118,7 @@ _configtouch(mach_port_t            server,
 )
 {
        CFStringRef             key             = NULL;         /* key  (un-serialized) */
 )
 {
        CFStringRef             key             = NULL;         /* key  (un-serialized) */
-       serverSessionRef        mySession       = getSession(server);
+       serverSessionRef        mySession;
 
        /* un-serialize the key */
        if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) {
 
        /* un-serialize the key */
        if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) {
@@ -131,6 +131,7 @@ _configtouch(mach_port_t            server,
                goto done;
        }
 
                goto done;
        }
 
+       mySession = getSession(server);
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
index 90616fdad949b41a179493807e0f47fe5be72e8c..8eebbbb2ece888054715f334ce56007c4b7cca64 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -126,7 +126,7 @@ _notifyadd(mach_port_t                      server,
 )
 {
        CFStringRef             key             = NULL; /* key  (un-serialized) */
 )
 {
        CFStringRef             key             = NULL; /* key  (un-serialized) */
-       serverSessionRef        mySession       = getSession(server);
+       serverSessionRef        mySession;
 
        /* un-serialize the key */
        if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) {
 
        /* un-serialize the key */
        if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) {
@@ -139,6 +139,7 @@ _notifyadd(mach_port_t                      server,
                goto done;
        }
 
                goto done;
        }
 
+       mySession = getSession(server);
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
@@ -276,7 +277,7 @@ _notifyset(mach_port_t                      server,
 )
 {
        CFArrayRef              keys            = NULL; /* key (un-serialized) */
 )
 {
        CFArrayRef              keys            = NULL; /* key (un-serialized) */
-       serverSessionRef        mySession       = getSession(server);
+       serverSessionRef        mySession;
        CFArrayRef              patterns        = NULL; /* patterns (un-serialized) */
 
        *sc_status = kSCStatusOK;
        CFArrayRef              patterns        = NULL; /* patterns (un-serialized) */
 
        *sc_status = kSCStatusOK;
@@ -309,6 +310,7 @@ _notifyset(mach_port_t                      server,
                goto done;
        }
 
                goto done;
        }
 
+       mySession = getSession(server);
        if (mySession == NULL) {
                /* you must have an open session to play */
                *sc_status = kSCStatusNoStoreSession;
        if (mySession == NULL) {
                /* you must have an open session to play */
                *sc_status = kSCStatusNoStoreSession;
index ba77aa02444dbebe5ed0d7ad4ec6266ad6c5f82b..36311c75fbde5b5233ba87dd2991d7b33693b271 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2003-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2006, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -47,7 +47,8 @@ __SCDynamicStoreNotifyCancel(SCDynamicStoreRef store)
         * cleanup any mach port based notifications.
         */
        if (storePrivate->notifyPort != MACH_PORT_NULL) {
         * cleanup any mach port based notifications.
         */
        if (storePrivate->notifyPort != MACH_PORT_NULL) {
-               (void) mach_port_destroy(mach_task_self(), storePrivate->notifyPort);
+               __MACH_PORT_DEBUG(TRUE, "*** __SCDynamicStoreNotifyCancel (notify port)", storePrivate->notifyPort);
+               (void) mach_port_deallocate(mach_task_self(), storePrivate->notifyPort);
                storePrivate->notifyPort = MACH_PORT_NULL;
        }
 
                storePrivate->notifyPort = MACH_PORT_NULL;
        }
 
@@ -64,7 +65,8 @@ __SCDynamicStoreNotifyCancel(SCDynamicStoreRef store)
         * cleanup any signal notifications.
         */
        if (storePrivate->notifySignal > 0) {
         * cleanup any signal notifications.
         */
        if (storePrivate->notifySignal > 0) {
-               (void) mach_port_destroy(mach_task_self(), storePrivate->notifySignalTask);
+               __MACH_PORT_DEBUG(TRUE, "*** __SCDynamicStoreNotifyCancel (signal)", storePrivate->notifySignalTask);
+               (void) mach_port_deallocate(mach_task_self(), storePrivate->notifySignalTask);
                storePrivate->notifySignal     = 0;
                storePrivate->notifySignalTask = TASK_NULL;
        }
                storePrivate->notifySignal     = 0;
                storePrivate->notifySignalTask = TASK_NULL;
        }
@@ -102,6 +104,9 @@ _notifycancel(mach_port_t   server,
                return KERN_SUCCESS;
        }
 
                return KERN_SUCCESS;
        }
 
+       __MACH_PORT_DEBUG(((SCDynamicStorePrivateRef)mySession->store)->notifyPort != MACH_PORT_NULL,
+                         "*** _notifycancel",
+                         ((SCDynamicStorePrivateRef)mySession->store)->notifyPort);
        *sc_status = __SCDynamicStoreNotifyCancel(mySession->store);
        return KERN_SUCCESS;
 }
        *sc_status = __SCDynamicStoreNotifyCancel(mySession->store);
        return KERN_SUCCESS;
 }
index 346beb03f63ddd38ca469b7edf5e1060516c9e51..e77c7772d267ae83860ea3ef8356d5ec6ed61a64 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -102,7 +102,7 @@ _notifyremove(mach_port_t           server,
 )
 {
        CFStringRef             key             = NULL;         /* key  (un-serialized) */
 )
 {
        CFStringRef             key             = NULL;         /* key  (un-serialized) */
-       serverSessionRef        mySession       = getSession(server);
+       serverSessionRef        mySession;
 
        /* un-serialize the key */
        if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) {
 
        /* un-serialize the key */
        if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) {
@@ -115,6 +115,7 @@ _notifyremove(mach_port_t           server,
                goto done;
        }
 
                goto done;
        }
 
+       mySession = getSession(server);
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                goto done;
index 7c1201f1c374d29588495f9362dacaa6138b12f1..870813cae7aed1046c151e4eabfd8b29534da98a 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2003-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2006, 2008, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -33,6 +33,7 @@
 
 #include <unistd.h>
 #include <sys/ioctl.h>
 
 #include <unistd.h>
 #include <sys/ioctl.h>
+#include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
@@ -102,8 +103,7 @@ _notifyviafd(mach_port_t            server,
        serverSessionRef                mySession       = getSession(server);
        int                             nbioYes;
        int                             sock;
        serverSessionRef                mySession       = getSession(server);
        int                             nbioYes;
        int                             sock;
-       kern_return_t                   status;
-       SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)mySession->store;
+       SCDynamicStorePrivateRef        storePrivate;
        struct sockaddr_un              un;
 
        /*
        struct sockaddr_un              un;
 
        /*
@@ -112,13 +112,7 @@ _notifyviafd(mach_port_t           server,
        /* validate the UNIX domain socket path */
        if (pathLen > (sizeof(un.sun_path) - 1)) {
                SCLog(TRUE, LOG_NOTICE, CFSTR("_notifyviafd(): domain socket path length too long!"));
        /* validate the UNIX domain socket path */
        if (pathLen > (sizeof(un.sun_path) - 1)) {
                SCLog(TRUE, LOG_NOTICE, CFSTR("_notifyviafd(): domain socket path length too long!"));
-               status = vm_deallocate(mach_task_self(), (vm_address_t)pathRef, pathLen);
-#ifdef DEBUG
-               if (status != KERN_SUCCESS) {
-                       SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviafd vm_deallocate() failed: %s"), mach_error_string(status));
-                       /* non-fatal???, proceed */
-               }
-#endif /* DEBUG */
+               (void) vm_deallocate(mach_task_self(), (vm_address_t)pathRef, pathLen);
                *sc_status = kSCStatusFailed;
                return KERN_SUCCESS;
        }
                *sc_status = kSCStatusFailed;
                return KERN_SUCCESS;
        }
@@ -127,18 +121,30 @@ _notifyviafd(mach_port_t          server,
        un.sun_family = AF_UNIX;
        bcopy(pathRef, un.sun_path, pathLen);
        un.sun_path[pathLen] = '\0';
        un.sun_family = AF_UNIX;
        bcopy(pathRef, un.sun_path, pathLen);
        un.sun_path[pathLen] = '\0';
-       status = vm_deallocate(mach_task_self(), (vm_address_t)pathRef, pathLen);
-#ifdef DEBUG
-       if (status != KERN_SUCCESS) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviafd vm_deallocate() failed: %s"), mach_error_string(status));
-               /* non-fatal???, proceed */
-       }
-#endif /* DEBUG */
+       (void) vm_deallocate(mach_task_self(), (vm_address_t)pathRef, pathLen);
 
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                return KERN_SUCCESS;
        }
 
        if (mySession == NULL) {
                *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
                return KERN_SUCCESS;
        }
+       storePrivate = (SCDynamicStorePrivateRef)mySession->store;
+
+       /* check permissions */
+       if (!hasRootAccess(mySession)) {
+               struct stat     statbuf;
+
+               bzero(&statbuf, sizeof(statbuf));
+               if (stat(un.sun_path, &statbuf) == -1) {
+                       *sc_status = errno;
+                       SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviafd stat() failed: %s"), strerror(errno));
+                       return KERN_SUCCESS;
+               }
+               if (mySession->callerEUID != statbuf.st_uid) {
+                       *sc_status = kSCStatusAccessError;
+                       SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviafd permissions error"));
+                       return KERN_SUCCESS;
+               }
+       }
 
        /* do common sanity checks, get socket */
        *sc_status = __SCDynamicStoreNotifyFileDescriptor(mySession->store, identifier, &sock);
 
        /* do common sanity checks, get socket */
        *sc_status = __SCDynamicStoreNotifyFileDescriptor(mySession->store, identifier, &sock);
@@ -150,29 +156,25 @@ _notifyviafd(mach_port_t          server,
 
        /* establish the connection, get ready for a read() */
        if (connect(sock, (struct sockaddr *)&un, sizeof(un)) == -1) {
 
        /* establish the connection, get ready for a read() */
        if (connect(sock, (struct sockaddr *)&un, sizeof(un)) == -1) {
+               *sc_status = errno;
                SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviafd connect() failed: %s"), strerror(errno));
                (void) close(sock);
                SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviafd connect() failed: %s"), strerror(errno));
                (void) close(sock);
-               storePrivate->notifyStatus = NotifierNotRegistered;
-               storePrivate->notifyFile   = -1;
-               *sc_status = kSCStatusFailed;
                return KERN_SUCCESS;
        }
 
                return KERN_SUCCESS;
        }
 
-       (void) unlink(un.sun_path);
-
        bufSiz = sizeof(storePrivate->notifyFileIdentifier);
        if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &bufSiz, sizeof(bufSiz)) == -1) {
        bufSiz = sizeof(storePrivate->notifyFileIdentifier);
        if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &bufSiz, sizeof(bufSiz)) == -1) {
+               *sc_status = errno;
                SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviafd setsockopt() failed: %s"), strerror(errno));
                (void) close(sock);
                SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviafd setsockopt() failed: %s"), strerror(errno));
                (void) close(sock);
-               *sc_status = kSCStatusFailed;
                return KERN_SUCCESS;
        }
 
        nbioYes = 1;
        if (ioctl(sock, FIONBIO, &nbioYes) == -1) {
                return KERN_SUCCESS;
        }
 
        nbioYes = 1;
        if (ioctl(sock, FIONBIO, &nbioYes) == -1) {
+               *sc_status = errno;
                SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviafd ioctl(,FIONBIO,) failed: %s"), strerror(errno));
                (void) close(sock);
                SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviafd ioctl(,FIONBIO,) failed: %s"), strerror(errno));
                (void) close(sock);
-               *sc_status = kSCStatusFailed;
                return KERN_SUCCESS;
        }
 
                return KERN_SUCCESS;
        }
 
index 906fe1407614143a6c348236cd462a1e32ddaed8..84561085389237190b6012a6f9abdac307e1023b 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2003, 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003, 2004, 2006, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -38,7 +38,7 @@ __private_extern__
 int
 __SCDynamicStoreNotifyMachPort(SCDynamicStoreRef       store,
                               mach_msg_id_t            identifier,
 int
 __SCDynamicStoreNotifyMachPort(SCDynamicStoreRef       store,
                               mach_msg_id_t            identifier,
-                              mach_port_t              *port)
+                              mach_port_t              port)
 {
        SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
        CFStringRef                     sessionKey;
 {
        SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)store;
        CFStringRef                     sessionKey;
@@ -53,7 +53,7 @@ __SCDynamicStoreNotifyMachPort(SCDynamicStoreRef      store,
                return kSCStatusNotifierActive;
        }
 
                return kSCStatusNotifierActive;
        }
 
-       if (*port == MACH_PORT_NULL) {
+       if (port == MACH_PORT_NULL) {
                /* sorry, you must specify a valid mach port */
                return kSCStatusInvalidArgument;
        }
                /* sorry, you must specify a valid mach port */
                return kSCStatusInvalidArgument;
        }
@@ -87,27 +87,34 @@ _notifyviaport(mach_port_t  server,
               int              *sc_status
 )
 {
               int              *sc_status
 )
 {
-       serverSessionRef                mySession = getSession(server);
-       SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)mySession->store;
+       serverSessionRef                mySession       = getSession(server);
+       SCDynamicStorePrivateRef        storePrivate;
 
        if (mySession == NULL) {
 
        if (mySession == NULL) {
-               *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
+               /* sorry, you must have an open session to play */
+               *sc_status = kSCStatusNoStoreSession;
+               if (port != MACH_PORT_NULL) {
+                       (void) mach_port_deallocate(mach_task_self(), port);
+               }
                return KERN_SUCCESS;
        }
                return KERN_SUCCESS;
        }
-
-       if (storePrivate->notifyPort != MACH_PORT_NULL) {
-               // destroying [old] callback mach port
-               (void) mach_port_destroy(mach_task_self(), storePrivate->notifyPort);
+       storePrivate = (SCDynamicStorePrivateRef)mySession->store;
+
+       *sc_status = __SCDynamicStoreNotifyMachPort(mySession->store, identifier, port);
+       if (*sc_status != kSCStatusOK) {
+               // if we can't enable the notification, release the provided callback port
+               if (port != MACH_PORT_NULL) {
+                       __MACH_PORT_DEBUG(TRUE, "*** _notifyviaport __SCDynamicStoreNotifyMachPort failed: releasing port", port);
+                       (void) mach_port_deallocate(mach_task_self(), port);
+               }
+               return KERN_SUCCESS;
        }
 
        }
 
-       *sc_status = __SCDynamicStoreNotifyMachPort(mySession->store, identifier, &port);
-
-       if (*sc_status == kSCStatusOK) {
-               /* save notification port, requested identifier, and set notifier active */
-               storePrivate->notifyStatus         = Using_NotifierInformViaMachPort;
-               storePrivate->notifyPort           = port;
-               storePrivate->notifyPortIdentifier = identifier;
-       }
+       /* save notification port, requested identifier, and set notifier active */
+       __MACH_PORT_DEBUG(TRUE, "*** _notifyviaport", port);
+       storePrivate->notifyStatus         = Using_NotifierInformViaMachPort;
+       storePrivate->notifyPort           = port;
+       storePrivate->notifyPortIdentifier = identifier;
 
        return KERN_SUCCESS;
 }
 
        return KERN_SUCCESS;
 }
index a31dcb54a131e15afab298365bae23fba63f8e26..4021c400785d45622319f30f4a74496fd485420e 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -96,84 +96,40 @@ _notifyviasignal(mach_port_t        server,
        serverSessionRef                mySession  = getSession(server);
        pid_t                           pid;
        kern_return_t                   status;
        serverSessionRef                mySession  = getSession(server);
        pid_t                           pid;
        kern_return_t                   status;
-       SCDynamicStorePrivateRef        storePrivate = (SCDynamicStorePrivateRef)mySession->store;
-#ifdef NOTYET
-       mach_port_t                     oldNotify;
-#endif /* NOTYET */
-
-       status = pid_for_task(task, &pid);
-       if (status != KERN_SUCCESS) {
-               *sc_status = kSCStatusFailed;           /* could not determine pid for task */
-               return KERN_SUCCESS;
-       }
+       SCDynamicStorePrivateRef        storePrivate;
 
        if (mySession == NULL) {
 
        if (mySession == NULL) {
-               *sc_status = kSCStatusNoStoreSession;   /* you must have an open session to play */
-               return KERN_SUCCESS;
-       }
-
-       *sc_status = __SCDynamicStoreNotifySignal(mySession->store, pid, sig);
-       if (*sc_status != kSCStatusOK) {
+               /* sorry, you must have an open session to play */
+               *sc_status = kSCStatusNoStoreSession;
                if (task != TASK_NULL) {
                if (task != TASK_NULL) {
-                       (void) mach_port_destroy(mach_task_self(), task);
+                       (void) mach_port_deallocate(mach_task_self(), task);
                }
                return KERN_SUCCESS;
        }
                }
                return KERN_SUCCESS;
        }
-
-#ifdef DEBUG
-       {       mach_port_type_t        pt;
-
-               status = mach_port_type(mach_task_self(), task, &pt);
-               if (status == MACH_MSG_SUCCESS) {
-                       char    rights[8], *rp = &rights[0];
-
-                       if (pt & MACH_PORT_TYPE_SEND)
-                               *rp++ = 'S';
-                       if (pt & MACH_PORT_TYPE_RECEIVE)
-                               *rp++ = 'R';
-                       if (pt & MACH_PORT_TYPE_SEND_ONCE)
-                               *rp++ = 'O';
-                       if (pt & MACH_PORT_TYPE_PORT_SET)
-                               *rp++ = 'P';
-                       if (pt & MACH_PORT_TYPE_DEAD_NAME)
-                               *rp++ = 'D';
-                       *rp = '\0';
-
-                       SCLog(_configd_verbose, LOG_DEBUG, CFSTR("Task %d, port rights = %s"), task, rights);
+       storePrivate = (SCDynamicStorePrivateRef)mySession->store;
+
+       if (task != TASK_NULL) {
+               status = pid_for_task(task, &pid);
+               if (status != KERN_SUCCESS) {
+                       /* could not determine pid for task */
+                       *sc_status = kSCStatusFailed;
+                       (void) mach_port_deallocate(mach_task_self(), task);
+                       return KERN_SUCCESS;
                }
                }
-       }
-#endif /* DEBUG */
-
-#ifdef NOTYET
-       /* Request a notification when/if the client dies */
-       status = mach_port_request_notification(mach_task_self(),
-                                               task,
-                                               MACH_NOTIFY_DEAD_NAME,
-                                               1,
-                                               task,
-                                               MACH_MSG_TYPE_MAKE_SEND_ONCE,
-                                               &oldNotify);
-       if (status != KERN_SUCCESS) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviasignal mach_port_request_notification() failed: %s"), mach_error_string(status));
-               *sc_status = kSCStatusFailed;
+       } else {
+               /* sorry, you must specify a valid task */
+               *sc_status = kSCStatusInvalidArgument;
                return KERN_SUCCESS;
        }
 
                return KERN_SUCCESS;
        }
 
-#ifdef NOTYET_DEBUG
-       if (oldNotify != MACH_PORT_NULL) {
-               SCLog(TRUE, LOG_ERR, CFSTR("_notifyviasignal(): why is oldNotify != MACH_PORT_NULL?"));
-       }
-#endif /* NOTYET_DEBUG */
-
-       // add task notification port to the server's port set
-       status = mach_port_move_member(mach_task_self(), task, server_ports);
-       if (status != KERN_SUCCESS) {
-               SCLog(TRUE, LOG_DEBUG, CFSTR("_notifyviasignal mach_port_move_member() failed: %s"), mach_error_string(status));
-               *sc_status = kSCStatusFailed;
+       *sc_status = __SCDynamicStoreNotifySignal(mySession->store, pid, sig);
+       if (*sc_status != kSCStatusOK) {
+               __MACH_PORT_DEBUG(TRUE, "*** _notifyviasignal __SCDynamicStoreNotifySignal failed: releasing task)", task);
+               (void) mach_port_deallocate(mach_task_self(), task);
                return KERN_SUCCESS;
        }
                return KERN_SUCCESS;
        }
-#endif /* NOTYET */
 
 
+       __MACH_PORT_DEBUG(TRUE, "*** _notifyviasignal", task);
        storePrivate->notifyStatus     = Using_NotifierInformViaSignal;
        storePrivate->notifySignal     = sig;
        storePrivate->notifySignalTask = task;
        storePrivate->notifyStatus     = Using_NotifierInformViaSignal;
        storePrivate->notifySignal     = sig;
        storePrivate->notifySignalTask = task;
index 8452da2c9f1258d434b0cd6062580e3a8a79e3de..4459095643179611f5e833bd46d893c9cc1203f9 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2006, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -136,7 +136,7 @@ __SCDynamicStoreSnapshot(SCDynamicStoreRef store)
        /* check credentials */
 
        mySession = getSession(storePrivate->server);
        /* check credentials */
 
        mySession = getSession(storePrivate->server);
-       if (mySession->callerEUID != 0) {
+       if (!hasRootAccess(mySession)) {
                return kSCStatusAccessError;
        }
 
                return kSCStatusAccessError;
        }
 
@@ -157,6 +157,7 @@ __SCDynamicStoreSnapshot(SCDynamicStoreRef store)
                SCPrint(TRUE, f, CFSTR("Plug-in thread :\n\n"));
                SCPrint(TRUE, f, CFSTR("%@\n"), plugin_runLoop);
        }
                SCPrint(TRUE, f, CFSTR("Plug-in thread :\n\n"));
                SCPrint(TRUE, f, CFSTR("%@\n"), plugin_runLoop);
        }
+       listSessions(f);
        (void) fclose(f);
 
        /* Save a snapshot of the "store" data */
        (void) fclose(f);
 
        /* Save a snapshot of the "store" data */
index 4a228fe4255686b32410f5cb4a31adf1b913fc5c..50243defc15c98771dbd0a60fa021eaf0e547b57 100644 (file)
@@ -1,11 +1,15 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
 <plist version="1.0">
 <dict>
+       <key>EnableTransactions</key>
+       <true/>
        <key>KeepAlive</key>
        <true/>
        <key>Label</key>
        <string>com.apple.configd</string>
        <key>KeepAlive</key>
        <true/>
        <key>Label</key>
        <string>com.apple.configd</string>
+       <key>MachExceptionHandler</key>
+       <string>com.apple.ReportCrash.DirectoryService</string>
        <key>MachServices</key>
        <dict>
                <key>com.apple.SystemConfiguration.configd</key>
        <key>MachServices</key>
        <dict>
                <key>com.apple.SystemConfiguration.configd</key>
@@ -13,7 +17,9 @@
        </dict>
        <key>ProgramArguments</key>
        <array>
        </dict>
        <key>ProgramArguments</key>
        <array>
-               <string>/usr/sbin/configd</string>
+               <string>/usr/libexec/configd</string>
        </array>
        </array>
+       <key>Umask</key>
+       <integer>18</integer>
 </dict>
 </plist>
 </dict>
 </plist>
index 12df9c6a60def2329d6f6aa31cdd0763ae9326d5..1cb36dabca6c5d6007bcb48d0b6dfac2938c9c9e 100644 (file)
@@ -66,8 +66,6 @@ At the present time, the majority of the configuration agents (or bundles) hoste
 are used to establish and maintain the network configuration.
 These agents include:
 .Pp
 are used to establish and maintain the network configuration.
 These agents include:
 .Pp
-.Ss ATconfig
-This bundle is responsible for establishing and maintaining the AppleTalk network configuration on the system.
 .Ss KernelEventMonitor
 This bundle is responsible for monitoring kernel events and conveying changes to the network state (e.g. link status) to other configuration agents and interested applications.
 .Ss InterfaceNamer
 .Ss KernelEventMonitor
 This bundle is responsible for monitoring kernel events and conveying changes to the network state (e.g. link status) to other configuration agents and interested applications.
 .Ss InterfaceNamer
@@ -83,7 +81,7 @@ This agent is responsible for establishing and maintaining the primary network s
 .Ss LinkConfiguration
 This agent is responsible for establishing and maintaining the media type, media options, and MTU for ethernet interfaces.
 .Ss PreferencesMonitor
 .Ss LinkConfiguration
 This agent is responsible for establishing and maintaining the media type, media options, and MTU for ethernet interfaces.
 .Ss PreferencesMonitor
-This agent is responsible for conveying the network configuration preferences specified by the administrator to the various configuration agents (AppleTalk, IPv4, IPv6, ...).
+This agent is responsible for conveying the network configuration preferences specified by the administrator to the various configuration agents (IPv4, IPv6, ...).
 .Ss PPPController
 This agent is responsible for establishing and maintaining PPP connections on the system.
 .Sh FILES
 .Ss PPPController
 This agent is responsible for establishing and maintaining PPP connections on the system.
 .Sh FILES
index ffb79c2af581c98f61a5a8fcb043bbab34454e34..ce441fa1b065ac9d8c41b2a68ae32a9d416038de 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2003, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003, 2006, 2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -54,6 +54,7 @@
 extern Boolean         _configd_verbose;       /* TRUE if verbose logging enabled */
 extern FILE            *_configd_trace;        /* non-NULL if tracing enabled */
 extern CFMutableSetRef _plugins_exclude;       /* bundle identifiers to exclude from loading */
 extern Boolean         _configd_verbose;       /* TRUE if verbose logging enabled */
 extern FILE            *_configd_trace;        /* non-NULL if tracing enabled */
 extern CFMutableSetRef _plugins_exclude;       /* bundle identifiers to exclude from loading */
+extern Boolean         _plugins_fork;          /* TRUE if plugins should be exec'd in their own process */
 extern CFMutableSetRef _plugins_verbose;       /* bundle identifiers to enable verbose logging */
 
 __BEGIN_DECLS
 extern CFMutableSetRef _plugins_verbose;       /* bundle identifiers to enable verbose logging */
 
 __BEGIN_DECLS
index b115bcbf2d4855439de93808895106d4f523504b..9a6958e970199b7aab0c92a09341eb3521e4448e 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -46,6 +46,8 @@
 #include <sys/wait.h>
 #include <objc/objc-runtime.h>
 #include <servers/bootstrap.h>
 #include <sys/wait.h>
 #include <objc/objc-runtime.h>
 #include <servers/bootstrap.h>
+#include <vproc.h>
+#include <vproc_priv.h>
 
 #include "configd.h"
 #include "configd_server.h"
 
 #include "configd.h"
 #include "configd_server.h"
@@ -60,6 +62,9 @@ FILE  *_configd_trace                 = NULL;         /* non-NULL if tracing enabled */
 __private_extern__
 CFMutableSetRef        _plugins_exclude        = NULL;         /* bundle identifiers to exclude from loading */
 
 __private_extern__
 CFMutableSetRef        _plugins_exclude        = NULL;         /* bundle identifiers to exclude from loading */
 
+__private_extern__
+Boolean        _plugins_fork                   = FALSE;        /* TRUE if plugins should be exec'd in their own process */
+
 __private_extern__
 CFMutableSetRef        _plugins_verbose        = NULL;         /* bundle identifiers to enable verbose logging */
 
 __private_extern__
 CFMutableSetRef        _plugins_verbose        = NULL;         /* bundle identifiers to enable verbose logging */
 
@@ -94,59 +99,6 @@ usage(const char *prog)
 }
 
 
 }
 
 
-static void
-allow_crash_reports(void)
-{
-       mach_msg_type_number_t  i;
-       exception_mask_t        masks[EXC_TYPES_COUNT];
-       mach_msg_type_number_t  n_masks                 = 0;
-       mach_port_t             new_exception_port      = MACH_PORT_NULL;
-       exception_port_t        old_handlers[EXC_TYPES_COUNT];
-       exception_behavior_t    old_behaviors[EXC_TYPES_COUNT];
-       thread_state_flavor_t   old_flavors[EXC_TYPES_COUNT];
-       kern_return_t           status;
-
-       status = bootstrap_look_up(bootstrap_port, "com.apple.ReportCrash.DirectoryService", &new_exception_port);
-       if (status != BOOTSTRAP_SUCCESS) {
-               SCLog(TRUE, LOG_ERR,
-                     CFSTR("allow_crash_reports bootstrap_look_up() failed: %s"),
-                     bootstrap_strerror(status));
-               return;
-       }
-
-       // get information about the original crash exception port for the task
-       status = task_get_exception_ports(mach_task_self(),
-                                         EXC_MASK_CRASH,
-                                         masks,
-                                         &n_masks,
-                                         old_handlers,
-                                         old_behaviors,
-                                         old_flavors);
-       if (status != KERN_SUCCESS) {
-               SCLog(TRUE, LOG_ERR,
-                     CFSTR("allow_crash_reports task_get_exception_ports() failed: %s"),
-                     mach_error_string(status));
-               return;
-       }
-
-       // replace the original crash exception port with our new port
-       for (i = 0; i < n_masks; i++) {
-               status = task_set_exception_ports(mach_task_self(),
-                                                 masks[i],
-                                                 new_exception_port,
-                                                 old_behaviors[i],
-                                                 old_flavors[i]);
-               if (status != KERN_SUCCESS) {
-                       SCLog(TRUE, LOG_ERR,
-                             CFSTR("allow_crash_reports task_set_exception_ports() failed: %s"),
-                             mach_error_string(status));
-               }
-       }
-
-       return;
-}
-
-
 static void
 catcher(int signum)
 {
 static void
 catcher(int signum)
 {
@@ -162,7 +114,7 @@ catcher(int signum)
                                         * such, let's also push any remaining log
                                         * messages to stdout/stderr.
                                         */
                                         * such, let's also push any remaining log
                                         * messages to stdout/stderr.
                                         */
-                                       _sc_log++;
+                                       _sc_log = 2;
                                }
 
                                /*
                                }
 
                                /*
@@ -330,8 +282,9 @@ main(int argc, char * const argv[])
                                                  , NULL
                                                  , termMPCopyDescription
                                                  };
                                                  , NULL
                                                  , termMPCopyDescription
                                                  };
-       Boolean                 enableRestart   = (argc <= 1);  /* only if there are no arguments */
        Boolean                 forceForeground = FALSE;
        Boolean                 forceForeground = FALSE;
+       Boolean                 forcePlugin     = FALSE;
+       int64_t                 is_launchd_job  = 0;
        mach_port_limits_t      limits;
        Boolean                 loadBundles     = TRUE;
        struct sigaction        nact;
        mach_port_limits_t      limits;
        Boolean                 loadBundles     = TRUE;
        struct sigaction        nact;
@@ -339,7 +292,6 @@ main(int argc, char * const argv[])
        extern int              optind;
        const char              *prog           = argv[0];
        CFRunLoopSourceRef      rls;
        extern int              optind;
        const char              *prog           = argv[0];
        CFRunLoopSourceRef      rls;
-       mach_port_t             service_port    = MACH_PORT_NULL;
        kern_return_t           status;
        CFStringRef             str;
        const char              *testBundle     = NULL;
        kern_return_t           status;
        CFStringRef             str;
        const char              *testBundle     = NULL;
@@ -349,7 +301,7 @@ main(int argc, char * const argv[])
 
        /* process any arguments */
 
 
        /* process any arguments */
 
-       while ((opt = getopt_long(argc, argv, "bB:dt:vV:", longopts, NULL)) != -1) {
+       while ((opt = getopt_long(argc, argv, "bB:dt:vV:f", longopts, NULL)) != -1) {
                switch(opt) {
                        case 'b':
                                loadBundles = FALSE;
                switch(opt) {
                        case 'b':
                                loadBundles = FALSE;
@@ -377,23 +329,16 @@ main(int argc, char * const argv[])
                                        CFRelease(str);
                                }
                                break;
                                        CFRelease(str);
                                }
                                break;
+                       case 'f':
+                               _plugins_fork = TRUE;
+                               break;
                        case '?':
                        default :
                                usage(prog);
                }
        }
                        case '?':
                        default :
                                usage(prog);
                }
        }
-       argc -= optind;
-       argv += optind;
-
-       /*
-        * display an error if configd is already running and we are
-        * not solely executing/testing a bundle.
-        */
-       if (testBundle == NULL) {
-               if (server_active(&service_port)) {
-                       exit (EX_UNAVAILABLE);
-               }
-       }
+//     argc -= optind;
+//     argv += optind;
 
        /* check credentials */
        if (getuid() != 0) {
 
        /* check credentials */
        if (getuid() != 0) {
@@ -401,7 +346,16 @@ main(int argc, char * const argv[])
                exit (EX_NOPERM);
        }
 
                exit (EX_NOPERM);
        }
 
-       if (!forceForeground && (service_port == MACH_PORT_NULL)) {
+       /* check if we have been started by launchd */
+       vproc_swap_integer(NULL, VPROC_GSK_IS_MANAGED, NULL, &is_launchd_job);
+
+       /* ensure that forked plugins behave */
+       if ((testBundle != NULL) && (getenv("__FORKED_PLUGIN__") != NULL)) {
+               forcePlugin = TRUE;
+       }
+
+       /* if needed, daemonize */
+       if (!forceForeground && !is_launchd_job) {
                /*
                 * if we haven't been asked to run in the foreground
                 * and have not been started by launchd (i.e. we're
                /*
                 * if we haven't been asked to run in the foreground
                 * and have not been started by launchd (i.e. we're
@@ -423,12 +377,12 @@ main(int argc, char * const argv[])
         * close file descriptors, establish stdin/stdout/stderr,
         * setup logging.
         */
         * close file descriptors, establish stdin/stdout/stderr,
         * setup logging.
         */
-       if (!forceForeground) {
+       if (!forceForeground || forcePlugin) {
                int             facility        = LOG_DAEMON;
                int             logopt          = LOG_CONS|LOG_NDELAY|LOG_PID;
                struct stat     statbuf;
 
                int             facility        = LOG_DAEMON;
                int             logopt          = LOG_CONS|LOG_NDELAY|LOG_PID;
                struct stat     statbuf;
 
-               if (service_port == MACH_PORT_NULL) {
+               if (!is_launchd_job && !forcePlugin) {
                        init_fds();
                }
 
                        init_fds();
                }
 
@@ -445,9 +399,6 @@ main(int argc, char * const argv[])
                _sc_log = FALSE;        /* redirect SCLog() to stdout/stderr */
        }
 
                _sc_log = FALSE;        /* redirect SCLog() to stdout/stderr */
        }
 
-       /* enable crash reporting */
-       allow_crash_reports();
-
        /* check/enable trace logging */
        set_trace();
 
        /* check/enable trace logging */
        set_trace();
 
@@ -508,9 +459,9 @@ main(int argc, char * const argv[])
 
        if (testBundle == NULL) {
                /* initialize primary (store management) thread */
 
        if (testBundle == NULL) {
                /* initialize primary (store management) thread */
-               server_init(service_port, enableRestart);
+               server_init();
 
 
-               if (!forceForeground && (service_port == MACH_PORT_NULL)) {
+               if (!forceForeground && !is_launchd_job) {
                        /* synchronize with parent process */
                        kill(getppid(), SIGTERM);
                }
                        /* synchronize with parent process */
                        kill(getppid(), SIGTERM);
                }
index ef9fb13912ee42f032e7a7fd5bec7ad7d7b33fcd..6b2af162157c2aebf5ef2c6c0e0218a2b20afc5f 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -58,9 +58,6 @@ extern boolean_t              shared_dns_info_server(mach_msg_header_t *, mach_msg_header_t
 /* configd server port (for new session requests) */
 static CFMachPortRef           configd_port            = NULL;
 
 /* configd server port (for new session requests) */
 static CFMachPortRef           configd_port            = NULL;
 
-/* priviledged bootstrap port (for registering/unregistering w/launchd) */
-static mach_port_t             priv_bootstrap_port     = MACH_PORT_NULL;
-
 __private_extern__
 boolean_t
 config_demux(mach_msg_header_t *request, mach_msg_header_t *reply)
 __private_extern__
 boolean_t
 config_demux(mach_msg_header_t *request, mach_msg_header_t *reply)
@@ -204,46 +201,6 @@ configdCallback(CFMachPortRef port, void *msg, CFIndex size, void *info)
 }
 
 
 }
 
 
-__private_extern__
-boolean_t
-server_active(mach_port_t *restart_service_port)
-{
-       char                    *service_name;
-       kern_return_t           status;
-
-       service_name = getenv("SCD_SERVER");
-       if (!service_name) {
-               service_name = SCD_SERVER;
-       }
-
-       /* Check "configd" server status */
-       status = bootstrap_check_in(bootstrap_port, service_name, restart_service_port);
-       switch (status) {
-               case BOOTSTRAP_SUCCESS :
-                       /* if we are being restarted by launchd */
-                       priv_bootstrap_port = bootstrap_port;
-                       break;
-               case BOOTSTRAP_SERVICE_ACTIVE :
-               case BOOTSTRAP_NOT_PRIVILEGED :
-                       /* if another instance of the server is active (or starting) */
-                       fprintf(stderr, "'%s' server already active\n",
-                               service_name);
-                       return TRUE;
-               case BOOTSTRAP_UNKNOWN_SERVICE :
-                       /* if the server is not currently registered/active */
-                       *restart_service_port = MACH_PORT_NULL;
-                       break;
-               default :
-                       fprintf(stderr,
-                               "bootstrap_check_in() failed: %s\n",
-                               bootstrap_strerror(status));
-                       exit (EX_UNAVAILABLE);
-       }
-
-       return FALSE;
-}
-
-
 static CFStringRef
 serverMPCopyDescription(const void *info)
 {
 static CFStringRef
 serverMPCopyDescription(const void *info)
 {
@@ -253,102 +210,40 @@ serverMPCopyDescription(const void *info)
 
 __private_extern__
 void
 
 __private_extern__
 void
-server_init(mach_port_t                restart_service_port,
-           Boolean             enableRestart)
+server_init()
 {
        serverSessionRef        mySession;
        CFRunLoopSourceRef      rls;
        char                    *service_name;
 {
        serverSessionRef        mySession;
        CFRunLoopSourceRef      rls;
        char                    *service_name;
-       mach_port_t             service_port    = restart_service_port;
+       mach_port_t             service_port    = MACH_PORT_NULL;
        kern_return_t           status;
        kern_return_t           status;
-       mach_port_t             unpriv_bootstrap_port;
 
        service_name = getenv("SCD_SERVER");
        if (!service_name) {
                service_name = SCD_SERVER;
        }
 
 
        service_name = getenv("SCD_SERVER");
        if (!service_name) {
                service_name = SCD_SERVER;
        }
 
-       if (service_port == MACH_PORT_NULL) {
-               mach_port_t     service_send_port;
-
-               /* Check "configd" server status */
-               status = bootstrap_check_in(bootstrap_port, service_name, &service_port);
-               switch (status) {
-                       case BOOTSTRAP_SUCCESS :
-                               /* if we are being restarted by launchd */
-                               priv_bootstrap_port = bootstrap_port;
-                               break;
-                       case BOOTSTRAP_NOT_PRIVILEGED :
-                               /* if another instance of the server is starting */
-                               SCLog(TRUE, LOG_ERR, CFSTR("'%s' server already starting"), service_name);
-                               exit (EX_UNAVAILABLE);
-                       case BOOTSTRAP_UNKNOWN_SERVICE :
-                               /* service not currently registered, "a good thing" (tm) */
-                               if (enableRestart) {
-                                       status = bootstrap_create_server(bootstrap_port,
-                                                                        "/usr/sbin/configd",
-                                                                        geteuid(),
-                                                                        FALSE,         /* not onDemand == restart now */
-                                                                        &priv_bootstrap_port);
-                                       if (status != BOOTSTRAP_SUCCESS) {
-                                               SCLog(TRUE, LOG_ERR,
-                                                     CFSTR("server_init bootstrap_create_server() failed: %s"),
-                                                     bootstrap_strerror(status));
-                                               exit (EX_UNAVAILABLE);
-                                       }
-                               } else {
-                                       priv_bootstrap_port = bootstrap_port;
-                               }
-
-                               status = bootstrap_create_service(priv_bootstrap_port, service_name, &service_send_port);
-                               if (status != BOOTSTRAP_SUCCESS) {
-                                       SCLog(TRUE, LOG_ERR,
-                                             CFSTR("server_init bootstrap_create_service() failed: %s"),
-                                             bootstrap_strerror(status));
-                                       exit (EX_UNAVAILABLE);
-                               }
-
-                               status = bootstrap_check_in(priv_bootstrap_port, service_name, &service_port);
-                               if (status != BOOTSTRAP_SUCCESS) {
-                                       SCLog(TRUE, LOG_ERR,
-                                             CFSTR("server_init bootstrap_check_in() failed: %s"),
-                                             bootstrap_strerror(status));
-                                       exit (EX_UNAVAILABLE);
-                               }
-                               break;
-                       case BOOTSTRAP_SERVICE_ACTIVE :
-                               /* if another instance of the server is active */
-                               SCLog(TRUE, LOG_ERR, CFSTR("'%s' server already active"), service_name);
-                               exit (EX_UNAVAILABLE);
-                       default :
+       /* Check "configd" server status */
+       status = bootstrap_check_in(bootstrap_port, service_name, &service_port);
+       switch (status) {
+               case BOOTSTRAP_SUCCESS :
+                       /* if we are being [re-]started by launchd */
+                       break;
+               case BOOTSTRAP_NOT_PRIVILEGED :
+                       /* if another instance of the server is starting */
+                       SCLog(TRUE, LOG_ERR, CFSTR("'%s' server already starting"), service_name);
+                       exit (EX_UNAVAILABLE);
+               case BOOTSTRAP_SERVICE_ACTIVE :
+                       /* if another instance of the server is active */
+                       SCLog(TRUE, LOG_ERR, CFSTR("'%s' server already active"), service_name);
+                       exit (EX_UNAVAILABLE);
+               default :
                        SCLog(TRUE, LOG_ERR,
                              CFSTR("server_init bootstrap_check_in() failed: %s"),
                              bootstrap_strerror(status));
                        exit (EX_UNAVAILABLE);
                        SCLog(TRUE, LOG_ERR,
                              CFSTR("server_init bootstrap_check_in() failed: %s"),
                              bootstrap_strerror(status));
                        exit (EX_UNAVAILABLE);
-               }
-
-       }
-
-       /* we don't want to pass our priviledged bootstrap port along to any spawned helpers so... */
-       status = bootstrap_unprivileged(priv_bootstrap_port, &unpriv_bootstrap_port);
-       if (status != BOOTSTRAP_SUCCESS) {
-               SCLog(TRUE, LOG_ERR,
-                     CFSTR("server_init bootstrap_unprivileged() failed: %s"),
-                     bootstrap_strerror(status));
-               exit (EX_UNAVAILABLE);
        }
 
        }
 
-       status = task_set_bootstrap_port(mach_task_self(), unpriv_bootstrap_port);
-       if (status != BOOTSTRAP_SUCCESS) {
-               SCLog(TRUE, LOG_ERR,
-                     CFSTR("server_init task_set_bootstrap_port(): %s"),
-                     mach_error_string(status));
-               exit (EX_UNAVAILABLE);
-       }
-
-       /* ... and make sure that the global "bootstrap_port" is also unpriviledged */
-       bootstrap_port = unpriv_bootstrap_port;
-
        /* Create the primary / new connection port and backing session */
        mySession = addSession(service_port, serverMPCopyDescription);
        configd_port = mySession->serverPort;
        /* Create the primary / new connection port and backing session */
        mySession = addSession(service_port, serverMPCopyDescription);
        configd_port = mySession->serverPort;
@@ -373,41 +268,20 @@ __private_extern__
 int
 server_shutdown()
 {
 int
 server_shutdown()
 {
-       char            *service_name;
-       mach_port_t     service_port;
-       kern_return_t   status;
-
-       /*
-        * Note: we can't use SCLog() since the signal may be received while the
-        *       logging thread lock is held.
-        */
-       if ((priv_bootstrap_port == MACH_PORT_NULL) || (configd_port == NULL)) {
-               return EX_OK;
-       }
-
-       service_name = getenv("SCD_SERVER");
-       if (!service_name) {
-               service_name = SCD_SERVER;
-       }
+       if (configd_port != NULL) {
+               mach_port_t     service_port;
+
+               service_port = CFMachPortGetPort(configd_port);
+               if (service_port != MACH_PORT_NULL) {
+                       (void) mach_port_mod_refs(mach_task_self(),
+                                                 service_port,
+                                                 MACH_PORT_RIGHT_RECEIVE,
+                                                 -1);
+               }
 
 
-       service_port = CFMachPortGetPort(configd_port);
-       if (service_port != MACH_PORT_NULL) {
-               (void) mach_port_destroy(mach_task_self(), service_port);
-       }
-
-       status = bootstrap_register(priv_bootstrap_port, service_name, MACH_PORT_NULL);
-       switch (status) {
-               case BOOTSTRAP_SUCCESS :
-                       break;
-               case MACH_SEND_INVALID_DEST :
-               case MIG_SERVER_DIED :
-                       /* something happened to launchd */
-                       break;
-               default :
-                       SCLog(TRUE, LOG_ERR,
-                             CFSTR("server_shutdown bootstrap_register(): %s"),
-                             bootstrap_strerror(status));
-                       return EX_UNAVAILABLE;
+               CFMachPortInvalidate(configd_port);
+               CFRelease(configd_port);
+               configd_port = NULL;
        }
 
        return EX_OK;
        }
 
        return EX_OK;
@@ -419,25 +293,18 @@ void
 server_loop()
 {
        CFStringRef     rlMode;
 server_loop()
 {
        CFStringRef     rlMode;
-       int             rlStatus;
 
        while (TRUE) {
 
        while (TRUE) {
-               /*
-                * if linked with a DEBUG version of the framework, display some
-                * debugging information
-                */
-               __showMachPortStatus();
-
                /*
                 * process one run loop event
                 */
                rlMode = (storeLocked > 0) ? CFSTR("locked") : kCFRunLoopDefaultMode;
                /*
                 * process one run loop event
                 */
                rlMode = (storeLocked > 0) ? CFSTR("locked") : kCFRunLoopDefaultMode;
-               rlStatus = CFRunLoopRunInMode(rlMode, 1.0e10, TRUE);
+               CFRunLoopRunInMode(rlMode, 1.0e10, TRUE);
 
                /*
                 * check for, and if necessary, push out change notifications
                 * to other processes.
                 */
 
                /*
                 * check for, and if necessary, push out change notifications
                 * to other processes.
                 */
-               pushNotifications();
+               pushNotifications(_configd_trace);
        }
 }
        }
 }
index 07becd3666c84c86265dcf5e2ead7835151320b3..934c91b49d89817e6d4ca1e00033bf62510abd80 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2006, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -45,10 +45,7 @@ void         configdCallback (CFMachPortRef          port,
                                 CFIndex                size,
                                 void                   *info);
 
                                 CFIndex                size,
                                 void                   *info);
 
-boolean_t      server_active   (mach_port_t            *service_port);
-
-void           server_init     (mach_port_t            service_port,
-                                Boolean                enableRestart);
+void           server_init     (void);
 
 int            server_shutdown (void);
 
 
 int            server_shutdown (void);
 
diff --git a/configd.tproj/entitlements.plist b/configd.tproj/entitlements.plist
new file mode 100644 (file)
index 0000000..ec0be16
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>keychain-access-groups</key>
+       <array>
+               <string>apple</string>
+       </array>
+       <key>com.apple.springboard.launchapplications</key>
+       <true/>
+       <key>com.apple.wifi.manager-access</key>
+       <true/>
+       <key>com.apple.MobileInternetSharing.allow</key>
+       <true/>
+</dict>
+</plist>
index f4aea4b9128dfeef4fc386bd4ae4204bfec6273d..75992381c45c53ddcf82b1bbe65195d047656bc3 100644 (file)
@@ -53,8 +53,7 @@ notify_server(mach_msg_header_t *request, mach_msg_header_t *reply)
 
        switch (Request->not_header.msgh_id) {
                case MACH_NOTIFY_NO_SENDERS :
 
        switch (Request->not_header.msgh_id) {
                case MACH_NOTIFY_NO_SENDERS :
-                       SCLog(_configd_verbose, LOG_DEBUG, CFSTR("No more senders for port %d, closing."),
-                             Request->not_header.msgh_local_port);
+                       __MACH_PORT_DEBUG(TRUE, "*** notify_server MACH_NOTIFY_NO_SENDERS", Request->not_header.msgh_local_port);
                        cleanupSession(Request->not_header.msgh_local_port);
 
                        Reply->Head.msgh_bits           = 0;
                        cleanupSession(Request->not_header.msgh_local_port);
 
                        Reply->Head.msgh_bits           = 0;
index e4bc1c43eb90e2f94ed6c8a013064e51af6a4878..207491ba475510f6203a6c6656bf2f3a334542c0 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2003, 2004, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2003, 2004, 2006-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -442,9 +442,11 @@ __private_extern__
 void
 patternAddKey(CFStringRef key)
 {
 void
 patternAddKey(CFStringRef key)
 {
+       void    *context        = (void *)key;
+
        my_CFDictionaryApplyFunction(patternData,
                                     (CFDictionaryApplierFunction)addKeyForPattern,
        my_CFDictionaryApplyFunction(patternData,
                                     (CFDictionaryApplierFunction)addKeyForPattern,
-                                    (void *)key);
+                                    context);
 
        return;
 }
 
        return;
 }
@@ -497,9 +499,11 @@ __private_extern__
 void
 patternRemoveKey(CFStringRef key)
 {
 void
 patternRemoveKey(CFStringRef key)
 {
+       void    *context        = (void *)key;
+
        my_CFDictionaryApplyFunction(patternData,
                                     (CFDictionaryApplierFunction)removeKeyFromPattern,
        my_CFDictionaryApplyFunction(patternData,
                                     (CFDictionaryApplierFunction)removeKeyFromPattern,
-                                    (void *)key);
+                                    context);
 
        return;
 }
 
        return;
 }
index 9ddeb4a3a5ac79332136e2c3629d7390b47b202e..f0a550662e220b5a093effaff73414c9d276c226 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -84,23 +84,16 @@ __private_extern__
 CFRunLoopRef                   plugin_runLoop          = NULL;
 
 
 CFRunLoopRef                   plugin_runLoop          = NULL;
 
 
-extern SCDynamicStoreBundleLoadFunction                load_ATconfig;
-extern SCDynamicStoreBundleStopFunction                stop_ATconfig;
 extern SCDynamicStoreBundleLoadFunction                load_IPMonitor;
 extern SCDynamicStoreBundlePrimeFunction       prime_IPMonitor;
 extern SCDynamicStoreBundleLoadFunction                load_InterfaceNamer;
 extern SCDynamicStoreBundleLoadFunction                load_KernelEventMonitor;
 extern SCDynamicStoreBundlePrimeFunction       prime_KernelEventMonitor;
 extern SCDynamicStoreBundleLoadFunction                load_IPMonitor;
 extern SCDynamicStoreBundlePrimeFunction       prime_IPMonitor;
 extern SCDynamicStoreBundleLoadFunction                load_InterfaceNamer;
 extern SCDynamicStoreBundleLoadFunction                load_KernelEventMonitor;
 extern SCDynamicStoreBundlePrimeFunction       prime_KernelEventMonitor;
-#ifdef INCLUDE_KICKER
-extern SCDynamicStoreBundleLoadFunction                load_Kicker;
-#endif // INCLUDE_KICKER
 extern SCDynamicStoreBundleLoadFunction                load_LinkConfiguration;
 extern SCDynamicStoreBundleLoadFunction                load_PreferencesMonitor;
 extern SCDynamicStoreBundlePrimeFunction       prime_PreferencesMonitor;
 extern SCDynamicStoreBundleLoadFunction                load_LinkConfiguration;
 extern SCDynamicStoreBundleLoadFunction                load_PreferencesMonitor;
 extern SCDynamicStoreBundlePrimeFunction       prime_PreferencesMonitor;
-extern SCDynamicStoreBundleStopFunction                stop_PreferencesMonitor;
 extern SCDynamicStoreBundleLoadFunction                load_NetworkIdentification;
 extern SCDynamicStoreBundlePrimeFunction       prime_NetworkIdentification;
 extern SCDynamicStoreBundleLoadFunction                load_NetworkIdentification;
 extern SCDynamicStoreBundlePrimeFunction       prime_NetworkIdentification;
-extern SCDynamicStoreBundleStopFunction                stop_NetworkIdentification;
 
 
 typedef struct {
 
 
 typedef struct {
@@ -113,13 +106,6 @@ typedef struct {
 
 
 static const builtin builtin_plugins[] = {
 
 
 static const builtin builtin_plugins[] = {
-       {
-               CFSTR("com.apple.SystemConfiguration.ATconfig"),
-               &load_ATconfig,
-               NULL,
-               NULL,
-               &stop_ATconfig
-       },
        {
                CFSTR("com.apple.SystemConfiguration.IPMonitor"),
                &load_IPMonitor,
        {
                CFSTR("com.apple.SystemConfiguration.IPMonitor"),
                &load_IPMonitor,
@@ -141,15 +127,6 @@ static const builtin builtin_plugins[] = {
                &prime_KernelEventMonitor,
                NULL
        },
                &prime_KernelEventMonitor,
                NULL
        },
-#ifdef INCLUDE_KICKER
-       {
-               CFSTR("com.apple.SystemConfiguration.Kicker"),
-               &load_Kicker,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif // INCLUDE_KICKER
        {
                CFSTR("com.apple.SystemConfiguration.LinkConfiguration"),
                &load_LinkConfiguration,
        {
                CFSTR("com.apple.SystemConfiguration.LinkConfiguration"),
                &load_LinkConfiguration,
@@ -162,14 +139,14 @@ static const builtin builtin_plugins[] = {
                &load_NetworkIdentification,
                NULL,
                &prime_NetworkIdentification,
                &load_NetworkIdentification,
                NULL,
                &prime_NetworkIdentification,
-               &stop_NetworkIdentification
+               NULL
        },
        {
                CFSTR("com.apple.SystemConfiguration.PreferencesMonitor"),
                &load_PreferencesMonitor,
                NULL,
                &prime_PreferencesMonitor,
        },
        {
                CFSTR("com.apple.SystemConfiguration.PreferencesMonitor"),
                &load_PreferencesMonitor,
                NULL,
                &prime_PreferencesMonitor,
-               &stop_PreferencesMonitor
+               NULL
        }
 };
 
        }
 };
 
@@ -293,6 +270,97 @@ getBundleSymbol(CFBundleRef bundle, CFStringRef functionName, CFStringRef shortI
 }
 
 
 }
 
 
+static const char *
+getBundleDirNameAndPath(CFBundleRef bundle, char *buf, size_t buf_len)
+{
+       char            *cp;
+       int             len;
+       Boolean         ok;
+       CFURLRef        url;
+
+       url = CFBundleCopyBundleURL(bundle);
+       if (url == NULL) {
+               return NULL;
+       }
+
+       ok = CFURLGetFileSystemRepresentation(url, TRUE, (UInt8 *)buf, buf_len);
+       CFRelease(url);
+       if (!ok) {
+               return NULL;
+       }
+
+       cp = strrchr(buf, '/');
+       if (cp != NULL) {
+               cp++;
+       } else {
+               cp = buf;
+       }
+
+       /* check if this directory entry is a valid bundle name */
+       len = strlen(cp);
+       if (len <= (int)sizeof(BUNDLE_DIR_EXTENSION)) {
+               /* if entry name isn't long enough */
+               return NULL;
+       }
+
+       len -= sizeof(BUNDLE_DIR_EXTENSION) - 1;
+       if (strcmp(&cp[len], BUNDLE_DIR_EXTENSION) != 0) {
+               /* if entry name doesn't end with ".bundle" */
+               return NULL;
+       }
+
+       return cp;
+}
+
+
+#pragma mark -
+#pragma mark load
+
+
+static void
+forkBundle_setup(pid_t pid, void *setupContext)
+{
+       if (pid == 0) {
+               // if child
+               unsetenv("__LAUNCHD_FD");
+               setenv("__FORKED_PLUGIN__", "Yes", 1);
+       }
+
+       return;
+}
+
+
+static void
+forkBundle(CFBundleRef bundle, CFStringRef bundleID)
+{
+       char            *argv[]         = { "configd", "-d", "-t", NULL, NULL };
+       const char      *name;
+       char            path[MAXPATHLEN];
+       pid_t           pid;
+
+       // get the bundle's path
+       name = getBundleDirNameAndPath(bundle, path, sizeof(path));
+       if (name == NULL) {
+               SCLog(TRUE, LOG_ERR, CFSTR("skipped %@ (could not determine path)"), bundle);
+               return;
+       }
+
+       // fork and exec configd opting to load only this plugin
+       argv[3] = path;
+       pid = _SCDPluginExecCommand2(NULL, NULL, 0, 0, "/usr/libexec/configd", argv, forkBundle_setup, NULL);
+       if (pid == -1) {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("skipped %@ (could not exec child) : %s"),
+                     bundle,
+                     strerror(errno));
+               return;
+       }
+
+       SCLog(TRUE, LOG_NOTICE, CFSTR("forked  %@, pid=%d"), bundleID, pid);
+       return;
+}
+
+
 static void
 loadBundle(const void *value, void *context) {
        CFStringRef     bundleID;
 static void
 loadBundle(const void *value, void *context) {
        CFStringRef     bundleID;
@@ -304,7 +372,7 @@ loadBundle(const void *value, void *context) {
        bundleID = CFBundleGetIdentifier(bundleInfo->bundle);
        if (bundleID == NULL) {
                // sorry, no bundles without a bundle identifier
        bundleID = CFBundleGetIdentifier(bundleInfo->bundle);
        if (bundleID == NULL) {
                // sorry, no bundles without a bundle identifier
-               SCLog(TRUE, LOG_DEBUG, CFSTR("skipped %@ (no bundle ID)"), bundleInfo->bundle);
+               SCLog(TRUE, LOG_NOTICE, CFSTR("skipped %@ (no bundle ID)"), bundleInfo->bundle);
                return;
        }
 
                return;
        }
 
@@ -319,13 +387,18 @@ loadBundle(const void *value, void *context) {
 
        if (bundleExclude) {
                // sorry, this bundle has been excluded
 
        if (bundleExclude) {
                // sorry, this bundle has been excluded
-               SCLog(TRUE, LOG_DEBUG, CFSTR("skipped %@ (excluded)"), bundleID);
+               SCLog(TRUE, LOG_NOTICE, CFSTR("skipped %@ (excluded)"), bundleID);
                goto done;
        }
 
        if (!bundleInfo->enabled) {
                goto done;
        }
 
        if (!bundleInfo->enabled) {
-               // sorry, this bundle has not been enaabled
-               SCLog(TRUE, LOG_DEBUG, CFSTR("skipped %@ (disabled)"), bundleID);
+               // sorry, this bundle has not been enabled
+               SCLog(TRUE, LOG_INFO, CFSTR("skipped %@ (disabled)"), bundleID);
+               goto done;
+       }
+
+       if (_plugins_fork) {
+               forkBundle(bundleInfo->bundle, bundleID);
                goto done;
        }
 
                goto done;
        }
 
@@ -339,7 +412,7 @@ loadBundle(const void *value, void *context) {
        }
 
        if (bundleInfo->builtin) {
        }
 
        if (bundleInfo->builtin) {
-               int     i;
+               int             i;
 
                SCLog(TRUE, LOG_DEBUG, CFSTR("adding  %@"), bundleID);
 
 
                SCLog(TRUE, LOG_DEBUG, CFSTR("adding  %@"), bundleID);
 
@@ -361,14 +434,22 @@ loadBundle(const void *value, void *context) {
                        goto done;
                }
        } else {
                        goto done;
                }
        } else {
+               CFErrorRef      error   = NULL;
+
                SCLog(TRUE, LOG_DEBUG, CFSTR("loading %@"), bundleID);
 
 #ifdef DEBUG
                traceBundle("loading", bundleInfo->bundle);
 #endif /* DEBUG */
 
                SCLog(TRUE, LOG_DEBUG, CFSTR("loading %@"), bundleID);
 
 #ifdef DEBUG
                traceBundle("loading", bundleInfo->bundle);
 #endif /* DEBUG */
 
-               if (!CFBundleLoadExecutable(bundleInfo->bundle)) {
+               if (!CFBundleLoadExecutableAndReturnError(bundleInfo->bundle, &error)) {
+                       CFStringRef     description;
+
+                       description = CFErrorCopyDescription(error);
                        SCLog(TRUE, LOG_NOTICE, CFSTR("%@ load failed"), bundleID);
                        SCLog(TRUE, LOG_NOTICE, CFSTR("%@ load failed"), bundleID);
+                       SCLog(TRUE, LOG_NOTICE, CFSTR("  %@"), description);
+                       CFRelease(description);
+                       CFRelease(error);
                        goto done;
                }
 
                        goto done;
                }
 
@@ -415,15 +496,17 @@ callLoadFunction(const void *value, void *context) {
 }
 
 
 }
 
 
+#pragma mark -
+#pragma mark start
+
+
 void
 callStartFunction(const void *value, void *context) {
 void
 callStartFunction(const void *value, void *context) {
+       const char      *bundleDirName;
        bundleInfoRef   bundleInfo      = (bundleInfoRef)value;
        bundleInfoRef   bundleInfo      = (bundleInfoRef)value;
-       CFURLRef        bundleURL;
        char            bundleName[MAXNAMLEN + 1];
        char            bundlePath[MAXPATHLEN];
        char            bundleName[MAXNAMLEN + 1];
        char            bundlePath[MAXPATHLEN];
-       char            *cp;
        int             len;
        int             len;
-       Boolean         ok;
 
        if (!bundleInfo->loaded) {
                return;
 
        if (!bundleInfo->loaded) {
                return;
@@ -434,43 +517,20 @@ callStartFunction(const void *value, void *context) {
                return;
        }
 
                return;
        }
 
-       bundleURL = CFBundleCopyBundleURL(bundleInfo->bundle);
-       if (bundleURL == NULL) {
-               return;
-       }
-
-       ok = CFURLGetFileSystemRepresentation(bundleURL,
-                                             TRUE,
-                                             (UInt8 *)&bundlePath,
-                                             sizeof(bundlePath));
-       CFRelease(bundleURL);
-       if (!ok) {
-               return;
-       }
-
-       cp = strrchr(bundlePath, '/');
-       if (cp) {
-               cp++;
-       } else {
-               cp = bundlePath;
-       }
-
-       /* check if this directory entry is a valid bundle name */
-       len = strlen(cp);
-       if (len <= (int)sizeof(BUNDLE_DIR_EXTENSION)) {
-               /* if entry name isn't long enough */
+       /* copy the bundle's path */
+       bundleDirName = getBundleDirNameAndPath(bundleInfo->bundle, bundlePath, sizeof(bundlePath));
+       if (bundleDirName == NULL) {
+               // if we have a problem with the bundle's path
                return;
        }
 
                return;
        }
 
-       len -= sizeof(BUNDLE_DIR_EXTENSION) - 1;
-       if (strcmp(&cp[len], BUNDLE_DIR_EXTENSION) != 0) {
-               /* if entry name doesn end with ".bundle" */
+       /* copy (just) the bundle's name */
+       if (strlcpy(bundleName, bundleDirName, sizeof(bundleName)) > sizeof(bundleName)) {
+               // if we have a problem with the bundle's name
                return;
        }
                return;
        }
-
-       /* get (just) the bundle's name */
-       bundleName[0] = '\0';
-       (void) strncat(bundleName, cp, len);
+       len = strlen(bundleName) - (sizeof(BUNDLE_DIR_EXTENSION) - 1);
+       bundleName[len] = '\0';
 
 #ifdef DEBUG
        traceBundle("calling start() for", bundleInfo->bundle);
 
 #ifdef DEBUG
        traceBundle("calling start() for", bundleInfo->bundle);
@@ -482,6 +542,10 @@ callStartFunction(const void *value, void *context) {
 }
 
 
 }
 
 
+#pragma mark -
+#pragma mark prime
+
+
 void
 callPrimeFunction(const void *value, void *context) {
        bundleInfoRef   bundleInfo      = (bundleInfoRef)value;
 void
 callPrimeFunction(const void *value, void *context) {
        bundleInfoRef   bundleInfo      = (bundleInfoRef)value;
@@ -505,6 +569,10 @@ callPrimeFunction(const void *value, void *context) {
 }
 
 
 }
 
 
+#pragma mark -
+#pragma mark stop
+
+
 static void
 stopComplete(void *info)
 {
 static void
 stopComplete(void *info)
 {
@@ -515,6 +583,10 @@ stopComplete(void *info)
        SCLog(TRUE, LOG_DEBUG, CFSTR("** %@ complete (%f)"), bundleID, CFAbsoluteTimeGetCurrent());
 
        stopRls = (CFRunLoopSourceRef)CFDictionaryGetValue(exiting, bundle);
        SCLog(TRUE, LOG_DEBUG, CFSTR("** %@ complete (%f)"), bundleID, CFAbsoluteTimeGetCurrent());
 
        stopRls = (CFRunLoopSourceRef)CFDictionaryGetValue(exiting, bundle);
+       if (stopRls == NULL) {
+               return;
+       }
+
        CFRunLoopSourceInvalidate(stopRls);
 
        CFDictionaryRemoveValue(exiting, bundle);
        CFRunLoopSourceInvalidate(stopRls);
 
        CFDictionaryRemoveValue(exiting, bundle);
@@ -653,6 +725,10 @@ stopBundles()
 }
 
 
 }
 
 
+#pragma mark -
+#pragma mark term
+
+
 static CFStringRef
 termRLSCopyDescription(const void *info)
 {
 static CFStringRef
 termRLSCopyDescription(const void *info)
 {
@@ -705,6 +781,10 @@ plugin_term(int *status)
 }
 
 
 }
 
 
+#pragma mark -
+#pragma mark initialization
+
+
 #ifdef DEBUG
 static void
 timerCallback(CFRunLoopTimerRef timer, void *info)
 #ifdef DEBUG
 static void
 timerCallback(CFRunLoopTimerRef timer, void *info)
@@ -898,6 +978,11 @@ plugin_exec(void *arg)
                             callLoadFunction,
                             NULL);
 
                             callLoadFunction,
                             NULL);
 
+       if (nLoaded == 0) {
+               // if no bundles loaded
+               goto done;
+       }
+
        /*
         * If defined, call each bundles start() function.  This function is
         * called after the bundle has been loaded and its load() function has
        /*
         * If defined, call each bundles start() function.  This function is
         * called after the bundle has been loaded and its load() function has
@@ -960,6 +1045,8 @@ plugin_exec(void *arg)
        plugin_runLoop = CFRunLoopGetCurrent();
        CFRunLoopRun();
 
        plugin_runLoop = CFRunLoopGetCurrent();
        CFRunLoopRun();
 
+    done :
+
        SCLog(_configd_verbose, LOG_INFO, CFSTR("No more work for the \"configd\" plugins"));
        plugin_runLoop = NULL;
        return NULL;
        SCLog(_configd_verbose, LOG_INFO, CFSTR("No more work for the \"configd\" plugins"));
        plugin_runLoop = NULL;
        return NULL;
index 968f39292d1e5cd75991eee3554577ac4f04da5d..bc25fe2afc53496486a7bde947ec0a8f8aa35612 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2003-2005, 2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2007-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -35,6 +35,9 @@
 #include "configd_server.h"
 #include "session.h"
 
 #include "configd_server.h"
 #include "session.h"
 
+#include <unistd.h>
+#include <bsm/libbsm.h>
+
 /* information maintained for each active session */
 static serverSessionRef        *sessions = NULL;
 static int             nSessions = 0;
 /* information maintained for each active session */
 static serverSessionRef        *sessions = NULL;
 static int             nSessions = 0;
@@ -47,7 +50,7 @@ getSession(mach_port_t server)
        int     i;
 
        if (server == MACH_PORT_NULL) {
        int     i;
 
        if (server == MACH_PORT_NULL) {
-               SCLog(TRUE, LOG_NOTICE, CFSTR("Excuse me, why is getSession() being called with an invalid port?"));
+               SCLog(TRUE, LOG_ERR, CFSTR("Excuse me, why is getSession() being called with an invalid port?"));
                return NULL;
        }
 
                return NULL;
        }
 
@@ -60,7 +63,7 @@ getSession(mach_port_t server)
                } else if (thisSession->key == server) {
                        return thisSession;     /* we've seen this server before */
                } else if (thisSession->store &&
                } else if (thisSession->key == server) {
                        return thisSession;     /* we've seen this server before */
                } else if (thisSession->store &&
-                                     (((SCDynamicStorePrivateRef)thisSession->store)->notifySignalTask == server)) {
+                          (((SCDynamicStorePrivateRef)thisSession->store)->notifySignalTask == server)) {
                        return thisSession;
                }
        }
                        return thisSession;
                }
        }
@@ -75,6 +78,7 @@ serverSessionRef
 addSession(mach_port_t server, CFStringRef (*copyDescription)(const void *info))
 {
        CFMachPortContext       context = { 0, NULL, NULL, NULL, NULL };
 addSession(mach_port_t server, CFStringRef (*copyDescription)(const void *info))
 {
        CFMachPortContext       context = { 0, NULL, NULL, NULL, NULL };
+       mach_port_t             mp      = server;
        int                     n = -1;
 
        if (nSessions <= 0) {
        int                     n = -1;
 
        if (nSessions <= 0) {
@@ -109,24 +113,37 @@ addSession(mach_port_t server, CFStringRef (*copyDescription)(const void *info))
        context.copyDescription = copyDescription;
 
        if (server == MACH_PORT_NULL) {
        context.copyDescription = copyDescription;
 
        if (server == MACH_PORT_NULL) {
-               // SCDynamicStore client ports 
+               // create mach port for SCDynamicStore client
                (void) mach_port_allocate(mach_task_self(),
                                          MACH_PORT_RIGHT_RECEIVE,
                (void) mach_port_allocate(mach_task_self(),
                                          MACH_PORT_RIGHT_RECEIVE,
-                                         &server);
+                                         &mp);
+       }
+
+       //
+       // Note: we create the CFMachPort *before* we insert a send
+       //       right present to ensure that CF does not establish
+       //       its dead name notification.
+       //
+       sessions[n]->serverPort = CFMachPortCreateWithPort(NULL,
+                                                          mp,
+                                                          configdCallback,
+                                                          &context,
+                                                          NULL);
+
+       if (server == MACH_PORT_NULL) {
+               // insert send right that will be moved to the client
                (void) mach_port_insert_right(mach_task_self(),
                (void) mach_port_insert_right(mach_task_self(),
-                                             server,
-                                             server,
+                                             mp,
+                                             mp,
                                              MACH_MSG_TYPE_MAKE_SEND);
        }
                                              MACH_MSG_TYPE_MAKE_SEND);
        }
-       sessions[n]->key                 = server;
-       sessions[n]->serverPort          = CFMachPortCreateWithPort(NULL,
-                                                                   server,
-                                                                   configdCallback,
-                                                                   &context,
-                                                                   NULL);
+
+       sessions[n]->key                 = mp;
 //     sessions[n]->serverRunLoopSource = NULL;
 //     sessions[n]->store               = NULL;
 //     sessions[n]->serverRunLoopSource = NULL;
 //     sessions[n]->store               = NULL;
-       sessions[n]->callerEUID          = 1;           /* not "root" */
+       sessions[n]->callerEUID          = 1;           /* not "root" */
+       sessions[n]->callerRootAccess    = UNKNOWN;
+       sessions[n]->callerWriteAccess   = UNKNOWN;
 
        return sessions[n];
 }
 
        return sessions[n];
 }
@@ -205,17 +222,15 @@ cleanupSession(mach_port_t server)
                         * Close any open connections including cancelling any outstanding
                         * notification requests and releasing any locks.
                         */
                         * Close any open connections including cancelling any outstanding
                         * notification requests and releasing any locks.
                         */
+                       __MACH_PORT_DEBUG(TRUE, "*** cleanupSession", server);
                        (void) __SCDynamicStoreClose(&thisSession->store, TRUE);
                        (void) __SCDynamicStoreClose(&thisSession->store, TRUE);
+                       __MACH_PORT_DEBUG(TRUE, "*** cleanupSession (after __SCDynamicStoreClose)", server);
 
                        /*
 
                        /*
-                        * Our send right has already been removed. Remove our
-                        * receive right.
+                        * Our send right has already been removed. Remove our receive right.
                         */
                         */
-                       mach_port_mod_refs(mach_task_self(),
-                                          thisSession->key,
-                                          MACH_PORT_RIGHT_RECEIVE,
-                                          -1);
-                       
+                       (void) mach_port_mod_refs(mach_task_self(), server, MACH_PORT_RIGHT_RECEIVE, -1);
+
                        /*
                         * Lastly, remove the session entry.
                         */
                        /*
                         * Lastly, remove the session entry.
                         */
@@ -224,17 +239,20 @@ cleanupSession(mach_port_t server)
                        return;
                }
        }
                        return;
                }
        }
+
+       SCLog(TRUE, LOG_ERR, CFSTR("MACH_NOTIFY_NO_SENDERS w/no session, port = %d"), server);
+       __MACH_PORT_DEBUG(TRUE, "*** cleanupSession w/no session", server);
        return;
 }
 
 
 __private_extern__
 void
        return;
 }
 
 
 __private_extern__
 void
-listSessions()
+listSessions(FILE *f)
 {
        int     i;
 
 {
        int     i;
 
-       fprintf(stderr, "Current sessions:");
+       SCPrint(TRUE, f, CFSTR("Current sessions :\n"));
        for (i = 0; i < nSessions; i++) {
                serverSessionRef        thisSession = sessions[i];
 
        for (i = 0; i < nSessions; i++) {
                serverSessionRef        thisSession = sessions[i];
 
@@ -242,16 +260,165 @@ listSessions()
                        continue;
                }
 
                        continue;
                }
 
-               fprintf(stderr, " %d", thisSession->key);
+               SCPrint(TRUE, f, CFSTR("\t%d : port = 0x%x"), i, thisSession->key);
+
+               if (thisSession->store != NULL) {
+                       SCDynamicStorePrivateRef        storePrivate    = (SCDynamicStorePrivateRef)thisSession->store;
+
+                       if (storePrivate->notifySignalTask != TASK_NULL) {
+                              SCPrint(TRUE, f, CFSTR(", task = %d"), storePrivate->notifySignalTask);
+                       }
+               }
+
+               if (sessionData != NULL) {
+                       CFDictionaryRef info;
+                       CFStringRef     key;
+
+                       key = CFStringCreateWithFormat(NULL, NULL, CFSTR("%d"), thisSession->key);
+                       info = CFDictionaryGetValue(sessionData, key);
+                       CFRelease(key);
+                       if (info != NULL) {
+                               CFStringRef     name;
+
+                               name = CFDictionaryGetValue(info, kSCDName);
+                               if (name != NULL) {
+                                       SCPrint(TRUE, f, CFSTR(", name = %@"), name);
+                               }
+                       }
+               }
+
+               if (thisSession->serverPort != NULL) {
+                       SCPrint(TRUE, f, CFSTR("\n\t\t%@"), thisSession->serverPort);
+               }
+
+               if (thisSession->serverRunLoopSource != NULL) {
+                       SCPrint(TRUE, f, CFSTR("\n\t\t%@"), thisSession->serverRunLoopSource);
+               }
+
+               SCPrint(TRUE, f, CFSTR("\n"));
+       }
+
+       SCPrint(TRUE, f, CFSTR("\n"));
+       return;
+}
+
+
+#if    TARGET_OS_IPHONE
+
+#include <Security/Security.h>
+#include <Security/SecTask.h>
 
 
-               if (thisSession->store) {
-                       task_t  task = ((SCDynamicStorePrivateRef)thisSession->store)->notifySignalTask;
+static CFStringRef
+sessionName(serverSessionRef session)
+{
+       CFDictionaryRef info;
+       CFStringRef     name    = NULL;
+       CFStringRef     sessionKey;
+
+       sessionKey = CFStringCreateWithFormat(NULL, NULL, CFSTR("%d"), session->key);
+       info = CFDictionaryGetValue(sessionData, sessionKey);
+       CFRelease(sessionKey);
+
+       if (info != NULL) {
+               name = CFDictionaryGetValue(info, kSCDName);
+       }
 
 
-                       if (task != TASK_NULL) {
-                              fprintf(stderr, "/%d", task);
+       return (name != NULL) ? name : CFSTR("???");
+}
+
+
+static Boolean
+hasEntitlement(serverSessionRef session, CFStringRef entitlement)
+{
+       Boolean         hasEntitlement  = FALSE;
+       SecTaskRef      task;
+
+       /* Create the security task from the audit token. */
+       task = SecTaskCreateWithAuditToken(NULL, session->auditToken);
+       if (task != NULL) {
+               CFErrorRef      error   = NULL;
+               CFTypeRef       value;
+
+               /* Get the value for the entitlement. */
+               value = SecTaskCopyValueForEntitlement(task, kSCWriteEntitlementName, &error);
+               if (value != NULL) {
+                       if (isA_CFBoolean(value)) {
+                               if (CFBooleanGetValue(value)) {
+                                       /* if client DOES have entitlement */
+                                       hasEntitlement = YES;
+                               }
+                       } else {
+                               SCLog(TRUE, LOG_ERR,
+                                     CFSTR("hasEntitlement: entitlement not valid: %@"),
+                                     sessionName(session));
                        }
                        }
+
+                       CFRelease(value);
+               } else if (error != NULL) {
+                       SCLog(TRUE, LOG_ERR,
+                             CFSTR("hasEntitlement SecTaskCopyValueForEntitlement() failed, error=%@: %@"),
+                             error,
+                             sessionName(session));
+                       CFRelease(error);
                }
                }
+
+               CFRelease(task);
+       } else {
+               SCLog(TRUE, LOG_ERR,
+                     CFSTR("hasEntitlement SecTaskCreateWithAuditToken() failed: %@"),
+                     sessionName(session));
        }
        }
-       fprintf(stderr, "\n");
+
+       return hasEntitlement;
 }
 
 }
 
+#endif // TARGET_OS_IPHONE
+
+
+__private_extern__
+Boolean
+hasRootAccess(serverSessionRef session)
+{
+       if (session->callerRootAccess == UNKNOWN) {
+               /*
+                * get the credentials associated with the caller.
+                */
+               audit_token_to_au32(session->auditToken,
+                                   NULL,                       // auidp
+                                   &session->callerEUID,       // euid
+                                   NULL,                       // egid
+                                   NULL,                       // ruid
+                                   NULL,                       // rgid
+                                   NULL,                       // pid
+                                   NULL,                       // asid
+                                   NULL);                      // tid
+
+               session->callerRootAccess = (session->callerEUID == 0) ? YES : NO;
+       }
+
+       return (session->callerRootAccess == YES) ? TRUE : FALSE;
+}
+
+
+__private_extern__
+Boolean
+hasWriteAccess(serverSessionRef session)
+{
+       if (session->callerWriteAccess == UNKNOWN) {
+               /* assume that the client DOES NOT have the entitlement */
+               session->callerWriteAccess = NO;
+
+               if (hasRootAccess(session)) {
+                       // grant write access to eUID==0 processes
+                       session->callerWriteAccess = YES;
+               }
+#if    TARGET_OS_IPHONE
+               else if (hasEntitlement(session, kSCWriteEntitlementName)) {
+                       // grant write access to "entitled" processes
+                       session->callerWriteAccess = YES;
+               }
+#endif // TARGET_OS_IPHONE
+       }
+
+       return (session->callerWriteAccess == YES) ? TRUE : FALSE;
+}
index bf25de1d5a998f028bc6de7ed2ddf7aad1b7d752..37817d16099461475a6fe7bc1ef92dc57ce6168a 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2005-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2005-2007, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #define _S_SESSION_H
 
 #include <sys/cdefs.h>
 #define _S_SESSION_H
 
 #include <sys/cdefs.h>
+#include <Availability.h>
+#include <TargetConditionals.h>
+
+
+#if    TARGET_OS_IPHONE
+#define        kSCWriteEntitlementName CFSTR("com.apple.SystemConfiguration.SCDynamicStore-write-access")
+#endif // TARGET_OS_IPHONE
+
+
+typedef        enum { UNKNOWN, NO, YES } lazyBoolean;
+
 
 /* Per client server state */
 typedef struct {
 
 /* Per client server state */
 typedef struct {
@@ -52,6 +63,15 @@ typedef struct {
        /* credentials associated with this "open" session */
        uid_t                   callerEUID;
 
        /* credentials associated with this "open" session */
        uid_t                   callerEUID;
 
+       /* Mach security audit trailer for evaluating credentials */
+       audit_token_t           auditToken;
+
+       /* root access credential associated with this "open" session */
+       lazyBoolean             callerRootAccess;
+
+       /* write access entitlement associated with this "open" session */
+       lazyBoolean             callerWriteAccess;
+
 } serverSession, *serverSessionRef;
 
 __BEGIN_DECLS
 } serverSession, *serverSessionRef;
 
 __BEGIN_DECLS
@@ -65,7 +85,11 @@ void                 removeSession   (mach_port_t    server);
 
 void                   cleanupSession  (mach_port_t    server);
 
 
 void                   cleanupSession  (mach_port_t    server);
 
-void                   listSessions    (void);
+void                   listSessions    (FILE           *f);
+
+Boolean                        hasRootAccess   (serverSessionRef       session);
+
+Boolean                        hasWriteAccess  (serverSessionRef       session);
 
 __END_DECLS
 
 
 __END_DECLS
 
index c994655c6327785c99c72f947210022fe18c6872..a29f24279b63726a720c293abb53e24cc9b7b2ff 100644 (file)
@@ -3,10 +3,35 @@
        archiveVersion = 1;
        classes = {
        };
        archiveVersion = 1;
        classes = {
        };
-       objectVersion = 42;
+       objectVersion = 45;
        objects = {
 
 /* Begin PBXAggregateTarget section */
        objects = {
 
 /* Begin PBXAggregateTarget section */
+               151C1CC60CFB487000C5AFD6 /* All-Embedded */ = {
+                       isa = PBXAggregateTarget;
+                       buildConfigurationList = 151C1CD60CFB48E300C5AFD6 /* Build configuration list for PBXAggregateTarget "All-Embedded" */;
+                       buildPhases = (
+                       );
+                       dependencies = (
+                               15C64A2F0F684C8300D78394 /* PBXTargetDependency */,
+                               158317100CFB77D1006F62B9 /* PBXTargetDependency */,
+                               158317160CFB783B006F62B9 /* PBXTargetDependency */,
+                               158317180CFB784D006F62B9 /* PBXTargetDependency */,
+                       );
+                       name = "All-Embedded";
+                       productName = Embedded;
+               };
+               151FE2DD0D5B7046000D6DB1 /* configd_base-EmbeddedSimulator */ = {
+                       isa = PBXAggregateTarget;
+                       buildConfigurationList = 151FE2E40D5B7046000D6DB1 /* Build configuration list for PBXAggregateTarget "configd_base-EmbeddedSimulator" */;
+                       buildPhases = (
+                       );
+                       dependencies = (
+                               15A5A2710D5B942D0087BDA0 /* PBXTargetDependency */,
+                       );
+                       name = "configd_base-EmbeddedSimulator";
+                       productName = Frameworks;
+               };
                155847FA07550D210046C2E9 /* configd_executables */ = {
                        isa = PBXAggregateTarget;
                        buildConfigurationList = 156EB62E0905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_executables" */;
                155847FA07550D210046C2E9 /* configd_executables */ = {
                        isa = PBXAggregateTarget;
                        buildConfigurationList = 156EB62E0905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_executables" */;
@@ -16,7 +41,7 @@
                                1558480607550D470046C2E9 /* PBXTargetDependency */,
                                1558480807550D470046C2E9 /* PBXTargetDependency */,
                                1558480A07550D470046C2E9 /* PBXTargetDependency */,
                                1558480607550D470046C2E9 /* PBXTargetDependency */,
                                1558480807550D470046C2E9 /* PBXTargetDependency */,
                                1558480A07550D470046C2E9 /* PBXTargetDependency */,
-                               150ECB3C0D0079280065E94D /* PBXTargetDependency */,
+                               150ECB300D0042DA0065E94D /* PBXTargetDependency */,
                        );
                        name = configd_executables;
                        productName = configd_executables;
                        );
                        name = configd_executables;
                        productName = configd_executables;
                        buildPhases = (
                        );
                        dependencies = (
                        buildPhases = (
                        );
                        dependencies = (
-                               157BB8C2075924470025DA7A /* PBXTargetDependency */,
                                157BB8C0075924460025DA7A /* PBXTargetDependency */,
                                1520A386084681350010B584 /* PBXTargetDependency */,
                        );
                        name = configd_base;
                        productName = Frameworks;
                };
                                157BB8C0075924460025DA7A /* PBXTargetDependency */,
                                1520A386084681350010B584 /* PBXTargetDependency */,
                        );
                        name = configd_base;
                        productName = Frameworks;
                };
+               158316CF0CFB774B006F62B9 /* configd_base-Embedded */ = {
+                       isa = PBXAggregateTarget;
+                       buildConfigurationList = 158316D80CFB774B006F62B9 /* Build configuration list for PBXAggregateTarget "configd_base-Embedded" */;
+                       buildPhases = (
+                       );
+                       dependencies = (
+                               158317120CFB77E1006F62B9 /* PBXTargetDependency */,
+                               158317140CFB77E8006F62B9 /* PBXTargetDependency */,
+                       );
+                       name = "configd_base-Embedded";
+                       productName = Frameworks;
+               };
+               158316E30CFB7761006F62B9 /* configd_plugins-Embedded */ = {
+                       isa = PBXAggregateTarget;
+                       buildConfigurationList = 158317000CFB7761006F62B9 /* Build configuration list for PBXAggregateTarget "configd_plugins-Embedded" */;
+                       buildPhases = (
+                       );
+                       dependencies = (
+                               157A85480D56CA0B00B6F1A0 /* PBXTargetDependency */,
+                               158317BB0CFB8660006F62B9 /* PBXTargetDependency */,
+                               157A854A0D56CA2300B6F1A0 /* PBXTargetDependency */,
+                               158317B90CFB8660006F62B9 /* PBXTargetDependency */,
+                               157A854C0D56CA5100B6F1A0 /* PBXTargetDependency */,
+                               158317B70CFB8660006F62B9 /* PBXTargetDependency */,
+                               157A854E0D56CA6F00B6F1A0 /* PBXTargetDependency */,
+                               158317B50CFB8660006F62B9 /* PBXTargetDependency */,
+                               156CA4A80EF8550800C59A18 /* PBXTargetDependency */,
+                               157A85500D56CA8800B6F1A0 /* PBXTargetDependency */,
+                               158317B30CFB8660006F62B9 /* PBXTargetDependency */,
+                               157A85520D56CA9E00B6F1A0 /* PBXTargetDependency */,
+                               157A85540D56CACA00B6F1A0 /* PBXTargetDependency */,
+                       );
+                       name = "configd_plugins-Embedded";
+                       productName = Plugins;
+               };
+               158317040CFB7782006F62B9 /* configd_executables-Embedded */ = {
+                       isa = PBXAggregateTarget;
+                       buildConfigurationList = 1583170B0CFB7782006F62B9 /* Build configuration list for PBXAggregateTarget "configd_executables-Embedded" */;
+                       buildPhases = (
+                       );
+                       dependencies = (
+                               158317660CFB80D5006F62B9 /* PBXTargetDependency */,
+                               157434210D4A8166002ACA73 /* PBXTargetDependency */,
+                               1574341F0D4A815E002ACA73 /* PBXTargetDependency */,
+                       );
+                       name = "configd_executables-Embedded";
+                       productName = configd_executables;
+               };
                159D542007528E7C004F8947 /* configd_plugins */ = {
                        isa = PBXAggregateTarget;
                        buildConfigurationList = 156EB61E0905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_plugins" */;
                        buildPhases = (
                        );
                        dependencies = (
                159D542007528E7C004F8947 /* configd_plugins */ = {
                        isa = PBXAggregateTarget;
                        buildConfigurationList = 156EB61E0905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_plugins" */;
                        buildPhases = (
                        );
                        dependencies = (
-                               1533B94109731A9600F2B34A /* PBXTargetDependency */,
-                               15DAD5740759115F0084A6ED /* PBXTargetDependency */,
                                159D542807528E85004F8947 /* PBXTargetDependency */,
                                158AD9860754E72500124717 /* PBXTargetDependency */,
                                159D542607528E85004F8947 /* PBXTargetDependency */,
                                159D542807528E85004F8947 /* PBXTargetDependency */,
                                158AD9860754E72500124717 /* PBXTargetDependency */,
                                159D542607528E85004F8947 /* PBXTargetDependency */,
                                159D542207528E85004F8947 /* PBXTargetDependency */,
                                159D542A07528E85004F8947 /* PBXTargetDependency */,
                                158AD98C0754E72500124717 /* PBXTargetDependency */,
                                159D542207528E85004F8947 /* PBXTargetDependency */,
                                159D542A07528E85004F8947 /* PBXTargetDependency */,
                                158AD98C0754E72500124717 /* PBXTargetDependency */,
+                               1521405B0E9400BF00DACD2C /* PBXTargetDependency */,
                                159D542C07528E85004F8947 /* PBXTargetDependency */,
                                158AD98E0754E72500124717 /* PBXTargetDependency */,
                                F95B8A790B03FB9100993BA3 /* PBXTargetDependency */,
                                159D542C07528E85004F8947 /* PBXTargetDependency */,
                                158AD98E0754E72500124717 /* PBXTargetDependency */,
                                F95B8A790B03FB9100993BA3 /* PBXTargetDependency */,
                        name = configd_plugins;
                        productName = Plugins;
                };
                        name = configd_plugins;
                        productName = Plugins;
                };
+               15C64A1E0F684C3300D78394 /* configd_libSystem */ = {
+                       isa = PBXAggregateTarget;
+                       buildConfigurationList = 15C64A270F684C6B00D78394 /* Build configuration list for PBXAggregateTarget "configd_libSystem" */;
+                       buildPhases = (
+                               15BED7930F6853F800016614 /* OLD libdnsinfo.a */,
+                       );
+                       dependencies = (
+                               15C64A220F684C4900D78394 /* PBXTargetDependency */,
+                       );
+                       name = configd_libSystem;
+                       productName = configd_libSystem;
+               };
+               15C64A280F684C6B00D78394 /* configd_libSystem-Embedded */ = {
+                       isa = PBXAggregateTarget;
+                       buildConfigurationList = 15C64A2B0F684C6B00D78394 /* Build configuration list for PBXAggregateTarget "configd_libSystem-Embedded" */;
+                       buildPhases = (
+                               15BED7A20F68551200016614 /* OLD libdnsinfo.a */,
+                       );
+                       dependencies = (
+                               15C64A310F684C8F00D78394 /* PBXTargetDependency */,
+                       );
+                       name = "configd_libSystem-Embedded";
+                       productName = configd_libSystem;
+               };
                15CB690005C0722A0099E85F /* All */ = {
                        isa = PBXAggregateTarget;
                        buildConfigurationList = 156EB6320905594A00EEF749 /* Build configuration list for PBXAggregateTarget "All" */;
                        buildPhases = (
                        );
                        dependencies = (
                15CB690005C0722A0099E85F /* All */ = {
                        isa = PBXAggregateTarget;
                        buildConfigurationList = 156EB6320905594A00EEF749 /* Build configuration list for PBXAggregateTarget "All" */;
                        buildPhases = (
                        );
                        dependencies = (
+                               15C64A240F684C5700D78394 /* PBXTargetDependency */,
                                157BB8C40759244B0025DA7A /* PBXTargetDependency */,
                                159D542E07529008004F8947 /* PBXTargetDependency */,
                                1558480F07550DD00046C2E9 /* PBXTargetDependency */,
                                157BB8C40759244B0025DA7A /* PBXTargetDependency */,
                                159D542E07529008004F8947 /* PBXTargetDependency */,
                                1558480F07550DD00046C2E9 /* PBXTargetDependency */,
                        name = All;
                        productName = "configd (Aggregate)";
                };
                        name = All;
                        productName = "configd (Aggregate)";
                };
+               15FD13BF0D59485000F9409C /* All-EmbeddedSimulator */ = {
+                       isa = PBXAggregateTarget;
+                       buildConfigurationList = 15FD13C60D59485000F9409C /* Build configuration list for PBXAggregateTarget "All-EmbeddedSimulator" */;
+                       buildPhases = (
+                       );
+                       dependencies = (
+                               151FE37A0D5B713C000D6DB1 /* PBXTargetDependency */,
+                       );
+                       name = "All-EmbeddedSimulator";
+                       productName = EmbeddedSimulator;
+               };
 /* End PBXAggregateTarget section */
 
 /* Begin PBXBuildFile section */
                15060818075A00A300B147BA /* SCSchemaDefinitions.c in Sources */ = {isa = PBXBuildFile; fileRef = 150607BD075A00A200B147BA /* SCSchemaDefinitions.c */; };
                1506081A075A00A300B147BA /* SCSchemaDefinitions.h in Headers */ = {isa = PBXBuildFile; fileRef = 150607DE075A00A300B147BA /* SCSchemaDefinitions.h */; settings = {ATTRIBUTES = (Public, ); }; };
 /* End PBXAggregateTarget section */
 
 /* Begin PBXBuildFile section */
                15060818075A00A300B147BA /* SCSchemaDefinitions.c in Sources */ = {isa = PBXBuildFile; fileRef = 150607BD075A00A200B147BA /* SCSchemaDefinitions.c */; };
                1506081A075A00A300B147BA /* SCSchemaDefinitions.h in Headers */ = {isa = PBXBuildFile; fileRef = 150607DE075A00A300B147BA /* SCSchemaDefinitions.h */; settings = {ATTRIBUTES = (Public, ); }; };
-               1508E39F07552B6A0062B350 /* atconfig.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53C707528B36004F8947 /* atconfig.c */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; };
-               1508E3A007552B6B0062B350 /* cfManager.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53C507528B36004F8947 /* cfManager.c */; };
-               1508E3A107552B720062B350 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53CA07528B36004F8947 /* cache.c */; };
                150D7E1E0D16DC6C00AF4BED /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1520A3DE0846B2DC0010B584 /* Security.framework */; };
                1520A3870846829A0010B584 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
                150D7E1E0D16DC6C00AF4BED /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1520A3DE0846B2DC0010B584 /* Security.framework */; };
                1520A3870846829A0010B584 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
-               1520A3D0084682A30010B584 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */; };
                1520A3DF0846B2DD0010B584 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1520A3DE0846B2DC0010B584 /* Security.framework */; };
                1520A3DF0846B2DD0010B584 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1520A3DE0846B2DC0010B584 /* Security.framework */; };
-               1523F6F1075A36F70066F0B2 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */; };
-               1523F6F2075A37050066F0B2 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */; };
-               1523F710075A371D0066F0B2 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */; };
-               1523F715075A376B0066F0B2 /* libdnsinfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15DAD5EE075913CE0084A6ED /* libdnsinfo.a */; };
-               1523F719075A37C70066F0B2 /* libdnsinfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15DAD5EE075913CE0084A6ED /* libdnsinfo.a */; };
+               152140020E93EC6500DACD2C /* logger.c in Sources */ = {isa = PBXBuildFile; fileRef = 1531D3DB0E93E6DA00248432 /* logger.c */; };
+               1521400C0E93FFF500DACD2C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
+               152140580E93FFFC00DACD2C /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */; };
+               1522FCFB0FA7FE4B00B24128 /* dnsinfo_flatfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 1522FCE50FA7FD7000B24128 /* dnsinfo_flatfile.c */; };
                152E68C10A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 152E68C00A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                152E68C30A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 152E68C20A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c */; };
                152E68C10A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 152E68C00A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                152E68C30A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 152E68C20A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c */; };
-               1533B94D09731BE600F2B34A /* libATconfig.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15FD73400754DBDA001CC321 /* libATconfig.a */; };
                1533D77B0B10A14300CA4946 /* libNetworkIdentification.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F95B8A5F0B03F81400993BA3 /* libNetworkIdentification.a */; };
                1533D77B0B10A14300CA4946 /* libNetworkIdentification.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F95B8A5F0B03F81400993BA3 /* libNetworkIdentification.a */; };
-               153BED940B75566200989D5C /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1587A31F0B6AACD70063104A /* libicucore.dylib */; };
                1540E3610987DA9500157C07 /* com.apple.configd.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1540E3600987DA9500157C07 /* com.apple.configd.plist */; };
                154361E00752C81800A8EC6C /* set-hostname.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AB07528B36004F8947 /* set-hostname.c */; };
                1543636B0752D03C00A8EC6C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1543636A0752D03C00A8EC6C /* IOKit.framework */; };
                1540E3610987DA9500157C07 /* com.apple.configd.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1540E3600987DA9500157C07 /* com.apple.configd.plist */; };
                154361E00752C81800A8EC6C /* set-hostname.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AB07528B36004F8947 /* set-hostname.c */; };
                1543636B0752D03C00A8EC6C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1543636A0752D03C00A8EC6C /* IOKit.framework */; };
+               154707300D1F70C80075C28D /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1547072E0D1F70C80075C28D /* SystemConfiguration.framework */; };
+               154707350D1F70C80075C28D /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1547072E0D1F70C80075C28D /* SystemConfiguration.framework */; };
                154CF3F407E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 154CF3F307E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                154CF3F407E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 154CF3F307E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               155281020E3E4A0F00C54315 /* ip_plugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53A707528B36004F8947 /* ip_plugin.c */; };
                155847470754FDCD0046C2E9 /* scutil.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4305C0722B0099E85F /* scutil.h */; };
                155847480754FDCD0046C2E9 /* commands.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4505C0722B0099E85F /* commands.h */; };
                155847490754FDCD0046C2E9 /* dictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4705C0722B0099E85F /* dictionary.h */; };
                155847470754FDCD0046C2E9 /* scutil.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4305C0722B0099E85F /* scutil.h */; };
                155847480754FDCD0046C2E9 /* commands.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4505C0722B0099E85F /* commands.h */; };
                155847490754FDCD0046C2E9 /* dictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4705C0722B0099E85F /* dictionary.h */; };
                1558481607550EC10046C2E9 /* scselect.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A2E05C0722B0099E85F /* scselect.c */; settings = {ATTRIBUTES = (); }; };
                1558481907550EC10046C2E9 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
                1558481C07550EC10046C2E9 /* scselect.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 15CB6A3605C0722B0099E85F /* scselect.8 */; };
                1558481607550EC10046C2E9 /* scselect.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A2E05C0722B0099E85F /* scselect.c */; settings = {ATTRIBUTES = (); }; };
                1558481907550EC10046C2E9 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
                1558481C07550EC10046C2E9 /* scselect.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 15CB6A3605C0722B0099E85F /* scselect.8 */; };
+               1559C4450D349A4E0098FD59 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */; };
+               1559C4490D349A4E0098FD59 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */; };
+               1559C44A0D349A4E0098FD59 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */; };
+               1559C44E0D349A4E0098FD59 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */; };
+               1559C44F0D349A4E0098FD59 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */; };
                155A1E6C081079CC00F70D98 /* SCNetworkConfigurationPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 155A1E6B081079CC00F70D98 /* SCNetworkConfigurationPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                155B7BF70847776D00F0E262 /* SCHelper_client.h in Headers */ = {isa = PBXBuildFile; fileRef = 155B7BF60847776D00F0E262 /* SCHelper_client.h */; };
                155B7BF80847776D00F0E262 /* SCHelper_client.h in Headers */ = {isa = PBXBuildFile; fileRef = 155B7BF60847776D00F0E262 /* SCHelper_client.h */; };
                155A1E6C081079CC00F70D98 /* SCNetworkConfigurationPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 155A1E6B081079CC00F70D98 /* SCNetworkConfigurationPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                155B7BF70847776D00F0E262 /* SCHelper_client.h in Headers */ = {isa = PBXBuildFile; fileRef = 155B7BF60847776D00F0E262 /* SCHelper_client.h */; };
                155B7BF80847776D00F0E262 /* SCHelper_client.h in Headers */ = {isa = PBXBuildFile; fileRef = 155B7BF60847776D00F0E262 /* SCHelper_client.h */; };
                155D223C0AF13A7300D52ED0 /* set-hostname.h in Headers */ = {isa = PBXBuildFile; fileRef = 155D22390AF13A7300D52ED0 /* set-hostname.h */; };
                155D223D0AF13A7300D52ED0 /* smb-configuration.h in Headers */ = {isa = PBXBuildFile; fileRef = 155D223A0AF13A7300D52ED0 /* smb-configuration.h */; };
                156BD6BC07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 156BD6BB07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                155D223C0AF13A7300D52ED0 /* set-hostname.h in Headers */ = {isa = PBXBuildFile; fileRef = 155D22390AF13A7300D52ED0 /* set-hostname.h */; };
                155D223D0AF13A7300D52ED0 /* smb-configuration.h in Headers */ = {isa = PBXBuildFile; fileRef = 155D223A0AF13A7300D52ED0 /* smb-configuration.h */; };
                156BD6BC07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 156BD6BB07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               156CA47B0EF853BB00C59A18 /* logger.c in Sources */ = {isa = PBXBuildFile; fileRef = 1531D3DB0E93E6DA00248432 /* logger.c */; };
+               156CA47D0EF853BB00C59A18 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
+               156CA47E0EF853BB00C59A18 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */; };
+               156CA47F0EF853BB00C59A18 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1543636A0752D03C00A8EC6C /* IOKit.framework */; };
+               1572C4A90CFB55B400E2776E /* SCSchemaDefinitions.h in Headers */ = {isa = PBXBuildFile; fileRef = 150607DE075A00A300B147BA /* SCSchemaDefinitions.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               1572C4AA0CFB55B400E2776E /* SystemConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691305C0722B0099E85F /* SystemConfiguration.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               1572C4AB0CFB55B400E2776E /* SCPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691505C0722B0099E85F /* SCPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               1572C4AC0CFB55B400E2776E /* SCDPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691705C0722B0099E85F /* SCDPlugin.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1572C4AD0CFB55B400E2776E /* SCDynamicStoreInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691B05C0722B0099E85F /* SCDynamicStoreInternal.h */; settings = {ATTRIBUTES = (Project, ); }; };
+               1572C4AE0CFB55B400E2776E /* SCDynamicStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691D05C0722B0099E85F /* SCDynamicStore.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               1572C4AF0CFB55B400E2776E /* SCDynamicStorePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691F05C0722B0099E85F /* SCDynamicStorePrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               1572C4B00CFB55B400E2776E /* SCDynamicStoreKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692105C0722B0099E85F /* SCDynamicStoreKey.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               1572C4B10CFB55B400E2776E /* SCDynamicStoreCopySpecific.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692305C0722B0099E85F /* SCDynamicStoreCopySpecific.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               1572C4B20CFB55B400E2776E /* SCDynamicStoreCopySpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692505C0722B0099E85F /* SCDynamicStoreCopySpecificPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               1572C4B30CFB55B400E2776E /* SCDynamicStoreSetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692705C0722B0099E85F /* SCDynamicStoreSetSpecificPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               1572C4B40CFB55B400E2776E /* SCPreferencesInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692905C0722B0099E85F /* SCPreferencesInternal.h */; settings = {ATTRIBUTES = (Project, ); }; };
+               1572C4B50CFB55B400E2776E /* SCPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692B05C0722B0099E85F /* SCPreferences.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               1572C4B60CFB55B400E2776E /* SCPreferencesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692D05C0722B0099E85F /* SCPreferencesPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               1572C4B70CFB55B400E2776E /* SCPreferencesPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692F05C0722B0099E85F /* SCPreferencesPath.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               1572C4B80CFB55B400E2776E /* SCPreferencesSetSpecific.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693105C0722B0099E85F /* SCPreferencesSetSpecific.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               1572C4B90CFB55B400E2776E /* SCNetworkConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15AD7A380670A85900BFE03C /* SCNetworkConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               1572C4BA0CFB55B400E2776E /* SCNetworkConfigurationInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15AD7A3A0670A85900BFE03C /* SCNetworkConfigurationInternal.h */; settings = {ATTRIBUTES = (); }; };
+               1572C4BB0CFB55B400E2776E /* SCNetwork.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693305C0722B0099E85F /* SCNetwork.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               1572C4BC0CFB55B400E2776E /* SCNetworkConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693505C0722B0099E85F /* SCNetworkConnection.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               1572C4BD0CFB55B400E2776E /* SCNetworkReachability.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693705C0722B0099E85F /* SCNetworkReachability.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               1572C4BE0CFB55B400E2776E /* SCValidation.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693905C0722B0099E85F /* SCValidation.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               1572C4BF0CFB55B400E2776E /* DHCPClientPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693D05C0722B0099E85F /* DHCPClientPreferences.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               1572C4C00CFB55B400E2776E /* SCDynamicStoreCopyDHCPInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693F05C0722B0099E85F /* SCDynamicStoreCopyDHCPInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               1572C4C10CFB55B400E2776E /* moh_msg.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694105C0722B0099E85F /* moh_msg.h */; };
+               1572C4C20CFB55B400E2776E /* moh.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694305C0722B0099E85F /* moh.h */; };
+               1572C4C30CFB55B400E2776E /* DeviceOnHold.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694505C0722B0099E85F /* DeviceOnHold.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1572C4C50CFB55B400E2776E /* dy_framework.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694905C0722B0099E85F /* dy_framework.h */; };
+               1572C4C70CFB55B400E2776E /* SCPreferencesPathKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 151BDA2B05D9E28B00657BC7 /* SCPreferencesPathKey.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1572C4C80CFB55B400E2776E /* dnsinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0905FD1B670096477F /* dnsinfo.h */; };
+               1572C4C90CFB55B400E2776E /* dnsinfo_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0C05FD1B670096477F /* dnsinfo_private.h */; };
+               1572C4CA0CFB55B400E2776E /* pppcontroller_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 23C1E2B4062DD2C700835B54 /* pppcontroller_types.h */; };
+               1572C4CB0CFB55B400E2776E /* pppcontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = 23C1E2BE062DD5DB00835B54 /* pppcontroller.h */; };
+               1572C4CE0CFB55B400E2776E /* SCPreferencesSetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 156BD6BB07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1572C4CF0CFB55B400E2776E /* SCPreferencesGetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 154CF3F307E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1572C4D00CFB55B400E2776E /* SCNetworkConfigurationPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 155A1E6B081079CC00F70D98 /* SCNetworkConfigurationPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1572C4D10CFB55B400E2776E /* helper_comm.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DAF2D708466D4900D1B2BD /* helper_comm.h */; };
+               1572C4D20CFB55B400E2776E /* SCHelper_client.h in Headers */ = {isa = PBXBuildFile; fileRef = 155B7BF60847776D00F0E262 /* SCHelper_client.h */; };
+               1572C4D40CFB55B400E2776E /* SCNetworkConnectionPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15A2972E0A13C08C009879B3 /* SCNetworkConnectionPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1572C4D50CFB55B400E2776E /* SCPreferencesKeychainPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 152E68C00A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1572C4D60CFB55B400E2776E /* SCSchemaDefinitionsPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 157A88880A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1572C4D70CFB55B400E2776E /* SCNetworkSignature.h in Headers */ = {isa = PBXBuildFile; fileRef = F95B8A440B03E09300993BA3 /* SCNetworkSignature.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1572C4D80CFB55B400E2776E /* SCNetworkSignaturePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = F95B8A450B03E09300993BA3 /* SCNetworkSignaturePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1572C4DA0CFB55B400E2776E /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 15A6F7C20A4B266D00B907EA /* Localizable.strings */; };
+               1572C4DB0CFB55B400E2776E /* NetworkInterface.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1577253606EFBF3100D7B52B /* NetworkInterface.strings */; };
+               1572C4DC0CFB55B400E2776E /* NetworkConfiguration.plist in Resources */ = {isa = PBXBuildFile; fileRef = 15B686220678B65C00FF4023 /* NetworkConfiguration.plist */; };
+               1572C4DD0CFB55B400E2776E /* get-mobility-info in Resources */ = {isa = PBXBuildFile; fileRef = 15CFC229068B222F00123568 /* get-mobility-info */; };
+               1572C4DF0CFB55B400E2776E /* SCSchemaDefinitions.c in Sources */ = {isa = PBXBuildFile; fileRef = 150607BD075A00A200B147BA /* SCSchemaDefinitions.c */; };
+               1572C4E00CFB55B400E2776E /* SCD.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695005C0722B0099E85F /* SCD.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4E10CFB55B400E2776E /* SCDKeys.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695205C0722B0099E85F /* SCDKeys.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4E20CFB55B400E2776E /* SCDPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695405C0722B0099E85F /* SCDPrivate.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4E30CFB55B400E2776E /* SCDPlugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695605C0722B0099E85F /* SCDPlugin.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4E40CFB55B400E2776E /* SCDOpen.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695805C0722B0099E85F /* SCDOpen.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4E50CFB55B400E2776E /* SCDLock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695A05C0722B0099E85F /* SCDLock.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4E60CFB55B400E2776E /* SCDUnlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695C05C0722B0099E85F /* SCDUnlock.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4E70CFB55B400E2776E /* SCDList.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695E05C0722B0099E85F /* SCDList.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4E80CFB55B400E2776E /* SCDAdd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696005C0722B0099E85F /* SCDAdd.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4E90CFB55B400E2776E /* SCDGet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696405C0722B0099E85F /* SCDGet.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4EA0CFB55B400E2776E /* SCDSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696605C0722B0099E85F /* SCDSet.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4EB0CFB55B400E2776E /* SCDRemove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696805C0722B0099E85F /* SCDRemove.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4EC0CFB55B400E2776E /* SCDTouch.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696A05C0722B0099E85F /* SCDTouch.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4ED0CFB55B400E2776E /* SCDNotify.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696C05C0722B0099E85F /* SCDNotify.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4EE0CFB55B400E2776E /* SCDNotifierSetKeys.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696E05C0722B0099E85F /* SCDNotifierSetKeys.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4EF0CFB55B400E2776E /* SCDNotifierAdd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697005C0722B0099E85F /* SCDNotifierAdd.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4F00CFB55B400E2776E /* SCDNotifierRemove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697205C0722B0099E85F /* SCDNotifierRemove.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4F10CFB55B400E2776E /* SCDNotifierGetChanges.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697405C0722B0099E85F /* SCDNotifierGetChanges.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4F20CFB55B400E2776E /* SCDNotifierWait.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697605C0722B0099E85F /* SCDNotifierWait.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4F30CFB55B400E2776E /* SCDNotifierInformViaCallback.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697805C0722B0099E85F /* SCDNotifierInformViaCallback.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4F40CFB55B400E2776E /* SCDNotifierInformViaMachPort.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697A05C0722B0099E85F /* SCDNotifierInformViaMachPort.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4F50CFB55B400E2776E /* SCDNotifierInformViaFD.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697C05C0722B0099E85F /* SCDNotifierInformViaFD.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4F60CFB55B400E2776E /* SCDNotifierInformViaSignal.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697E05C0722B0099E85F /* SCDNotifierInformViaSignal.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4F70CFB55B400E2776E /* SCDNotifierCancel.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698005C0722B0099E85F /* SCDNotifierCancel.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4F80CFB55B400E2776E /* SCDSnapshot.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698205C0722B0099E85F /* SCDSnapshot.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4F90CFB55B400E2776E /* SCP.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698405C0722B0099E85F /* SCP.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4FA0CFB55B400E2776E /* SCPOpen.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698605C0722B0099E85F /* SCPOpen.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4FB0CFB55B400E2776E /* SCPLock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698805C0722B0099E85F /* SCPLock.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4FC0CFB55B400E2776E /* SCPUnlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698A05C0722B0099E85F /* SCPUnlock.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4FD0CFB55B400E2776E /* SCPList.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698C05C0722B0099E85F /* SCPList.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4FE0CFB55B400E2776E /* SCPGet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698E05C0722B0099E85F /* SCPGet.c */; settings = {ATTRIBUTES = (); }; };
+               1572C4FF0CFB55B400E2776E /* SCPAdd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699005C0722B0099E85F /* SCPAdd.c */; settings = {ATTRIBUTES = (); }; };
+               1572C5000CFB55B400E2776E /* SCPSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699205C0722B0099E85F /* SCPSet.c */; settings = {ATTRIBUTES = (); }; };
+               1572C5010CFB55B400E2776E /* SCPRemove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699405C0722B0099E85F /* SCPRemove.c */; settings = {ATTRIBUTES = (); }; };
+               1572C5020CFB55B400E2776E /* SCPCommit.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699605C0722B0099E85F /* SCPCommit.c */; settings = {ATTRIBUTES = (); }; };
+               1572C5030CFB55B400E2776E /* SCPApply.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699805C0722B0099E85F /* SCPApply.c */; settings = {ATTRIBUTES = (); }; };
+               1572C5040CFB55B400E2776E /* SCPPath.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699A05C0722B0099E85F /* SCPPath.c */; settings = {ATTRIBUTES = (); }; };
+               1572C5060CFB55B400E2776E /* SCDHostName.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699E05C0722B0099E85F /* SCDHostName.c */; settings = {ATTRIBUTES = (); }; };
+               1572C5070CFB55B400E2776E /* SCLocation.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A005C0722B0099E85F /* SCLocation.c */; settings = {ATTRIBUTES = (); }; };
+               1572C5080CFB55B400E2776E /* SCNetwork.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A205C0722B0099E85F /* SCNetwork.c */; settings = {ATTRIBUTES = (); }; };
+               1572C5090CFB55B400E2776E /* pppcontroller.defs in Sources */ = {isa = PBXBuildFile; fileRef = 23C1E2B8062DD45900835B54 /* pppcontroller.defs */; settings = {ATTRIBUTES = (Client, ); }; };
+               1572C50A0CFB55B400E2776E /* SCNetworkConnection.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A405C0722B0099E85F /* SCNetworkConnection.c */; settings = {ATTRIBUTES = (); }; };
+               1572C50B0CFB55B400E2776E /* SCNetworkConnectionPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 15A2972D0A13C08C009879B3 /* SCNetworkConnectionPrivate.c */; };
+               1572C50C0CFB55B400E2776E /* SCNetworkReachability.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A605C0722B0099E85F /* SCNetworkReachability.c */; settings = {ATTRIBUTES = (); }; };
+               1572C50D0CFB55B400E2776E /* SCProxies.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A805C0722B0099E85F /* SCProxies.c */; settings = {ATTRIBUTES = (); }; };
+               1572C50E0CFB55B400E2776E /* DHCP.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69AC05C0722B0099E85F /* DHCP.c */; settings = {ATTRIBUTES = (); }; };
+               1572C50F0CFB55B400E2776E /* moh.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69AE05C0722B0099E85F /* moh.c */; settings = {ATTRIBUTES = (); }; };
+               1572C5100CFB55B400E2776E /* DeviceOnHold.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B005C0722B0099E85F /* DeviceOnHold.c */; settings = {ATTRIBUTES = (); }; };
+               1572C5110CFB55B400E2776E /* LinkConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B205C0722B0099E85F /* LinkConfiguration.c */; settings = {ATTRIBUTES = (); }; };
+               1572C5120CFB55B400E2776E /* dy_framework.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B405C0722B0099E85F /* dy_framework.c */; settings = {ATTRIBUTES = (); }; };
+               1572C5140CFB55B400E2776E /* config.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69BE05C0722B0099E85F /* config.defs */; settings = {ATTRIBUTES = (Client, ); }; };
+               1572C5150CFB55B400E2776E /* SCPreferencesPathKey.c in Sources */ = {isa = PBXBuildFile; fileRef = 151BDA5D05D9E2ED00657BC7 /* SCPreferencesPathKey.c */; };
+               1572C5160CFB55B400E2776E /* dnsinfo_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0B05FD1B670096477F /* dnsinfo_private.c */; };
+               1572C5170CFB55B400E2776E /* dnsinfo_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0805FD1B670096477F /* dnsinfo_copy.c */; };
+               1572C5180CFB55B400E2776E /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; settings = {ATTRIBUTES = (Client, ); }; };
+               1572C5190CFB55B400E2776E /* SCNetworkConfigurationInternal.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A390670A85900BFE03C /* SCNetworkConfigurationInternal.c */; };
+               1572C51A0CFB55B400E2776E /* SCNetworkInterface.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3B0670A85900BFE03C /* SCNetworkInterface.c */; };
+               1572C51B0CFB55B400E2776E /* SCNetworkProtocol.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3C0670A85900BFE03C /* SCNetworkProtocol.c */; };
+               1572C51C0CFB55B400E2776E /* SCNetworkService.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3D0670A85900BFE03C /* SCNetworkService.c */; };
+               1572C51D0CFB55B400E2776E /* SCNetworkSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3E0670A85900BFE03C /* SCNetworkSet.c */; };
+               1572C51F0CFB55B400E2776E /* helper_comm.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D608466D4900D1B2BD /* helper_comm.c */; };
+               1572C5200CFB55B400E2776E /* SCHelper_client.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D808466D4900D1B2BD /* SCHelper_client.c */; };
+               1572C5210CFB55B400E2776E /* SCPreferencesKeychainPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 152E68C20A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c */; };
+               1572C5220CFB55B400E2776E /* SCNetworkSignature.c in Sources */ = {isa = PBXBuildFile; fileRef = F95B8A420B03E07A00993BA3 /* SCNetworkSignature.c */; };
+               1572C5240CFB55B400E2776E /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
                1572EB7B0A506D3B00D02459 /* smb-configuration.c in Sources */ = {isa = PBXBuildFile; fileRef = 1572EB7A0A506D3B00D02459 /* smb-configuration.c */; };
                1572EB7B0A506D3B00D02459 /* smb-configuration.c in Sources */ = {isa = PBXBuildFile; fileRef = 1572EB7A0A506D3B00D02459 /* smb-configuration.c */; };
+               157433E00D4A8122002ACA73 /* scselect.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A2E05C0722B0099E85F /* scselect.c */; settings = {ATTRIBUTES = (); }; };
+               157433E20D4A8122002ACA73 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
+               157433E30D4A8122002ACA73 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1547072E0D1F70C80075C28D /* SystemConfiguration.framework */; };
+               157433F20D4A8137002ACA73 /* scutil.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4305C0722B0099E85F /* scutil.h */; };
+               157433F30D4A8137002ACA73 /* commands.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4505C0722B0099E85F /* commands.h */; };
+               157433F40D4A8137002ACA73 /* dictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4705C0722B0099E85F /* dictionary.h */; };
+               157433F50D4A8137002ACA73 /* session.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4905C0722B0099E85F /* session.h */; };
+               157433F60D4A8137002ACA73 /* cache.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4B05C0722B0099E85F /* cache.h */; };
+               157433F70D4A8137002ACA73 /* notifications.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4D05C0722B0099E85F /* notifications.h */; };
+               157433F80D4A8137002ACA73 /* tests.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A4F05C0722B0099E85F /* tests.h */; };
+               157433F90D4A8137002ACA73 /* prefs.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB6A5105C0722B0099E85F /* prefs.h */; };
+               157433FA0D4A8137002ACA73 /* net.h in Headers */ = {isa = PBXBuildFile; fileRef = 15A509A406C2518F001F0AB7 /* net.h */; };
+               157433FB0D4A8137002ACA73 /* net_interface.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DC34680711D49400A3311C /* net_interface.h */; };
+               157433FC0D4A8137002ACA73 /* net_protocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DC346A0711D49400A3311C /* net_protocol.h */; };
+               157433FD0D4A8137002ACA73 /* net_service.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DC346C0711D49400A3311C /* net_service.h */; };
+               157433FE0D4A8137002ACA73 /* net_set.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DC346E0711D49400A3311C /* net_set.h */; };
+               157434000D4A8137002ACA73 /* scutil.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5405C0722B0099E85F /* scutil.c */; settings = {ATTRIBUTES = (); }; };
+               157434010D4A8137002ACA73 /* commands.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5605C0722B0099E85F /* commands.c */; settings = {ATTRIBUTES = (); }; };
+               157434020D4A8137002ACA73 /* dictionary.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5805C0722B0099E85F /* dictionary.c */; settings = {ATTRIBUTES = (); }; };
+               157434030D4A8137002ACA73 /* session.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5A05C0722B0099E85F /* session.c */; settings = {ATTRIBUTES = (); }; };
+               157434040D4A8137002ACA73 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5C05C0722B0099E85F /* cache.c */; settings = {ATTRIBUTES = (); }; };
+               157434050D4A8137002ACA73 /* notifications.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A5E05C0722B0099E85F /* notifications.c */; settings = {ATTRIBUTES = (); }; };
+               157434060D4A8137002ACA73 /* tests.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A6005C0722B0099E85F /* tests.c */; settings = {ATTRIBUTES = (); }; };
+               157434070D4A8137002ACA73 /* prefs.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A6205C0722B0099E85F /* prefs.c */; settings = {ATTRIBUTES = (); }; };
+               157434080D4A8137002ACA73 /* net.c in Sources */ = {isa = PBXBuildFile; fileRef = 15A509A306C2518F001F0AB7 /* net.c */; };
+               157434090D4A8137002ACA73 /* net_interface.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DC34670711D49400A3311C /* net_interface.c */; };
+               1574340A0D4A8137002ACA73 /* net_protocol.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DC34690711D49400A3311C /* net_protocol.c */; };
+               1574340B0D4A8137002ACA73 /* net_service.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DC346B0711D49400A3311C /* net_service.c */; };
+               1574340C0D4A8137002ACA73 /* net_set.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DC346D0711D49400A3311C /* net_set.c */; };
+               1574340E0D4A8137002ACA73 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
+               1574340F0D4A8137002ACA73 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1547072E0D1F70C80075C28D /* SystemConfiguration.framework */; };
+               157434110D4A8137002ACA73 /* libedit.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 152CEED0070CF6640050F23C /* libedit.dylib */; };
+               15792B9B0DA2C190008DDED9 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1543636A0752D03C00A8EC6C /* IOKit.framework */; };
+               157A84DA0D56C63900B6F1A0 /* dnsinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0905FD1B670096477F /* dnsinfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               157A84DB0D56C63900B6F1A0 /* dnsinfo_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0C05FD1B670096477F /* dnsinfo_private.h */; };
+               157A84DE0D56C63900B6F1A0 /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; settings = {ATTRIBUTES = (Client, ); }; };
+               157A84DF0D56C63900B6F1A0 /* dnsinfo_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0805FD1B670096477F /* dnsinfo_copy.c */; };
+               157A84E00D56C63900B6F1A0 /* dnsinfo_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0B05FD1B670096477F /* dnsinfo_private.c */; };
+               157A84F60D56C7E800B6F1A0 /* dns-configuration.h in Headers */ = {isa = PBXBuildFile; fileRef = 155D22380AF13A7300D52ED0 /* dns-configuration.h */; };
+               157A84F70D56C7E800B6F1A0 /* set-hostname.h in Headers */ = {isa = PBXBuildFile; fileRef = 155D22390AF13A7300D52ED0 /* set-hostname.h */; };
+               157A84FB0D56C7E800B6F1A0 /* dns-configuration.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AA07528B36004F8947 /* dns-configuration.c */; };
+               157A84FC0D56C7E800B6F1A0 /* set-hostname.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AB07528B36004F8947 /* set-hostname.c */; };
+               157A85080D56C8AA00B6F1A0 /* ifnamer.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AE07528B36004F8947 /* ifnamer.c */; };
+               157A85120D56C8E000B6F1A0 /* cache.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53CB07528B36004F8947 /* cache.h */; };
+               157A85140D56C8E000B6F1A0 /* ev_dlil.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53B207528B36004F8947 /* ev_dlil.h */; };
+               157A85150D56C8E000B6F1A0 /* ev_ipv4.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53B807528B36004F8947 /* ev_ipv4.h */; };
+               157A85160D56C8E000B6F1A0 /* ev_ipv6.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53BA07528B36004F8947 /* ev_ipv6.h */; };
+               157A85170D56C8E000B6F1A0 /* eventmon.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53B707528B36004F8947 /* eventmon.h */; };
+               157A85190D56C8E000B6F1A0 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53CA07528B36004F8947 /* cache.c */; };
+               157A851B0D56C8E000B6F1A0 /* ev_dlil.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B107528B36004F8947 /* ev_dlil.c */; };
+               157A851C0D56C8E000B6F1A0 /* ev_ipv4.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B307528B36004F8947 /* ev_ipv4.c */; };
+               157A851D0D56C8E000B6F1A0 /* ev_ipv6.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B407528B36004F8947 /* ev_ipv6.c */; };
+               157A851E0D56C8E000B6F1A0 /* eventmon.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B007528B36004F8947 /* eventmon.c */; };
+               157A85290D56C91100B6F1A0 /* linkconfig.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53C107528B36004F8947 /* linkconfig.c */; };
+               157A85340D56C94F00B6F1A0 /* NetworkIdentification.c in Sources */ = {isa = PBXBuildFile; fileRef = F95B8A680B03F97800993BA3 /* NetworkIdentification.c */; };
+               157A853F0D56C96F00B6F1A0 /* prefsmon.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53C307528B36004F8947 /* prefsmon.c */; };
                157A88890A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 157A88880A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                157A88890A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 157A88880A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               158ADD0E0754F1A000124717 /* Resolvers.plist in Resources */ = {isa = PBXBuildFile; fileRef = 159D53A807528B36004F8947 /* Resolvers.plist */; };
+               158317250CFB80A1006F62B9 /* configd.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69CF05C0722B0099E85F /* configd.h */; };
+               158317260CFB80A1006F62B9 /* _SCD.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69D105C0722B0099E85F /* _SCD.h */; };
+               158317270CFB80A1006F62B9 /* configd_server.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69D305C0722B0099E85F /* configd_server.h */; };
+               158317280CFB80A1006F62B9 /* notify_server.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69D505C0722B0099E85F /* notify_server.h */; };
+               158317290CFB80A1006F62B9 /* plugin_support.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69D705C0722B0099E85F /* plugin_support.h */; };
+               1583172A0CFB80A1006F62B9 /* session.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69D905C0722B0099E85F /* session.h */; };
+               1583172B0CFB80A1006F62B9 /* pattern.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB69DB05C0722B0099E85F /* pattern.h */; };
+               1583172D0CFB80A1006F62B9 /* configd.m in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69E005C0722B0099E85F /* configd.m */; settings = {ATTRIBUTES = (); }; };
+               1583172E0CFB80A1006F62B9 /* _SCD.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69E205C0722B0099E85F /* _SCD.c */; settings = {ATTRIBUTES = (); }; };
+               1583172F0CFB80A1006F62B9 /* configd_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69E405C0722B0099E85F /* configd_server.c */; settings = {ATTRIBUTES = (); }; };
+               158317300CFB80A1006F62B9 /* notify_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69E605C0722B0099E85F /* notify_server.c */; settings = {ATTRIBUTES = (); }; };
+               158317310CFB80A1006F62B9 /* plugin_support.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69E805C0722B0099E85F /* plugin_support.c */; settings = {ATTRIBUTES = (); }; };
+               158317320CFB80A1006F62B9 /* session.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69EA05C0722B0099E85F /* session.c */; settings = {ATTRIBUTES = (); }; };
+               158317330CFB80A1006F62B9 /* pattern.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69EC05C0722B0099E85F /* pattern.c */; settings = {ATTRIBUTES = (); }; };
+               158317340CFB80A1006F62B9 /* _configopen.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69F005C0722B0099E85F /* _configopen.c */; settings = {ATTRIBUTES = (); }; };
+               158317350CFB80A1006F62B9 /* _configclose.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69F205C0722B0099E85F /* _configclose.c */; settings = {ATTRIBUTES = (); }; };
+               158317360CFB80A1006F62B9 /* _configlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69F405C0722B0099E85F /* _configlock.c */; settings = {ATTRIBUTES = (); }; };
+               158317370CFB80A1006F62B9 /* _configunlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69F605C0722B0099E85F /* _configunlock.c */; settings = {ATTRIBUTES = (); }; };
+               158317380CFB80A1006F62B9 /* _configlist.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69F805C0722B0099E85F /* _configlist.c */; settings = {ATTRIBUTES = (); }; };
+               158317390CFB80A1006F62B9 /* _configadd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69FA05C0722B0099E85F /* _configadd.c */; settings = {ATTRIBUTES = (); }; };
+               1583173A0CFB80A1006F62B9 /* _configget.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69FE05C0722B0099E85F /* _configget.c */; settings = {ATTRIBUTES = (); }; };
+               1583173B0CFB80A1006F62B9 /* _configset.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0005C0722B0099E85F /* _configset.c */; settings = {ATTRIBUTES = (); }; };
+               1583173C0CFB80A1006F62B9 /* _configremove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0205C0722B0099E85F /* _configremove.c */; settings = {ATTRIBUTES = (); }; };
+               1583173D0CFB80A1006F62B9 /* _configtouch.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0405C0722B0099E85F /* _configtouch.c */; settings = {ATTRIBUTES = (); }; };
+               1583173E0CFB80A1006F62B9 /* _confignotify.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0605C0722B0099E85F /* _confignotify.c */; settings = {ATTRIBUTES = (); }; };
+               1583173F0CFB80A1006F62B9 /* _notifyadd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0805C0722B0099E85F /* _notifyadd.c */; settings = {ATTRIBUTES = (); }; };
+               158317400CFB80A1006F62B9 /* _notifyremove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0A05C0722B0099E85F /* _notifyremove.c */; settings = {ATTRIBUTES = (); }; };
+               158317410CFB80A1006F62B9 /* _notifychanges.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0C05C0722B0099E85F /* _notifychanges.c */; settings = {ATTRIBUTES = (); }; };
+               158317420CFB80A1006F62B9 /* _notifyviaport.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A0E05C0722B0099E85F /* _notifyviaport.c */; settings = {ATTRIBUTES = (); }; };
+               158317430CFB80A1006F62B9 /* _notifyviafd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A1005C0722B0099E85F /* _notifyviafd.c */; settings = {ATTRIBUTES = (); }; };
+               158317440CFB80A1006F62B9 /* _notifyviasignal.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A1205C0722B0099E85F /* _notifyviasignal.c */; settings = {ATTRIBUTES = (); }; };
+               158317450CFB80A1006F62B9 /* _notifycancel.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A1405C0722B0099E85F /* _notifycancel.c */; settings = {ATTRIBUTES = (); }; };
+               158317460CFB80A1006F62B9 /* _snapshot.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB6A1605C0722B0099E85F /* _snapshot.c */; settings = {ATTRIBUTES = (); }; };
+               158317470CFB80A1006F62B9 /* config.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69BE05C0722B0099E85F /* config.defs */; settings = {ATTRIBUTES = (Server, ); }; };
+               158317480CFB80A1006F62B9 /* dnsinfo_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0B05FD1B670096477F /* dnsinfo_private.c */; };
+               158317490CFB80A1006F62B9 /* dnsinfo_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0D05FD1B670096477F /* dnsinfo_server.c */; };
+               1583174A0CFB80A1006F62B9 /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; settings = {ATTRIBUTES = (Server, ); }; };
+               1583174C0CFB80A1006F62B9 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
+               1583174E0CFB80A1006F62B9 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1543636A0752D03C00A8EC6C /* IOKit.framework */; };
+               158317500CFB80A1006F62B9 /* libbsm.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15BAA32207F0699A00D9EC95 /* libbsm.dylib */; };
+               158317520CFB80A1006F62B9 /* libKernelEventMonitor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53D407528BDA004F8947 /* libKernelEventMonitor.a */; };
+               158317530CFB80A1006F62B9 /* libInterfaceNamer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53E507528C4A004F8947 /* libInterfaceNamer.a */; };
+               158317540CFB80A1006F62B9 /* libIPMonitor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53EC07528C61004F8947 /* libIPMonitor.a */; };
+               158317550CFB80A1006F62B9 /* libLinkConfiguration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53F307528C79004F8947 /* libLinkConfiguration.a */; };
+               158317560CFB80A1006F62B9 /* libNetworkIdentification.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F95B8A5F0B03F81400993BA3 /* libNetworkIdentification.a */; };
+               158317570CFB80A1006F62B9 /* libPreferencesMonitor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 159D53FA07528C95004F8947 /* libPreferencesMonitor.a */; };
+               1583175C0CFB80A1006F62B9 /* com.apple.configd.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1540E3600987DA9500157C07 /* com.apple.configd.plist */; };
+               1583379B0CFB6B9E0033AB93 /* helper_comm.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DAF2D708466D4900D1B2BD /* helper_comm.h */; };
+               1583379C0CFB6B9E0033AB93 /* SCHelper_client.h in Headers */ = {isa = PBXBuildFile; fileRef = 155B7BF60847776D00F0E262 /* SCHelper_client.h */; };
+               1583379E0CFB6B9E0033AB93 /* SCHelper_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D908466D4900D1B2BD /* SCHelper_server.c */; };
+               158337A00CFB6B9E0033AB93 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
+               158337A20CFB6B9E0033AB93 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1520A3DE0846B2DC0010B584 /* Security.framework */; };
+               158337AD0CFB6BDC0033AB93 /* com.apple.SCHelper-embedded.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 151356AD0CE0CF2F0017E523 /* com.apple.SCHelper-embedded.plist */; };
                158ADD190754F1F100124717 /* Kicker.xml in Resources */ = {isa = PBXBuildFile; fileRef = 159D53BC07528B36004F8947 /* Kicker.xml */; };
                158ADD1B0754F1F400124717 /* enable-network in Resources */ = {isa = PBXBuildFile; fileRef = 159D53BD07528B36004F8947 /* enable-network */; };
                158ADD190754F1F100124717 /* Kicker.xml in Resources */ = {isa = PBXBuildFile; fileRef = 159D53BC07528B36004F8947 /* Kicker.xml */; };
                158ADD1B0754F1F400124717 /* enable-network in Resources */ = {isa = PBXBuildFile; fileRef = 159D53BD07528B36004F8947 /* enable-network */; };
+               15943D440E94081800B87535 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1543636A0752D03C00A8EC6C /* IOKit.framework */; };
+               159C32B60F583724008A72EE /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1520A3DE0846B2DC0010B584 /* Security.framework */; };
+               159C9B290DB68E0700BEEF10 /* atconfig.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53C707528B36004F8947 /* atconfig.c */; };
+               159C9B2A0DB68E0800BEEF10 /* cfManager.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53C507528B36004F8947 /* cfManager.c */; };
+               159C9B2D0DB68E3D00BEEF10 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53CA07528B36004F8947 /* cache.c */; };
+               159C9B300DB68E8400BEEF10 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
+               159C9B7A0DB68E8A00BEEF10 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */; };
+               159C9B820DB68EE500BEEF10 /* kicker.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53BE07528B36004F8947 /* kicker.c */; };
+               159C9B860DB68F1600BEEF10 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
+               159C9B870DB68F1600BEEF10 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */; };
                159D540907528D3A004F8947 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53CA07528B36004F8947 /* cache.c */; };
                159D540A07528D3B004F8947 /* cache.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53CB07528B36004F8947 /* cache.h */; };
                159D540907528D3A004F8947 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53CA07528B36004F8947 /* cache.c */; };
                159D540A07528D3B004F8947 /* cache.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53CB07528B36004F8947 /* cache.h */; };
-               159D540B07528DA9004F8947 /* ev_appletalk.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B907528B36004F8947 /* ev_appletalk.c */; };
-               159D540C07528DAA004F8947 /* ev_appletalk.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53B607528B36004F8947 /* ev_appletalk.h */; };
                159D540D07528DAE004F8947 /* ev_dlil.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B107528B36004F8947 /* ev_dlil.c */; };
                159D540E07528DAE004F8947 /* ev_dlil.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53B207528B36004F8947 /* ev_dlil.h */; };
                159D540F07528DB0004F8947 /* ev_ipv4.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B307528B36004F8947 /* ev_ipv4.c */; };
                159D540D07528DAE004F8947 /* ev_dlil.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B107528B36004F8947 /* ev_dlil.c */; };
                159D540E07528DAE004F8947 /* ev_dlil.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53B207528B36004F8947 /* ev_dlil.h */; };
                159D540F07528DB0004F8947 /* ev_ipv4.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B307528B36004F8947 /* ev_ipv4.c */; };
                159D541207528DB3004F8947 /* ev_ipv6.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53BA07528B36004F8947 /* ev_ipv6.h */; };
                159D541307528DB5004F8947 /* eventmon.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B007528B36004F8947 /* eventmon.c */; };
                159D541407528DB5004F8947 /* eventmon.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53B707528B36004F8947 /* eventmon.h */; };
                159D541207528DB3004F8947 /* ev_ipv6.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53BA07528B36004F8947 /* ev_ipv6.h */; };
                159D541307528DB5004F8947 /* eventmon.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53B007528B36004F8947 /* eventmon.c */; };
                159D541407528DB5004F8947 /* eventmon.h in Headers */ = {isa = PBXBuildFile; fileRef = 159D53B707528B36004F8947 /* eventmon.h */; };
-               159D541507528DDE004F8947 /* kicker.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53BE07528B36004F8947 /* kicker.c */; };
                159D541607528DF1004F8947 /* ifnamer.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AE07528B36004F8947 /* ifnamer.c */; };
                159D541707528E05004F8947 /* ip_plugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53A707528B36004F8947 /* ip_plugin.c */; };
                159D541807528E09004F8947 /* dns-configuration.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AA07528B36004F8947 /* dns-configuration.c */; };
                159D541607528DF1004F8947 /* ifnamer.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AE07528B36004F8947 /* ifnamer.c */; };
                159D541707528E05004F8947 /* ip_plugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53A707528B36004F8947 /* ip_plugin.c */; };
                159D541807528E09004F8947 /* dns-configuration.c in Sources */ = {isa = PBXBuildFile; fileRef = 159D53AA07528B36004F8947 /* dns-configuration.c */; };
                159D54D607529FFF004F8947 /* configd.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 15CB6A2005C0722B0099E85F /* configd.8 */; };
                15A2972F0A13C08C009879B3 /* SCNetworkConnectionPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 15A2972D0A13C08C009879B3 /* SCNetworkConnectionPrivate.c */; };
                15A297300A13C08C009879B3 /* SCNetworkConnectionPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15A2972E0A13C08C009879B3 /* SCNetworkConnectionPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                159D54D607529FFF004F8947 /* configd.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 15CB6A2005C0722B0099E85F /* configd.8 */; };
                15A2972F0A13C08C009879B3 /* SCNetworkConnectionPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 15A2972D0A13C08C009879B3 /* SCNetworkConnectionPrivate.c */; };
                15A297300A13C08C009879B3 /* SCNetworkConnectionPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15A2972E0A13C08C009879B3 /* SCNetworkConnectionPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15A5A1E70D5B94190087BDA0 /* SCSchemaDefinitions.h in Headers */ = {isa = PBXBuildFile; fileRef = 150607DE075A00A300B147BA /* SCSchemaDefinitions.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               15A5A1E80D5B94190087BDA0 /* SystemConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691305C0722B0099E85F /* SystemConfiguration.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               15A5A1E90D5B94190087BDA0 /* SCPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691505C0722B0099E85F /* SCPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               15A5A1EA0D5B94190087BDA0 /* SCDPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691705C0722B0099E85F /* SCDPlugin.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15A5A1EB0D5B94190087BDA0 /* SCDynamicStoreInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691B05C0722B0099E85F /* SCDynamicStoreInternal.h */; settings = {ATTRIBUTES = (Project, ); }; };
+               15A5A1EC0D5B94190087BDA0 /* SCDynamicStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691D05C0722B0099E85F /* SCDynamicStore.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               15A5A1ED0D5B94190087BDA0 /* SCDynamicStorePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691F05C0722B0099E85F /* SCDynamicStorePrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               15A5A1EE0D5B94190087BDA0 /* SCDynamicStoreKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692105C0722B0099E85F /* SCDynamicStoreKey.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               15A5A1EF0D5B94190087BDA0 /* SCDynamicStoreCopySpecific.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692305C0722B0099E85F /* SCDynamicStoreCopySpecific.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               15A5A1F00D5B94190087BDA0 /* SCDynamicStoreCopySpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692505C0722B0099E85F /* SCDynamicStoreCopySpecificPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               15A5A1F10D5B94190087BDA0 /* SCDynamicStoreSetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692705C0722B0099E85F /* SCDynamicStoreSetSpecificPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               15A5A1F20D5B94190087BDA0 /* SCPreferencesInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692905C0722B0099E85F /* SCPreferencesInternal.h */; settings = {ATTRIBUTES = (Project, ); }; };
+               15A5A1F30D5B94190087BDA0 /* SCPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692B05C0722B0099E85F /* SCPreferences.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               15A5A1F40D5B94190087BDA0 /* SCPreferencesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692D05C0722B0099E85F /* SCPreferencesPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               15A5A1F50D5B94190087BDA0 /* SCPreferencesPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB692F05C0722B0099E85F /* SCPreferencesPath.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               15A5A1F60D5B94190087BDA0 /* SCPreferencesSetSpecific.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693105C0722B0099E85F /* SCPreferencesSetSpecific.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               15A5A1F70D5B94190087BDA0 /* SCNetworkConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15AD7A380670A85900BFE03C /* SCNetworkConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               15A5A1F80D5B94190087BDA0 /* SCNetworkConfigurationInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15AD7A3A0670A85900BFE03C /* SCNetworkConfigurationInternal.h */; settings = {ATTRIBUTES = (); }; };
+               15A5A1F90D5B94190087BDA0 /* SCNetwork.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693305C0722B0099E85F /* SCNetwork.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               15A5A1FA0D5B94190087BDA0 /* SCNetworkConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693505C0722B0099E85F /* SCNetworkConnection.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               15A5A1FB0D5B94190087BDA0 /* SCNetworkReachability.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693705C0722B0099E85F /* SCNetworkReachability.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
+               15A5A1FC0D5B94190087BDA0 /* SCValidation.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693905C0722B0099E85F /* SCValidation.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
+               15A5A1FD0D5B94190087BDA0 /* DHCPClientPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693D05C0722B0099E85F /* DHCPClientPreferences.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               15A5A1FE0D5B94190087BDA0 /* SCDynamicStoreCopyDHCPInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB693F05C0722B0099E85F /* SCDynamicStoreCopyDHCPInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               15A5A1FF0D5B94190087BDA0 /* moh_msg.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694105C0722B0099E85F /* moh_msg.h */; };
+               15A5A2000D5B94190087BDA0 /* moh.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694305C0722B0099E85F /* moh.h */; };
+               15A5A2010D5B94190087BDA0 /* DeviceOnHold.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694505C0722B0099E85F /* DeviceOnHold.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15A5A2030D5B94190087BDA0 /* dy_framework.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694905C0722B0099E85F /* dy_framework.h */; };
+               15A5A2050D5B94190087BDA0 /* SCPreferencesPathKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 151BDA2B05D9E28B00657BC7 /* SCPreferencesPathKey.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15A5A2060D5B94190087BDA0 /* dnsinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0905FD1B670096477F /* dnsinfo.h */; };
+               15A5A2070D5B94190087BDA0 /* dnsinfo_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0C05FD1B670096477F /* dnsinfo_private.h */; };
+               15A5A2080D5B94190087BDA0 /* pppcontroller_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 23C1E2B4062DD2C700835B54 /* pppcontroller_types.h */; };
+               15A5A2090D5B94190087BDA0 /* pppcontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = 23C1E2BE062DD5DB00835B54 /* pppcontroller.h */; };
+               15A5A20C0D5B94190087BDA0 /* SCPreferencesSetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 156BD6BB07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15A5A20D0D5B94190087BDA0 /* SCPreferencesGetSpecificPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 154CF3F307E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15A5A20E0D5B94190087BDA0 /* SCNetworkConfigurationPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 155A1E6B081079CC00F70D98 /* SCNetworkConfigurationPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15A5A20F0D5B94190087BDA0 /* helper_comm.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DAF2D708466D4900D1B2BD /* helper_comm.h */; };
+               15A5A2100D5B94190087BDA0 /* SCHelper_client.h in Headers */ = {isa = PBXBuildFile; fileRef = 155B7BF60847776D00F0E262 /* SCHelper_client.h */; };
+               15A5A2110D5B94190087BDA0 /* SCNetworkConnectionPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15A2972E0A13C08C009879B3 /* SCNetworkConnectionPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15A5A2120D5B94190087BDA0 /* SCPreferencesKeychainPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 152E68C00A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15A5A2130D5B94190087BDA0 /* SCSchemaDefinitionsPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 157A88880A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15A5A2140D5B94190087BDA0 /* SCNetworkSignature.h in Headers */ = {isa = PBXBuildFile; fileRef = F95B8A440B03E09300993BA3 /* SCNetworkSignature.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15A5A2150D5B94190087BDA0 /* SCNetworkSignaturePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = F95B8A450B03E09300993BA3 /* SCNetworkSignaturePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               15A5A2190D5B94190087BDA0 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 15A6F7C20A4B266D00B907EA /* Localizable.strings */; };
+               15A5A21A0D5B94190087BDA0 /* NetworkInterface.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1577253606EFBF3100D7B52B /* NetworkInterface.strings */; };
+               15A5A21B0D5B94190087BDA0 /* NetworkConfiguration.plist in Resources */ = {isa = PBXBuildFile; fileRef = 15B686220678B65C00FF4023 /* NetworkConfiguration.plist */; };
+               15A5A21E0D5B94190087BDA0 /* SCSchemaDefinitions.c in Sources */ = {isa = PBXBuildFile; fileRef = 150607BD075A00A200B147BA /* SCSchemaDefinitions.c */; };
+               15A5A21F0D5B94190087BDA0 /* SCD.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695005C0722B0099E85F /* SCD.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2200D5B94190087BDA0 /* SCDKeys.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695205C0722B0099E85F /* SCDKeys.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2210D5B94190087BDA0 /* SCDPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695405C0722B0099E85F /* SCDPrivate.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2220D5B94190087BDA0 /* SCDPlugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695605C0722B0099E85F /* SCDPlugin.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2230D5B94190087BDA0 /* SCDOpen.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695805C0722B0099E85F /* SCDOpen.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2240D5B94190087BDA0 /* SCDLock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695A05C0722B0099E85F /* SCDLock.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2250D5B94190087BDA0 /* SCDUnlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695C05C0722B0099E85F /* SCDUnlock.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2260D5B94190087BDA0 /* SCDList.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB695E05C0722B0099E85F /* SCDList.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2270D5B94190087BDA0 /* SCDAdd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696005C0722B0099E85F /* SCDAdd.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2280D5B94190087BDA0 /* SCDGet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696405C0722B0099E85F /* SCDGet.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2290D5B94190087BDA0 /* SCDSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696605C0722B0099E85F /* SCDSet.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A22A0D5B94190087BDA0 /* SCDRemove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696805C0722B0099E85F /* SCDRemove.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A22B0D5B94190087BDA0 /* SCDTouch.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696A05C0722B0099E85F /* SCDTouch.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A22C0D5B94190087BDA0 /* SCDNotify.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696C05C0722B0099E85F /* SCDNotify.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A22D0D5B94190087BDA0 /* SCDNotifierSetKeys.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB696E05C0722B0099E85F /* SCDNotifierSetKeys.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A22E0D5B94190087BDA0 /* SCDNotifierAdd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697005C0722B0099E85F /* SCDNotifierAdd.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A22F0D5B94190087BDA0 /* SCDNotifierRemove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697205C0722B0099E85F /* SCDNotifierRemove.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2300D5B94190087BDA0 /* SCDNotifierGetChanges.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697405C0722B0099E85F /* SCDNotifierGetChanges.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2310D5B94190087BDA0 /* SCDNotifierWait.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697605C0722B0099E85F /* SCDNotifierWait.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2320D5B94190087BDA0 /* SCDNotifierInformViaCallback.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697805C0722B0099E85F /* SCDNotifierInformViaCallback.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2330D5B94190087BDA0 /* SCDNotifierInformViaMachPort.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697A05C0722B0099E85F /* SCDNotifierInformViaMachPort.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2340D5B94190087BDA0 /* SCDNotifierInformViaFD.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697C05C0722B0099E85F /* SCDNotifierInformViaFD.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2350D5B94190087BDA0 /* SCDNotifierInformViaSignal.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB697E05C0722B0099E85F /* SCDNotifierInformViaSignal.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2360D5B94190087BDA0 /* SCDNotifierCancel.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698005C0722B0099E85F /* SCDNotifierCancel.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2370D5B94190087BDA0 /* SCDSnapshot.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698205C0722B0099E85F /* SCDSnapshot.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2380D5B94190087BDA0 /* SCP.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698405C0722B0099E85F /* SCP.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2390D5B94190087BDA0 /* SCPOpen.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698605C0722B0099E85F /* SCPOpen.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A23A0D5B94190087BDA0 /* SCPLock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698805C0722B0099E85F /* SCPLock.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A23B0D5B94190087BDA0 /* SCPUnlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698A05C0722B0099E85F /* SCPUnlock.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A23C0D5B94190087BDA0 /* SCPList.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698C05C0722B0099E85F /* SCPList.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A23D0D5B94190087BDA0 /* SCPGet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB698E05C0722B0099E85F /* SCPGet.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A23E0D5B94190087BDA0 /* SCPAdd.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699005C0722B0099E85F /* SCPAdd.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A23F0D5B94190087BDA0 /* SCPSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699205C0722B0099E85F /* SCPSet.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2400D5B94190087BDA0 /* SCPRemove.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699405C0722B0099E85F /* SCPRemove.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2410D5B94190087BDA0 /* SCPCommit.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699605C0722B0099E85F /* SCPCommit.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2420D5B94190087BDA0 /* SCPApply.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699805C0722B0099E85F /* SCPApply.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2430D5B94190087BDA0 /* SCPPath.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699A05C0722B0099E85F /* SCPPath.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2450D5B94190087BDA0 /* SCDHostName.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB699E05C0722B0099E85F /* SCDHostName.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2460D5B94190087BDA0 /* SCLocation.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A005C0722B0099E85F /* SCLocation.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2470D5B94190087BDA0 /* SCNetwork.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A205C0722B0099E85F /* SCNetwork.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2480D5B94190087BDA0 /* pppcontroller.defs in Sources */ = {isa = PBXBuildFile; fileRef = 23C1E2B8062DD45900835B54 /* pppcontroller.defs */; settings = {ATTRIBUTES = (Client, ); }; };
+               15A5A2490D5B94190087BDA0 /* SCNetworkConnection.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A405C0722B0099E85F /* SCNetworkConnection.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A24A0D5B94190087BDA0 /* SCNetworkConnectionPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 15A2972D0A13C08C009879B3 /* SCNetworkConnectionPrivate.c */; };
+               15A5A24B0D5B94190087BDA0 /* SCNetworkReachability.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A605C0722B0099E85F /* SCNetworkReachability.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A24C0D5B94190087BDA0 /* SCProxies.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69A805C0722B0099E85F /* SCProxies.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A24D0D5B94190087BDA0 /* DHCP.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69AC05C0722B0099E85F /* DHCP.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A24E0D5B94190087BDA0 /* moh.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69AE05C0722B0099E85F /* moh.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A24F0D5B94190087BDA0 /* DeviceOnHold.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B005C0722B0099E85F /* DeviceOnHold.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2500D5B94190087BDA0 /* LinkConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B205C0722B0099E85F /* LinkConfiguration.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2510D5B94190087BDA0 /* dy_framework.c in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69B405C0722B0099E85F /* dy_framework.c */; settings = {ATTRIBUTES = (); }; };
+               15A5A2530D5B94190087BDA0 /* config.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15CB69BE05C0722B0099E85F /* config.defs */; settings = {ATTRIBUTES = (Client, ); }; };
+               15A5A2540D5B94190087BDA0 /* SCPreferencesPathKey.c in Sources */ = {isa = PBXBuildFile; fileRef = 151BDA5D05D9E2ED00657BC7 /* SCPreferencesPathKey.c */; };
+               15A5A2550D5B94190087BDA0 /* dnsinfo_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0B05FD1B670096477F /* dnsinfo_private.c */; };
+               15A5A2560D5B94190087BDA0 /* dnsinfo_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0805FD1B670096477F /* dnsinfo_copy.c */; };
+               15A5A2570D5B94190087BDA0 /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; settings = {ATTRIBUTES = (Client, ); }; };
+               15A5A2580D5B94190087BDA0 /* SCNetworkConfigurationInternal.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A390670A85900BFE03C /* SCNetworkConfigurationInternal.c */; };
+               15A5A2590D5B94190087BDA0 /* SCNetworkInterface.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3B0670A85900BFE03C /* SCNetworkInterface.c */; };
+               15A5A25A0D5B94190087BDA0 /* SCNetworkProtocol.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3C0670A85900BFE03C /* SCNetworkProtocol.c */; };
+               15A5A25B0D5B94190087BDA0 /* SCNetworkService.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3D0670A85900BFE03C /* SCNetworkService.c */; };
+               15A5A25C0D5B94190087BDA0 /* SCNetworkSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3E0670A85900BFE03C /* SCNetworkSet.c */; };
+               15A5A25E0D5B94190087BDA0 /* helper_comm.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D608466D4900D1B2BD /* helper_comm.c */; };
+               15A5A25F0D5B94190087BDA0 /* SCHelper_client.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D808466D4900D1B2BD /* SCHelper_client.c */; };
+               15A5A2600D5B94190087BDA0 /* SCPreferencesKeychainPrivate.c in Sources */ = {isa = PBXBuildFile; fileRef = 152E68C20A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c */; };
+               15A5A2610D5B94190087BDA0 /* SCNetworkSignature.c in Sources */ = {isa = PBXBuildFile; fileRef = F95B8A420B03E07A00993BA3 /* SCNetworkSignature.c */; };
+               15A5A2630D5B94190087BDA0 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
                15A6F7C40A4B266D00B907EA /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 15A6F7C20A4B266D00B907EA /* Localizable.strings */; };
                15BAA32307F0699A00D9EC95 /* libbsm.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15BAA32207F0699A00D9EC95 /* libbsm.dylib */; };
                15A6F7C40A4B266D00B907EA /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 15A6F7C20A4B266D00B907EA /* Localizable.strings */; };
                15BAA32307F0699A00D9EC95 /* libbsm.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15BAA32207F0699A00D9EC95 /* libbsm.dylib */; };
+               15D48EBF0F67061600B4711E /* dnsinfo_create.c in Sources */ = {isa = PBXBuildFile; fileRef = 1521FC5C060F296A003B28F5 /* dnsinfo_create.c */; };
+               15D48EC00F67061700B4711E /* dnsinfo_create.h in Headers */ = {isa = PBXBuildFile; fileRef = 1532629006281C9D00B1C10C /* dnsinfo_create.h */; };
+               15D48EC10F67061F00B4711E /* dnsinfo_create.c in Sources */ = {isa = PBXBuildFile; fileRef = 1521FC5C060F296A003B28F5 /* dnsinfo_create.c */; };
+               15D48EC20F67061F00B4711E /* dnsinfo_create.h in Headers */ = {isa = PBXBuildFile; fileRef = 1532629006281C9D00B1C10C /* dnsinfo_create.h */; };
+               15D48ED30F67079B00B4711E /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; };
+               15D48ED40F6707A600B4711E /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; };
                15DAD5E1075913CE0084A6ED /* dnsinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0905FD1B670096477F /* dnsinfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
                15DAD5E2075913CE0084A6ED /* dnsinfo_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0C05FD1B670096477F /* dnsinfo_private.h */; };
                15DAD5E1075913CE0084A6ED /* dnsinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0905FD1B670096477F /* dnsinfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
                15DAD5E2075913CE0084A6ED /* dnsinfo_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0C05FD1B670096477F /* dnsinfo_private.h */; };
-               15DAD5E3075913CE0084A6ED /* dnsinfo_create.h in Headers */ = {isa = PBXBuildFile; fileRef = 1532629006281C9D00B1C10C /* dnsinfo_create.h */; settings = {ATTRIBUTES = (Public, ); }; };
                15DAD5E5075913CE0084A6ED /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; settings = {ATTRIBUTES = (Client, ); }; };
                15DAD5E6075913CE0084A6ED /* dnsinfo_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0805FD1B670096477F /* dnsinfo_copy.c */; };
                15DAD5E7075913CE0084A6ED /* dnsinfo_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0B05FD1B670096477F /* dnsinfo_private.c */; };
                15DAD5E5075913CE0084A6ED /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; settings = {ATTRIBUTES = (Client, ); }; };
                15DAD5E6075913CE0084A6ED /* dnsinfo_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0805FD1B670096477F /* dnsinfo_copy.c */; };
                15DAD5E7075913CE0084A6ED /* dnsinfo_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0B05FD1B670096477F /* dnsinfo_private.c */; };
-               15DAD5E8075913CE0084A6ED /* dnsinfo_create.c in Sources */ = {isa = PBXBuildFile; fileRef = 1521FC5C060F296A003B28F5 /* dnsinfo_create.c */; };
                15DAD64307591A1A0084A6ED /* SystemConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691305C0722B0099E85F /* SystemConfiguration.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
                15DAD64407591A1A0084A6ED /* SCPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691505C0722B0099E85F /* SCPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
                15DAD64507591A1A0084A6ED /* SCDPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691705C0722B0099E85F /* SCDPlugin.h */; settings = {ATTRIBUTES = (Private, ); }; };
                15DAD64307591A1A0084A6ED /* SystemConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691305C0722B0099E85F /* SystemConfiguration.h */; settings = {ATTRIBUTES = (Public, Project, ); }; };
                15DAD64407591A1A0084A6ED /* SCPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691505C0722B0099E85F /* SCPrivate.h */; settings = {ATTRIBUTES = (Project, Private, ); }; };
                15DAD64507591A1A0084A6ED /* SCDPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB691705C0722B0099E85F /* SCDPlugin.h */; settings = {ATTRIBUTES = (Private, ); }; };
                15DAD65C07591A1A0084A6ED /* DeviceOnHold.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694505C0722B0099E85F /* DeviceOnHold.h */; settings = {ATTRIBUTES = (Private, ); }; };
                15DAD65D07591A1A0084A6ED /* LinkConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694705C0722B0099E85F /* LinkConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; };
                15DAD65E07591A1A0084A6ED /* dy_framework.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694905C0722B0099E85F /* dy_framework.h */; };
                15DAD65C07591A1A0084A6ED /* DeviceOnHold.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694505C0722B0099E85F /* DeviceOnHold.h */; settings = {ATTRIBUTES = (Private, ); }; };
                15DAD65D07591A1A0084A6ED /* LinkConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694705C0722B0099E85F /* LinkConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; };
                15DAD65E07591A1A0084A6ED /* dy_framework.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694905C0722B0099E85F /* dy_framework.h */; };
-               15DAD65F07591A1A0084A6ED /* VLANConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 15CB694B05C0722B0099E85F /* VLANConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; };
                15DAD66107591A1A0084A6ED /* SCPreferencesPathKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 151BDA2B05D9E28B00657BC7 /* SCPreferencesPathKey.h */; settings = {ATTRIBUTES = (Private, ); }; };
                15DAD66207591A1A0084A6ED /* dnsinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0905FD1B670096477F /* dnsinfo.h */; };
                15DAD66307591A1A0084A6ED /* dnsinfo_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0C05FD1B670096477F /* dnsinfo_private.h */; };
                15DAD66407591A1A0084A6ED /* pppcontroller_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 23C1E2B4062DD2C700835B54 /* pppcontroller_types.h */; };
                15DAD66507591A1A0084A6ED /* pppcontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = 23C1E2BE062DD5DB00835B54 /* pppcontroller.h */; };
                15DAD66107591A1A0084A6ED /* SCPreferencesPathKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 151BDA2B05D9E28B00657BC7 /* SCPreferencesPathKey.h */; settings = {ATTRIBUTES = (Private, ); }; };
                15DAD66207591A1A0084A6ED /* dnsinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0905FD1B670096477F /* dnsinfo.h */; };
                15DAD66307591A1A0084A6ED /* dnsinfo_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B73F0C05FD1B670096477F /* dnsinfo_private.h */; };
                15DAD66407591A1A0084A6ED /* pppcontroller_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 23C1E2B4062DD2C700835B54 /* pppcontroller_types.h */; };
                15DAD66507591A1A0084A6ED /* pppcontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = 23C1E2BE062DD5DB00835B54 /* pppcontroller.h */; };
-               15DAD66607591A1A0084A6ED /* BondConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 9EE943F406AF409B00772EB5 /* BondConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               15DAD66707591A1A0084A6ED /* BondConfigurationPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 9EE943F506AF409B00772EB5 /* BondConfigurationPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                15DAD66907591A1A0084A6ED /* NetworkConfiguration.plist in Resources */ = {isa = PBXBuildFile; fileRef = 15B686220678B65C00FF4023 /* NetworkConfiguration.plist */; };
                15DAD66A07591A1A0084A6ED /* get-mobility-info in Resources */ = {isa = PBXBuildFile; fileRef = 15CFC229068B222F00123568 /* get-mobility-info */; };
                15DAD66B07591A1A0084A6ED /* NetworkInterface.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1577253606EFBF3100D7B52B /* NetworkInterface.strings */; };
                15DAD66907591A1A0084A6ED /* NetworkConfiguration.plist in Resources */ = {isa = PBXBuildFile; fileRef = 15B686220678B65C00FF4023 /* NetworkConfiguration.plist */; };
                15DAD66A07591A1A0084A6ED /* get-mobility-info in Resources */ = {isa = PBXBuildFile; fileRef = 15CFC229068B222F00123568 /* get-mobility-info */; };
                15DAD66B07591A1A0084A6ED /* NetworkInterface.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1577253606EFBF3100D7B52B /* NetworkInterface.strings */; };
                15DAD6A407591A1A0084A6ED /* dnsinfo_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0805FD1B670096477F /* dnsinfo_copy.c */; };
                15DAD6A507591A1A0084A6ED /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; settings = {ATTRIBUTES = (Client, ); }; };
                15DAD6A607591A1A0084A6ED /* SCNetworkConfigurationInternal.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A390670A85900BFE03C /* SCNetworkConfigurationInternal.c */; };
                15DAD6A407591A1A0084A6ED /* dnsinfo_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 15B73F0805FD1B670096477F /* dnsinfo_copy.c */; };
                15DAD6A507591A1A0084A6ED /* shared_dns_info.defs in Sources */ = {isa = PBXBuildFile; fileRef = 15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */; settings = {ATTRIBUTES = (Client, ); }; };
                15DAD6A607591A1A0084A6ED /* SCNetworkConfigurationInternal.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A390670A85900BFE03C /* SCNetworkConfigurationInternal.c */; };
-               15DAD6A707591A1A0084A6ED /* SCNetworkInterface.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3B0670A85900BFE03C /* SCNetworkInterface.c */; };
-               15DAD6A807591A1A0084A6ED /* SCNetworkProtocol.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3C0670A85900BFE03C /* SCNetworkProtocol.c */; };
+               15DAD6A707591A1A0084A6ED /* SCNetworkInterface.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3B0670A85900BFE03C /* SCNetworkInterface.c */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; };
+               15DAD6A807591A1A0084A6ED /* SCNetworkProtocol.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3C0670A85900BFE03C /* SCNetworkProtocol.c */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; };
                15DAD6A907591A1A0084A6ED /* SCNetworkService.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3D0670A85900BFE03C /* SCNetworkService.c */; };
                15DAD6AA07591A1A0084A6ED /* SCNetworkSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3E0670A85900BFE03C /* SCNetworkSet.c */; };
                15DAD6AB07591A1A0084A6ED /* BondConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 9EE943F306AF409B00772EB5 /* BondConfiguration.c */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; };
                15DAD6A907591A1A0084A6ED /* SCNetworkService.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3D0670A85900BFE03C /* SCNetworkService.c */; };
                15DAD6AA07591A1A0084A6ED /* SCNetworkSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7A3E0670A85900BFE03C /* SCNetworkSet.c */; };
                15DAD6AB07591A1A0084A6ED /* BondConfiguration.c in Sources */ = {isa = PBXBuildFile; fileRef = 9EE943F306AF409B00772EB5 /* BondConfiguration.c */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; };
                15DAF2DC08466D4900D1B2BD /* SCHelper_client.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D808466D4900D1B2BD /* SCHelper_client.c */; };
                15DAF2DF08466D4900D1B2BD /* helper_comm.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DAF2D708466D4900D1B2BD /* helper_comm.h */; };
                15DAF2E108466D4900D1B2BD /* SCHelper_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D908466D4900D1B2BD /* SCHelper_server.c */; };
                15DAF2DC08466D4900D1B2BD /* SCHelper_client.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D808466D4900D1B2BD /* SCHelper_client.c */; };
                15DAF2DF08466D4900D1B2BD /* helper_comm.h in Headers */ = {isa = PBXBuildFile; fileRef = 15DAF2D708466D4900D1B2BD /* helper_comm.h */; };
                15DAF2E108466D4900D1B2BD /* SCHelper_server.c in Sources */ = {isa = PBXBuildFile; fileRef = 15DAF2D908466D4900D1B2BD /* SCHelper_server.c */; };
-               15E517680CCFBCD0008FFE82 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */; };
                15FC130B0CCEA59E0013872C /* monitor.c in Sources */ = {isa = PBXBuildFile; fileRef = 15FC130A0CCEA59E0013872C /* monitor.c */; };
                15FC13180CCF74740013872C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
                15FEE80E0CCFD341001312F9 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15FEE80D0CCFD341001312F9 /* ApplicationServices.framework */; };
                15FEE81F0CD03E75001312F9 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 15FEE8180CD03CBB001312F9 /* Localizable.strings */; };
                15FC130B0CCEA59E0013872C /* monitor.c in Sources */ = {isa = PBXBuildFile; fileRef = 15FC130A0CCEA59E0013872C /* monitor.c */; };
                15FC13180CCF74740013872C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */; };
                15FEE80E0CCFD341001312F9 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15FEE80D0CCFD341001312F9 /* ApplicationServices.framework */; };
                15FEE81F0CD03E75001312F9 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 15FEE8180CD03CBB001312F9 /* Localizable.strings */; };
+               15FF5C370CDF776200EEC8AA /* com.apple.SCHelper.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 15FF5C290CDF770500EEC8AA /* com.apple.SCHelper.plist */; };
                F95B8A430B03E07A00993BA3 /* SCNetworkSignature.c in Sources */ = {isa = PBXBuildFile; fileRef = F95B8A420B03E07A00993BA3 /* SCNetworkSignature.c */; };
                F95B8A460B03E09300993BA3 /* SCNetworkSignature.h in Headers */ = {isa = PBXBuildFile; fileRef = F95B8A440B03E09300993BA3 /* SCNetworkSignature.h */; settings = {ATTRIBUTES = (Private, ); }; };
                F95B8A470B03E09300993BA3 /* SCNetworkSignaturePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = F95B8A450B03E09300993BA3 /* SCNetworkSignaturePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                F95B8A430B03E07A00993BA3 /* SCNetworkSignature.c in Sources */ = {isa = PBXBuildFile; fileRef = F95B8A420B03E07A00993BA3 /* SCNetworkSignature.c */; };
                F95B8A460B03E09300993BA3 /* SCNetworkSignature.h in Headers */ = {isa = PBXBuildFile; fileRef = F95B8A440B03E09300993BA3 /* SCNetworkSignature.h */; settings = {ATTRIBUTES = (Private, ); }; };
                F95B8A470B03E09300993BA3 /* SCNetworkSignaturePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = F95B8A450B03E09300993BA3 /* SCNetworkSignaturePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
-               150ECB3B0D0079280065E94D /* PBXContainerItemProxy */ = {
+               150ECB2F0D0042DA0065E94D /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                        containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
                        proxyType = 1;
                        remoteGlobalIDString = 151F5D990CCE98E50093AC3B;
                        remoteInfo = SCMonitor;
                };
                        isa = PBXContainerItemProxy;
                        containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
                        proxyType = 1;
                        remoteGlobalIDString = 151F5D990CCE98E50093AC3B;
                        remoteInfo = SCMonitor;
                };
+               151FE3790D5B713C000D6DB1 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 151FE2DD0D5B7046000D6DB1;
+                       remoteInfo = "configd_base-EmbeddedSimulator";
+               };
                1520A385084681350010B584 /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                        containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
                1520A385084681350010B584 /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                        containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
                        remoteGlobalIDString = 1547001808455B98006787CE;
                        remoteInfo = SCHelper;
                };
                        remoteGlobalIDString = 1547001808455B98006787CE;
                        remoteInfo = SCHelper;
                };
-               1533B94009731A9600F2B34A /* PBXContainerItemProxy */ = {
+               1521405A0E9400BF00DACD2C /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                        containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
                        proxyType = 1;
                        isa = PBXContainerItemProxy;
                        containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
                        proxyType = 1;
-                       remoteGlobalIDString = 15FD733A0754DBDA001CC321;
-                       remoteInfo = ATconfig;
+                       remoteGlobalIDString = 15213FF90E93E9F500DACD2C;
+                       remoteInfo = Logger.bundle;
                };
                1558480507550D470046C2E9 /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                };
                1558480507550D470046C2E9 /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                        remoteGlobalIDString = 155847FA07550D210046C2E9;
                        remoteInfo = configd_executables;
                };
                        remoteGlobalIDString = 155847FA07550D210046C2E9;
                        remoteInfo = configd_executables;
                };
-               157BB8BF075924460025DA7A /* PBXContainerItemProxy */ = {
+               156CA4A70EF8550800C59A18 /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                        containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
                        proxyType = 1;
                        isa = PBXContainerItemProxy;
                        containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
                        proxyType = 1;
-                       remoteGlobalIDString = 15DAD63F07591A1A0084A6ED;
-                       remoteInfo = SystemConfiguration.framework;
+                       remoteGlobalIDString = 156CA4790EF853BB00C59A18;
+                       remoteInfo = "Logger.bundle-Embedded";
                };
                };
-               157BB8C1075924470025DA7A /* PBXContainerItemProxy */ = {
+               1574341E0D4A815E002ACA73 /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                        containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
                        proxyType = 1;
                        isa = PBXContainerItemProxy;
                        containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
                        proxyType = 1;
-                       remoteGlobalIDString = 15DAD5DF075913CE0084A6ED;
-                       remoteInfo = DNSConfiguration;
+                       remoteGlobalIDString = 157433F00D4A8137002ACA73;
+                       remoteInfo = "scutil-Embedded";
+               };
+               157434200D4A8166002ACA73 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 157433DD0D4A8122002ACA73;
+                       remoteInfo = "scselect-Embedded";
+               };
+               157A85470D56CA0B00B6F1A0 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 157A84F40D56C7E800B6F1A0;
+                       remoteInfo = "IPMonitor-Embedded";
+               };
+               157A85490D56CA2300B6F1A0 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 157A85050D56C8AA00B6F1A0;
+                       remoteInfo = "InterfaceNamer-Embedded";
+               };
+               157A854B0D56CA5100B6F1A0 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 157A85100D56C8E000B6F1A0;
+                       remoteInfo = "KernelEventMonitor-Embedded";
+               };
+               157A854D0D56CA6F00B6F1A0 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 157A85260D56C91100B6F1A0;
+                       remoteInfo = "LinkConfiguration-Embedded";
+               };
+               157A854F0D56CA8800B6F1A0 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 157A85310D56C94F00B6F1A0;
+                       remoteInfo = "NetworkIdentification-Embedded";
+               };
+               157A85510D56CA9E00B6F1A0 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 157A853C0D56C96F00B6F1A0;
+                       remoteInfo = "PreferencesMonitor-Embedded";
+               };
+               157A85530D56CACA00B6F1A0 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 158317A80CFB8639006F62B9;
+                       remoteInfo = "PreferencesMonitor.bundle-Embedded";
+               };
+               157BB8BF075924460025DA7A /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 15DAD63F07591A1A0084A6ED;
+                       remoteInfo = SystemConfiguration.framework;
                };
                157BB8C30759244B0025DA7A /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                };
                157BB8C30759244B0025DA7A /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                        remoteGlobalIDString = 15828AE60753B5F900AD4710;
                        remoteInfo = KernelEventMonitor.bundle;
                };
                        remoteGlobalIDString = 15828AE60753B5F900AD4710;
                        remoteInfo = KernelEventMonitor.bundle;
                };
+               1583170F0CFB77D1006F62B9 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 158316CF0CFB774B006F62B9;
+                       remoteInfo = "configd_base-Embedded";
+               };
+               158317110CFB77E1006F62B9 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1572C4A60CFB55B400E2776E;
+                       remoteInfo = "SystemConfiguration.framework-Embedded";
+               };
+               158317130CFB77E8006F62B9 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 158337990CFB6B9E0033AB93;
+                       remoteInfo = "SCHelper-Embedded";
+               };
+               158317150CFB783B006F62B9 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 158316E30CFB7761006F62B9;
+                       remoteInfo = "configd_plugins-Embedded";
+               };
+               158317170CFB784D006F62B9 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 158317040CFB7782006F62B9;
+                       remoteInfo = "configd_executables-Embedded";
+               };
+               158317650CFB80D5006F62B9 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 158317230CFB80A1006F62B9;
+                       remoteInfo = "configd-Embedded";
+               };
+               158317B20CFB8660006F62B9 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 158317A00CFB8626006F62B9;
+                       remoteInfo = "NetworkIdentification.bundle-Embedded";
+               };
+               158317B40CFB8660006F62B9 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 158317980CFB860C006F62B9;
+                       remoteInfo = "LinkConfiguration.bundle-Embedded";
+               };
+               158317B60CFB8660006F62B9 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 158317900CFB85F7006F62B9;
+                       remoteInfo = "KernelEventMonitor.bundle-Embedded";
+               };
+               158317B80CFB8660006F62B9 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 158317870CFB85DD006F62B9;
+                       remoteInfo = "InterfaceNamer.bundle-Embedded";
+               };
+               158317BA0CFB8660006F62B9 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 1583177D0CFB85C8006F62B9;
+                       remoteInfo = "IPMonitor.bundle-Embedded";
+               };
                158AD9850754E72500124717 /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                        containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
                158AD9850754E72500124717 /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                        containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
                        remoteGlobalIDString = 159D542007528E7C004F8947;
                        remoteInfo = Plugins;
                };
                        remoteGlobalIDString = 159D542007528E7C004F8947;
                        remoteInfo = Plugins;
                };
-               15DAD5730759115F0084A6ED /* PBXContainerItemProxy */ = {
+               15A5A2700D5B942D0087BDA0 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 15A5A1E40D5B94190087BDA0;
+                       remoteInfo = "SystemConfiguration.framework-EmbeddedSimulator";
+               };
+               15C64A210F684C4900D78394 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 15DAD5DF075913CE0084A6ED;
+                       remoteInfo = DNSConfiguration;
+               };
+               15C64A230F684C5700D78394 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 15C64A1E0F684C3300D78394;
+                       remoteInfo = configd_libSystem;
+               };
+               15C64A2E0F684C8300D78394 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = 15C64A280F684C6B00D78394;
+                       remoteInfo = "configd_libSystem-Embedded";
+               };
+               15C64A300F684C8F00D78394 /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                        containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
                        proxyType = 1;
                        isa = PBXContainerItemProxy;
                        containerPortal = 15CB6A7705C0722B0099E85F /* Project object */;
                        proxyType = 1;
-                       remoteGlobalIDString = 15FD731E0754DB9F001CC321;
-                       remoteInfo = ATconfig.bundle;
+                       remoteGlobalIDString = 157A84D80D56C63900B6F1A0;
+                       remoteInfo = "DNSConfiguration-Embedded";
                };
                F95B8A760B03FB9100993BA3 /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                };
                F95B8A760B03FB9100993BA3 /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                        );
                        runOnlyForDeploymentPostprocessing = 1;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 1;
                };
+               1583175B0CFB80A1006F62B9 /* CopyFiles */ = {
+                       isa = PBXCopyFilesBuildPhase;
+                       buildActionMask = 8;
+                       dstPath = /System/Library/LaunchDaemons;
+                       dstSubfolderSpec = 0;
+                       files = (
+                               1583175C0CFB80A1006F62B9 /* com.apple.configd.plist in CopyFiles */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 1;
+               };
+               158337A40CFB6B9E0033AB93 /* CopyFiles */ = {
+                       isa = PBXCopyFilesBuildPhase;
+                       buildActionMask = 8;
+                       dstPath = /System/Library/LaunchDaemons;
+                       dstSubfolderSpec = 0;
+                       files = (
+                               158337AD0CFB6BDC0033AB93 /* com.apple.SCHelper-embedded.plist in CopyFiles */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 1;
+               };
                159D54D507529FFF004F8947 /* CopyFiles */ = {
                        isa = PBXCopyFilesBuildPhase;
                        buildActionMask = 8;
                159D54D507529FFF004F8947 /* CopyFiles */ = {
                        isa = PBXCopyFilesBuildPhase;
                        buildActionMask = 8;
                        );
                        runOnlyForDeploymentPostprocessing = 1;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 1;
                };
+               15FF5C380CDF778F00EEC8AA /* CopyFiles */ = {
+                       isa = PBXCopyFilesBuildPhase;
+                       buildActionMask = 8;
+                       dstPath = /System/Library/LaunchDaemons;
+                       dstSubfolderSpec = 0;
+                       files = (
+                               15FF5C370CDF776200EEC8AA /* com.apple.SCHelper.plist in CopyFiles */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 1;
+               };
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
                150607BD075A00A200B147BA /* SCSchemaDefinitions.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCSchemaDefinitions.c; sourceTree = "<group>"; };
                150607DE075A00A300B147BA /* SCSchemaDefinitions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCSchemaDefinitions.h; sourceTree = "<group>"; };
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
                150607BD075A00A200B147BA /* SCSchemaDefinitions.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCSchemaDefinitions.c; sourceTree = "<group>"; };
                150607DE075A00A300B147BA /* SCSchemaDefinitions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCSchemaDefinitions.h; sourceTree = "<group>"; };
+               151356AD0CE0CF2F0017E523 /* com.apple.SCHelper-embedded.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "com.apple.SCHelper-embedded.plist"; path = "helper/com.apple.SCHelper-embedded.plist"; sourceTree = "<group>"; };
                1514D76D05C08A5F00757DC9 /* config_types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = config_types.h; path = SystemConfiguration.fproj/config_types.h; sourceTree = SOURCE_ROOT; };
                151BDA2B05D9E28B00657BC7 /* SCPreferencesPathKey.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SCPreferencesPathKey.h; path = SystemConfiguration.fproj/SCPreferencesPathKey.h; sourceTree = SOURCE_ROOT; };
                151BDA5D05D9E2ED00657BC7 /* SCPreferencesPathKey.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SCPreferencesPathKey.c; path = SystemConfiguration.fproj/SCPreferencesPathKey.c; sourceTree = SOURCE_ROOT; };
                151F5D9A0CCE98E50093AC3B /* SCMonitor.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SCMonitor.plugin; sourceTree = BUILT_PRODUCTS_DIR; };
                151F63EC09328A3C0096DCC9 /* genSCPreferences */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = genSCPreferences; sourceTree = BUILT_PRODUCTS_DIR; };
                1520A3DE0846B2DC0010B584 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = "<absolute>"; };
                1514D76D05C08A5F00757DC9 /* config_types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = config_types.h; path = SystemConfiguration.fproj/config_types.h; sourceTree = SOURCE_ROOT; };
                151BDA2B05D9E28B00657BC7 /* SCPreferencesPathKey.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SCPreferencesPathKey.h; path = SystemConfiguration.fproj/SCPreferencesPathKey.h; sourceTree = SOURCE_ROOT; };
                151BDA5D05D9E2ED00657BC7 /* SCPreferencesPathKey.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SCPreferencesPathKey.c; path = SystemConfiguration.fproj/SCPreferencesPathKey.c; sourceTree = SOURCE_ROOT; };
                151F5D9A0CCE98E50093AC3B /* SCMonitor.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SCMonitor.plugin; sourceTree = BUILT_PRODUCTS_DIR; };
                151F63EC09328A3C0096DCC9 /* genSCPreferences */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = genSCPreferences; sourceTree = BUILT_PRODUCTS_DIR; };
                1520A3DE0846B2DC0010B584 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = "<absolute>"; };
+               15213FFA0E93E9F500DACD2C /* Logger.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Logger.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
                1521FC5C060F296A003B28F5 /* dnsinfo_create.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dnsinfo_create.c; path = dnsinfo/dnsinfo_create.c; sourceTree = SOURCE_ROOT; };
                1521FC5C060F296A003B28F5 /* dnsinfo_create.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dnsinfo_create.c; path = dnsinfo/dnsinfo_create.c; sourceTree = SOURCE_ROOT; };
+               1522FCE50FA7FD7000B24128 /* dnsinfo_flatfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dnsinfo_flatfile.c; path = dnsinfo/dnsinfo_flatfile.c; sourceTree = "<group>"; };
                152CEED0070CF6640050F23C /* libedit.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libedit.dylib; path = /usr/lib/libedit.2.dylib; sourceTree = "<absolute>"; };
                152E68C00A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCPreferencesKeychainPrivate.h; sourceTree = "<group>"; };
                152E68C20A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCPreferencesKeychainPrivate.c; sourceTree = "<group>"; };
                152CEED0070CF6640050F23C /* libedit.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libedit.dylib; path = /usr/lib/libedit.2.dylib; sourceTree = "<absolute>"; };
                152E68C00A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCPreferencesKeychainPrivate.h; sourceTree = "<group>"; };
                152E68C20A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCPreferencesKeychainPrivate.c; sourceTree = "<group>"; };
+               1531D3DA0E93E6DA00248432 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Plugins/Logger/Info.plist; sourceTree = "<group>"; };
+               1531D3DB0E93E6DA00248432 /* logger.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = logger.c; path = Plugins/Logger/logger.c; sourceTree = "<group>"; };
                1532629006281C9D00B1C10C /* dnsinfo_create.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dnsinfo_create.h; path = dnsinfo/dnsinfo_create.h; sourceTree = "<group>"; };
                1532629006281C9D00B1C10C /* dnsinfo_create.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dnsinfo_create.h; path = dnsinfo/dnsinfo_create.h; sourceTree = "<group>"; };
-               1540E3600987DA9500157C07 /* com.apple.configd.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = com.apple.configd.plist; sourceTree = "<group>"; };
+               153393E20D34994100FE74E7 /* update-headers */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = "update-headers"; sourceTree = "<group>"; };
+               1540E3600987DA9500157C07 /* com.apple.configd.plist */ = {isa = PBXFileReference; explicitFileType = text.plist.xml; fileEncoding = 30; path = com.apple.configd.plist; sourceTree = "<group>"; };
                1543636A0752D03C00A8EC6C /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; };
                1547001D08455B98006787CE /* SCHelper */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SCHelper; sourceTree = BUILT_PRODUCTS_DIR; };
                1543636A0752D03C00A8EC6C /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; };
                1547001D08455B98006787CE /* SCHelper */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SCHelper; sourceTree = BUILT_PRODUCTS_DIR; };
+               1547072E0D1F70C80075C28D /* SystemConfiguration.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SystemConfiguration.framework; sourceTree = BUILT_PRODUCTS_DIR; };
                154CF3F307E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCPreferencesGetSpecificPrivate.h; sourceTree = "<group>"; };
                1558476A0754FDCD0046C2E9 /* scutil */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = scutil; sourceTree = BUILT_PRODUCTS_DIR; };
                1558481D07550EC10046C2E9 /* scselect */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = scselect; sourceTree = BUILT_PRODUCTS_DIR; };
                154CF3F307E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCPreferencesGetSpecificPrivate.h; sourceTree = "<group>"; };
                1558476A0754FDCD0046C2E9 /* scutil */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = scutil; sourceTree = BUILT_PRODUCTS_DIR; };
                1558481D07550EC10046C2E9 /* scselect */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = scselect; sourceTree = BUILT_PRODUCTS_DIR; };
+               1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SystemConfiguration.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+               1559C4470D349A4E0098FD59 /* SCHelper */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SCHelper; sourceTree = BUILT_PRODUCTS_DIR; };
+               1559C44C0D349A4E0098FD59 /* configd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = configd; sourceTree = BUILT_PRODUCTS_DIR; };
+               1559C4500D349A4E0098FD59 /* IPMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = IPMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+               1559C4510D349A4E0098FD59 /* InterfaceNamer.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InterfaceNamer.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+               1559C4520D349A4E0098FD59 /* KernelEventMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KernelEventMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+               1559C4530D349A4E0098FD59 /* LinkConfiguration.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LinkConfiguration.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+               1559C4540D349A4E0098FD59 /* PreferencesMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PreferencesMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+               1559C4550D349A4E0098FD59 /* NetworkIdentification.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NetworkIdentification.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
                155A1E6B081079CC00F70D98 /* SCNetworkConfigurationPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkConfigurationPrivate.h; sourceTree = "<group>"; };
                155B7BF60847776D00F0E262 /* SCHelper_client.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SCHelper_client.h; path = helper/SCHelper_client.h; sourceTree = "<group>"; };
                155D22380AF13A7300D52ED0 /* dns-configuration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "dns-configuration.h"; sourceTree = "<group>"; };
                155D22390AF13A7300D52ED0 /* set-hostname.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "set-hostname.h"; sourceTree = "<group>"; };
                155D223A0AF13A7300D52ED0 /* smb-configuration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "smb-configuration.h"; sourceTree = "<group>"; };
                155A1E6B081079CC00F70D98 /* SCNetworkConfigurationPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkConfigurationPrivate.h; sourceTree = "<group>"; };
                155B7BF60847776D00F0E262 /* SCHelper_client.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SCHelper_client.h; path = helper/SCHelper_client.h; sourceTree = "<group>"; };
                155D22380AF13A7300D52ED0 /* dns-configuration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "dns-configuration.h"; sourceTree = "<group>"; };
                155D22390AF13A7300D52ED0 /* set-hostname.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "set-hostname.h"; sourceTree = "<group>"; };
                155D223A0AF13A7300D52ED0 /* smb-configuration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "smb-configuration.h"; sourceTree = "<group>"; };
+               1567333E0DD1FD6500145179 /* entitlements.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = entitlements.plist; sourceTree = "<group>"; };
                156BD6BB07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCPreferencesSetSpecificPrivate.h; sourceTree = "<group>"; };
                156BD6BB07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCPreferencesSetSpecificPrivate.h; sourceTree = "<group>"; };
+               156CA4850EF853BB00C59A18 /* Logger.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Logger.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+               156CA48D0EF853BB00C59A18 /* Info-Embedded.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Info-Embedded.plist"; path = "Plugins/Logger/Info-Embedded.plist"; sourceTree = "<group>"; };
                1572EB7A0A506D3B00D02459 /* smb-configuration.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "smb-configuration.c"; sourceTree = "<group>"; };
                1572EB7A0A506D3B00D02459 /* smb-configuration.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "smb-configuration.c"; sourceTree = "<group>"; };
+               157433EC0D4A8122002ACA73 /* scselect */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = scselect; sourceTree = BUILT_PRODUCTS_DIR; };
+               1574341A0D4A8137002ACA73 /* scutil */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = scutil; sourceTree = BUILT_PRODUCTS_DIR; };
                1577252F06EFB96700D7B52B /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/NetworkInterface.strings; sourceTree = "<group>"; };
                1577252F06EFB96700D7B52B /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/NetworkInterface.strings; sourceTree = "<group>"; };
+               157A84E80D56C63900B6F1A0 /* libdnsinfo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libdnsinfo.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               157A85020D56C7E800B6F1A0 /* libIPMonitor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libIPMonitor.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               157A850D0D56C8AA00B6F1A0 /* libInterfaceNamer.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libInterfaceNamer.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               157A85230D56C8E000B6F1A0 /* libKernelEventMonitor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libKernelEventMonitor.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               157A852E0D56C91100B6F1A0 /* libLinkConfiguration.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libLinkConfiguration.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               157A85390D56C94F00B6F1A0 /* libNetworkIdentification.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libNetworkIdentification.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               157A85440D56C96F00B6F1A0 /* libPreferencesMonitor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPreferencesMonitor.a; sourceTree = BUILT_PRODUCTS_DIR; };
                157A88880A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCSchemaDefinitionsPrivate.h; sourceTree = "<group>"; };
                15828AE70753B5F900AD4710 /* KernelEventMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KernelEventMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
                157A88880A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCSchemaDefinitionsPrivate.h; sourceTree = "<group>"; };
                15828AE70753B5F900AD4710 /* KernelEventMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KernelEventMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
-               1587A31F0B6AACD70063104A /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = /usr/lib/libicucore.dylib; sourceTree = "<absolute>"; };
-               158AD85B0754E38F00124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
-               158AD8700754E3D400124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
-               158AD8C00754E3EF00124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
-               158AD9100754E40E00124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
+               158AD85B0754E38F00124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+               158AD8700754E3D400124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+               158AD8C00754E3EF00124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+               158AD9100754E40E00124717 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
                158AD9F80754EA2F00124717 /* AppleTalk.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppleTalk.framework; path = /System/Library/Frameworks/AppleTalk.framework; sourceTree = "<absolute>"; };
                158AD9F80754EA2F00124717 /* AppleTalk.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppleTalk.framework; path = /System/Library/Frameworks/AppleTalk.framework; sourceTree = "<absolute>"; };
-               159D53A707528B36004F8947 /* ip_plugin.c */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.c; path = ip_plugin.c; sourceTree = "<group>"; tabWidth = 8; usesTabs = 1; };
-               159D53A807528B36004F8947 /* Resolvers.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Resolvers.plist; sourceTree = "<group>"; };
+               159D53A707528B36004F8947 /* ip_plugin.c */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.c; path = ip_plugin.c; sourceTree = "<group>"; };
                159D53AA07528B36004F8947 /* dns-configuration.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "dns-configuration.c"; sourceTree = "<group>"; };
                159D53AB07528B36004F8947 /* set-hostname.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "set-hostname.c"; sourceTree = "<group>"; };
                159D53AA07528B36004F8947 /* dns-configuration.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "dns-configuration.c"; sourceTree = "<group>"; };
                159D53AB07528B36004F8947 /* set-hostname.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "set-hostname.c"; sourceTree = "<group>"; };
-               159D53AE07528B36004F8947 /* ifnamer.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ifnamer.c; sourceTree = "<group>"; };
+               159D53AE07528B36004F8947 /* ifnamer.c */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.c; path = ifnamer.c; sourceTree = "<group>"; };
                159D53B007528B36004F8947 /* eventmon.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = eventmon.c; sourceTree = "<group>"; };
                159D53B107528B36004F8947 /* ev_dlil.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ev_dlil.c; sourceTree = "<group>"; };
                159D53B207528B36004F8947 /* ev_dlil.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ev_dlil.h; sourceTree = "<group>"; };
                159D53B007528B36004F8947 /* eventmon.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = eventmon.c; sourceTree = "<group>"; };
                159D53B107528B36004F8947 /* ev_dlil.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ev_dlil.c; sourceTree = "<group>"; };
                159D53B207528B36004F8947 /* ev_dlil.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ev_dlil.h; sourceTree = "<group>"; };
                159D53CA07528B36004F8947 /* cache.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = cache.c; sourceTree = "<group>"; };
                159D53CB07528B36004F8947 /* cache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cache.h; sourceTree = "<group>"; };
                159D53D407528BDA004F8947 /* libKernelEventMonitor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libKernelEventMonitor.a; sourceTree = BUILT_PRODUCTS_DIR; };
                159D53CA07528B36004F8947 /* cache.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = cache.c; sourceTree = "<group>"; };
                159D53CB07528B36004F8947 /* cache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cache.h; sourceTree = "<group>"; };
                159D53D407528BDA004F8947 /* libKernelEventMonitor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libKernelEventMonitor.a; sourceTree = BUILT_PRODUCTS_DIR; };
-               159D53DE07528C2E004F8947 /* libKicker.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libKicker.a; sourceTree = BUILT_PRODUCTS_DIR; };
                159D53E507528C4A004F8947 /* libInterfaceNamer.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libInterfaceNamer.a; sourceTree = BUILT_PRODUCTS_DIR; };
                159D53EC07528C61004F8947 /* libIPMonitor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libIPMonitor.a; sourceTree = BUILT_PRODUCTS_DIR; };
                159D53F307528C79004F8947 /* libLinkConfiguration.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libLinkConfiguration.a; sourceTree = BUILT_PRODUCTS_DIR; };
                159D53E507528C4A004F8947 /* libInterfaceNamer.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libInterfaceNamer.a; sourceTree = BUILT_PRODUCTS_DIR; };
                159D53EC07528C61004F8947 /* libIPMonitor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libIPMonitor.a; sourceTree = BUILT_PRODUCTS_DIR; };
                159D53F307528C79004F8947 /* libLinkConfiguration.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libLinkConfiguration.a; sourceTree = BUILT_PRODUCTS_DIR; };
                15A2972E0A13C08C009879B3 /* SCNetworkConnectionPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkConnectionPrivate.h; sourceTree = "<group>"; };
                15A509A306C2518F001F0AB7 /* net.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = net.c; sourceTree = "<group>"; };
                15A509A406C2518F001F0AB7 /* net.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = net.h; sourceTree = "<group>"; };
                15A2972E0A13C08C009879B3 /* SCNetworkConnectionPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkConnectionPrivate.h; sourceTree = "<group>"; };
                15A509A306C2518F001F0AB7 /* net.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = net.c; sourceTree = "<group>"; };
                15A509A406C2518F001F0AB7 /* net.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = net.h; sourceTree = "<group>"; };
+               15A5A26A0D5B94190087BDA0 /* SystemConfiguration.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SystemConfiguration.framework; sourceTree = BUILT_PRODUCTS_DIR; };
                15A6F7C30A4B266D00B907EA /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = "<group>"; };
                15AD7A380670A85900BFE03C /* SCNetworkConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkConfiguration.h; sourceTree = "<group>"; };
                15AD7A390670A85900BFE03C /* SCNetworkConfigurationInternal.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkConfigurationInternal.c; sourceTree = "<group>"; };
                15A6F7C30A4B266D00B907EA /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = "<group>"; };
                15AD7A380670A85900BFE03C /* SCNetworkConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkConfiguration.h; sourceTree = "<group>"; };
                15AD7A390670A85900BFE03C /* SCNetworkConfigurationInternal.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkConfigurationInternal.c; sourceTree = "<group>"; };
                15AD7A3C0670A85900BFE03C /* SCNetworkProtocol.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkProtocol.c; sourceTree = "<group>"; };
                15AD7A3D0670A85900BFE03C /* SCNetworkService.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkService.c; sourceTree = "<group>"; };
                15AD7A3E0670A85900BFE03C /* SCNetworkSet.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkSet.c; sourceTree = "<group>"; };
                15AD7A3C0670A85900BFE03C /* SCNetworkProtocol.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkProtocol.c; sourceTree = "<group>"; };
                15AD7A3D0670A85900BFE03C /* SCNetworkService.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkService.c; sourceTree = "<group>"; };
                15AD7A3E0670A85900BFE03C /* SCNetworkSet.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkSet.c; sourceTree = "<group>"; };
-               15B686220678B65C00FF4023 /* NetworkConfiguration.plist */ = {isa = PBXFileReference; explicitFileType = text.xml; fileEncoding = 4; path = NetworkConfiguration.plist; sourceTree = "<group>"; };
+               15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = AspenSDK.xcconfig; path = AppleInternal/XcodeConfig/AspenSDK.xcconfig; sourceTree = DEVELOPER_DIR; };
+               15B686220678B65C00FF4023 /* NetworkConfiguration.plist */ = {isa = PBXFileReference; explicitFileType = text.plist.xml; fileEncoding = 4; path = NetworkConfiguration.plist; sourceTree = "<group>"; };
                15B73F0805FD1B670096477F /* dnsinfo_copy.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dnsinfo_copy.c; path = dnsinfo/dnsinfo_copy.c; sourceTree = "<group>"; };
                15B73F0905FD1B670096477F /* dnsinfo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dnsinfo.h; path = dnsinfo/dnsinfo.h; sourceTree = "<group>"; };
                15B73F0B05FD1B670096477F /* dnsinfo_private.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dnsinfo_private.c; path = dnsinfo/dnsinfo_private.c; sourceTree = "<group>"; };
                15B73F0805FD1B670096477F /* dnsinfo_copy.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dnsinfo_copy.c; path = dnsinfo/dnsinfo_copy.c; sourceTree = "<group>"; };
                15B73F0905FD1B670096477F /* dnsinfo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dnsinfo.h; path = dnsinfo/dnsinfo.h; sourceTree = "<group>"; };
                15B73F0B05FD1B670096477F /* dnsinfo_private.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dnsinfo_private.c; path = dnsinfo/dnsinfo_private.c; sourceTree = "<group>"; };
                15B73F0D05FD1B670096477F /* dnsinfo_server.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dnsinfo_server.c; path = dnsinfo/dnsinfo_server.c; sourceTree = "<group>"; };
                15B73F0E05FD1B670096477F /* dnsinfo_server.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dnsinfo_server.h; path = dnsinfo/dnsinfo_server.h; sourceTree = "<group>"; };
                15BAA32207F0699A00D9EC95 /* libbsm.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbsm.dylib; path = /usr/lib/libbsm.dylib; sourceTree = "<absolute>"; };
                15B73F0D05FD1B670096477F /* dnsinfo_server.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dnsinfo_server.c; path = dnsinfo/dnsinfo_server.c; sourceTree = "<group>"; };
                15B73F0E05FD1B670096477F /* dnsinfo_server.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dnsinfo_server.h; path = dnsinfo/dnsinfo_server.h; sourceTree = "<group>"; };
                15BAA32207F0699A00D9EC95 /* libbsm.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbsm.dylib; path = /usr/lib/libbsm.dylib; sourceTree = "<absolute>"; };
-               15CB690505C0722A0099E85F /* preferences.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = preferences.xml; sourceTree = "<group>"; };
                15CB691305C0722B0099E85F /* SystemConfiguration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SystemConfiguration.h; sourceTree = "<group>"; };
                15CB691505C0722B0099E85F /* SCPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCPrivate.h; sourceTree = "<group>"; };
                15CB691705C0722B0099E85F /* SCDPlugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCDPlugin.h; sourceTree = "<group>"; };
                15CB691305C0722B0099E85F /* SystemConfiguration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SystemConfiguration.h; sourceTree = "<group>"; };
                15CB691505C0722B0099E85F /* SCPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCPrivate.h; sourceTree = "<group>"; };
                15CB691705C0722B0099E85F /* SCDPlugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCDPlugin.h; sourceTree = "<group>"; };
                15CB694505C0722B0099E85F /* DeviceOnHold.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeviceOnHold.h; sourceTree = "<group>"; };
                15CB694705C0722B0099E85F /* LinkConfiguration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LinkConfiguration.h; sourceTree = "<group>"; };
                15CB694905C0722B0099E85F /* dy_framework.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dy_framework.h; sourceTree = "<group>"; };
                15CB694505C0722B0099E85F /* DeviceOnHold.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeviceOnHold.h; sourceTree = "<group>"; };
                15CB694705C0722B0099E85F /* LinkConfiguration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LinkConfiguration.h; sourceTree = "<group>"; };
                15CB694905C0722B0099E85F /* dy_framework.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dy_framework.h; sourceTree = "<group>"; };
-               15CB694B05C0722B0099E85F /* VLANConfiguration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLANConfiguration.h; sourceTree = "<group>"; };
                15CB695005C0722B0099E85F /* SCD.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCD.c; sourceTree = "<group>"; };
                15CB695205C0722B0099E85F /* SCDKeys.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDKeys.c; sourceTree = "<group>"; };
                15CB695405C0722B0099E85F /* SCDPrivate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDPrivate.c; sourceTree = "<group>"; };
                15CB695005C0722B0099E85F /* SCD.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCD.c; sourceTree = "<group>"; };
                15CB695205C0722B0099E85F /* SCDKeys.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDKeys.c; sourceTree = "<group>"; };
                15CB695405C0722B0099E85F /* SCDPrivate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDPrivate.c; sourceTree = "<group>"; };
                15CB698005C0722B0099E85F /* SCDNotifierCancel.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDNotifierCancel.c; sourceTree = "<group>"; };
                15CB698205C0722B0099E85F /* SCDSnapshot.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDSnapshot.c; sourceTree = "<group>"; };
                15CB698405C0722B0099E85F /* SCP.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCP.c; sourceTree = "<group>"; };
                15CB698005C0722B0099E85F /* SCDNotifierCancel.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDNotifierCancel.c; sourceTree = "<group>"; };
                15CB698205C0722B0099E85F /* SCDSnapshot.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCDSnapshot.c; sourceTree = "<group>"; };
                15CB698405C0722B0099E85F /* SCP.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCP.c; sourceTree = "<group>"; };
-               15CB698605C0722B0099E85F /* SCPOpen.c */ = {isa = PBXFileReference; indentWidth = 8; lastKnownFileType = sourcecode.c.c; path = SCPOpen.c; sourceTree = "<group>"; tabWidth = 8; };
+               15CB698605C0722B0099E85F /* SCPOpen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCPOpen.c; sourceTree = "<group>"; };
                15CB698805C0722B0099E85F /* SCPLock.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCPLock.c; sourceTree = "<group>"; };
                15CB698A05C0722B0099E85F /* SCPUnlock.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCPUnlock.c; sourceTree = "<group>"; };
                15CB698C05C0722B0099E85F /* SCPList.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCPList.c; sourceTree = "<group>"; };
                15CB698805C0722B0099E85F /* SCPLock.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCPLock.c; sourceTree = "<group>"; };
                15CB698A05C0722B0099E85F /* SCPUnlock.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCPUnlock.c; sourceTree = "<group>"; };
                15CB698C05C0722B0099E85F /* SCPList.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SCPList.c; sourceTree = "<group>"; };
                15CB69B405C0722B0099E85F /* dy_framework.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = dy_framework.c; sourceTree = "<group>"; };
                15CB69B605C0722B0099E85F /* VLANConfiguration.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = VLANConfiguration.c; sourceTree = "<group>"; };
                15CB69BE05C0722B0099E85F /* config.defs */ = {isa = PBXFileReference; explicitFileType = sourcecode.mig; name = config.defs; path = SystemConfiguration.fproj/config.defs; sourceTree = "<group>"; };
                15CB69B405C0722B0099E85F /* dy_framework.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = dy_framework.c; sourceTree = "<group>"; };
                15CB69B605C0722B0099E85F /* VLANConfiguration.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = VLANConfiguration.c; sourceTree = "<group>"; };
                15CB69BE05C0722B0099E85F /* config.defs */ = {isa = PBXFileReference; explicitFileType = sourcecode.mig; name = config.defs; path = SystemConfiguration.fproj/config.defs; sourceTree = "<group>"; };
-               15CB69BF05C0722B0099E85F /* genSCPreferences.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = genSCPreferences.c; path = SystemConfiguration.fproj/genSCPreferences.c; sourceTree = "<group>"; };
+               15CB69BF05C0722B0099E85F /* genSCPreferences.c */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.c; name = genSCPreferences.c; path = SystemConfiguration.fproj/genSCPreferences.c; sourceTree = "<group>"; };
                15CB69CF05C0722B0099E85F /* configd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = configd.h; sourceTree = "<group>"; };
                15CB69D105C0722B0099E85F /* _SCD.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _SCD.h; sourceTree = "<group>"; };
                15CB69D305C0722B0099E85F /* configd_server.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = configd_server.h; sourceTree = "<group>"; };
                15CB69CF05C0722B0099E85F /* configd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = configd.h; sourceTree = "<group>"; };
                15CB69D105C0722B0099E85F /* _SCD.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _SCD.h; sourceTree = "<group>"; };
                15CB69D305C0722B0099E85F /* configd_server.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = configd_server.h; sourceTree = "<group>"; };
                15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
                15CFC229068B222F00123568 /* get-mobility-info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = "get-mobility-info"; sourceTree = SOURCE_ROOT; };
                15DAD5EE075913CE0084A6ED /* libdnsinfo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libdnsinfo.a; sourceTree = BUILT_PRODUCTS_DIR; };
                15CB6A6F05C0722B0099E85F /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
                15CFC229068B222F00123568 /* get-mobility-info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = "get-mobility-info"; sourceTree = SOURCE_ROOT; };
                15DAD5EE075913CE0084A6ED /* libdnsinfo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libdnsinfo.a; sourceTree = BUILT_PRODUCTS_DIR; };
-               15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SystemConfiguration.framework; sourceTree = BUILT_PRODUCTS_DIR; };
                15DAF2D608466D4900D1B2BD /* helper_comm.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = helper_comm.c; path = helper/helper_comm.c; sourceTree = "<group>"; };
                15DAF2D708466D4900D1B2BD /* helper_comm.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = helper_comm.h; path = helper/helper_comm.h; sourceTree = "<group>"; };
                15DAF2D808466D4900D1B2BD /* SCHelper_client.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SCHelper_client.c; path = helper/SCHelper_client.c; sourceTree = "<group>"; };
                15DAF2D608466D4900D1B2BD /* helper_comm.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = helper_comm.c; path = helper/helper_comm.c; sourceTree = "<group>"; };
                15DAF2D708466D4900D1B2BD /* helper_comm.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = helper_comm.h; path = helper/helper_comm.h; sourceTree = "<group>"; };
                15DAF2D808466D4900D1B2BD /* SCHelper_client.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SCHelper_client.c; path = helper/SCHelper_client.c; sourceTree = "<group>"; };
                15FC130A0CCEA59E0013872C /* monitor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = monitor.c; path = SCMonitor/monitor.c; sourceTree = "<group>"; };
                15FCAACF05FD0EBF00CB79E6 /* shared_dns_info_types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = shared_dns_info_types.h; path = dnsinfo/shared_dns_info_types.h; sourceTree = SOURCE_ROOT; };
                15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.mig; name = shared_dns_info.defs; path = dnsinfo/shared_dns_info.defs; sourceTree = "<group>"; };
                15FC130A0CCEA59E0013872C /* monitor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = monitor.c; path = SCMonitor/monitor.c; sourceTree = "<group>"; };
                15FCAACF05FD0EBF00CB79E6 /* shared_dns_info_types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = shared_dns_info_types.h; path = dnsinfo/shared_dns_info_types.h; sourceTree = SOURCE_ROOT; };
                15FCAAD005FD0EBF00CB79E6 /* shared_dns_info.defs */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.mig; name = shared_dns_info.defs; path = dnsinfo/shared_dns_info.defs; sourceTree = "<group>"; };
+               15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = IndigoSDK.xcconfig; path = /AppleInternal/Indigo/IndigoSDK.xcconfig; sourceTree = "<absolute>"; };
                15FD71090754D628001CC321 /* Kicker.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Kicker.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
                15FD72970754DA2B001CC321 /* InterfaceNamer.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InterfaceNamer.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
                15FD72A50754DA4C001CC321 /* IPMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = IPMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
                15FD72B50754DA69001CC321 /* LinkConfiguration.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LinkConfiguration.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
                15FD72C90754DA7E001CC321 /* PreferencesMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PreferencesMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
                15FD73220754DB9F001CC321 /* ATconfig.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ATconfig.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
                15FD71090754D628001CC321 /* Kicker.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Kicker.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
                15FD72970754DA2B001CC321 /* InterfaceNamer.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InterfaceNamer.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
                15FD72A50754DA4C001CC321 /* IPMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = IPMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
                15FD72B50754DA69001CC321 /* LinkConfiguration.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LinkConfiguration.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
                15FD72C90754DA7E001CC321 /* PreferencesMonitor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PreferencesMonitor.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
                15FD73220754DB9F001CC321 /* ATconfig.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ATconfig.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
-               15FD73400754DBDA001CC321 /* libATconfig.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libATconfig.a; sourceTree = BUILT_PRODUCTS_DIR; };
-               15FD73970754DE49001CC321 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
-               15FD73EE0754DE62001CC321 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
-               15FD743E0754DE7A001CC321 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
+               15FD73970754DE49001CC321 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+               15FD73EE0754DE62001CC321 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+               15FD743E0754DE7A001CC321 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
                15FEE80D0CCFD341001312F9 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; };
                15FEE8160CD03CA3001312F9 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = SCMonitor/English.lproj/Localizable.strings; sourceTree = "<group>"; };
                15FEE80D0CCFD341001312F9 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; };
                15FEE8160CD03CA3001312F9 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = SCMonitor/English.lproj/Localizable.strings; sourceTree = "<group>"; };
+               15FF5C290CDF770500EEC8AA /* com.apple.SCHelper.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = com.apple.SCHelper.plist; path = helper/com.apple.SCHelper.plist; sourceTree = "<group>"; };
                23C1E2B4062DD2C700835B54 /* pppcontroller_types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = pppcontroller_types.h; path = /usr/local/include/ppp/pppcontroller_types.h; sourceTree = "<absolute>"; };
                23C1E2B8062DD45900835B54 /* pppcontroller.defs */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.mig; name = pppcontroller.defs; path = SystemConfiguration.fproj/pppcontroller.defs; sourceTree = "<group>"; };
                23C1E2BE062DD5DB00835B54 /* pppcontroller.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = pppcontroller.h; path = configd.build/SystemConfiguration.framework.build/DerivedSources/pppcontroller.h; sourceTree = BUILT_PRODUCTS_DIR; };
                9EE943F306AF409B00772EB5 /* BondConfiguration.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = BondConfiguration.c; sourceTree = "<group>"; };
                23C1E2B4062DD2C700835B54 /* pppcontroller_types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = pppcontroller_types.h; path = /usr/local/include/ppp/pppcontroller_types.h; sourceTree = "<absolute>"; };
                23C1E2B8062DD45900835B54 /* pppcontroller.defs */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.mig; name = pppcontroller.defs; path = SystemConfiguration.fproj/pppcontroller.defs; sourceTree = "<group>"; };
                23C1E2BE062DD5DB00835B54 /* pppcontroller.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = pppcontroller.h; path = configd.build/SystemConfiguration.framework.build/DerivedSources/pppcontroller.h; sourceTree = BUILT_PRODUCTS_DIR; };
                9EE943F306AF409B00772EB5 /* BondConfiguration.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = BondConfiguration.c; sourceTree = "<group>"; };
-               9EE943F406AF409B00772EB5 /* BondConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = BondConfiguration.h; sourceTree = "<group>"; };
-               9EE943F506AF409B00772EB5 /* BondConfigurationPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = BondConfigurationPrivate.h; sourceTree = "<group>"; };
                F95B8A420B03E07A00993BA3 /* SCNetworkSignature.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkSignature.c; sourceTree = "<group>"; };
                F95B8A440B03E09300993BA3 /* SCNetworkSignature.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkSignature.h; sourceTree = "<group>"; };
                F95B8A450B03E09300993BA3 /* SCNetworkSignaturePrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkSignaturePrivate.h; sourceTree = "<group>"; };
                F95B8A5F0B03F81400993BA3 /* libNetworkIdentification.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libNetworkIdentification.a; sourceTree = BUILT_PRODUCTS_DIR; };
                F95B8A420B03E07A00993BA3 /* SCNetworkSignature.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SCNetworkSignature.c; sourceTree = "<group>"; };
                F95B8A440B03E09300993BA3 /* SCNetworkSignature.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkSignature.h; sourceTree = "<group>"; };
                F95B8A450B03E09300993BA3 /* SCNetworkSignaturePrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SCNetworkSignaturePrivate.h; sourceTree = "<group>"; };
                F95B8A5F0B03F81400993BA3 /* libNetworkIdentification.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libNetworkIdentification.a; sourceTree = BUILT_PRODUCTS_DIR; };
-               F95B8A670B03F97800993BA3 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
-               F95B8A680B03F97800993BA3 /* NetworkIdentification.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = NetworkIdentification.c; sourceTree = "<group>"; };
+               F95B8A670B03F97800993BA3 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+               F95B8A680B03F97800993BA3 /* NetworkIdentification.c */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.c; path = NetworkIdentification.c; sourceTree = "<group>"; };
                F95B8A700B03F9D100993BA3 /* NetworkIdentification.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NetworkIdentification.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
 /* End PBXFileReference section */
 
                F95B8A700B03F9D100993BA3 /* NetworkIdentification.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NetworkIdentification.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
 /* End PBXFileReference section */
 
                        buildActionMask = 2147483647;
                        files = (
                                15FC13180CCF74740013872C /* CoreFoundation.framework in Frameworks */,
                        buildActionMask = 2147483647;
                        files = (
                                15FC13180CCF74740013872C /* CoreFoundation.framework in Frameworks */,
-                               15E517680CCFBCD0008FFE82 /* SystemConfiguration.framework in Frameworks */,
+                               1559C4490D349A4E0098FD59 /* SystemConfiguration.framework in Frameworks */,
+                               15792B9B0DA2C190008DDED9 /* IOKit.framework in Frameworks */,
                                15FEE80E0CCFD341001312F9 /* ApplicationServices.framework in Frameworks */,
                                150D7E1E0D16DC6C00AF4BED /* Security.framework in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                15FEE80E0CCFD341001312F9 /* ApplicationServices.framework in Frameworks */,
                                150D7E1E0D16DC6C00AF4BED /* Security.framework in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
+               1521400B0E93FF8600DACD2C /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1521400C0E93FFF500DACD2C /* CoreFoundation.framework in Frameworks */,
+                               152140580E93FFFC00DACD2C /* SystemConfiguration.framework in Frameworks */,
+                               15943D440E94081800B87535 /* IOKit.framework in Frameworks */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
                1547001B08455B98006787CE /* Frameworks */ = {
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                                1520A3870846829A0010B584 /* CoreFoundation.framework in Frameworks */,
                1547001B08455B98006787CE /* Frameworks */ = {
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                                1520A3870846829A0010B584 /* CoreFoundation.framework in Frameworks */,
-                               1520A3D0084682A30010B584 /* SystemConfiguration.framework in Frameworks */,
+                               1559C4450D349A4E0098FD59 /* SystemConfiguration.framework in Frameworks */,
                                1520A3DF0846B2DD0010B584 /* Security.framework in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                                1520A3DF0846B2DD0010B584 /* Security.framework in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        buildActionMask = 2147483647;
                        files = (
                                155847640754FDCD0046C2E9 /* CoreFoundation.framework in Frameworks */,
                        buildActionMask = 2147483647;
                        files = (
                                155847640754FDCD0046C2E9 /* CoreFoundation.framework in Frameworks */,
-                               1523F710075A371D0066F0B2 /* SystemConfiguration.framework in Frameworks */,
-                               1523F719075A37C70066F0B2 /* libdnsinfo.a in Frameworks */,
+                               1559C44F0D349A4E0098FD59 /* SystemConfiguration.framework in Frameworks */,
                                155847660754FDCD0046C2E9 /* libedit.dylib in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                                155847660754FDCD0046C2E9 /* libedit.dylib in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        buildActionMask = 2147483647;
                        files = (
                                1558481907550EC10046C2E9 /* CoreFoundation.framework in Frameworks */,
                        buildActionMask = 2147483647;
                        files = (
                                1558481907550EC10046C2E9 /* CoreFoundation.framework in Frameworks */,
-                               1523F6F2075A37050066F0B2 /* SystemConfiguration.framework in Frameworks */,
+                               1559C44E0D349A4E0098FD59 /* SystemConfiguration.framework in Frameworks */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               156CA47C0EF853BB00C59A18 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               156CA47D0EF853BB00C59A18 /* CoreFoundation.framework in Frameworks */,
+                               156CA47E0EF853BB00C59A18 /* SystemConfiguration.framework in Frameworks */,
+                               156CA47F0EF853BB00C59A18 /* IOKit.framework in Frameworks */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1572C5230CFB55B400E2776E /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1572C5240CFB55B400E2776E /* CoreFoundation.framework in Frameworks */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               157433E10D4A8122002ACA73 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               157433E20D4A8122002ACA73 /* CoreFoundation.framework in Frameworks */,
+                               157433E30D4A8122002ACA73 /* SystemConfiguration.framework in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159D53D207528BDA004F8947 /* Frameworks */ = {
+               1574340D0D4A8137002ACA73 /* Frameworks */ = {
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               1574340E0D4A8137002ACA73 /* CoreFoundation.framework in Frameworks */,
+                               1574340F0D4A8137002ACA73 /* SystemConfiguration.framework in Frameworks */,
+                               157434110D4A8137002ACA73 /* libedit.dylib in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159D53DC07528C2E004F8947 /* Frameworks */ = {
+               157A84E20D56C63900B6F1A0 /* Frameworks */ = {
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159D53E307528C4A004F8947 /* Frameworks */ = {
+               1583174B0CFB80A1006F62B9 /* Frameworks */ = {
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               1583174C0CFB80A1006F62B9 /* CoreFoundation.framework in Frameworks */,
+                               154707350D1F70C80075C28D /* SystemConfiguration.framework in Frameworks */,
+                               1583174E0CFB80A1006F62B9 /* IOKit.framework in Frameworks */,
+                               159C32B60F583724008A72EE /* Security.framework in Frameworks */,
+                               158317500CFB80A1006F62B9 /* libbsm.dylib in Frameworks */,
+                               158317520CFB80A1006F62B9 /* libKernelEventMonitor.a in Frameworks */,
+                               158317530CFB80A1006F62B9 /* libInterfaceNamer.a in Frameworks */,
+                               158317540CFB80A1006F62B9 /* libIPMonitor.a in Frameworks */,
+                               158317550CFB80A1006F62B9 /* libLinkConfiguration.a in Frameworks */,
+                               158317560CFB80A1006F62B9 /* libNetworkIdentification.a in Frameworks */,
+                               158317570CFB80A1006F62B9 /* libPreferencesMonitor.a in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159D53EA07528C61004F8947 /* Frameworks */ = {
+               1583379F0CFB6B9E0033AB93 /* Frameworks */ = {
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               158337A00CFB6B9E0033AB93 /* CoreFoundation.framework in Frameworks */,
+                               154707300D1F70C80075C28D /* SystemConfiguration.framework in Frameworks */,
+                               158337A20CFB6B9E0033AB93 /* Security.framework in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159D53F107528C79004F8947 /* Frameworks */ = {
+               159C9B2F0DB68E8300BEEF10 /* Frameworks */ = {
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               159C9B300DB68E8400BEEF10 /* CoreFoundation.framework in Frameworks */,
+                               159C9B7A0DB68E8A00BEEF10 /* SystemConfiguration.framework in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159D53F807528C95004F8947 /* Frameworks */ = {
+               159C9B850DB68F0300BEEF10 /* Frameworks */ = {
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               159C9B860DB68F1600BEEF10 /* CoreFoundation.framework in Frameworks */,
+                               159C9B870DB68F1600BEEF10 /* SystemConfiguration.framework in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        buildActionMask = 2147483647;
                        files = (
                                159D54CC07529FFF004F8947 /* CoreFoundation.framework in Frameworks */,
                        buildActionMask = 2147483647;
                        files = (
                                159D54CC07529FFF004F8947 /* CoreFoundation.framework in Frameworks */,
-                               1523F6F1075A36F70066F0B2 /* SystemConfiguration.framework in Frameworks */,
+                               1559C44A0D349A4E0098FD59 /* SystemConfiguration.framework in Frameworks */,
                                1543636B0752D03C00A8EC6C /* IOKit.framework in Frameworks */,
                                1543636B0752D03C00A8EC6C /* IOKit.framework in Frameworks */,
-                               1523F715075A376B0066F0B2 /* libdnsinfo.a in Frameworks */,
                                15BAA32307F0699A00D9EC95 /* libbsm.dylib in Frameworks */,
                                15BAA32307F0699A00D9EC95 /* libbsm.dylib in Frameworks */,
-                               1533B94D09731BE600F2B34A /* libATconfig.a in Frameworks */,
                                159D54CE07529FFF004F8947 /* libKernelEventMonitor.a in Frameworks */,
                                159D54D007529FFF004F8947 /* libInterfaceNamer.a in Frameworks */,
                                159D54D107529FFF004F8947 /* libIPMonitor.a in Frameworks */,
                                159D54CE07529FFF004F8947 /* libKernelEventMonitor.a in Frameworks */,
                                159D54D007529FFF004F8947 /* libInterfaceNamer.a in Frameworks */,
                                159D54D107529FFF004F8947 /* libIPMonitor.a in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               15DAD5E9075913CE0084A6ED /* Frameworks */ = {
-                       isa = PBXFrameworksBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-               15DAD6AD07591A1A0084A6ED /* Frameworks */ = {
+               15A5A2620D5B94190087BDA0 /* Frameworks */ = {
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               15DAD6AE07591A1A0084A6ED /* CoreFoundation.framework in Frameworks */,
-                               153BED940B75566200989D5C /* libicucore.dylib in Frameworks */,
+                               15A5A2630D5B94190087BDA0 /* CoreFoundation.framework in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               15FD733F0754DBDA001CC321 /* Frameworks */ = {
+               15DAD5E9075913CE0084A6ED /* Frameworks */ = {
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               F95B8A5D0B03F81400993BA3 /* Frameworks */ = {
+               15DAD6AD07591A1A0084A6ED /* Frameworks */ = {
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               15DAD6AE07591A1A0084A6ED /* CoreFoundation.framework in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
-               1514D77D05C08AB700757DC9 /* Initial Preferences */ = {
-                       isa = PBXGroup;
-                       children = (
-                               15CB690505C0722A0099E85F /* preferences.xml */,
-                       );
-                       name = "Initial Preferences";
-                       sourceTree = "<group>";
-               };
                151F5DA80CCE995D0093AC3B /* SCMonitor */ = {
                        isa = PBXGroup;
                        children = (
                151F5DA80CCE995D0093AC3B /* SCMonitor */ = {
                        isa = PBXGroup;
                        children = (
                        name = SCMonitor;
                        sourceTree = "<group>";
                };
                        name = SCMonitor;
                        sourceTree = "<group>";
                };
-               1547002E084561B4006787CE /* SCHelper */ = {
+               1531D3D90E93E6AA00248432 /* Logger */ = {
                        isa = PBXGroup;
                        children = (
                        isa = PBXGroup;
                        children = (
-                               1547002F084561ED006787CE /* Headers */,
-                               15470030084561FF006787CE /* Sources */,
+                               1531D3DB0E93E6DA00248432 /* logger.c */,
+                               1531D3DA0E93E6DA00248432 /* Info.plist */,
+                               156CA48D0EF853BB00C59A18 /* Info-Embedded.plist */,
                        );
                        );
-                       name = SCHelper;
-                       path = SystemConfiguration.fproj;
+                       name = Logger;
                        sourceTree = "<group>";
                };
                        sourceTree = "<group>";
                };
-               1547002F084561ED006787CE /* Headers */ = {
+               154083530D5B824400E07907 /* MacOSX */ = {
                        isa = PBXGroup;
                        children = (
                        isa = PBXGroup;
                        children = (
-                               15DAF2D708466D4900D1B2BD /* helper_comm.h */,
-                               155B7BF60847776D00F0E262 /* SCHelper_client.h */,
+                               15DAD5EE075913CE0084A6ED /* libdnsinfo.a */,
+                               1547072E0D1F70C80075C28D /* SystemConfiguration.framework */,
+                               1547001D08455B98006787CE /* SCHelper */,
+                               151F5D9A0CCE98E50093AC3B /* SCMonitor.plugin */,
+                               158ADBFD0754ECB100124717 /* Plugins */,
+                               158ADCA60754ECC800124717 /* configd, scutil, scselect */,
                        );
                        );
-                       name = Headers;
+                       name = MacOSX;
                        sourceTree = "<group>";
                };
                        sourceTree = "<group>";
                };
-               15470030084561FF006787CE /* Sources */ = {
+               1540835A0D5B825200E07907 /* Embedded */ = {
                        isa = PBXGroup;
                        children = (
                        isa = PBXGroup;
                        children = (
-                               15DAF2D608466D4900D1B2BD /* helper_comm.c */,
-                               15DAF2D808466D4900D1B2BD /* SCHelper_client.c */,
-                               15DAF2D908466D4900D1B2BD /* SCHelper_server.c */,
+                               157A84E80D56C63900B6F1A0 /* libdnsinfo.a */,
+                               1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */,
+                               154083C50D5B832F00E07907 /* Plugins */,
+                               1559C4470D349A4E0098FD59 /* SCHelper */,
+                               154083C90D5B835200E07907 /* configd, scutil, scselect */,
                        );
                        );
-                       name = Sources;
+                       name = Embedded;
                        sourceTree = "<group>";
                };
                        sourceTree = "<group>";
                };
-               1582B36B05FD1A4D009C2750 /* DNSConfiguration */ = {
+               154083890D5B82A900E07907 /* EmbeddedSimulator */ = {
                        isa = PBXGroup;
                        children = (
                        isa = PBXGroup;
                        children = (
-                               1582B37205FD1A5B009C2750 /* Headers */,
-                               1582B37905FD1A66009C2750 /* Sources */,
+                               15A5A26A0D5B94190087BDA0 /* SystemConfiguration.framework */,
                        );
                        );
-                       name = DNSConfiguration;
+                       name = EmbeddedSimulator;
                        sourceTree = "<group>";
                };
                        sourceTree = "<group>";
                };
-               1582B37205FD1A5B009C2750 /* Headers */ = {
+               154083C50D5B832F00E07907 /* Plugins */ = {
                        isa = PBXGroup;
                        children = (
                        isa = PBXGroup;
                        children = (
-                               15B73F0905FD1B670096477F /* dnsinfo.h */,
-                               1532629006281C9D00B1C10C /* dnsinfo_create.h */,
-                               15B73F0C05FD1B670096477F /* dnsinfo_private.h */,
-                               15B73F0E05FD1B670096477F /* dnsinfo_server.h */,
+                               157A85020D56C7E800B6F1A0 /* libIPMonitor.a */,
+                               1559C4500D349A4E0098FD59 /* IPMonitor.bundle */,
+                               157A850D0D56C8AA00B6F1A0 /* libInterfaceNamer.a */,
+                               1559C4510D349A4E0098FD59 /* InterfaceNamer.bundle */,
+                               157A85230D56C8E000B6F1A0 /* libKernelEventMonitor.a */,
+                               1559C4520D349A4E0098FD59 /* KernelEventMonitor.bundle */,
+                               157A852E0D56C91100B6F1A0 /* libLinkConfiguration.a */,
+                               1559C4530D349A4E0098FD59 /* LinkConfiguration.bundle */,
+                               156CA4850EF853BB00C59A18 /* Logger.bundle */,
+                               157A85440D56C96F00B6F1A0 /* libPreferencesMonitor.a */,
+                               1559C4540D349A4E0098FD59 /* PreferencesMonitor.bundle */,
+                               157A85390D56C94F00B6F1A0 /* libNetworkIdentification.a */,
+                               1559C4550D349A4E0098FD59 /* NetworkIdentification.bundle */,
                        );
                        );
-                       name = Headers;
+                       name = Plugins;
+                       sourceTree = "<group>";
+               };
+               154083C90D5B835200E07907 /* configd, scutil, scselect */ = {
+                       isa = PBXGroup;
+                       children = (
+                               1559C44C0D349A4E0098FD59 /* configd */,
+                               157433EC0D4A8122002ACA73 /* scselect */,
+                               1574341A0D4A8137002ACA73 /* scutil */,
+                       );
+                       name = "configd, scutil, scselect";
+                       sourceTree = "<group>";
+               };
+               1547002E084561B4006787CE /* SCHelper */ = {
+                       isa = PBXGroup;
+                       children = (
+                               1547002F084561ED006787CE /* Headers */,
+                               15470030084561FF006787CE /* Sources */,
+                               15FF5C390CDF9C4000EEC8AA /* Supporting Files */,
+                       );
+                       name = SCHelper;
+                       path = SystemConfiguration.fproj;
+                       sourceTree = "<group>";
+               };
+               1547002F084561ED006787CE /* Headers */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15DAF2D708466D4900D1B2BD /* helper_comm.h */,
+                               155B7BF60847776D00F0E262 /* SCHelper_client.h */,
+                       );
+                       name = Headers;
+                       sourceTree = "<group>";
+               };
+               15470030084561FF006787CE /* Sources */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15DAF2D608466D4900D1B2BD /* helper_comm.c */,
+                               15DAF2D808466D4900D1B2BD /* SCHelper_client.c */,
+                               15DAF2D908466D4900D1B2BD /* SCHelper_server.c */,
+                       );
+                       name = Sources;
+                       sourceTree = "<group>";
+               };
+               1582B36B05FD1A4D009C2750 /* DNSConfiguration */ = {
+                       isa = PBXGroup;
+                       children = (
+                               1582B37205FD1A5B009C2750 /* Headers */,
+                               1582B37905FD1A66009C2750 /* Sources */,
+                       );
+                       name = DNSConfiguration;
+                       sourceTree = "<group>";
+               };
+               1582B37205FD1A5B009C2750 /* Headers */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15B73F0905FD1B670096477F /* dnsinfo.h */,
+                               1532629006281C9D00B1C10C /* dnsinfo_create.h */,
+                               15B73F0C05FD1B670096477F /* dnsinfo_private.h */,
+                               15B73F0E05FD1B670096477F /* dnsinfo_server.h */,
+                       );
+                       name = Headers;
                        sourceTree = "<group>";
                };
                1582B37905FD1A66009C2750 /* Sources */ = {
                        sourceTree = "<group>";
                };
                1582B37905FD1A66009C2750 /* Sources */ = {
                                15B73F0B05FD1B670096477F /* dnsinfo_private.c */,
                                15B73F0805FD1B670096477F /* dnsinfo_copy.c */,
                                1521FC5C060F296A003B28F5 /* dnsinfo_create.c */,
                                15B73F0B05FD1B670096477F /* dnsinfo_private.c */,
                                15B73F0805FD1B670096477F /* dnsinfo_copy.c */,
                                1521FC5C060F296A003B28F5 /* dnsinfo_create.c */,
+                               1522FCE50FA7FD7000B24128 /* dnsinfo_flatfile.c */,
                                15B73F0D05FD1B670096477F /* dnsinfo_server.c */,
                        );
                        name = Sources;
                                15B73F0D05FD1B670096477F /* dnsinfo_server.c */,
                        );
                        name = Sources;
                158ADBFD0754ECB100124717 /* Plugins */ = {
                        isa = PBXGroup;
                        children = (
                158ADBFD0754ECB100124717 /* Plugins */ = {
                        isa = PBXGroup;
                        children = (
-                               15FD73400754DBDA001CC321 /* libATconfig.a */,
                                15FD73220754DB9F001CC321 /* ATconfig.bundle */,
                                159D53EC07528C61004F8947 /* libIPMonitor.a */,
                                15FD72A50754DA4C001CC321 /* IPMonitor.bundle */,
                                15FD73220754DB9F001CC321 /* ATconfig.bundle */,
                                159D53EC07528C61004F8947 /* libIPMonitor.a */,
                                15FD72A50754DA4C001CC321 /* IPMonitor.bundle */,
                                15FD72970754DA2B001CC321 /* InterfaceNamer.bundle */,
                                159D53D407528BDA004F8947 /* libKernelEventMonitor.a */,
                                15828AE70753B5F900AD4710 /* KernelEventMonitor.bundle */,
                                15FD72970754DA2B001CC321 /* InterfaceNamer.bundle */,
                                159D53D407528BDA004F8947 /* libKernelEventMonitor.a */,
                                15828AE70753B5F900AD4710 /* KernelEventMonitor.bundle */,
-                               159D53DE07528C2E004F8947 /* libKicker.a */,
                                15FD71090754D628001CC321 /* Kicker.bundle */,
                                159D53F307528C79004F8947 /* libLinkConfiguration.a */,
                                15FD72B50754DA69001CC321 /* LinkConfiguration.bundle */,
                                15FD71090754D628001CC321 /* Kicker.bundle */,
                                159D53F307528C79004F8947 /* libLinkConfiguration.a */,
                                15FD72B50754DA69001CC321 /* LinkConfiguration.bundle */,
-                               F95B8A700B03F9D100993BA3 /* NetworkIdentification.bundle */,
                                F95B8A5F0B03F81400993BA3 /* libNetworkIdentification.a */,
                                F95B8A5F0B03F81400993BA3 /* libNetworkIdentification.a */,
-                               15FD72C90754DA7E001CC321 /* PreferencesMonitor.bundle */,
+                               15213FFA0E93E9F500DACD2C /* Logger.bundle */,
+                               F95B8A700B03F9D100993BA3 /* NetworkIdentification.bundle */,
                                159D53FA07528C95004F8947 /* libPreferencesMonitor.a */,
                                159D53FA07528C95004F8947 /* libPreferencesMonitor.a */,
+                               15FD72C90754DA7E001CC321 /* PreferencesMonitor.bundle */,
                        );
                        name = Plugins;
                        sourceTree = "<group>";
                        );
                        name = Plugins;
                        sourceTree = "<group>";
                                159D53AF07528B36004F8947 /* KernelEventMonitor */,
                                159D53BB07528B36004F8947 /* Kicker */,
                                159D53C007528B36004F8947 /* LinkConfiguration */,
                                159D53AF07528B36004F8947 /* KernelEventMonitor */,
                                159D53BB07528B36004F8947 /* Kicker */,
                                159D53C007528B36004F8947 /* LinkConfiguration */,
+                               1531D3D90E93E6AA00248432 /* Logger */,
                                F95B8A660B03F97800993BA3 /* NetworkIdentification */,
                                159D53C207528B36004F8947 /* PreferencesMonitor */,
                        );
                                F95B8A660B03F97800993BA3 /* NetworkIdentification */,
                                159D53C207528B36004F8947 /* PreferencesMonitor */,
                        );
                                159D53AB07528B36004F8947 /* set-hostname.c */,
                                155D223A0AF13A7300D52ED0 /* smb-configuration.h */,
                                1572EB7A0A506D3B00D02459 /* smb-configuration.c */,
                                159D53AB07528B36004F8947 /* set-hostname.c */,
                                155D223A0AF13A7300D52ED0 /* smb-configuration.h */,
                                1572EB7A0A506D3B00D02459 /* smb-configuration.c */,
-                               159D53A807528B36004F8947 /* Resolvers.plist */,
                                15FD743E0754DE7A001CC321 /* Info.plist */,
                        );
                        name = IPMonitor;
                                15FD743E0754DE7A001CC321 /* Info.plist */,
                        );
                        name = IPMonitor;
                                15B686220678B65C00FF4023 /* NetworkConfiguration.plist */,
                                1577253606EFBF3100D7B52B /* NetworkInterface.strings */,
                                15CFC229068B222F00123568 /* get-mobility-info */,
                                15B686220678B65C00FF4023 /* NetworkConfiguration.plist */,
                                1577253606EFBF3100D7B52B /* NetworkInterface.strings */,
                                15CFC229068B222F00123568 /* get-mobility-info */,
+                               153393E20D34994100FE74E7 /* update-headers */,
                        );
                        name = "Supporting Files";
                        sourceTree = "<group>";
                        );
                        name = "Supporting Files";
                        sourceTree = "<group>";
                                15CB6A2205C0722B0099E85F /* scselect */,
                                15CB6A3705C0722B0099E85F /* scutil */,
                                159D53A207528B06004F8947 /* Plugins */,
                                15CB6A2205C0722B0099E85F /* scselect */,
                                15CB6A3705C0722B0099E85F /* scutil */,
                                159D53A207528B06004F8947 /* Plugins */,
-                               1514D77D05C08AB700757DC9 /* Initial Preferences */,
                                15CB6A6E05C0722B0099E85F /* External Frameworks and Libraries */,
                                15CB690F05C0722B0099E85F /* Products */,
                                15CB6A6E05C0722B0099E85F /* External Frameworks and Libraries */,
                                15CB690F05C0722B0099E85F /* Products */,
+                               15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */,
+                               15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */,
                        );
                        );
+                       indentWidth = 8;
                        name = configd;
                        sourceTree = "<group>";
                        name = configd;
                        sourceTree = "<group>";
+                       tabWidth = 8;
+                       usesTabs = 1;
                };
                15CB690705C0722A0099E85F /* SystemConfiguration */ = {
                        isa = PBXGroup;
                };
                15CB690705C0722A0099E85F /* SystemConfiguration */ = {
                        isa = PBXGroup;
                15CB690F05C0722B0099E85F /* Products */ = {
                        isa = PBXGroup;
                        children = (
                15CB690F05C0722B0099E85F /* Products */ = {
                        isa = PBXGroup;
                        children = (
-                               15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */,
-                               15DAD5EE075913CE0084A6ED /* libdnsinfo.a */,
-                               1547001D08455B98006787CE /* SCHelper */,
-                               151F5D9A0CCE98E50093AC3B /* SCMonitor.plugin */,
-                               158ADCA60754ECC800124717 /* configd, scutil, scselect */,
-                               158ADBFD0754ECB100124717 /* Plugins */,
                                151F63EC09328A3C0096DCC9 /* genSCPreferences */,
                                151F63EC09328A3C0096DCC9 /* genSCPreferences */,
+                               154083530D5B824400E07907 /* MacOSX */,
+                               1540835A0D5B825200E07907 /* Embedded */,
+                               154083890D5B82A900E07907 /* EmbeddedSimulator */,
                        );
                        name = Products;
                        sourceTree = "<group>";
                        );
                        name = Products;
                        sourceTree = "<group>";
                15CB691205C0722B0099E85F /* Headers */ = {
                        isa = PBXGroup;
                        children = (
                15CB691205C0722B0099E85F /* Headers */ = {
                        isa = PBXGroup;
                        children = (
-                               F95B8A440B03E09300993BA3 /* SCNetworkSignature.h */,
-                               F95B8A450B03E09300993BA3 /* SCNetworkSignaturePrivate.h */,
-                               152E68C00A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h */,
                                15CB691305C0722B0099E85F /* SystemConfiguration.h */,
                                150607DE075A00A300B147BA /* SCSchemaDefinitions.h */,
                                157A88880A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h */,
                                15CB691305C0722B0099E85F /* SystemConfiguration.h */,
                                150607DE075A00A300B147BA /* SCSchemaDefinitions.h */,
                                157A88880A470D0F003A4256 /* SCSchemaDefinitionsPrivate.h */,
                                154CF3F307E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h */,
                                15CB693105C0722B0099E85F /* SCPreferencesSetSpecific.h */,
                                156BD6BB07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h */,
                                154CF3F307E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h */,
                                15CB693105C0722B0099E85F /* SCPreferencesSetSpecific.h */,
                                156BD6BB07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h */,
+                               152E68C00A2C89C70011FDA8 /* SCPreferencesKeychainPrivate.h */,
                                15CB691505C0722B0099E85F /* SCPrivate.h */,
                                15AD7A380670A85900BFE03C /* SCNetworkConfiguration.h */,
                                155A1E6B081079CC00F70D98 /* SCNetworkConfigurationPrivate.h */,
                                15CB691505C0722B0099E85F /* SCPrivate.h */,
                                15AD7A380670A85900BFE03C /* SCNetworkConfiguration.h */,
                                155A1E6B081079CC00F70D98 /* SCNetworkConfigurationPrivate.h */,
                                15CB693505C0722B0099E85F /* SCNetworkConnection.h */,
                                15A2972E0A13C08C009879B3 /* SCNetworkConnectionPrivate.h */,
                                15CB693705C0722B0099E85F /* SCNetworkReachability.h */,
                                15CB693505C0722B0099E85F /* SCNetworkConnection.h */,
                                15A2972E0A13C08C009879B3 /* SCNetworkConnectionPrivate.h */,
                                15CB693705C0722B0099E85F /* SCNetworkReachability.h */,
+                               F95B8A440B03E09300993BA3 /* SCNetworkSignature.h */,
+                               F95B8A450B03E09300993BA3 /* SCNetworkSignaturePrivate.h */,
                                15CB693905C0722B0099E85F /* SCValidation.h */,
                                15CB693905C0722B0099E85F /* SCValidation.h */,
-                               9EE943F406AF409B00772EB5 /* BondConfiguration.h */,
-                               9EE943F506AF409B00772EB5 /* BondConfigurationPrivate.h */,
                                15CB694505C0722B0099E85F /* DeviceOnHold.h */,
                                15CB693D05C0722B0099E85F /* DHCPClientPreferences.h */,
                                15CB694705C0722B0099E85F /* LinkConfiguration.h */,
                                15CB694505C0722B0099E85F /* DeviceOnHold.h */,
                                15CB693D05C0722B0099E85F /* DHCPClientPreferences.h */,
                                15CB694705C0722B0099E85F /* LinkConfiguration.h */,
-                               15CB694B05C0722B0099E85F /* VLANConfiguration.h */,
                                15CB694905C0722B0099E85F /* dy_framework.h */,
                                15CB694305C0722B0099E85F /* moh.h */,
                                15CB694105C0722B0099E85F /* moh_msg.h */,
                                15CB694905C0722B0099E85F /* dy_framework.h */,
                                15CB694305C0722B0099E85F /* moh.h */,
                                15CB694105C0722B0099E85F /* moh_msg.h */,
                15CB694F05C0722B0099E85F /* Sources */ = {
                        isa = PBXGroup;
                        children = (
                15CB694F05C0722B0099E85F /* Sources */ = {
                        isa = PBXGroup;
                        children = (
-                               F95B8A420B03E07A00993BA3 /* SCNetworkSignature.c */,
-                               152E68C20A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c */,
                                150607BD075A00A200B147BA /* SCSchemaDefinitions.c */,
                                15CB695005C0722B0099E85F /* SCD.c */,
                                150607BD075A00A200B147BA /* SCSchemaDefinitions.c */,
                                15CB695005C0722B0099E85F /* SCD.c */,
-                               15CB695205C0722B0099E85F /* SCDKeys.c */,
                                15CB695405C0722B0099E85F /* SCDPrivate.c */,
                                15CB695405C0722B0099E85F /* SCDPrivate.c */,
-                               15CB695605C0722B0099E85F /* SCDPlugin.c */,
+                               15CB695205C0722B0099E85F /* SCDKeys.c */,
                                15CB695805C0722B0099E85F /* SCDOpen.c */,
                                15CB695A05C0722B0099E85F /* SCDLock.c */,
                                15CB695C05C0722B0099E85F /* SCDUnlock.c */,
                                15CB695805C0722B0099E85F /* SCDOpen.c */,
                                15CB695A05C0722B0099E85F /* SCDLock.c */,
                                15CB695C05C0722B0099E85F /* SCDUnlock.c */,
                                15CB699805C0722B0099E85F /* SCPApply.c */,
                                15CB699A05C0722B0099E85F /* SCPPath.c */,
                                151BDA5D05D9E2ED00657BC7 /* SCPreferencesPathKey.c */,
                                15CB699805C0722B0099E85F /* SCPApply.c */,
                                15CB699A05C0722B0099E85F /* SCPPath.c */,
                                151BDA5D05D9E2ED00657BC7 /* SCPreferencesPathKey.c */,
+                               152E68C20A2C89E30011FDA8 /* SCPreferencesKeychainPrivate.c */,
                                15AD7A390670A85900BFE03C /* SCNetworkConfigurationInternal.c */,
                                15AD7A3B0670A85900BFE03C /* SCNetworkInterface.c */,
                                15AD7A3C0670A85900BFE03C /* SCNetworkProtocol.c */,
                                15AD7A3D0670A85900BFE03C /* SCNetworkService.c */,
                                15AD7A3E0670A85900BFE03C /* SCNetworkSet.c */,
                                15AD7A390670A85900BFE03C /* SCNetworkConfigurationInternal.c */,
                                15AD7A3B0670A85900BFE03C /* SCNetworkInterface.c */,
                                15AD7A3C0670A85900BFE03C /* SCNetworkProtocol.c */,
                                15AD7A3D0670A85900BFE03C /* SCNetworkService.c */,
                                15AD7A3E0670A85900BFE03C /* SCNetworkSet.c */,
+                               15CB69B205C0722B0099E85F /* LinkConfiguration.c */,
+                               9EE943F306AF409B00772EB5 /* BondConfiguration.c */,
+                               15CB69B605C0722B0099E85F /* VLANConfiguration.c */,
+                               15CB695605C0722B0099E85F /* SCDPlugin.c */,
                                15CB699C05C0722B0099E85F /* SCDConsoleUser.c */,
                                15CB699E05C0722B0099E85F /* SCDHostName.c */,
                                15CB69A005C0722B0099E85F /* SCLocation.c */,
                                15CB699C05C0722B0099E85F /* SCDConsoleUser.c */,
                                15CB699E05C0722B0099E85F /* SCDHostName.c */,
                                15CB69A005C0722B0099E85F /* SCLocation.c */,
                                15CB69A405C0722B0099E85F /* SCNetworkConnection.c */,
                                15A2972D0A13C08C009879B3 /* SCNetworkConnectionPrivate.c */,
                                15CB69A605C0722B0099E85F /* SCNetworkReachability.c */,
                                15CB69A405C0722B0099E85F /* SCNetworkConnection.c */,
                                15A2972D0A13C08C009879B3 /* SCNetworkConnectionPrivate.c */,
                                15CB69A605C0722B0099E85F /* SCNetworkReachability.c */,
+                               F95B8A420B03E07A00993BA3 /* SCNetworkSignature.c */,
                                15CB69A805C0722B0099E85F /* SCProxies.c */,
                                15CB69AC05C0722B0099E85F /* DHCP.c */,
                                15CB69AE05C0722B0099E85F /* moh.c */,
                                15CB69B005C0722B0099E85F /* DeviceOnHold.c */,
                                15CB69A805C0722B0099E85F /* SCProxies.c */,
                                15CB69AC05C0722B0099E85F /* DHCP.c */,
                                15CB69AE05C0722B0099E85F /* moh.c */,
                                15CB69B005C0722B0099E85F /* DeviceOnHold.c */,
-                               15CB69B205C0722B0099E85F /* LinkConfiguration.c */,
                                15CB69B405C0722B0099E85F /* dy_framework.c */,
                                15CB69B405C0722B0099E85F /* dy_framework.c */,
-                               9EE943F306AF409B00772EB5 /* BondConfiguration.c */,
-                               15CB69B605C0722B0099E85F /* VLANConfiguration.c */,
                        );
                        name = Sources;
                        sourceTree = "<group>";
                        );
                        name = Sources;
                        sourceTree = "<group>";
                        children = (
                                1540E3600987DA9500157C07 /* com.apple.configd.plist */,
                                15CB6A2005C0722B0099E85F /* configd.8 */,
                        children = (
                                1540E3600987DA9500157C07 /* com.apple.configd.plist */,
                                15CB6A2005C0722B0099E85F /* configd.8 */,
+                               1567333E0DD1FD6500145179 /* entitlements.plist */,
                        );
                        name = "Supporting Files";
                        sourceTree = "<group>";
                        );
                        name = "Supporting Files";
                        sourceTree = "<group>";
                                1520A3DE0846B2DC0010B584 /* Security.framework */,
                                15BAA32207F0699A00D9EC95 /* libbsm.dylib */,
                                152CEED0070CF6640050F23C /* libedit.dylib */,
                                1520A3DE0846B2DC0010B584 /* Security.framework */,
                                15BAA32207F0699A00D9EC95 /* libbsm.dylib */,
                                152CEED0070CF6640050F23C /* libedit.dylib */,
-                               1587A31F0B6AACD70063104A /* libicucore.dylib */,
                        );
                        name = "External Frameworks and Libraries";
                        sourceTree = "<group>";
                        );
                        name = "External Frameworks and Libraries";
                        sourceTree = "<group>";
                        name = MiG;
                        sourceTree = "<group>";
                };
                        name = MiG;
                        sourceTree = "<group>";
                };
+               15FF5C390CDF9C4000EEC8AA /* Supporting Files */ = {
+                       isa = PBXGroup;
+                       children = (
+                               15FF5C290CDF770500EEC8AA /* com.apple.SCHelper.plist */,
+                               151356AD0CE0CF2F0017E523 /* com.apple.SCHelper-embedded.plist */,
+                       );
+                       name = "Supporting Files";
+                       sourceTree = "<group>";
+               };
                F95B8A660B03F97800993BA3 /* NetworkIdentification */ = {
                        isa = PBXGroup;
                        children = (
                F95B8A660B03F97800993BA3 /* NetworkIdentification */ = {
                        isa = PBXGroup;
                        children = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159D53D007528BDA004F8947 /* Headers */ = {
+               1572C4A80CFB55B400E2776E /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1572C4A90CFB55B400E2776E /* SCSchemaDefinitions.h in Headers */,
+                               1572C4AA0CFB55B400E2776E /* SystemConfiguration.h in Headers */,
+                               1572C4AB0CFB55B400E2776E /* SCPrivate.h in Headers */,
+                               1572C4AC0CFB55B400E2776E /* SCDPlugin.h in Headers */,
+                               1572C4AD0CFB55B400E2776E /* SCDynamicStoreInternal.h in Headers */,
+                               1572C4AE0CFB55B400E2776E /* SCDynamicStore.h in Headers */,
+                               1572C4AF0CFB55B400E2776E /* SCDynamicStorePrivate.h in Headers */,
+                               1572C4B00CFB55B400E2776E /* SCDynamicStoreKey.h in Headers */,
+                               1572C4B10CFB55B400E2776E /* SCDynamicStoreCopySpecific.h in Headers */,
+                               1572C4B20CFB55B400E2776E /* SCDynamicStoreCopySpecificPrivate.h in Headers */,
+                               1572C4B30CFB55B400E2776E /* SCDynamicStoreSetSpecificPrivate.h in Headers */,
+                               1572C4B40CFB55B400E2776E /* SCPreferencesInternal.h in Headers */,
+                               1572C4B50CFB55B400E2776E /* SCPreferences.h in Headers */,
+                               1572C4B60CFB55B400E2776E /* SCPreferencesPrivate.h in Headers */,
+                               1572C4B70CFB55B400E2776E /* SCPreferencesPath.h in Headers */,
+                               1572C4B80CFB55B400E2776E /* SCPreferencesSetSpecific.h in Headers */,
+                               1572C4B90CFB55B400E2776E /* SCNetworkConfiguration.h in Headers */,
+                               1572C4BA0CFB55B400E2776E /* SCNetworkConfigurationInternal.h in Headers */,
+                               1572C4BB0CFB55B400E2776E /* SCNetwork.h in Headers */,
+                               1572C4BC0CFB55B400E2776E /* SCNetworkConnection.h in Headers */,
+                               1572C4BD0CFB55B400E2776E /* SCNetworkReachability.h in Headers */,
+                               1572C4BE0CFB55B400E2776E /* SCValidation.h in Headers */,
+                               1572C4BF0CFB55B400E2776E /* DHCPClientPreferences.h in Headers */,
+                               1572C4C00CFB55B400E2776E /* SCDynamicStoreCopyDHCPInfo.h in Headers */,
+                               1572C4C10CFB55B400E2776E /* moh_msg.h in Headers */,
+                               1572C4C20CFB55B400E2776E /* moh.h in Headers */,
+                               1572C4C30CFB55B400E2776E /* DeviceOnHold.h in Headers */,
+                               1572C4C50CFB55B400E2776E /* dy_framework.h in Headers */,
+                               1572C4C70CFB55B400E2776E /* SCPreferencesPathKey.h in Headers */,
+                               1572C4C80CFB55B400E2776E /* dnsinfo.h in Headers */,
+                               1572C4C90CFB55B400E2776E /* dnsinfo_private.h in Headers */,
+                               1572C4CA0CFB55B400E2776E /* pppcontroller_types.h in Headers */,
+                               1572C4CB0CFB55B400E2776E /* pppcontroller.h in Headers */,
+                               1572C4CE0CFB55B400E2776E /* SCPreferencesSetSpecificPrivate.h in Headers */,
+                               1572C4CF0CFB55B400E2776E /* SCPreferencesGetSpecificPrivate.h in Headers */,
+                               1572C4D00CFB55B400E2776E /* SCNetworkConfigurationPrivate.h in Headers */,
+                               1572C4D10CFB55B400E2776E /* helper_comm.h in Headers */,
+                               1572C4D20CFB55B400E2776E /* SCHelper_client.h in Headers */,
+                               1572C4D40CFB55B400E2776E /* SCNetworkConnectionPrivate.h in Headers */,
+                               1572C4D50CFB55B400E2776E /* SCPreferencesKeychainPrivate.h in Headers */,
+                               1572C4D60CFB55B400E2776E /* SCSchemaDefinitionsPrivate.h in Headers */,
+                               1572C4D70CFB55B400E2776E /* SCNetworkSignature.h in Headers */,
+                               1572C4D80CFB55B400E2776E /* SCNetworkSignaturePrivate.h in Headers */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               157433DE0D4A8122002ACA73 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               157433F10D4A8137002ACA73 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               157433F20D4A8137002ACA73 /* scutil.h in Headers */,
+                               157433F30D4A8137002ACA73 /* commands.h in Headers */,
+                               157433F40D4A8137002ACA73 /* dictionary.h in Headers */,
+                               157433F50D4A8137002ACA73 /* session.h in Headers */,
+                               157433F60D4A8137002ACA73 /* cache.h in Headers */,
+                               157433F70D4A8137002ACA73 /* notifications.h in Headers */,
+                               157433F80D4A8137002ACA73 /* tests.h in Headers */,
+                               157433F90D4A8137002ACA73 /* prefs.h in Headers */,
+                               157433FA0D4A8137002ACA73 /* net.h in Headers */,
+                               157433FB0D4A8137002ACA73 /* net_interface.h in Headers */,
+                               157433FC0D4A8137002ACA73 /* net_protocol.h in Headers */,
+                               157433FD0D4A8137002ACA73 /* net_service.h in Headers */,
+                               157433FE0D4A8137002ACA73 /* net_set.h in Headers */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               157A84D90D56C63900B6F1A0 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               157A84DA0D56C63900B6F1A0 /* dnsinfo.h in Headers */,
+                               157A84DB0D56C63900B6F1A0 /* dnsinfo_private.h in Headers */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               157A84F50D56C7E800B6F1A0 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               157A84F60D56C7E800B6F1A0 /* dns-configuration.h in Headers */,
+                               157A84F70D56C7E800B6F1A0 /* set-hostname.h in Headers */,
+                               15D48EC20F67061F00B4711E /* dnsinfo_create.h in Headers */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               157A85060D56C8AA00B6F1A0 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               157A85110D56C8E000B6F1A0 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               157A85120D56C8E000B6F1A0 /* cache.h in Headers */,
+                               157A85140D56C8E000B6F1A0 /* ev_dlil.h in Headers */,
+                               157A85150D56C8E000B6F1A0 /* ev_ipv4.h in Headers */,
+                               157A85160D56C8E000B6F1A0 /* ev_ipv6.h in Headers */,
+                               157A85170D56C8E000B6F1A0 /* eventmon.h in Headers */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               157A85270D56C91100B6F1A0 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               157A85320D56C94F00B6F1A0 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               157A853D0D56C96F00B6F1A0 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               158317240CFB80A1006F62B9 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               158317250CFB80A1006F62B9 /* configd.h in Headers */,
+                               158317260CFB80A1006F62B9 /* _SCD.h in Headers */,
+                               158317270CFB80A1006F62B9 /* configd_server.h in Headers */,
+                               158317280CFB80A1006F62B9 /* notify_server.h in Headers */,
+                               158317290CFB80A1006F62B9 /* plugin_support.h in Headers */,
+                               1583172A0CFB80A1006F62B9 /* session.h in Headers */,
+                               1583172B0CFB80A1006F62B9 /* pattern.h in Headers */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583379A0CFB6B9E0033AB93 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583379B0CFB6B9E0033AB93 /* helper_comm.h in Headers */,
+                               1583379C0CFB6B9E0033AB93 /* SCHelper_client.h in Headers */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159C9B2B0DB68E2600BEEF10 /* Headers */ = {
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               159D540A07528D3B004F8947 /* cache.h in Headers */,
-                               159D540C07528DAA004F8947 /* ev_appletalk.h in Headers */,
-                               159D540E07528DAE004F8947 /* ev_dlil.h in Headers */,
-                               159D541007528DB1004F8947 /* ev_ipv4.h in Headers */,
-                               159D541207528DB3004F8947 /* ev_ipv6.h in Headers */,
-                               159D541407528DB5004F8947 /* eventmon.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159D53DA07528C2E004F8947 /* Headers */ = {
+               159C9B830DB68F0300BEEF10 /* Headers */ = {
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
+               159D53D007528BDA004F8947 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               159D540A07528D3B004F8947 /* cache.h in Headers */,
+                               159D540E07528DAE004F8947 /* ev_dlil.h in Headers */,
+                               159D541007528DB1004F8947 /* ev_ipv4.h in Headers */,
+                               159D541207528DB3004F8947 /* ev_ipv6.h in Headers */,
+                               159D541407528DB5004F8947 /* eventmon.h in Headers */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
                159D53E107528C4A004F8947 /* Headers */ = {
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                159D53E107528C4A004F8947 /* Headers */ = {
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                                155D223B0AF13A7300D52ED0 /* dns-configuration.h in Headers */,
                                155D223C0AF13A7300D52ED0 /* set-hostname.h in Headers */,
                                155D223D0AF13A7300D52ED0 /* smb-configuration.h in Headers */,
                                155D223B0AF13A7300D52ED0 /* dns-configuration.h in Headers */,
                                155D223C0AF13A7300D52ED0 /* set-hostname.h in Headers */,
                                155D223D0AF13A7300D52ED0 /* smb-configuration.h in Headers */,
+                               15D48EC00F67061700B4711E /* dnsinfo_create.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
+               15A5A1E60D5B94190087BDA0 /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               15A5A1E70D5B94190087BDA0 /* SCSchemaDefinitions.h in Headers */,
+                               15A5A1E80D5B94190087BDA0 /* SystemConfiguration.h in Headers */,
+                               15A5A1E90D5B94190087BDA0 /* SCPrivate.h in Headers */,
+                               15A5A1EA0D5B94190087BDA0 /* SCDPlugin.h in Headers */,
+                               15A5A1EB0D5B94190087BDA0 /* SCDynamicStoreInternal.h in Headers */,
+                               15A5A1EC0D5B94190087BDA0 /* SCDynamicStore.h in Headers */,
+                               15A5A1ED0D5B94190087BDA0 /* SCDynamicStorePrivate.h in Headers */,
+                               15A5A1EE0D5B94190087BDA0 /* SCDynamicStoreKey.h in Headers */,
+                               15A5A1EF0D5B94190087BDA0 /* SCDynamicStoreCopySpecific.h in Headers */,
+                               15A5A1F00D5B94190087BDA0 /* SCDynamicStoreCopySpecificPrivate.h in Headers */,
+                               15A5A1F10D5B94190087BDA0 /* SCDynamicStoreSetSpecificPrivate.h in Headers */,
+                               15A5A1F20D5B94190087BDA0 /* SCPreferencesInternal.h in Headers */,
+                               15A5A1F30D5B94190087BDA0 /* SCPreferences.h in Headers */,
+                               15A5A1F40D5B94190087BDA0 /* SCPreferencesPrivate.h in Headers */,
+                               15A5A1F50D5B94190087BDA0 /* SCPreferencesPath.h in Headers */,
+                               15A5A1F60D5B94190087BDA0 /* SCPreferencesSetSpecific.h in Headers */,
+                               15A5A1F70D5B94190087BDA0 /* SCNetworkConfiguration.h in Headers */,
+                               15A5A1F80D5B94190087BDA0 /* SCNetworkConfigurationInternal.h in Headers */,
+                               15A5A1F90D5B94190087BDA0 /* SCNetwork.h in Headers */,
+                               15A5A1FA0D5B94190087BDA0 /* SCNetworkConnection.h in Headers */,
+                               15A5A1FB0D5B94190087BDA0 /* SCNetworkReachability.h in Headers */,
+                               15A5A1FC0D5B94190087BDA0 /* SCValidation.h in Headers */,
+                               15A5A1FD0D5B94190087BDA0 /* DHCPClientPreferences.h in Headers */,
+                               15A5A1FE0D5B94190087BDA0 /* SCDynamicStoreCopyDHCPInfo.h in Headers */,
+                               15A5A1FF0D5B94190087BDA0 /* moh_msg.h in Headers */,
+                               15A5A2000D5B94190087BDA0 /* moh.h in Headers */,
+                               15A5A2010D5B94190087BDA0 /* DeviceOnHold.h in Headers */,
+                               15A5A2030D5B94190087BDA0 /* dy_framework.h in Headers */,
+                               15A5A2050D5B94190087BDA0 /* SCPreferencesPathKey.h in Headers */,
+                               15A5A2060D5B94190087BDA0 /* dnsinfo.h in Headers */,
+                               15A5A2070D5B94190087BDA0 /* dnsinfo_private.h in Headers */,
+                               15A5A2080D5B94190087BDA0 /* pppcontroller_types.h in Headers */,
+                               15A5A2090D5B94190087BDA0 /* pppcontroller.h in Headers */,
+                               15A5A20C0D5B94190087BDA0 /* SCPreferencesSetSpecificPrivate.h in Headers */,
+                               15A5A20D0D5B94190087BDA0 /* SCPreferencesGetSpecificPrivate.h in Headers */,
+                               15A5A20E0D5B94190087BDA0 /* SCNetworkConfigurationPrivate.h in Headers */,
+                               15A5A20F0D5B94190087BDA0 /* helper_comm.h in Headers */,
+                               15A5A2100D5B94190087BDA0 /* SCHelper_client.h in Headers */,
+                               15A5A2110D5B94190087BDA0 /* SCNetworkConnectionPrivate.h in Headers */,
+                               15A5A2120D5B94190087BDA0 /* SCPreferencesKeychainPrivate.h in Headers */,
+                               15A5A2130D5B94190087BDA0 /* SCSchemaDefinitionsPrivate.h in Headers */,
+                               15A5A2140D5B94190087BDA0 /* SCNetworkSignature.h in Headers */,
+                               15A5A2150D5B94190087BDA0 /* SCNetworkSignaturePrivate.h in Headers */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
                15DAD5E0075913CE0084A6ED /* Headers */ = {
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                                15DAD5E1075913CE0084A6ED /* dnsinfo.h in Headers */,
                                15DAD5E2075913CE0084A6ED /* dnsinfo_private.h in Headers */,
                15DAD5E0075913CE0084A6ED /* Headers */ = {
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                                15DAD5E1075913CE0084A6ED /* dnsinfo.h in Headers */,
                                15DAD5E2075913CE0084A6ED /* dnsinfo_private.h in Headers */,
-                               15DAD5E3075913CE0084A6ED /* dnsinfo_create.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                15DAD65C07591A1A0084A6ED /* DeviceOnHold.h in Headers */,
                                15DAD65D07591A1A0084A6ED /* LinkConfiguration.h in Headers */,
                                15DAD65E07591A1A0084A6ED /* dy_framework.h in Headers */,
                                15DAD65C07591A1A0084A6ED /* DeviceOnHold.h in Headers */,
                                15DAD65D07591A1A0084A6ED /* LinkConfiguration.h in Headers */,
                                15DAD65E07591A1A0084A6ED /* dy_framework.h in Headers */,
-                               15DAD65F07591A1A0084A6ED /* VLANConfiguration.h in Headers */,
                                15DAD66107591A1A0084A6ED /* SCPreferencesPathKey.h in Headers */,
                                15DAD66207591A1A0084A6ED /* dnsinfo.h in Headers */,
                                15DAD66307591A1A0084A6ED /* dnsinfo_private.h in Headers */,
                                15DAD66407591A1A0084A6ED /* pppcontroller_types.h in Headers */,
                                15DAD66507591A1A0084A6ED /* pppcontroller.h in Headers */,
                                15DAD66107591A1A0084A6ED /* SCPreferencesPathKey.h in Headers */,
                                15DAD66207591A1A0084A6ED /* dnsinfo.h in Headers */,
                                15DAD66307591A1A0084A6ED /* dnsinfo_private.h in Headers */,
                                15DAD66407591A1A0084A6ED /* pppcontroller_types.h in Headers */,
                                15DAD66507591A1A0084A6ED /* pppcontroller.h in Headers */,
-                               15DAD66607591A1A0084A6ED /* BondConfiguration.h in Headers */,
-                               15DAD66707591A1A0084A6ED /* BondConfigurationPrivate.h in Headers */,
                                156BD6BC07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h in Headers */,
                                154CF3F407E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h in Headers */,
                                155A1E6C081079CC00F70D98 /* SCNetworkConfigurationPrivate.h in Headers */,
                                156BD6BC07E0DFA9008698FF /* SCPreferencesSetSpecificPrivate.h in Headers */,
                                154CF3F407E1EA4D00D8302E /* SCPreferencesGetSpecificPrivate.h in Headers */,
                                155A1E6C081079CC00F70D98 /* SCNetworkConfigurationPrivate.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               15FD733C0754DBDA001CC321 /* Headers */ = {
-                       isa = PBXHeadersBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
                F95B8A5B0B03F81400993BA3 /* Headers */ = {
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                F95B8A5B0B03F81400993BA3 /* Headers */ = {
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                        productReference = 151F63EC09328A3C0096DCC9 /* genSCPreferences */;
                        productType = "com.apple.product-type.tool";
                };
                        productReference = 151F63EC09328A3C0096DCC9 /* genSCPreferences */;
                        productType = "com.apple.product-type.tool";
                };
+               15213FF90E93E9F500DACD2C /* Logger.bundle */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 15213FFF0E93E9F600DACD2C /* Build configuration list for PBXNativeTarget "Logger.bundle" */;
+                       buildPhases = (
+                               15213FF70E93E9F500DACD2C /* Sources */,
+                               1521400B0E93FF8600DACD2C /* Frameworks */,
+                               15213FF60E93E9F500DACD2C /* Resources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = Logger.bundle;
+                       productName = Logger.bundle;
+                       productReference = 15213FFA0E93E9F500DACD2C /* Logger.bundle */;
+                       productType = "com.apple.product-type.bundle";
+               };
                1547001808455B98006787CE /* SCHelper */ = {
                        isa = PBXNativeTarget;
                        buildConfigurationList = 156EB5E20905594A00EEF749 /* Build configuration list for PBXNativeTarget "SCHelper" */;
                1547001808455B98006787CE /* SCHelper */ = {
                        isa = PBXNativeTarget;
                        buildConfigurationList = 156EB5E20905594A00EEF749 /* Build configuration list for PBXNativeTarget "SCHelper" */;
                                1547001908455B98006787CE /* Headers */,
                                1547001A08455B98006787CE /* Sources */,
                                1547001B08455B98006787CE /* Frameworks */,
                                1547001908455B98006787CE /* Headers */,
                                1547001A08455B98006787CE /* Sources */,
                                1547001B08455B98006787CE /* Frameworks */,
-                               1547001C08455B98006787CE /* Rez */,
+                               15FF5C380CDF778F00EEC8AA /* CopyFiles */,
                        );
                        buildRules = (
                        );
                        );
                        buildRules = (
                        );
                                155847460754FDCD0046C2E9 /* Headers */,
                                155847540754FDCD0046C2E9 /* Sources */,
                                155847620754FDCD0046C2E9 /* Frameworks */,
                                155847460754FDCD0046C2E9 /* Headers */,
                                155847540754FDCD0046C2E9 /* Sources */,
                                155847620754FDCD0046C2E9 /* Frameworks */,
-                               155847670754FDCD0046C2E9 /* Rez */,
                                155847680754FDCD0046C2E9 /* CopyFiles */,
                        );
                        buildRules = (
                                155847680754FDCD0046C2E9 /* CopyFiles */,
                        );
                        buildRules = (
                                1558481407550EC10046C2E9 /* Headers */,
                                1558481507550EC10046C2E9 /* Sources */,
                                1558481707550EC10046C2E9 /* Frameworks */,
                                1558481407550EC10046C2E9 /* Headers */,
                                1558481507550EC10046C2E9 /* Sources */,
                                1558481707550EC10046C2E9 /* Frameworks */,
-                               1558481A07550EC10046C2E9 /* Rez */,
                                1558481B07550EC10046C2E9 /* CopyFiles */,
                        );
                        buildRules = (
                                1558481B07550EC10046C2E9 /* CopyFiles */,
                        );
                        buildRules = (
                        productReference = 1558481D07550EC10046C2E9 /* scselect */;
                        productType = "com.apple.product-type.tool";
                };
                        productReference = 1558481D07550EC10046C2E9 /* scselect */;
                        productType = "com.apple.product-type.tool";
                };
-               15828AE60753B5F900AD4710 /* KernelEventMonitor.bundle */ = {
+               156CA4790EF853BB00C59A18 /* Logger.bundle-Embedded */ = {
                        isa = PBXNativeTarget;
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB5FE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "KernelEventMonitor.bundle" */;
+                       buildConfigurationList = 156CA4820EF853BB00C59A18 /* Build configuration list for PBXNativeTarget "Logger.bundle-Embedded" */;
                        buildPhases = (
                        buildPhases = (
-                               15828AE30753B5F900AD4710 /* Resources */,
+                               156CA47A0EF853BB00C59A18 /* Sources */,
+                               156CA47C0EF853BB00C59A18 /* Frameworks */,
+                               156CA4810EF853BB00C59A18 /* Resources */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = KernelEventMonitor.bundle;
-                       productName = KernelEventMonitor.bundle;
-                       productReference = 15828AE70753B5F900AD4710 /* KernelEventMonitor.bundle */;
+                       name = "Logger.bundle-Embedded";
+                       productName = Logger.bundle;
+                       productReference = 156CA4850EF853BB00C59A18 /* Logger.bundle */;
                        productType = "com.apple.product-type.bundle";
                };
                        productType = "com.apple.product-type.bundle";
                };
-               159D53D307528BDA004F8947 /* KernelEventMonitor */ = {
+               1572C4A60CFB55B400E2776E /* SystemConfiguration.framework-Embedded */ = {
                        isa = PBXNativeTarget;
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB6020905594A00EEF749 /* Build configuration list for PBXNativeTarget "KernelEventMonitor" */;
+                       buildConfigurationList = 1572C5290CFB55B400E2776E /* Build configuration list for PBXNativeTarget "SystemConfiguration.framework-Embedded" */;
                        buildPhases = (
                        buildPhases = (
-                               159D53D007528BDA004F8947 /* Headers */,
-                               159D53D107528BDA004F8947 /* Sources */,
-                               159D53D207528BDA004F8947 /* Frameworks */,
+                               1572C4A80CFB55B400E2776E /* Headers */,
+                               153393E40D34999D00FE74E7 /* Update Headers */,
+                               1572C4D90CFB55B400E2776E /* Resources */,
+                               1572C4DE0CFB55B400E2776E /* Sources */,
+                               1572C5230CFB55B400E2776E /* Frameworks */,
+                               1572C5270CFB55B400E2776E /* get-mobility-info */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = KernelEventMonitor;
-                       productName = KernelEventMonitor;
-                       productReference = 159D53D407528BDA004F8947 /* libKernelEventMonitor.a */;
-                       productType = "com.apple.product-type.library.static";
+                       name = "SystemConfiguration.framework-Embedded";
+                       productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
+                       productName = "SystemConfiguration (Framework)";
+                       productReference = 1547072E0D1F70C80075C28D /* SystemConfiguration.framework */;
+                       productType = "com.apple.product-type.framework";
                };
                };
-               159D53DD07528C2E004F8947 /* Kicker */ = {
+               157433DD0D4A8122002ACA73 /* scselect-Embedded */ = {
                        isa = PBXNativeTarget;
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB6060905594A00EEF749 /* Build configuration list for PBXNativeTarget "Kicker" */;
+                       buildConfigurationList = 157433E80D4A8122002ACA73 /* Build configuration list for PBXNativeTarget "scselect-Embedded" */;
                        buildPhases = (
                        buildPhases = (
-                               159D53DA07528C2E004F8947 /* Headers */,
-                               159D53DB07528C2E004F8947 /* Sources */,
-                               159D53DC07528C2E004F8947 /* Frameworks */,
+                               157433DE0D4A8122002ACA73 /* Headers */,
+                               157433DF0D4A8122002ACA73 /* Sources */,
+                               157433E10D4A8122002ACA73 /* Frameworks */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = Kicker;
-                       productName = Kicker;
-                       productReference = 159D53DE07528C2E004F8947 /* libKicker.a */;
-                       productType = "com.apple.product-type.library.static";
+                       name = "scselect-Embedded";
+                       productInstallPath = /usr/sbin;
+                       productName = "scselect (Tool)";
+                       productReference = 157433EC0D4A8122002ACA73 /* scselect */;
+                       productType = "com.apple.product-type.tool";
                };
                };
-               159D53E407528C4A004F8947 /* InterfaceNamer */ = {
+               157433F00D4A8137002ACA73 /* scutil-Embedded */ = {
                        isa = PBXNativeTarget;
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB5F60905594A00EEF749 /* Build configuration list for PBXNativeTarget "InterfaceNamer" */;
+                       buildConfigurationList = 157434160D4A8137002ACA73 /* Build configuration list for PBXNativeTarget "scutil-Embedded" */;
                        buildPhases = (
                        buildPhases = (
-                               159D53E107528C4A004F8947 /* Headers */,
-                               159D53E207528C4A004F8947 /* Sources */,
-                               159D53E307528C4A004F8947 /* Frameworks */,
+                               157433F10D4A8137002ACA73 /* Headers */,
+                               157433FF0D4A8137002ACA73 /* Sources */,
+                               1574340D0D4A8137002ACA73 /* Frameworks */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = InterfaceNamer;
-                       productName = InterfaceNamer;
-                       productReference = 159D53E507528C4A004F8947 /* libInterfaceNamer.a */;
-                       productType = "com.apple.product-type.library.static";
+                       name = "scutil-Embedded";
+                       productInstallPath = /usr/sbin;
+                       productName = "scutil (Tool)";
+                       productReference = 1574341A0D4A8137002ACA73 /* scutil */;
+                       productType = "com.apple.product-type.tool";
                };
                };
-               159D53EB07528C61004F8947 /* IPMonitor */ = {
+               157A84D80D56C63900B6F1A0 /* DNSConfiguration-Embedded */ = {
                        isa = PBXNativeTarget;
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB5EE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "IPMonitor" */;
+                       buildConfigurationList = 157A84E40D56C63900B6F1A0 /* Build configuration list for PBXNativeTarget "DNSConfiguration-Embedded" */;
                        buildPhases = (
                        buildPhases = (
-                               159D53E807528C61004F8947 /* Headers */,
-                               159D53E907528C61004F8947 /* Sources */,
-                               159D53EA07528C61004F8947 /* Frameworks */,
+                               157A84D90D56C63900B6F1A0 /* Headers */,
+                               157A84DD0D56C63900B6F1A0 /* Sources */,
+                               157A84E20D56C63900B6F1A0 /* Frameworks */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = IPMonitor;
-                       productName = IPMonitor;
-                       productReference = 159D53EC07528C61004F8947 /* libIPMonitor.a */;
+                       name = "DNSConfiguration-Embedded";
+                       productInstallPath = /usr/local/lib/system;
+                       productName = DNSConfiguration;
+                       productReference = 157A84E80D56C63900B6F1A0 /* libdnsinfo.a */;
                        productType = "com.apple.product-type.library.static";
                };
                        productType = "com.apple.product-type.library.static";
                };
-               159D53F207528C79004F8947 /* LinkConfiguration */ = {
+               157A84F40D56C7E800B6F1A0 /* IPMonitor-Embedded */ = {
                        isa = PBXNativeTarget;
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB60E0905594A00EEF749 /* Build configuration list for PBXNativeTarget "LinkConfiguration" */;
+                       buildConfigurationList = 157A84FE0D56C7E800B6F1A0 /* Build configuration list for PBXNativeTarget "IPMonitor-Embedded" */;
                        buildPhases = (
                        buildPhases = (
-                               159D53EF07528C79004F8947 /* Headers */,
-                               159D53F007528C79004F8947 /* Sources */,
-                               159D53F107528C79004F8947 /* Frameworks */,
+                               157A84F50D56C7E800B6F1A0 /* Headers */,
+                               157A84F90D56C7E800B6F1A0 /* Sources */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = LinkConfiguration;
-                       productName = LinkConfiguration;
-                       productReference = 159D53F307528C79004F8947 /* libLinkConfiguration.a */;
+                       name = "IPMonitor-Embedded";
+                       productName = IPMonitor;
+                       productReference = 157A85020D56C7E800B6F1A0 /* libIPMonitor.a */;
                        productType = "com.apple.product-type.library.static";
                };
                        productType = "com.apple.product-type.library.static";
                };
-               159D53F907528C95004F8947 /* PreferencesMonitor */ = {
+               157A85050D56C8AA00B6F1A0 /* InterfaceNamer-Embedded */ = {
                        isa = PBXNativeTarget;
                        isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB6160905594A00EEF749 /* Build configuration list for PBXNativeTarget "PreferencesMonitor" */;
+                       buildConfigurationList = 157A85090D56C8AA00B6F1A0 /* Build configuration list for PBXNativeTarget "InterfaceNamer-Embedded" */;
                        buildPhases = (
                        buildPhases = (
-                               159D53F607528C95004F8947 /* Headers */,
-                               159D53F707528C95004F8947 /* Sources */,
-                               159D53F807528C95004F8947 /* Frameworks */,
+                               157A85060D56C8AA00B6F1A0 /* Headers */,
+                               157A85070D56C8AA00B6F1A0 /* Sources */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
-                       name = PreferencesMonitor;
-                       productName = PreferencesMonitor;
+                       name = "InterfaceNamer-Embedded";
+                       productName = InterfaceNamer;
+                       productReference = 157A850D0D56C8AA00B6F1A0 /* libInterfaceNamer.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               157A85100D56C8E000B6F1A0 /* KernelEventMonitor-Embedded */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 157A851F0D56C8E000B6F1A0 /* Build configuration list for PBXNativeTarget "KernelEventMonitor-Embedded" */;
+                       buildPhases = (
+                               157A85110D56C8E000B6F1A0 /* Headers */,
+                               157A85180D56C8E000B6F1A0 /* Sources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = "KernelEventMonitor-Embedded";
+                       productName = KernelEventMonitor;
+                       productReference = 157A85230D56C8E000B6F1A0 /* libKernelEventMonitor.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               157A85260D56C91100B6F1A0 /* LinkConfiguration-Embedded */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 157A852A0D56C91100B6F1A0 /* Build configuration list for PBXNativeTarget "LinkConfiguration-Embedded" */;
+                       buildPhases = (
+                               157A85270D56C91100B6F1A0 /* Headers */,
+                               157A85280D56C91100B6F1A0 /* Sources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = "LinkConfiguration-Embedded";
+                       productName = LinkConfiguration;
+                       productReference = 157A852E0D56C91100B6F1A0 /* libLinkConfiguration.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               157A85310D56C94F00B6F1A0 /* NetworkIdentification-Embedded */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 157A85350D56C94F00B6F1A0 /* Build configuration list for PBXNativeTarget "NetworkIdentification-Embedded" */;
+                       buildPhases = (
+                               157A85320D56C94F00B6F1A0 /* Headers */,
+                               157A85330D56C94F00B6F1A0 /* Sources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = "NetworkIdentification-Embedded";
+                       productName = NetworkIdentification;
+                       productReference = 157A85390D56C94F00B6F1A0 /* libNetworkIdentification.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               157A853C0D56C96F00B6F1A0 /* PreferencesMonitor-Embedded */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 157A85400D56C96F00B6F1A0 /* Build configuration list for PBXNativeTarget "PreferencesMonitor-Embedded" */;
+                       buildPhases = (
+                               157A853D0D56C96F00B6F1A0 /* Headers */,
+                               157A853E0D56C96F00B6F1A0 /* Sources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = "PreferencesMonitor-Embedded";
+                       productName = PreferencesMonitor;
+                       productReference = 157A85440D56C96F00B6F1A0 /* libPreferencesMonitor.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               15828AE60753B5F900AD4710 /* KernelEventMonitor.bundle */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB5FE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "KernelEventMonitor.bundle" */;
+                       buildPhases = (
+                               15828AE30753B5F900AD4710 /* Resources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = KernelEventMonitor.bundle;
+                       productName = KernelEventMonitor.bundle;
+                       productReference = 15828AE70753B5F900AD4710 /* KernelEventMonitor.bundle */;
+                       productType = "com.apple.product-type.bundle";
+               };
+               158317230CFB80A1006F62B9 /* configd-Embedded */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 1583175D0CFB80A1006F62B9 /* Build configuration list for PBXNativeTarget "configd-Embedded" */;
+                       buildPhases = (
+                               158317240CFB80A1006F62B9 /* Headers */,
+                               1583172C0CFB80A1006F62B9 /* Sources */,
+                               1583174B0CFB80A1006F62B9 /* Frameworks */,
+                               1583175B0CFB80A1006F62B9 /* CopyFiles */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = "configd-Embedded";
+                       productInstallPath = /usr/sbin;
+                       productName = "configd (Tool)";
+                       productReference = 1559C44C0D349A4E0098FD59 /* configd */;
+                       productType = "com.apple.product-type.tool";
+               };
+               1583177D0CFB85C8006F62B9 /* IPMonitor.bundle-Embedded */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 158317800CFB85C8006F62B9 /* Build configuration list for PBXNativeTarget "IPMonitor.bundle-Embedded" */;
+                       buildPhases = (
+                               1583177E0CFB85C8006F62B9 /* Resources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = "IPMonitor.bundle-Embedded";
+                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
+                       productName = IPMonitor.bundle;
+                       productReference = 1559C4500D349A4E0098FD59 /* IPMonitor.bundle */;
+                       productType = "com.apple.product-type.bundle";
+               };
+               158317870CFB85DD006F62B9 /* InterfaceNamer.bundle-Embedded */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 158317890CFB85DD006F62B9 /* Build configuration list for PBXNativeTarget "InterfaceNamer.bundle-Embedded" */;
+                       buildPhases = (
+                               158317880CFB85DD006F62B9 /* Resources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = "InterfaceNamer.bundle-Embedded";
+                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
+                       productName = InterfaceNamer.bundle;
+                       productReference = 1559C4510D349A4E0098FD59 /* InterfaceNamer.bundle */;
+                       productType = "com.apple.product-type.bundle";
+               };
+               158317900CFB85F7006F62B9 /* KernelEventMonitor.bundle-Embedded */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 158317920CFB85F7006F62B9 /* Build configuration list for PBXNativeTarget "KernelEventMonitor.bundle-Embedded" */;
+                       buildPhases = (
+                               158317910CFB85F7006F62B9 /* Resources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = "KernelEventMonitor.bundle-Embedded";
+                       productName = KernelEventMonitor.bundle;
+                       productReference = 1559C4520D349A4E0098FD59 /* KernelEventMonitor.bundle */;
+                       productType = "com.apple.product-type.bundle";
+               };
+               158317980CFB860C006F62B9 /* LinkConfiguration.bundle-Embedded */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 1583179A0CFB860C006F62B9 /* Build configuration list for PBXNativeTarget "LinkConfiguration.bundle-Embedded" */;
+                       buildPhases = (
+                               158317990CFB860C006F62B9 /* Resources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = "LinkConfiguration.bundle-Embedded";
+                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
+                       productName = LinkConfiguration.bundle;
+                       productReference = 1559C4530D349A4E0098FD59 /* LinkConfiguration.bundle */;
+                       productType = "com.apple.product-type.bundle";
+               };
+               158317A00CFB8626006F62B9 /* NetworkIdentification.bundle-Embedded */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 158317A20CFB8626006F62B9 /* Build configuration list for PBXNativeTarget "NetworkIdentification.bundle-Embedded" */;
+                       buildPhases = (
+                               158317A10CFB8626006F62B9 /* Resources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = "NetworkIdentification.bundle-Embedded";
+                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
+                       productName = NetworkIdentification.bundle;
+                       productReference = 1559C4550D349A4E0098FD59 /* NetworkIdentification.bundle */;
+                       productType = "com.apple.product-type.bundle";
+               };
+               158317A80CFB8639006F62B9 /* PreferencesMonitor.bundle-Embedded */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 158317AA0CFB8639006F62B9 /* Build configuration list for PBXNativeTarget "PreferencesMonitor.bundle-Embedded" */;
+                       buildPhases = (
+                               158317A90CFB8639006F62B9 /* Resources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = "PreferencesMonitor.bundle-Embedded";
+                       productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
+                       productName = PreferencesMonitor.bundle;
+                       productReference = 1559C4540D349A4E0098FD59 /* PreferencesMonitor.bundle */;
+                       productType = "com.apple.product-type.bundle";
+               };
+               158337990CFB6B9E0033AB93 /* SCHelper-Embedded */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 158337A60CFB6B9E0033AB93 /* Build configuration list for PBXNativeTarget "SCHelper-Embedded" */;
+                       buildPhases = (
+                               1583379A0CFB6B9E0033AB93 /* Headers */,
+                               1583379D0CFB6B9E0033AB93 /* Sources */,
+                               1583379F0CFB6B9E0033AB93 /* Frameworks */,
+                               158337A40CFB6B9E0033AB93 /* CopyFiles */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = "SCHelper-Embedded";
+                       productInstallPath = /usr/local/bin;
+                       productName = SCPreferencesHelper;
+                       productReference = 1559C4470D349A4E0098FD59 /* SCHelper */;
+                       productType = "com.apple.product-type.tool";
+               };
+               159D53D307528BDA004F8947 /* KernelEventMonitor */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB6020905594A00EEF749 /* Build configuration list for PBXNativeTarget "KernelEventMonitor" */;
+                       buildPhases = (
+                               159D53D007528BDA004F8947 /* Headers */,
+                               159D53D107528BDA004F8947 /* Sources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = KernelEventMonitor;
+                       productName = KernelEventMonitor;
+                       productReference = 159D53D407528BDA004F8947 /* libKernelEventMonitor.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               159D53E407528C4A004F8947 /* InterfaceNamer */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB5F60905594A00EEF749 /* Build configuration list for PBXNativeTarget "InterfaceNamer" */;
+                       buildPhases = (
+                               159D53E107528C4A004F8947 /* Headers */,
+                               159D53E207528C4A004F8947 /* Sources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = InterfaceNamer;
+                       productName = InterfaceNamer;
+                       productReference = 159D53E507528C4A004F8947 /* libInterfaceNamer.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               159D53EB07528C61004F8947 /* IPMonitor */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB5EE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "IPMonitor" */;
+                       buildPhases = (
+                               159D53E807528C61004F8947 /* Headers */,
+                               159D53E907528C61004F8947 /* Sources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = IPMonitor;
+                       productName = IPMonitor;
+                       productReference = 159D53EC07528C61004F8947 /* libIPMonitor.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               159D53F207528C79004F8947 /* LinkConfiguration */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB60E0905594A00EEF749 /* Build configuration list for PBXNativeTarget "LinkConfiguration" */;
+                       buildPhases = (
+                               159D53EF07528C79004F8947 /* Headers */,
+                               159D53F007528C79004F8947 /* Sources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = LinkConfiguration;
+                       productName = LinkConfiguration;
+                       productReference = 159D53F307528C79004F8947 /* libLinkConfiguration.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               159D53F907528C95004F8947 /* PreferencesMonitor */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 156EB6160905594A00EEF749 /* Build configuration list for PBXNativeTarget "PreferencesMonitor" */;
+                       buildPhases = (
+                               159D53F607528C95004F8947 /* Headers */,
+                               159D53F707528C95004F8947 /* Sources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = PreferencesMonitor;
+                       productName = PreferencesMonitor;
                        productReference = 159D53FA07528C95004F8947 /* libPreferencesMonitor.a */;
                        productType = "com.apple.product-type.library.static";
                };
                        productReference = 159D53FA07528C95004F8947 /* libPreferencesMonitor.a */;
                        productType = "com.apple.product-type.library.static";
                };
                                159D54A307529FFF004F8947 /* Headers */,
                                159D54AB07529FFF004F8947 /* Sources */,
                                159D54CA07529FFF004F8947 /* Frameworks */,
                                159D54A307529FFF004F8947 /* Headers */,
                                159D54AB07529FFF004F8947 /* Sources */,
                                159D54CA07529FFF004F8947 /* Frameworks */,
-                               159D54D407529FFF004F8947 /* Rez */,
                                159D54D507529FFF004F8947 /* CopyFiles */,
                                159D54D707529FFF004F8947 /* CopyFiles */,
                        );
                                159D54D507529FFF004F8947 /* CopyFiles */,
                                159D54D707529FFF004F8947 /* CopyFiles */,
                        );
                        productReference = 159D54D907529FFF004F8947 /* configd */;
                        productType = "com.apple.product-type.tool";
                };
                        productReference = 159D54D907529FFF004F8947 /* configd */;
                        productType = "com.apple.product-type.tool";
                };
+               15A5A1E40D5B94190087BDA0 /* SystemConfiguration.framework-EmbeddedSimulator */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 15A5A2660D5B94190087BDA0 /* Build configuration list for PBXNativeTarget "SystemConfiguration.framework-EmbeddedSimulator" */;
+                       buildPhases = (
+                               15A5A1E60D5B94190087BDA0 /* Headers */,
+                               15A5A2170D5B94190087BDA0 /* Update Headers */,
+                               15A5A2180D5B94190087BDA0 /* Resources */,
+                               15A5A21D0D5B94190087BDA0 /* Sources */,
+                               15A5A2620D5B94190087BDA0 /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = "SystemConfiguration.framework-EmbeddedSimulator";
+                       productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
+                       productName = "SystemConfiguration (Framework)";
+                       productReference = 15A5A26A0D5B94190087BDA0 /* SystemConfiguration.framework */;
+                       productType = "com.apple.product-type.framework";
+               };
                15DAD5DF075913CE0084A6ED /* DNSConfiguration */ = {
                        isa = PBXNativeTarget;
                        buildConfigurationList = 156EB5DA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "DNSConfiguration" */;
                15DAD5DF075913CE0084A6ED /* DNSConfiguration */ = {
                        isa = PBXNativeTarget;
                        buildConfigurationList = 156EB5DA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "DNSConfiguration" */;
                                15DAD5E0075913CE0084A6ED /* Headers */,
                                15DAD5E4075913CE0084A6ED /* Sources */,
                                15DAD5E9075913CE0084A6ED /* Frameworks */,
                                15DAD5E0075913CE0084A6ED /* Headers */,
                                15DAD5E4075913CE0084A6ED /* Sources */,
                                15DAD5E9075913CE0084A6ED /* Frameworks */,
-                               15DAD5EA075913CE0084A6ED /* Rez */,
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
                        name = DNSConfiguration;
                        );
                        buildRules = (
                        );
                        dependencies = (
                        );
                        name = DNSConfiguration;
-                       productInstallPath = /usr/local/lib;
+                       productInstallPath = /usr/local/lib/system;
                        productName = DNSConfiguration;
                        productReference = 15DAD5EE075913CE0084A6ED /* libdnsinfo.a */;
                        productType = "com.apple.product-type.library.static";
                        productName = DNSConfiguration;
                        productReference = 15DAD5EE075913CE0084A6ED /* libdnsinfo.a */;
                        productType = "com.apple.product-type.library.static";
                        buildPhases = (
                                15DAD6AC07591A1A0084A6ED /* SystemConfiguration.order */,
                                15DAD64107591A1A0084A6ED /* Headers */,
                        buildPhases = (
                                15DAD6AC07591A1A0084A6ED /* SystemConfiguration.order */,
                                15DAD64107591A1A0084A6ED /* Headers */,
+                               15AC82480D376E2400A579D0 /* Update Headers */,
                                15DAD66807591A1A0084A6ED /* Resources */,
                                15DAD66C07591A1A0084A6ED /* Sources */,
                                15DAD6AD07591A1A0084A6ED /* Frameworks */,
                                15DAD66807591A1A0084A6ED /* Resources */,
                                15DAD66C07591A1A0084A6ED /* Sources */,
                                15DAD6AD07591A1A0084A6ED /* Frameworks */,
-                               15DAD6AF07591A1A0084A6ED /* Rez */,
                                15DAD6B007591A1A0084A6ED /* get-mobility-info */,
                                15DAD6B007591A1A0084A6ED /* get-mobility-info */,
-                               15DAD6B107591A1A0084A6ED /* preferences.plist */,
                        );
                        buildRules = (
                        );
                        );
                        buildRules = (
                        );
                        name = SystemConfiguration.framework;
                        productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
                        productName = "SystemConfiguration (Framework)";
                        name = SystemConfiguration.framework;
                        productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
                        productName = "SystemConfiguration (Framework)";
-                       productReference = 15DAD6C807591A1A0084A6ED /* SystemConfiguration.framework */;
+                       productReference = 1559C4440D349A4E0098FD59 /* SystemConfiguration.framework */;
                        productType = "com.apple.product-type.framework";
                };
                15FD70FF0754D627001CC321 /* Kicker.bundle */ = {
                        isa = PBXNativeTarget;
                        buildConfigurationList = 156EB60A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "Kicker.bundle" */;
                        buildPhases = (
                        productType = "com.apple.product-type.framework";
                };
                15FD70FF0754D627001CC321 /* Kicker.bundle */ = {
                        isa = PBXNativeTarget;
                        buildConfigurationList = 156EB60A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "Kicker.bundle" */;
                        buildPhases = (
+                               159C9B830DB68F0300BEEF10 /* Headers */,
+                               159C9B840DB68F0300BEEF10 /* Sources */,
+                               159C9B850DB68F0300BEEF10 /* Frameworks */,
                                15FD71010754D627001CC321 /* Resources */,
                        );
                        buildRules = (
                                15FD71010754D627001CC321 /* Resources */,
                        );
                        buildRules = (
                        );
                        name = InterfaceNamer.bundle;
                        productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
                        );
                        name = InterfaceNamer.bundle;
                        productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
-                       productName = Kicker.bundle;
+                       productName = InterfaceNamer.bundle;
                        productReference = 15FD72970754DA2B001CC321 /* InterfaceNamer.bundle */;
                        productType = "com.apple.product-type.bundle";
                };
                        productReference = 15FD72970754DA2B001CC321 /* InterfaceNamer.bundle */;
                        productType = "com.apple.product-type.bundle";
                };
                        );
                        name = IPMonitor.bundle;
                        productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
                        );
                        name = IPMonitor.bundle;
                        productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
-                       productName = Kicker.bundle;
+                       productName = IPMonitor.bundle;
                        productReference = 15FD72A50754DA4C001CC321 /* IPMonitor.bundle */;
                        productType = "com.apple.product-type.bundle";
                };
                        productReference = 15FD72A50754DA4C001CC321 /* IPMonitor.bundle */;
                        productType = "com.apple.product-type.bundle";
                };
                        );
                        name = LinkConfiguration.bundle;
                        productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
                        );
                        name = LinkConfiguration.bundle;
                        productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
-                       productName = Kicker.bundle;
+                       productName = LinkConfiguration.bundle;
                        productReference = 15FD72B50754DA69001CC321 /* LinkConfiguration.bundle */;
                        productType = "com.apple.product-type.bundle";
                };
                        productReference = 15FD72B50754DA69001CC321 /* LinkConfiguration.bundle */;
                        productType = "com.apple.product-type.bundle";
                };
                        );
                        name = PreferencesMonitor.bundle;
                        productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
                        );
                        name = PreferencesMonitor.bundle;
                        productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
-                       productName = Kicker.bundle;
+                       productName = PreferencesMonitor.bundle;
                        productReference = 15FD72C90754DA7E001CC321 /* PreferencesMonitor.bundle */;
                        productType = "com.apple.product-type.bundle";
                };
                        productReference = 15FD72C90754DA7E001CC321 /* PreferencesMonitor.bundle */;
                        productType = "com.apple.product-type.bundle";
                };
                        isa = PBXNativeTarget;
                        buildConfigurationList = 156EB5EA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "ATconfig.bundle" */;
                        buildPhases = (
                        isa = PBXNativeTarget;
                        buildConfigurationList = 156EB5EA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "ATconfig.bundle" */;
                        buildPhases = (
+                               159C9B2B0DB68E2600BEEF10 /* Headers */,
+                               159C9B2C0DB68E2600BEEF10 /* Sources */,
+                               159C9B2F0DB68E8300BEEF10 /* Frameworks */,
                                15FD731F0754DB9F001CC321 /* Resources */,
                        );
                        buildRules = (
                                15FD731F0754DB9F001CC321 /* Resources */,
                        );
                        buildRules = (
                        );
                        name = ATconfig.bundle;
                        productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
                        );
                        name = ATconfig.bundle;
                        productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
-                       productName = Kicker.bundle;
+                       productName = ATconfig.bundle;
                        productReference = 15FD73220754DB9F001CC321 /* ATconfig.bundle */;
                        productType = "com.apple.product-type.bundle";
                };
                        productReference = 15FD73220754DB9F001CC321 /* ATconfig.bundle */;
                        productType = "com.apple.product-type.bundle";
                };
-               15FD733A0754DBDA001CC321 /* ATconfig */ = {
-                       isa = PBXNativeTarget;
-                       buildConfigurationList = 156EB63A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "ATconfig" */;
-                       buildPhases = (
-                               15FD733C0754DBDA001CC321 /* Headers */,
-                               15FD733D0754DBDA001CC321 /* Sources */,
-                               15FD733F0754DBDA001CC321 /* Frameworks */,
-                       );
-                       buildRules = (
-                       );
-                       dependencies = (
-                       );
-                       name = ATconfig;
-                       productName = InterfaceNamer;
-                       productReference = 15FD73400754DBDA001CC321 /* libATconfig.a */;
-                       productType = "com.apple.product-type.library.static";
-               };
                F95B8A5E0B03F81400993BA3 /* NetworkIdentification */ = {
                        isa = PBXNativeTarget;
                        buildConfigurationList = F95B8A610B03F83200993BA3 /* Build configuration list for PBXNativeTarget "NetworkIdentification" */;
                        buildPhases = (
                                F95B8A5B0B03F81400993BA3 /* Headers */,
                                F95B8A5C0B03F81400993BA3 /* Sources */,
                F95B8A5E0B03F81400993BA3 /* NetworkIdentification */ = {
                        isa = PBXNativeTarget;
                        buildConfigurationList = F95B8A610B03F83200993BA3 /* Build configuration list for PBXNativeTarget "NetworkIdentification" */;
                        buildPhases = (
                                F95B8A5B0B03F81400993BA3 /* Headers */,
                                F95B8A5C0B03F81400993BA3 /* Sources */,
-                               F95B8A5D0B03F81400993BA3 /* Frameworks */,
                        );
                        buildRules = (
                        );
                        );
                        buildRules = (
                        );
                        );
                        name = NetworkIdentification.bundle;
                        productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
                        );
                        name = NetworkIdentification.bundle;
                        productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
-                       productName = Kicker.bundle;
+                       productName = NetworkIdentification.bundle;
                        productReference = F95B8A700B03F9D100993BA3 /* NetworkIdentification.bundle */;
                        productType = "com.apple.product-type.bundle";
                };
                        productReference = F95B8A700B03F9D100993BA3 /* NetworkIdentification.bundle */;
                        productType = "com.apple.product-type.bundle";
                };
                15CB6A7705C0722B0099E85F /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 156EB63E0905594A00EEF749 /* Build configuration list for PBXProject "configd" */;
                15CB6A7705C0722B0099E85F /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 156EB63E0905594A00EEF749 /* Build configuration list for PBXProject "configd" */;
-                       compatibilityVersion = "Xcode 2.4";
+                       compatibilityVersion = "Xcode 3.1";
                        hasScannedForEncodings = 1;
                        mainGroup = 15CB68FC05C072220099E85F /* configd */;
                        productRefGroup = 15CB690F05C0722B0099E85F /* Products */;
                        hasScannedForEncodings = 1;
                        mainGroup = 15CB68FC05C072220099E85F /* configd */;
                        productRefGroup = 15CB690F05C0722B0099E85F /* Products */;
                        projectRoot = "";
                        targets = (
                                15CB690005C0722A0099E85F /* All */,
                        projectRoot = "";
                        targets = (
                                15CB690005C0722A0099E85F /* All */,
-                               157BB8AE075924360025DA7A /* configd_base */,
-                               159D542007528E7C004F8947 /* configd_plugins */,
-                               155847FA07550D210046C2E9 /* configd_executables */,
+                               15C64A1E0F684C3300D78394 /* configd_libSystem */,
                                15DAD5DF075913CE0084A6ED /* DNSConfiguration */,
                                15DAD5DF075913CE0084A6ED /* DNSConfiguration */,
-                               151F63DA09328A3C0096DCC9 /* Schema */,
+                               157BB8AE075924360025DA7A /* configd_base */,
                                15DAD63F07591A1A0084A6ED /* SystemConfiguration.framework */,
                                1547001808455B98006787CE /* SCHelper */,
                                15DAD63F07591A1A0084A6ED /* SystemConfiguration.framework */,
                                1547001808455B98006787CE /* SCHelper */,
-                               151F5D990CCE98E50093AC3B /* SCMonitor */,
-                               159D549F07529FFF004F8947 /* configd */,
-                               1558481207550EC10046C2E9 /* scselect */,
-                               155847430754FDCD0046C2E9 /* scutil */,
-                               15FD733A0754DBDA001CC321 /* ATconfig */,
+                               159D542007528E7C004F8947 /* configd_plugins */,
                                15FD731E0754DB9F001CC321 /* ATconfig.bundle */,
                                159D53EB07528C61004F8947 /* IPMonitor */,
                                15FD72A10754DA4C001CC321 /* IPMonitor.bundle */,
                                15FD731E0754DB9F001CC321 /* ATconfig.bundle */,
                                159D53EB07528C61004F8947 /* IPMonitor */,
                                15FD72A10754DA4C001CC321 /* IPMonitor.bundle */,
                                15FD72930754DA2B001CC321 /* InterfaceNamer.bundle */,
                                159D53D307528BDA004F8947 /* KernelEventMonitor */,
                                15828AE60753B5F900AD4710 /* KernelEventMonitor.bundle */,
                                15FD72930754DA2B001CC321 /* InterfaceNamer.bundle */,
                                159D53D307528BDA004F8947 /* KernelEventMonitor */,
                                15828AE60753B5F900AD4710 /* KernelEventMonitor.bundle */,
-                               159D53DD07528C2E004F8947 /* Kicker */,
                                15FD70FF0754D627001CC321 /* Kicker.bundle */,
                                159D53F207528C79004F8947 /* LinkConfiguration */,
                                15FD72B10754DA69001CC321 /* LinkConfiguration.bundle */,
                                15FD70FF0754D627001CC321 /* Kicker.bundle */,
                                159D53F207528C79004F8947 /* LinkConfiguration */,
                                15FD72B10754DA69001CC321 /* LinkConfiguration.bundle */,
+                               15213FF90E93E9F500DACD2C /* Logger.bundle */,
                                F95B8A5E0B03F81400993BA3 /* NetworkIdentification */,
                                F95B8A6A0B03F9D100993BA3 /* NetworkIdentification.bundle */,
                                159D53F907528C95004F8947 /* PreferencesMonitor */,
                                15FD72C50754DA7E001CC321 /* PreferencesMonitor.bundle */,
                                F95B8A5E0B03F81400993BA3 /* NetworkIdentification */,
                                F95B8A6A0B03F9D100993BA3 /* NetworkIdentification.bundle */,
                                159D53F907528C95004F8947 /* PreferencesMonitor */,
                                15FD72C50754DA7E001CC321 /* PreferencesMonitor.bundle */,
-                       );
+                               155847FA07550D210046C2E9 /* configd_executables */,
+                               159D549F07529FFF004F8947 /* configd */,
+                               1558481207550EC10046C2E9 /* scselect */,
+                               155847430754FDCD0046C2E9 /* scutil */,
+                               151F5D990CCE98E50093AC3B /* SCMonitor */,
+                               151C1CC60CFB487000C5AFD6 /* All-Embedded */,
+                               15C64A280F684C6B00D78394 /* configd_libSystem-Embedded */,
+                               157A84D80D56C63900B6F1A0 /* DNSConfiguration-Embedded */,
+                               158316CF0CFB774B006F62B9 /* configd_base-Embedded */,
+                               1572C4A60CFB55B400E2776E /* SystemConfiguration.framework-Embedded */,
+                               158337990CFB6B9E0033AB93 /* SCHelper-Embedded */,
+                               158316E30CFB7761006F62B9 /* configd_plugins-Embedded */,
+                               157A84F40D56C7E800B6F1A0 /* IPMonitor-Embedded */,
+                               1583177D0CFB85C8006F62B9 /* IPMonitor.bundle-Embedded */,
+                               157A85050D56C8AA00B6F1A0 /* InterfaceNamer-Embedded */,
+                               158317870CFB85DD006F62B9 /* InterfaceNamer.bundle-Embedded */,
+                               157A85100D56C8E000B6F1A0 /* KernelEventMonitor-Embedded */,
+                               158317900CFB85F7006F62B9 /* KernelEventMonitor.bundle-Embedded */,
+                               157A85260D56C91100B6F1A0 /* LinkConfiguration-Embedded */,
+                               158317980CFB860C006F62B9 /* LinkConfiguration.bundle-Embedded */,
+                               156CA4790EF853BB00C59A18 /* Logger.bundle-Embedded */,
+                               157A85310D56C94F00B6F1A0 /* NetworkIdentification-Embedded */,
+                               158317A00CFB8626006F62B9 /* NetworkIdentification.bundle-Embedded */,
+                               157A853C0D56C96F00B6F1A0 /* PreferencesMonitor-Embedded */,
+                               158317A80CFB8639006F62B9 /* PreferencesMonitor.bundle-Embedded */,
+                               158317040CFB7782006F62B9 /* configd_executables-Embedded */,
+                               158317230CFB80A1006F62B9 /* configd-Embedded */,
+                               157433DD0D4A8122002ACA73 /* scselect-Embedded */,
+                               157433F00D4A8137002ACA73 /* scutil-Embedded */,
+                               15FD13BF0D59485000F9409C /* All-EmbeddedSimulator */,
+                               151FE2DD0D5B7046000D6DB1 /* configd_base-EmbeddedSimulator */,
+                               15A5A1E40D5B94190087BDA0 /* SystemConfiguration.framework-EmbeddedSimulator */,
+                               151F63DA09328A3C0096DCC9 /* Schema */,
+                       );
                };
 /* End PBXProject section */
 
                };
 /* End PBXProject section */
 
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
+               15213FF60E93E9F500DACD2C /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               156CA4810EF853BB00C59A18 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1572C4D90CFB55B400E2776E /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1572C4DA0CFB55B400E2776E /* Localizable.strings in Resources */,
+                               1572C4DB0CFB55B400E2776E /* NetworkInterface.strings in Resources */,
+                               1572C4DC0CFB55B400E2776E /* NetworkConfiguration.plist in Resources */,
+                               1572C4DD0CFB55B400E2776E /* get-mobility-info in Resources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
                15828AE30753B5F900AD4710 /* Resources */ = {
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                15828AE30753B5F900AD4710 /* Resources */ = {
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               15DAD66807591A1A0084A6ED /* Resources */ = {
+               1583177E0CFB85C8006F62B9 /* Resources */ = {
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               15A6F7C40A4B266D00B907EA /* Localizable.strings in Resources */,
-                               15DAD66B07591A1A0084A6ED /* NetworkInterface.strings in Resources */,
-                               15DAD66907591A1A0084A6ED /* NetworkConfiguration.plist in Resources */,
-                               15DAD66A07591A1A0084A6ED /* get-mobility-info in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               15FD71010754D627001CC321 /* Resources */ = {
+               158317880CFB85DD006F62B9 /* Resources */ = {
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               158ADD190754F1F100124717 /* Kicker.xml in Resources */,
-                               158ADD1B0754F1F400124717 /* enable-network in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               15FD72940754DA2B001CC321 /* Resources */ = {
+               158317910CFB85F7006F62B9 /* Resources */ = {
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               15FD72A20754DA4C001CC321 /* Resources */ = {
+               158317990CFB860C006F62B9 /* Resources */ = {
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               158ADD0E0754F1A000124717 /* Resolvers.plist in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               15FD72B20754DA69001CC321 /* Resources */ = {
+               158317A10CFB8626006F62B9 /* Resources */ = {
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               15FD72C60754DA7E001CC321 /* Resources */ = {
+               158317A90CFB8639006F62B9 /* Resources */ = {
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               15FD731F0754DB9F001CC321 /* Resources */ = {
+               15A5A2180D5B94190087BDA0 /* Resources */ = {
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               15A5A2190D5B94190087BDA0 /* Localizable.strings in Resources */,
+                               15A5A21A0D5B94190087BDA0 /* NetworkInterface.strings in Resources */,
+                               15A5A21B0D5B94190087BDA0 /* NetworkConfiguration.plist in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               F95B8A6B0B03F9D100993BA3 /* Resources */ = {
+               15DAD66807591A1A0084A6ED /* Resources */ = {
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               15A6F7C40A4B266D00B907EA /* Localizable.strings in Resources */,
+                               15DAD66B07591A1A0084A6ED /* NetworkInterface.strings in Resources */,
+                               15DAD66907591A1A0084A6ED /* NetworkConfiguration.plist in Resources */,
+                               15DAD66A07591A1A0084A6ED /* get-mobility-info in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-/* End PBXResourcesBuildPhase section */
-
-/* Begin PBXRezBuildPhase section */
-               1547001C08455B98006787CE /* Rez */ = {
-                       isa = PBXRezBuildPhase;
+               15FD71010754D627001CC321 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               158ADD190754F1F100124717 /* Kicker.xml in Resources */,
+                               158ADD1B0754F1F400124717 /* enable-network in Resources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               15FD72940754DA2B001CC321 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               155847670754FDCD0046C2E9 /* Rez */ = {
-                       isa = PBXRezBuildPhase;
+               15FD72A20754DA4C001CC321 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               1558481A07550EC10046C2E9 /* Rez */ = {
-                       isa = PBXRezBuildPhase;
+               15FD72B20754DA69001CC321 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159D54D407529FFF004F8947 /* Rez */ = {
-                       isa = PBXRezBuildPhase;
+               15FD72C60754DA7E001CC321 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               15DAD5EA075913CE0084A6ED /* Rez */ = {
-                       isa = PBXRezBuildPhase;
+               15FD731F0754DB9F001CC321 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               15DAD6AF07591A1A0084A6ED /* Rez */ = {
-                       isa = PBXRezBuildPhase;
+               F95B8A6B0B03F9D100993BA3 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        buildActionMask = 2147483647;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-/* End PBXRezBuildPhase section */
+/* End PBXResourcesBuildPhase section */
 
 /* Begin PBXShellScriptBuildPhase section */
                151F63DB09328A3C0096DCC9 /* ShellScript */ = {
 
 /* Begin PBXShellScriptBuildPhase section */
                151F63DB09328A3C0096DCC9 /* ShellScript */ = {
                        shellPath = /bin/sh;
                        shellScript = "echo ${BUILT_PRODUCTS_DIR}\ncc -o ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME} ${SRCROOT}/SystemConfiguration.fproj/genSCPreferences.c || exit 1\n${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME} header   > ${BUILT_PRODUCTS_DIR}/SCSchemaDefinitions.h        || exit 1\n${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME} private  > ${BUILT_PRODUCTS_DIR}/SCSchemaDefinitionsPrivate.h || exit 1\n${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME} cfile    > ${BUILT_PRODUCTS_DIR}/SCSchemaDefinitions.c        || exit 1\nexit 0";
                };
                        shellPath = /bin/sh;
                        shellScript = "echo ${BUILT_PRODUCTS_DIR}\ncc -o ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME} ${SRCROOT}/SystemConfiguration.fproj/genSCPreferences.c || exit 1\n${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME} header   > ${BUILT_PRODUCTS_DIR}/SCSchemaDefinitions.h        || exit 1\n${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME} private  > ${BUILT_PRODUCTS_DIR}/SCSchemaDefinitionsPrivate.h || exit 1\n${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME} cfile    > ${BUILT_PRODUCTS_DIR}/SCSchemaDefinitions.c        || exit 1\nexit 0";
                };
-               15DAD6AC07591A1A0084A6ED /* SystemConfiguration.order */ = {
+               153393E40D34999D00FE74E7 /* Update Headers */ = {
                        isa = PBXShellScriptBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        inputPaths = (
                        isa = PBXShellScriptBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        );
                        inputPaths = (
-                               /usr/local/lib/OrderFiles/SystemConfiguration.order,
+                               "$(SRCROOT)/SystemConfiguration.fproj/update-headers",
                        );
                        );
-                       name = SystemConfiguration.order;
+                       name = "Update Headers";
                        outputPaths = (
                        outputPaths = (
-                               "${OBJROOT}/SystemConfiguration.order",
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        shellPath = /bin/sh;
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        shellPath = /bin/sh;
-                       shellScript = "if [ -r /usr/local/lib/OrderFiles/SystemConfiguration.order ]; then\n\tcp /usr/local/lib/OrderFiles/SystemConfiguration.order ${OBJROOT}/SystemConfiguration.order\nelse\n\ttouch ${OBJROOT}/SystemConfiguration.order\nfi";
+                       shellScript = "if [ -x ${SCRIPT_INPUT_FILE_0} ]; then\n\t${SCRIPT_INPUT_FILE_0} split\nfi\n";
+                       showEnvVarsInLog = 0;
                };
                };
-               15DAD6B007591A1A0084A6ED /* get-mobility-info */ = {
+               1572C5270CFB55B400E2776E /* get-mobility-info */ = {
                        isa = PBXShellScriptBuildPhase;
                        buildActionMask = 8;
                        files = (
                        isa = PBXShellScriptBuildPhase;
                        buildActionMask = 8;
                        files = (
                        );
                        runOnlyForDeploymentPostprocessing = 1;
                        shellPath = /bin/sh;
                        );
                        runOnlyForDeploymentPostprocessing = 1;
                        shellPath = /bin/sh;
-                       shellScript = "mkdir -p \"${DSTROOT}/usr/local/bin\"\nln -fs \"${INSTALL_PATH}/${TARGET_NAME}/Resources/get-mobility-info\" \"${DSTROOT}/usr/local/bin/\"\n";
+                       shellScript = "mkdir -p \"${DSTROOT}/usr/local/bin\"\nln -fs \"${INSTALL_PATH}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/get-mobility-info\" \"${DSTROOT}/usr/local/bin/\"\n";
+                       showEnvVarsInLog = 0;
+               };
+               15A5A2170D5B94190087BDA0 /* Update Headers */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                               "$(SRCROOT)/SystemConfiguration.fproj/update-headers",
+                       );
+                       name = "Update Headers";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/sh;
+                       shellScript = "if [ -x ${SCRIPT_INPUT_FILE_0} ]; then\n\t${SCRIPT_INPUT_FILE_0} split\nfi\n";
+                       showEnvVarsInLog = 0;
+               };
+               15AC82480D376E2400A579D0 /* Update Headers */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                               "$(SRCROOT)/SystemConfiguration.fproj/update-headers",
+                       );
+                       name = "Update Headers";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/sh;
+                       shellScript = "if [ -x ${SCRIPT_INPUT_FILE_0} ]; then\n\t${SCRIPT_INPUT_FILE_0} clean\nfi\n";
+                       showEnvVarsInLog = 0;
+               };
+               15BED7930F6853F800016614 /* OLD libdnsinfo.a */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 8;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "OLD libdnsinfo.a";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 1;
+                       shellPath = /bin/sh;
+                       shellScript = "if [ -f \"${INSTALL_DIR}/libdnsinfo.a\" ]; then\n\tln -f \"${INSTALL_DIR}/libdnsinfo.a\" \"${INSTALL_DIR}/../libdnsinfo.a\"\nfi";
+                       showEnvVarsInLog = 0;
+               };
+               15BED7A20F68551200016614 /* OLD libdnsinfo.a */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 8;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "OLD libdnsinfo.a";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 1;
+                       shellPath = /bin/sh;
+                       shellScript = "if [ -f \"${INSTALL_DIR}/libdnsinfo.a\" ]; then\n\tln -f \"${INSTALL_DIR}/libdnsinfo.a\" \"${INSTALL_DIR}/../libdnsinfo.a\"\nfi";
+                       showEnvVarsInLog = 0;
+               };
+               15DAD6AC07591A1A0084A6ED /* SystemConfiguration.order */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                               /usr/local/lib/OrderFiles/SystemConfiguration.order,
+                       );
+                       name = SystemConfiguration.order;
+                       outputPaths = (
+                               "${OBJROOT}/SystemConfiguration.order",
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/sh;
+                       shellScript = "if [ -r /usr/local/lib/OrderFiles/SystemConfiguration.order ]; then\n\tcp /usr/local/lib/OrderFiles/SystemConfiguration.order ${OBJROOT}/SystemConfiguration.order\nelse\n\ttouch ${OBJROOT}/SystemConfiguration.order\nfi";
+                       showEnvVarsInLog = 0;
                };
                };
-               15DAD6B107591A1A0084A6ED /* preferences.plist */ = {
+               15DAD6B007591A1A0084A6ED /* get-mobility-info */ = {
                        isa = PBXShellScriptBuildPhase;
                        buildActionMask = 8;
                        files = (
                        );
                        inputPaths = (
                        isa = PBXShellScriptBuildPhase;
                        buildActionMask = 8;
                        files = (
                        );
                        inputPaths = (
-                               preferences.xml,
                        );
                        );
-                       name = preferences.plist;
+                       name = "get-mobility-info";
                        outputPaths = (
                        );
                        runOnlyForDeploymentPostprocessing = 1;
                        shellPath = /bin/sh;
                        outputPaths = (
                        );
                        runOnlyForDeploymentPostprocessing = 1;
                        shellPath = /bin/sh;
-                       shellScript = "PREFS_DIR=\"/Library/Preferences/SystemConfiguration\"\nmkdir -p ${DSTROOT}${PREFS_DIR}\nchmod 755 ${DSTROOT}${PREFS_DIR}\n#install -c -m 644 preferences.xml ${DSTROOT}${PREFS_DIR}/preferences.plist";
+                       shellScript = "mkdir -p \"${DSTROOT}/usr/local/bin\"\nln -fs \"${INSTALL_PATH}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/get-mobility-info\" \"${DSTROOT}/usr/local/bin/\"\n";
+                       showEnvVarsInLog = 0;
                };
 /* End PBXShellScriptBuildPhase section */
 
                };
 /* End PBXShellScriptBuildPhase section */
 
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
+               15213FF70E93E9F500DACD2C /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               152140020E93EC6500DACD2C /* logger.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
                1547001A08455B98006787CE /* Sources */ = {
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                1547001A08455B98006787CE /* Sources */ = {
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159D53D107528BDA004F8947 /* Sources */ = {
+               156CA47A0EF853BB00C59A18 /* Sources */ = {
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               159D540907528D3A004F8947 /* cache.c in Sources */,
-                               159D540B07528DA9004F8947 /* ev_appletalk.c in Sources */,
-                               159D540D07528DAE004F8947 /* ev_dlil.c in Sources */,
-                               159D540F07528DB0004F8947 /* ev_ipv4.c in Sources */,
-                               159D541107528DB2004F8947 /* ev_ipv6.c in Sources */,
-                               159D541307528DB5004F8947 /* eventmon.c in Sources */,
+                               156CA47B0EF853BB00C59A18 /* logger.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1572C4DE0CFB55B400E2776E /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1572C4DF0CFB55B400E2776E /* SCSchemaDefinitions.c in Sources */,
+                               1572C4E00CFB55B400E2776E /* SCD.c in Sources */,
+                               1572C4E10CFB55B400E2776E /* SCDKeys.c in Sources */,
+                               1572C4E20CFB55B400E2776E /* SCDPrivate.c in Sources */,
+                               1572C4E30CFB55B400E2776E /* SCDPlugin.c in Sources */,
+                               1572C4E40CFB55B400E2776E /* SCDOpen.c in Sources */,
+                               1572C4E50CFB55B400E2776E /* SCDLock.c in Sources */,
+                               1572C4E60CFB55B400E2776E /* SCDUnlock.c in Sources */,
+                               1572C4E70CFB55B400E2776E /* SCDList.c in Sources */,
+                               1572C4E80CFB55B400E2776E /* SCDAdd.c in Sources */,
+                               1572C4E90CFB55B400E2776E /* SCDGet.c in Sources */,
+                               1572C4EA0CFB55B400E2776E /* SCDSet.c in Sources */,
+                               1572C4EB0CFB55B400E2776E /* SCDRemove.c in Sources */,
+                               1572C4EC0CFB55B400E2776E /* SCDTouch.c in Sources */,
+                               1572C4ED0CFB55B400E2776E /* SCDNotify.c in Sources */,
+                               1572C4EE0CFB55B400E2776E /* SCDNotifierSetKeys.c in Sources */,
+                               1572C4EF0CFB55B400E2776E /* SCDNotifierAdd.c in Sources */,
+                               1572C4F00CFB55B400E2776E /* SCDNotifierRemove.c in Sources */,
+                               1572C4F10CFB55B400E2776E /* SCDNotifierGetChanges.c in Sources */,
+                               1572C4F20CFB55B400E2776E /* SCDNotifierWait.c in Sources */,
+                               1572C4F30CFB55B400E2776E /* SCDNotifierInformViaCallback.c in Sources */,
+                               1572C4F40CFB55B400E2776E /* SCDNotifierInformViaMachPort.c in Sources */,
+                               1572C4F50CFB55B400E2776E /* SCDNotifierInformViaFD.c in Sources */,
+                               1572C4F60CFB55B400E2776E /* SCDNotifierInformViaSignal.c in Sources */,
+                               1572C4F70CFB55B400E2776E /* SCDNotifierCancel.c in Sources */,
+                               1572C4F80CFB55B400E2776E /* SCDSnapshot.c in Sources */,
+                               1572C4F90CFB55B400E2776E /* SCP.c in Sources */,
+                               1572C4FA0CFB55B400E2776E /* SCPOpen.c in Sources */,
+                               1572C4FB0CFB55B400E2776E /* SCPLock.c in Sources */,
+                               1572C4FC0CFB55B400E2776E /* SCPUnlock.c in Sources */,
+                               1572C4FD0CFB55B400E2776E /* SCPList.c in Sources */,
+                               1572C4FE0CFB55B400E2776E /* SCPGet.c in Sources */,
+                               1572C4FF0CFB55B400E2776E /* SCPAdd.c in Sources */,
+                               1572C5000CFB55B400E2776E /* SCPSet.c in Sources */,
+                               1572C5010CFB55B400E2776E /* SCPRemove.c in Sources */,
+                               1572C5020CFB55B400E2776E /* SCPCommit.c in Sources */,
+                               1572C5030CFB55B400E2776E /* SCPApply.c in Sources */,
+                               1572C5040CFB55B400E2776E /* SCPPath.c in Sources */,
+                               1572C5060CFB55B400E2776E /* SCDHostName.c in Sources */,
+                               1572C5070CFB55B400E2776E /* SCLocation.c in Sources */,
+                               1572C5080CFB55B400E2776E /* SCNetwork.c in Sources */,
+                               1572C5090CFB55B400E2776E /* pppcontroller.defs in Sources */,
+                               1572C50A0CFB55B400E2776E /* SCNetworkConnection.c in Sources */,
+                               1572C50B0CFB55B400E2776E /* SCNetworkConnectionPrivate.c in Sources */,
+                               1572C50C0CFB55B400E2776E /* SCNetworkReachability.c in Sources */,
+                               1572C50D0CFB55B400E2776E /* SCProxies.c in Sources */,
+                               1572C50E0CFB55B400E2776E /* DHCP.c in Sources */,
+                               1572C50F0CFB55B400E2776E /* moh.c in Sources */,
+                               1572C5100CFB55B400E2776E /* DeviceOnHold.c in Sources */,
+                               1572C5110CFB55B400E2776E /* LinkConfiguration.c in Sources */,
+                               1572C5120CFB55B400E2776E /* dy_framework.c in Sources */,
+                               1572C5140CFB55B400E2776E /* config.defs in Sources */,
+                               1572C5150CFB55B400E2776E /* SCPreferencesPathKey.c in Sources */,
+                               1572C5160CFB55B400E2776E /* dnsinfo_private.c in Sources */,
+                               1572C5170CFB55B400E2776E /* dnsinfo_copy.c in Sources */,
+                               1572C5180CFB55B400E2776E /* shared_dns_info.defs in Sources */,
+                               1572C5190CFB55B400E2776E /* SCNetworkConfigurationInternal.c in Sources */,
+                               1572C51A0CFB55B400E2776E /* SCNetworkInterface.c in Sources */,
+                               1572C51B0CFB55B400E2776E /* SCNetworkProtocol.c in Sources */,
+                               1572C51C0CFB55B400E2776E /* SCNetworkService.c in Sources */,
+                               1572C51D0CFB55B400E2776E /* SCNetworkSet.c in Sources */,
+                               1572C51F0CFB55B400E2776E /* helper_comm.c in Sources */,
+                               1572C5200CFB55B400E2776E /* SCHelper_client.c in Sources */,
+                               1572C5210CFB55B400E2776E /* SCPreferencesKeychainPrivate.c in Sources */,
+                               1572C5220CFB55B400E2776E /* SCNetworkSignature.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               157433DF0D4A8122002ACA73 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               157433E00D4A8122002ACA73 /* scselect.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               157433FF0D4A8137002ACA73 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               157434000D4A8137002ACA73 /* scutil.c in Sources */,
+                               157434010D4A8137002ACA73 /* commands.c in Sources */,
+                               157434020D4A8137002ACA73 /* dictionary.c in Sources */,
+                               157434030D4A8137002ACA73 /* session.c in Sources */,
+                               157434040D4A8137002ACA73 /* cache.c in Sources */,
+                               157434050D4A8137002ACA73 /* notifications.c in Sources */,
+                               157434060D4A8137002ACA73 /* tests.c in Sources */,
+                               157434070D4A8137002ACA73 /* prefs.c in Sources */,
+                               157434080D4A8137002ACA73 /* net.c in Sources */,
+                               157434090D4A8137002ACA73 /* net_interface.c in Sources */,
+                               1574340A0D4A8137002ACA73 /* net_protocol.c in Sources */,
+                               1574340B0D4A8137002ACA73 /* net_service.c in Sources */,
+                               1574340C0D4A8137002ACA73 /* net_set.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               157A84DD0D56C63900B6F1A0 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               157A84DE0D56C63900B6F1A0 /* shared_dns_info.defs in Sources */,
+                               157A84DF0D56C63900B6F1A0 /* dnsinfo_copy.c in Sources */,
+                               157A84E00D56C63900B6F1A0 /* dnsinfo_private.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               157A84F90D56C7E800B6F1A0 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               155281020E3E4A0F00C54315 /* ip_plugin.c in Sources */,
+                               157A84FB0D56C7E800B6F1A0 /* dns-configuration.c in Sources */,
+                               157A84FC0D56C7E800B6F1A0 /* set-hostname.c in Sources */,
+                               15D48EC10F67061F00B4711E /* dnsinfo_create.c in Sources */,
+                               15D48ED40F6707A600B4711E /* shared_dns_info.defs in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               157A85070D56C8AA00B6F1A0 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               157A85080D56C8AA00B6F1A0 /* ifnamer.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               157A85180D56C8E000B6F1A0 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               157A85190D56C8E000B6F1A0 /* cache.c in Sources */,
+                               157A851B0D56C8E000B6F1A0 /* ev_dlil.c in Sources */,
+                               157A851C0D56C8E000B6F1A0 /* ev_ipv4.c in Sources */,
+                               157A851D0D56C8E000B6F1A0 /* ev_ipv6.c in Sources */,
+                               157A851E0D56C8E000B6F1A0 /* eventmon.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               157A85280D56C91100B6F1A0 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               157A85290D56C91100B6F1A0 /* linkconfig.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               157A85330D56C94F00B6F1A0 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               157A85340D56C94F00B6F1A0 /* NetworkIdentification.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               157A853E0D56C96F00B6F1A0 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               157A853F0D56C96F00B6F1A0 /* prefsmon.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583172C0CFB80A1006F62B9 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583172D0CFB80A1006F62B9 /* configd.m in Sources */,
+                               1583172E0CFB80A1006F62B9 /* _SCD.c in Sources */,
+                               1583172F0CFB80A1006F62B9 /* configd_server.c in Sources */,
+                               158317300CFB80A1006F62B9 /* notify_server.c in Sources */,
+                               158317310CFB80A1006F62B9 /* plugin_support.c in Sources */,
+                               158317320CFB80A1006F62B9 /* session.c in Sources */,
+                               158317330CFB80A1006F62B9 /* pattern.c in Sources */,
+                               158317340CFB80A1006F62B9 /* _configopen.c in Sources */,
+                               158317350CFB80A1006F62B9 /* _configclose.c in Sources */,
+                               158317360CFB80A1006F62B9 /* _configlock.c in Sources */,
+                               158317370CFB80A1006F62B9 /* _configunlock.c in Sources */,
+                               158317380CFB80A1006F62B9 /* _configlist.c in Sources */,
+                               158317390CFB80A1006F62B9 /* _configadd.c in Sources */,
+                               1583173A0CFB80A1006F62B9 /* _configget.c in Sources */,
+                               1583173B0CFB80A1006F62B9 /* _configset.c in Sources */,
+                               1583173C0CFB80A1006F62B9 /* _configremove.c in Sources */,
+                               1583173D0CFB80A1006F62B9 /* _configtouch.c in Sources */,
+                               1583173E0CFB80A1006F62B9 /* _confignotify.c in Sources */,
+                               1583173F0CFB80A1006F62B9 /* _notifyadd.c in Sources */,
+                               158317400CFB80A1006F62B9 /* _notifyremove.c in Sources */,
+                               158317410CFB80A1006F62B9 /* _notifychanges.c in Sources */,
+                               158317420CFB80A1006F62B9 /* _notifyviaport.c in Sources */,
+                               158317430CFB80A1006F62B9 /* _notifyviafd.c in Sources */,
+                               158317440CFB80A1006F62B9 /* _notifyviasignal.c in Sources */,
+                               158317450CFB80A1006F62B9 /* _notifycancel.c in Sources */,
+                               158317460CFB80A1006F62B9 /* _snapshot.c in Sources */,
+                               158317470CFB80A1006F62B9 /* config.defs in Sources */,
+                               158317480CFB80A1006F62B9 /* dnsinfo_private.c in Sources */,
+                               158317490CFB80A1006F62B9 /* dnsinfo_server.c in Sources */,
+                               1583174A0CFB80A1006F62B9 /* shared_dns_info.defs in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               1583379D0CFB6B9E0033AB93 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               1583379E0CFB6B9E0033AB93 /* SCHelper_server.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159C9B2C0DB68E2600BEEF10 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               159C9B290DB68E0700BEEF10 /* atconfig.c in Sources */,
+                               159C9B2A0DB68E0800BEEF10 /* cfManager.c in Sources */,
+                               159C9B2D0DB68E3D00BEEF10 /* cache.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               159C9B840DB68F0300BEEF10 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               159C9B820DB68EE500BEEF10 /* kicker.c in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               159D53DB07528C2E004F8947 /* Sources */ = {
+               159D53D107528BDA004F8947 /* Sources */ = {
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               159D541507528DDE004F8947 /* kicker.c in Sources */,
+                               159D540907528D3A004F8947 /* cache.c in Sources */,
+                               159D540D07528DAE004F8947 /* ev_dlil.c in Sources */,
+                               159D540F07528DB0004F8947 /* ev_ipv4.c in Sources */,
+                               159D541107528DB2004F8947 /* ev_ipv6.c in Sources */,
+                               159D541307528DB5004F8947 /* eventmon.c in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                159D541807528E09004F8947 /* dns-configuration.c in Sources */,
                                154361E00752C81800A8EC6C /* set-hostname.c in Sources */,
                                1572EB7B0A506D3B00D02459 /* smb-configuration.c in Sources */,
                                159D541807528E09004F8947 /* dns-configuration.c in Sources */,
                                154361E00752C81800A8EC6C /* set-hostname.c in Sources */,
                                1572EB7B0A506D3B00D02459 /* smb-configuration.c in Sources */,
+                               15D48EBF0F67061600B4711E /* dnsinfo_create.c in Sources */,
+                               15D48ED30F67079B00B4711E /* shared_dns_info.defs in Sources */,
+                               1522FCFB0FA7FE4B00B24128 /* dnsinfo_flatfile.c in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
+               15A5A21D0D5B94190087BDA0 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               15A5A21E0D5B94190087BDA0 /* SCSchemaDefinitions.c in Sources */,
+                               15A5A21F0D5B94190087BDA0 /* SCD.c in Sources */,
+                               15A5A2200D5B94190087BDA0 /* SCDKeys.c in Sources */,
+                               15A5A2210D5B94190087BDA0 /* SCDPrivate.c in Sources */,
+                               15A5A2220D5B94190087BDA0 /* SCDPlugin.c in Sources */,
+                               15A5A2230D5B94190087BDA0 /* SCDOpen.c in Sources */,
+                               15A5A2240D5B94190087BDA0 /* SCDLock.c in Sources */,
+                               15A5A2250D5B94190087BDA0 /* SCDUnlock.c in Sources */,
+                               15A5A2260D5B94190087BDA0 /* SCDList.c in Sources */,
+                               15A5A2270D5B94190087BDA0 /* SCDAdd.c in Sources */,
+                               15A5A2280D5B94190087BDA0 /* SCDGet.c in Sources */,
+                               15A5A2290D5B94190087BDA0 /* SCDSet.c in Sources */,
+                               15A5A22A0D5B94190087BDA0 /* SCDRemove.c in Sources */,
+                               15A5A22B0D5B94190087BDA0 /* SCDTouch.c in Sources */,
+                               15A5A22C0D5B94190087BDA0 /* SCDNotify.c in Sources */,
+                               15A5A22D0D5B94190087BDA0 /* SCDNotifierSetKeys.c in Sources */,
+                               15A5A22E0D5B94190087BDA0 /* SCDNotifierAdd.c in Sources */,
+                               15A5A22F0D5B94190087BDA0 /* SCDNotifierRemove.c in Sources */,
+                               15A5A2300D5B94190087BDA0 /* SCDNotifierGetChanges.c in Sources */,
+                               15A5A2310D5B94190087BDA0 /* SCDNotifierWait.c in Sources */,
+                               15A5A2320D5B94190087BDA0 /* SCDNotifierInformViaCallback.c in Sources */,
+                               15A5A2330D5B94190087BDA0 /* SCDNotifierInformViaMachPort.c in Sources */,
+                               15A5A2340D5B94190087BDA0 /* SCDNotifierInformViaFD.c in Sources */,
+                               15A5A2350D5B94190087BDA0 /* SCDNotifierInformViaSignal.c in Sources */,
+                               15A5A2360D5B94190087BDA0 /* SCDNotifierCancel.c in Sources */,
+                               15A5A2370D5B94190087BDA0 /* SCDSnapshot.c in Sources */,
+                               15A5A2380D5B94190087BDA0 /* SCP.c in Sources */,
+                               15A5A2390D5B94190087BDA0 /* SCPOpen.c in Sources */,
+                               15A5A23A0D5B94190087BDA0 /* SCPLock.c in Sources */,
+                               15A5A23B0D5B94190087BDA0 /* SCPUnlock.c in Sources */,
+                               15A5A23C0D5B94190087BDA0 /* SCPList.c in Sources */,
+                               15A5A23D0D5B94190087BDA0 /* SCPGet.c in Sources */,
+                               15A5A23E0D5B94190087BDA0 /* SCPAdd.c in Sources */,
+                               15A5A23F0D5B94190087BDA0 /* SCPSet.c in Sources */,
+                               15A5A2400D5B94190087BDA0 /* SCPRemove.c in Sources */,
+                               15A5A2410D5B94190087BDA0 /* SCPCommit.c in Sources */,
+                               15A5A2420D5B94190087BDA0 /* SCPApply.c in Sources */,
+                               15A5A2430D5B94190087BDA0 /* SCPPath.c in Sources */,
+                               15A5A2450D5B94190087BDA0 /* SCDHostName.c in Sources */,
+                               15A5A2460D5B94190087BDA0 /* SCLocation.c in Sources */,
+                               15A5A2470D5B94190087BDA0 /* SCNetwork.c in Sources */,
+                               15A5A2480D5B94190087BDA0 /* pppcontroller.defs in Sources */,
+                               15A5A2490D5B94190087BDA0 /* SCNetworkConnection.c in Sources */,
+                               15A5A24A0D5B94190087BDA0 /* SCNetworkConnectionPrivate.c in Sources */,
+                               15A5A24B0D5B94190087BDA0 /* SCNetworkReachability.c in Sources */,
+                               15A5A24C0D5B94190087BDA0 /* SCProxies.c in Sources */,
+                               15A5A24D0D5B94190087BDA0 /* DHCP.c in Sources */,
+                               15A5A24E0D5B94190087BDA0 /* moh.c in Sources */,
+                               15A5A24F0D5B94190087BDA0 /* DeviceOnHold.c in Sources */,
+                               15A5A2500D5B94190087BDA0 /* LinkConfiguration.c in Sources */,
+                               15A5A2510D5B94190087BDA0 /* dy_framework.c in Sources */,
+                               15A5A2530D5B94190087BDA0 /* config.defs in Sources */,
+                               15A5A2540D5B94190087BDA0 /* SCPreferencesPathKey.c in Sources */,
+                               15A5A2550D5B94190087BDA0 /* dnsinfo_private.c in Sources */,
+                               15A5A2560D5B94190087BDA0 /* dnsinfo_copy.c in Sources */,
+                               15A5A2570D5B94190087BDA0 /* shared_dns_info.defs in Sources */,
+                               15A5A2580D5B94190087BDA0 /* SCNetworkConfigurationInternal.c in Sources */,
+                               15A5A2590D5B94190087BDA0 /* SCNetworkInterface.c in Sources */,
+                               15A5A25A0D5B94190087BDA0 /* SCNetworkProtocol.c in Sources */,
+                               15A5A25B0D5B94190087BDA0 /* SCNetworkService.c in Sources */,
+                               15A5A25C0D5B94190087BDA0 /* SCNetworkSet.c in Sources */,
+                               15A5A25E0D5B94190087BDA0 /* helper_comm.c in Sources */,
+                               15A5A25F0D5B94190087BDA0 /* SCHelper_client.c in Sources */,
+                               15A5A2600D5B94190087BDA0 /* SCPreferencesKeychainPrivate.c in Sources */,
+                               15A5A2610D5B94190087BDA0 /* SCNetworkSignature.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
                15DAD5E4075913CE0084A6ED /* Sources */ = {
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                15DAD5E4075913CE0084A6ED /* Sources */ = {
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                                15DAD5E5075913CE0084A6ED /* shared_dns_info.defs in Sources */,
                                15DAD5E6075913CE0084A6ED /* dnsinfo_copy.c in Sources */,
                                15DAD5E7075913CE0084A6ED /* dnsinfo_private.c in Sources */,
                                15DAD5E5075913CE0084A6ED /* shared_dns_info.defs in Sources */,
                                15DAD5E6075913CE0084A6ED /* dnsinfo_copy.c in Sources */,
                                15DAD5E7075913CE0084A6ED /* dnsinfo_private.c in Sources */,
-                               15DAD5E8075913CE0084A6ED /* dnsinfo_create.c in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               15FD733D0754DBDA001CC321 /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
-                               1508E39F07552B6A0062B350 /* atconfig.c in Sources */,
-                               1508E3A007552B6B0062B350 /* cfManager.c in Sources */,
-                               1508E3A107552B720062B350 /* cache.c in Sources */,
-                       );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
                F95B8A5C0B03F81400993BA3 /* Sources */ = {
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                F95B8A5C0B03F81400993BA3 /* Sources */ = {
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
 /* End PBXSourcesBuildPhase section */
 
 /* Begin PBXTargetDependency section */
 /* End PBXSourcesBuildPhase section */
 
 /* Begin PBXTargetDependency section */
-               150ECB3C0D0079280065E94D /* PBXTargetDependency */ = {
+               150ECB300D0042DA0065E94D /* PBXTargetDependency */ = {
                        isa = PBXTargetDependency;
                        target = 151F5D990CCE98E50093AC3B /* SCMonitor */;
                        isa = PBXTargetDependency;
                        target = 151F5D990CCE98E50093AC3B /* SCMonitor */;
-                       targetProxy = 150ECB3B0D0079280065E94D /* PBXContainerItemProxy */;
+                       targetProxy = 150ECB2F0D0042DA0065E94D /* PBXContainerItemProxy */;
+               };
+               151FE37A0D5B713C000D6DB1 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 151FE2DD0D5B7046000D6DB1 /* configd_base-EmbeddedSimulator */;
+                       targetProxy = 151FE3790D5B713C000D6DB1 /* PBXContainerItemProxy */;
                };
                1520A386084681350010B584 /* PBXTargetDependency */ = {
                        isa = PBXTargetDependency;
                        target = 1547001808455B98006787CE /* SCHelper */;
                        targetProxy = 1520A385084681350010B584 /* PBXContainerItemProxy */;
                };
                };
                1520A386084681350010B584 /* PBXTargetDependency */ = {
                        isa = PBXTargetDependency;
                        target = 1547001808455B98006787CE /* SCHelper */;
                        targetProxy = 1520A385084681350010B584 /* PBXContainerItemProxy */;
                };
-               1533B94109731A9600F2B34A /* PBXTargetDependency */ = {
+               1521405B0E9400BF00DACD2C /* PBXTargetDependency */ = {
                        isa = PBXTargetDependency;
                        isa = PBXTargetDependency;
-                       target = 15FD733A0754DBDA001CC321 /* ATconfig */;
-                       targetProxy = 1533B94009731A9600F2B34A /* PBXContainerItemProxy */;
+                       target = 15213FF90E93E9F500DACD2C /* Logger.bundle */;
+                       targetProxy = 1521405A0E9400BF00DACD2C /* PBXContainerItemProxy */;
                };
                1558480607550D470046C2E9 /* PBXTargetDependency */ = {
                        isa = PBXTargetDependency;
                };
                1558480607550D470046C2E9 /* PBXTargetDependency */ = {
                        isa = PBXTargetDependency;
                        target = 155847FA07550D210046C2E9 /* configd_executables */;
                        targetProxy = 1558480E07550DD00046C2E9 /* PBXContainerItemProxy */;
                };
                        target = 155847FA07550D210046C2E9 /* configd_executables */;
                        targetProxy = 1558480E07550DD00046C2E9 /* PBXContainerItemProxy */;
                };
-               157BB8C0075924460025DA7A /* PBXTargetDependency */ = {
+               156CA4A80EF8550800C59A18 /* PBXTargetDependency */ = {
                        isa = PBXTargetDependency;
                        isa = PBXTargetDependency;
-                       target = 15DAD63F07591A1A0084A6ED /* SystemConfiguration.framework */;
-                       targetProxy = 157BB8BF075924460025DA7A /* PBXContainerItemProxy */;
+                       target = 156CA4790EF853BB00C59A18 /* Logger.bundle-Embedded */;
+                       targetProxy = 156CA4A70EF8550800C59A18 /* PBXContainerItemProxy */;
                };
                };
-               157BB8C2075924470025DA7A /* PBXTargetDependency */ = {
+               1574341F0D4A815E002ACA73 /* PBXTargetDependency */ = {
                        isa = PBXTargetDependency;
                        isa = PBXTargetDependency;
-                       target = 15DAD5DF075913CE0084A6ED /* DNSConfiguration */;
-                       targetProxy = 157BB8C1075924470025DA7A /* PBXContainerItemProxy */;
+                       target = 157433F00D4A8137002ACA73 /* scutil-Embedded */;
+                       targetProxy = 1574341E0D4A815E002ACA73 /* PBXContainerItemProxy */;
+               };
+               157434210D4A8166002ACA73 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 157433DD0D4A8122002ACA73 /* scselect-Embedded */;
+                       targetProxy = 157434200D4A8166002ACA73 /* PBXContainerItemProxy */;
+               };
+               157A85480D56CA0B00B6F1A0 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 157A84F40D56C7E800B6F1A0 /* IPMonitor-Embedded */;
+                       targetProxy = 157A85470D56CA0B00B6F1A0 /* PBXContainerItemProxy */;
+               };
+               157A854A0D56CA2300B6F1A0 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 157A85050D56C8AA00B6F1A0 /* InterfaceNamer-Embedded */;
+                       targetProxy = 157A85490D56CA2300B6F1A0 /* PBXContainerItemProxy */;
+               };
+               157A854C0D56CA5100B6F1A0 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 157A85100D56C8E000B6F1A0 /* KernelEventMonitor-Embedded */;
+                       targetProxy = 157A854B0D56CA5100B6F1A0 /* PBXContainerItemProxy */;
+               };
+               157A854E0D56CA6F00B6F1A0 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 157A85260D56C91100B6F1A0 /* LinkConfiguration-Embedded */;
+                       targetProxy = 157A854D0D56CA6F00B6F1A0 /* PBXContainerItemProxy */;
+               };
+               157A85500D56CA8800B6F1A0 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 157A85310D56C94F00B6F1A0 /* NetworkIdentification-Embedded */;
+                       targetProxy = 157A854F0D56CA8800B6F1A0 /* PBXContainerItemProxy */;
+               };
+               157A85520D56CA9E00B6F1A0 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 157A853C0D56C96F00B6F1A0 /* PreferencesMonitor-Embedded */;
+                       targetProxy = 157A85510D56CA9E00B6F1A0 /* PBXContainerItemProxy */;
+               };
+               157A85540D56CACA00B6F1A0 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 158317A80CFB8639006F62B9 /* PreferencesMonitor.bundle-Embedded */;
+                       targetProxy = 157A85530D56CACA00B6F1A0 /* PBXContainerItemProxy */;
+               };
+               157BB8C0075924460025DA7A /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 15DAD63F07591A1A0084A6ED /* SystemConfiguration.framework */;
+                       targetProxy = 157BB8BF075924460025DA7A /* PBXContainerItemProxy */;
                };
                157BB8C40759244B0025DA7A /* PBXTargetDependency */ = {
                        isa = PBXTargetDependency;
                };
                157BB8C40759244B0025DA7A /* PBXTargetDependency */ = {
                        isa = PBXTargetDependency;
                        target = 15828AE60753B5F900AD4710 /* KernelEventMonitor.bundle */;
                        targetProxy = 15828B060753B77E00AD4710 /* PBXContainerItemProxy */;
                };
                        target = 15828AE60753B5F900AD4710 /* KernelEventMonitor.bundle */;
                        targetProxy = 15828B060753B77E00AD4710 /* PBXContainerItemProxy */;
                };
+               158317100CFB77D1006F62B9 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 158316CF0CFB774B006F62B9 /* configd_base-Embedded */;
+                       targetProxy = 1583170F0CFB77D1006F62B9 /* PBXContainerItemProxy */;
+               };
+               158317120CFB77E1006F62B9 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1572C4A60CFB55B400E2776E /* SystemConfiguration.framework-Embedded */;
+                       targetProxy = 158317110CFB77E1006F62B9 /* PBXContainerItemProxy */;
+               };
+               158317140CFB77E8006F62B9 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 158337990CFB6B9E0033AB93 /* SCHelper-Embedded */;
+                       targetProxy = 158317130CFB77E8006F62B9 /* PBXContainerItemProxy */;
+               };
+               158317160CFB783B006F62B9 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 158316E30CFB7761006F62B9 /* configd_plugins-Embedded */;
+                       targetProxy = 158317150CFB783B006F62B9 /* PBXContainerItemProxy */;
+               };
+               158317180CFB784D006F62B9 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 158317040CFB7782006F62B9 /* configd_executables-Embedded */;
+                       targetProxy = 158317170CFB784D006F62B9 /* PBXContainerItemProxy */;
+               };
+               158317660CFB80D5006F62B9 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 158317230CFB80A1006F62B9 /* configd-Embedded */;
+                       targetProxy = 158317650CFB80D5006F62B9 /* PBXContainerItemProxy */;
+               };
+               158317B30CFB8660006F62B9 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 158317A00CFB8626006F62B9 /* NetworkIdentification.bundle-Embedded */;
+                       targetProxy = 158317B20CFB8660006F62B9 /* PBXContainerItemProxy */;
+               };
+               158317B50CFB8660006F62B9 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 158317980CFB860C006F62B9 /* LinkConfiguration.bundle-Embedded */;
+                       targetProxy = 158317B40CFB8660006F62B9 /* PBXContainerItemProxy */;
+               };
+               158317B70CFB8660006F62B9 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 158317900CFB85F7006F62B9 /* KernelEventMonitor.bundle-Embedded */;
+                       targetProxy = 158317B60CFB8660006F62B9 /* PBXContainerItemProxy */;
+               };
+               158317B90CFB8660006F62B9 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 158317870CFB85DD006F62B9 /* InterfaceNamer.bundle-Embedded */;
+                       targetProxy = 158317B80CFB8660006F62B9 /* PBXContainerItemProxy */;
+               };
+               158317BB0CFB8660006F62B9 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 1583177D0CFB85C8006F62B9 /* IPMonitor.bundle-Embedded */;
+                       targetProxy = 158317BA0CFB8660006F62B9 /* PBXContainerItemProxy */;
+               };
                158AD9860754E72500124717 /* PBXTargetDependency */ = {
                        isa = PBXTargetDependency;
                        target = 15FD72A10754DA4C001CC321 /* IPMonitor.bundle */;
                158AD9860754E72500124717 /* PBXTargetDependency */ = {
                        isa = PBXTargetDependency;
                        target = 15FD72A10754DA4C001CC321 /* IPMonitor.bundle */;
                        target = 159D542007528E7C004F8947 /* configd_plugins */;
                        targetProxy = 159D542D07529008004F8947 /* PBXContainerItemProxy */;
                };
                        target = 159D542007528E7C004F8947 /* configd_plugins */;
                        targetProxy = 159D542D07529008004F8947 /* PBXContainerItemProxy */;
                };
-               15DAD5740759115F0084A6ED /* PBXTargetDependency */ = {
+               15A5A2710D5B942D0087BDA0 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 15A5A1E40D5B94190087BDA0 /* SystemConfiguration.framework-EmbeddedSimulator */;
+                       targetProxy = 15A5A2700D5B942D0087BDA0 /* PBXContainerItemProxy */;
+               };
+               15C64A220F684C4900D78394 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 15DAD5DF075913CE0084A6ED /* DNSConfiguration */;
+                       targetProxy = 15C64A210F684C4900D78394 /* PBXContainerItemProxy */;
+               };
+               15C64A240F684C5700D78394 /* PBXTargetDependency */ = {
                        isa = PBXTargetDependency;
                        isa = PBXTargetDependency;
-                       target = 15FD731E0754DB9F001CC321 /* ATconfig.bundle */;
-                       targetProxy = 15DAD5730759115F0084A6ED /* PBXContainerItemProxy */;
+                       target = 15C64A1E0F684C3300D78394 /* configd_libSystem */;
+                       targetProxy = 15C64A230F684C5700D78394 /* PBXContainerItemProxy */;
+               };
+               15C64A2F0F684C8300D78394 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 15C64A280F684C6B00D78394 /* configd_libSystem-Embedded */;
+                       targetProxy = 15C64A2E0F684C8300D78394 /* PBXContainerItemProxy */;
+               };
+               15C64A310F684C8F00D78394 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = 157A84D80D56C63900B6F1A0 /* DNSConfiguration-Embedded */;
+                       targetProxy = 15C64A300F684C8F00D78394 /* PBXContainerItemProxy */;
                };
                F95B8A770B03FB9100993BA3 /* PBXTargetDependency */ = {
                        isa = PBXTargetDependency;
                };
                F95B8A770B03FB9100993BA3 /* PBXTargetDependency */ = {
                        isa = PBXTargetDependency;
 /* End PBXVariantGroup section */
 
 /* Begin XCBuildConfiguration section */
 /* End PBXVariantGroup section */
 
 /* Begin XCBuildConfiguration section */
-               151F5D9C0CCE98E60093AC3B /* Development */ = {
+               151C1CC70CFB487000C5AFD6 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               COPY_PHASE_STRIP = NO;
-                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
-                               GCC_DYNAMIC_NO_PIC = NO;
-                               GCC_ENABLE_FIX_AND_CONTINUE = YES;
-                               GCC_MODEL_TUNING = G5;
-                               GCC_OPTIMIZATION_LEVEL = 0;
-                               INFOPLIST_FILE = "$(SRCROOT)/SCMonitor/Info.plist";
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /System/Library/UserEventPlugins;
-                               PRODUCT_NAME = SCMonitor;
-                               WRAPPER_EXTENSION = plugin;
-                               ZERO_LINK = YES;
+                               PRODUCT_NAME = "configd (Aggregate/Embedded)";
                        };
                        };
-                       name = Development;
+                       name = Debug;
                };
                };
-               151F5D9D0CCE98E60093AC3B /* Deployment */ = {
+               151C1CC80CFB487000C5AFD6 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               COPY_PHASE_STRIP = YES;
-                               DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+                               PRODUCT_NAME = "configd (Aggregate/Embedded)";
+                       };
+                       name = Release;
+               };
+               151F5D9C0CCE98E60093AC3B /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               DYLIB_COMPATIBILITY_VERSION = 1;
+                               DYLIB_CURRENT_VERSION = "$(RC_ProjectSourceVersion)";
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
-                               GCC_ENABLE_FIX_AND_CONTINUE = NO;
-                               GCC_MODEL_TUNING = G5;
-                               INFOPLIST_FILE = "$(SRCROOT)/SCMonitor/Info.plist";
+                               GCC_ENABLE_FIX_AND_CONTINUE = YES;
+                               INFOPLIST_FILE = SCMonitor/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /System/Library/UserEventPlugins;
                                PRODUCT_NAME = SCMonitor;
                                WRAPPER_EXTENSION = plugin;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /System/Library/UserEventPlugins;
                                PRODUCT_NAME = SCMonitor;
                                WRAPPER_EXTENSION = plugin;
-                               ZERO_LINK = NO;
                        };
                        };
-                       name = Deployment;
+                       name = Debug;
                };
                };
-               151F5D9E0CCE98E60093AC3B /* Default */ = {
+               151F5D9D0CCE98E60093AC3B /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               DYLIB_COMPATIBILITY_VERSION = 1;
+                               DYLIB_CURRENT_VERSION = "$(RC_ProjectSourceVersion)";
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
-                               GCC_ENABLE_FIX_AND_CONTINUE = YES;
-                               GCC_MODEL_TUNING = G5;
-                               INFOPLIST_FILE = "$(SRCROOT)/SCMonitor/Info.plist";
+                               GCC_ENABLE_FIX_AND_CONTINUE = NO;
+                               INFOPLIST_FILE = SCMonitor/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /System/Library/UserEventPlugins;
                                PRODUCT_NAME = SCMonitor;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /System/Library/UserEventPlugins;
                                PRODUCT_NAME = SCMonitor;
-                               VALID_ARCHS = "i386 ppc";
                                WRAPPER_EXTENSION = plugin;
                                WRAPPER_EXTENSION = plugin;
-                               ZERO_LINK = YES;
                        };
                        };
-                       name = Default;
+                       name = Release;
                };
                };
-               151F63DD09328A3C0096DCC9 /* Development */ = {
+               151F63DD09328A3C0096DCC9 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = NO;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = NO;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
                                INSTALLHDRS_SCRIPT_PHASE = YES;
                                INSTALLHDRS_SCRIPT_PHASE = YES;
-                               OTHER_CFLAGS = "";
-                               OTHER_LDFLAGS = "";
                                PRODUCT_NAME = genSCPreferences;
                                PRODUCT_NAME = genSCPreferences;
-                               SECTORDER_FLAGS = "";
                                WARNING_CFLAGS = (
                                        "-Wall",
                                        "-Wno-four-char-constants",
                                        "-Wno-unknown-pragmas",
                                );
                        };
                                WARNING_CFLAGS = (
                                        "-Wall",
                                        "-Wno-four-char-constants",
                                        "-Wno-unknown-pragmas",
                                );
                        };
-                       name = Development;
+                       name = Debug;
                };
                };
-               151F63DE09328A3C0096DCC9 /* Deployment */ = {
+               151F63DE09328A3C0096DCC9 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = YES;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = YES;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
                                INSTALLHDRS_SCRIPT_PHASE = YES;
                                INSTALLHDRS_SCRIPT_PHASE = YES;
-                               OTHER_CFLAGS = "";
-                               OTHER_LDFLAGS = "";
                                PRODUCT_NAME = genSCPreferences;
                                PRODUCT_NAME = genSCPreferences;
-                               SECTORDER_FLAGS = "";
                                WARNING_CFLAGS = (
                                        "-Wall",
                                        "-Wno-four-char-constants",
                                        "-Wno-unknown-pragmas",
                                );
                        };
                                WARNING_CFLAGS = (
                                        "-Wall",
                                        "-Wno-four-char-constants",
                                        "-Wno-unknown-pragmas",
                                );
                        };
-                       name = Deployment;
+                       name = Release;
                };
                };
-               151F63DF09328A3C0096DCC9 /* Default */ = {
+               151FE2E50D5B7046000D6DB1 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */;
                        buildSettings = {
                        buildSettings = {
-                               INSTALLHDRS_SCRIPT_PHASE = YES;
-                               OTHER_CFLAGS = "";
-                               OTHER_LDFLAGS = "";
-                               PRODUCT_NAME = genSCPreferences;
-                               SECTORDER_FLAGS = "";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-four-char-constants",
-                                       "-Wno-unknown-pragmas",
-                               );
+                               PRODUCT_NAME = "configd_base (EmbeddedSimulator)";
                        };
                        };
-                       name = Default;
+                       name = Debug;
                };
                };
-               156EB5DB0905594A00EEF749 /* Development */ = {
+               151FE2E60D5B7046000D6DB1 /* Release */ = {
                        isa = XCBuildConfiguration;
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */;
                        buildSettings = {
                        buildSettings = {
-                               COPY_PHASE_STRIP = NO;
-                               DYLIB_COMPATIBILITY_VERSION = 1;
-                               DYLIB_CURRENT_VERSION = 212.2;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
-                               INSTALLHDRS_COPY_PHASE = YES;
+                               PRODUCT_NAME = "configd_base (EmbeddedSimulator)";
+                       };
+                       name = Release;
+               };
+               15213FFC0E93E9F600DACD2C /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/Logger/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib;
-                               LIBRARY_STYLE = STATIC;
-                               PRODUCT_NAME = dnsinfo;
-                               SECTORDER_FLAGS = "";
-                               UNSTRIPPED_PRODUCT = YES;
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = Logger;
                        };
                        };
-                       name = Development;
+                       name = Debug;
                };
                };
-               156EB5DC0905594A00EEF749 /* Deployment */ = {
+               15213FFD0E93E9F600DACD2C /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               COPY_PHASE_STRIP = YES;
-                               DYLIB_COMPATIBILITY_VERSION = 1;
-                               DYLIB_CURRENT_VERSION = 212.2;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
-                               INSTALLHDRS_COPY_PHASE = YES;
+                               INFOPLIST_FILE = Plugins/Logger/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib;
-                               LIBRARY_STYLE = STATIC;
-                               PRODUCT_NAME = dnsinfo;
-                               SECTORDER_FLAGS = "";
-                               UNSTRIPPED_PRODUCT = YES;
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = Logger;
                        };
                        };
-                       name = Deployment;
+                       name = Release;
                };
                };
-               156EB5DD0905594A00EEF749 /* Default */ = {
+               156CA4830EF853BB00C59A18 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               DYLIB_COMPATIBILITY_VERSION = 1;
-                               DYLIB_CURRENT_VERSION = 212.2;
+                               INFOPLIST_FILE = "Plugins/Logger/Info-Embedded.plist";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = Logger;
+                       };
+                       name = Debug;
+               };
+               156CA4840EF853BB00C59A18 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               INFOPLIST_FILE = "Plugins/Logger/Info-Embedded.plist";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = Logger;
+                       };
+                       name = Release;
+               };
+               156EB5DB0905594A00EEF749 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               BUILD_VARIANTS = (
+                                       normal,
+                                       debug,
+                                       profile,
+                               );
+                               COPY_PHASE_STRIP = NO;
+                               GENERATE_PROFILING_CODE_profile = YES;
                                INSTALLHDRS_COPY_PHASE = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALLHDRS_COPY_PHASE = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib;
+                               INSTALL_PATH = /usr/local/lib/system;
                                LIBRARY_STYLE = STATIC;
                                LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS_debug = "-O0";
+                               OTHER_MIGFLAGS = "-DLIBDNSINFO";
                                PRODUCT_NAME = dnsinfo;
                                PRODUCT_NAME = dnsinfo;
-                               SECTORDER_FLAGS = "";
-                               UNSTRIPPED_PRODUCT = YES;
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
+                               STRIPFLAGS = "";
+                               STRIP_INSTALLED_PRODUCT_debug = NO;
+                               STRIP_INSTALLED_PRODUCT_normal = YES;
+                               STRIP_INSTALLED_PRODUCT_profile = NO;
                        };
                        };
-                       name = Default;
+                       name = Debug;
                };
                };
-               156EB5DF0905594A00EEF749 /* Development */ = {
+               156EB5DC0905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               COPY_PHASE_STRIP = NO;
-                               DYLIB_COMPATIBILITY_VERSION = 1;
-                               DYLIB_CURRENT_VERSION = 212.2;
-                               FRAMEWORK_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks";
-                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
-                               INFOPLIST_FILE = SystemConfiguration.fproj/Info.plist;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
-                               LIBRARY_SEARCH_PATHS = "$(SYMROOT)";
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               OTHER_LDFLAGS = (
-                                       "-seg_addr_table",
-                                       "$(APPLE_INTERNAL_DEVELOPER_DIR)/seg_addr_table",
-                               );
-                               PRODUCT_NAME = SystemConfiguration;
-                               SECTORDER_FLAGS = (
-                                       "-sectorder",
-                                       __TEXT,
-                                       __text,
-                                       "$(OBJROOT)/SystemConfiguration.order",
-                               );
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
+                               BUILD_VARIANTS = (
+                                       normal,
+                                       debug,
+                                       profile,
                                );
                                );
-                               WRAPPER_EXTENSION = framework;
+                               GENERATE_PROFILING_CODE_profile = YES;
+                               INSTALLHDRS_COPY_PHASE = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/system;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS_debug = "-O0";
+                               OTHER_CFLAGS_normal = "";
+                               OTHER_CFLAGS_profile = "";
+                               OTHER_MIGFLAGS = "-DLIBDNSINFO";
+                               PRODUCT_NAME = dnsinfo;
+                               STRIPFLAGS = "";
+                               STRIP_INSTALLED_PRODUCT_debug = NO;
+                               STRIP_INSTALLED_PRODUCT_normal = YES;
+                               STRIP_INSTALLED_PRODUCT_profile = NO;
                        };
                        };
-                       name = Development;
+                       name = Release;
                };
                };
-               156EB5E00905594A00EEF749 /* Deployment */ = {
+               156EB5DF0905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               COPY_PHASE_STRIP = YES;
-                               DYLIB_COMPATIBILITY_VERSION = 1;
-                               DYLIB_CURRENT_VERSION = 212.2;
+                               COPY_PHASE_STRIP = NO;
                                FRAMEWORK_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks";
                                HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
                                INFOPLIST_FILE = SystemConfiguration.fproj/Info.plist;
                                FRAMEWORK_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks";
                                HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
                                INFOPLIST_FILE = SystemConfiguration.fproj/Info.plist;
+                               INSTALLHDRS_SCRIPT_PHASE = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
                                LIBRARY_SEARCH_PATHS = "$(SYMROOT)";
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
                                LIBRARY_SEARCH_PATHS = "$(SYMROOT)";
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               OTHER_LDFLAGS = (
-                                       "-seg_addr_table",
-                                       "$(APPLE_INTERNAL_DEVELOPER_DIR)/seg_addr_table",
-                               );
                                PRODUCT_NAME = SystemConfiguration;
                                SECTORDER_FLAGS = (
                                        "-sectorder",
                                PRODUCT_NAME = SystemConfiguration;
                                SECTORDER_FLAGS = (
                                        "-sectorder",
                                        __text,
                                        "$(OBJROOT)/SystemConfiguration.order",
                                );
                                        __text,
                                        "$(OBJROOT)/SystemConfiguration.order",
                                );
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
                                WRAPPER_EXTENSION = framework;
                        };
                                WRAPPER_EXTENSION = framework;
                        };
-                       name = Deployment;
+                       name = Debug;
                };
                };
-               156EB5E10905594A00EEF749 /* Default */ = {
+               156EB5E00905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               DYLIB_COMPATIBILITY_VERSION = 1;
-                               DYLIB_CURRENT_VERSION = 212.2;
+                               COPY_PHASE_STRIP = YES;
                                FRAMEWORK_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks";
                                HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
                                INFOPLIST_FILE = SystemConfiguration.fproj/Info.plist;
                                FRAMEWORK_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks";
                                HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
                                INFOPLIST_FILE = SystemConfiguration.fproj/Info.plist;
+                               INSTALLHDRS_SCRIPT_PHASE = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
                                LIBRARY_SEARCH_PATHS = "$(SYMROOT)";
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
                                LIBRARY_SEARCH_PATHS = "$(SYMROOT)";
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               OTHER_LDFLAGS = (
-                                       "-seg_addr_table",
-                                       "$(APPLE_INTERNAL_DEVELOPER_DIR)/seg_addr_table",
-                               );
                                PRODUCT_NAME = SystemConfiguration;
                                SECTORDER_FLAGS = (
                                        "-sectorder",
                                PRODUCT_NAME = SystemConfiguration;
                                SECTORDER_FLAGS = (
                                        "-sectorder",
                                        __text,
                                        "$(OBJROOT)/SystemConfiguration.order",
                                );
                                        __text,
                                        "$(OBJROOT)/SystemConfiguration.order",
                                );
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
                                WRAPPER_EXTENSION = framework;
                        };
                                WRAPPER_EXTENSION = framework;
                        };
-                       name = Default;
+                       name = Release;
                };
                };
-               156EB5E30905594A00EEF749 /* Development */ = {
+               156EB5E30905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               CODE_SIGN_IDENTITY = "-";
                                COPY_PHASE_STRIP = NO;
                                DEAD_CODE_STRIPPING = YES;
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
                                COPY_PHASE_STRIP = NO;
                                DEAD_CODE_STRIPPING = YES;
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
-                               INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework/Versions/A/Resources";
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework/Versions/A/Resources";
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
                                PRODUCT_NAME = SCHelper;
                                STRIPFLAGS = "-S";
                                PRODUCT_NAME = SCHelper;
                                STRIPFLAGS = "-S";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
                        };
                        };
-                       name = Development;
+                       name = Debug;
                };
                };
-               156EB5E40905594A00EEF749 /* Deployment */ = {
+               156EB5E40905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               CODE_SIGN_IDENTITY = "-";
                                COPY_PHASE_STRIP = YES;
                                DEAD_CODE_STRIPPING = YES;
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
                                COPY_PHASE_STRIP = YES;
                                DEAD_CODE_STRIPPING = YES;
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
-                               INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework/Versions/A/Resources";
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = SCHelper;
-                               STRIPFLAGS = "-S";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
-                       };
-                       name = Deployment;
-               };
-               156EB5E50905594A00EEF749 /* Default */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               DEAD_CODE_STRIPPING = YES;
-                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
-                               INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework/Versions/A/Resources";
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework/Versions/A/Resources";
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
                                PRODUCT_NAME = SCHelper;
                                STRIPFLAGS = "-S";
                                PRODUCT_NAME = SCHelper;
                                STRIPFLAGS = "-S";
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
-                       };
-                       name = Default;
-               };
-               156EB5E70905594A00EEF749 /* Development */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               COPY_PHASE_STRIP = NO;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
-                               PRODUCT_NAME = Frameworks;
-                               WARNING_CFLAGS = (
-                                       "-Wmost",
-                                       "-Wno-unknown-pragmas",
-                               );
-                       };
-                       name = Development;
-               };
-               156EB5E80905594A00EEF749 /* Deployment */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               COPY_PHASE_STRIP = YES;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
-                               PRODUCT_NAME = Frameworks;
-                               WARNING_CFLAGS = (
-                                       "-Wmost",
-                                       "-Wno-unknown-pragmas",
-                               );
                        };
                        };
-                       name = Deployment;
+                       name = Release;
                };
                };
-               156EB5E90905594A00EEF749 /* Default */ = {
+               156EB5E70905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               PRODUCT_NAME = Frameworks;
-                               WARNING_CFLAGS = (
-                                       "-Wmost",
-                                       "-Wno-unknown-pragmas",
-                               );
+                               PRODUCT_NAME = configd_base;
                        };
                        };
-                       name = Default;
+                       name = Debug;
                };
                };
-               156EB5EB0905594A00EEF749 /* Development */ = {
+               156EB5E80905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               INFOPLIST_FILE = Plugins/ATconfig/Info.plist;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = ATconfig;
+                               PRODUCT_NAME = configd_base;
                        };
                        };
-                       name = Development;
+                       name = Release;
                };
                };
-               156EB5EC0905594A00EEF749 /* Deployment */ = {
+               156EB5EB0905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
                                INFOPLIST_FILE = Plugins/ATconfig/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = ATconfig;
                        };
                                INFOPLIST_FILE = Plugins/ATconfig/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = ATconfig;
                        };
-                       name = Deployment;
+                       name = Debug;
                };
                };
-               156EB5ED0905594A00EEF749 /* Default */ = {
+               156EB5EC0905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
                                INFOPLIST_FILE = Plugins/ATconfig/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = ATconfig;
                        };
                                INFOPLIST_FILE = Plugins/ATconfig/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = ATconfig;
                        };
-                       name = Default;
+                       name = Release;
                };
                };
-               156EB5EF0905594A00EEF749 /* Development */ = {
+               156EB5EF0905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = NO;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = NO;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
                                PRODUCT_NAME = IPMonitor;
                                PRODUCT_NAME = IPMonitor;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
                        };
                        };
-                       name = Development;
+                       name = Debug;
                };
                };
-               156EB5F00905594A00EEF749 /* Deployment */ = {
+               156EB5F00905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = YES;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = IPMonitor;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
-                       };
-                       name = Deployment;
-               };
-               156EB5F10905594A00EEF749 /* Default */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = IPMonitor;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
-                       };
-                       name = Default;
-               };
-               156EB5F30905594A00EEF749 /* Development */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               INFOPLIST_FILE = Plugins/IPMonitor/Info.plist;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = IPMonitor;
                        };
                                PRODUCT_NAME = IPMonitor;
                        };
-                       name = Development;
+                       name = Release;
                };
                };
-               156EB5F40905594A00EEF749 /* Deployment */ = {
+               156EB5F30905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/IPMonitor/Info.plist;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/IPMonitor/Info.plist;
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = IPMonitor;
                        };
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = IPMonitor;
                        };
-                       name = Deployment;
+                       name = Debug;
                };
                };
-               156EB5F50905594A00EEF749 /* Default */ = {
+               156EB5F40905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/IPMonitor/Info.plist;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/IPMonitor/Info.plist;
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = IPMonitor;
                        };
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = IPMonitor;
                        };
-                       name = Default;
+                       name = Release;
                };
                };
-               156EB5F70905594A00EEF749 /* Development */ = {
+               156EB5F70905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = NO;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = NO;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
                                PRODUCT_NAME = InterfaceNamer;
                                PRODUCT_NAME = InterfaceNamer;
-                               VALID_ARCHS = "ppc i386";
                                WARNING_CFLAGS = (
                                        "-Wall",
                                        "-Wno-unknown-pragmas",
                                );
                        };
                                WARNING_CFLAGS = (
                                        "-Wall",
                                        "-Wno-unknown-pragmas",
                                );
                        };
-                       name = Development;
+                       name = Debug;
                };
                };
-               156EB5F80905594A00EEF749 /* Deployment */ = {
+               156EB5F80905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = YES;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
                                PRODUCT_NAME = InterfaceNamer;
                                PRODUCT_NAME = InterfaceNamer;
-                               VALID_ARCHS = "ppc i386";
                                WARNING_CFLAGS = (
                                        "-Wall",
                                        "-Wno-unknown-pragmas",
                                );
                        };
                                WARNING_CFLAGS = (
                                        "-Wall",
                                        "-Wno-unknown-pragmas",
                                );
                        };
-                       name = Deployment;
+                       name = Release;
                };
                };
-               156EB5F90905594A00EEF749 /* Default */ = {
+               156EB5FB0905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = InterfaceNamer;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
-                       };
-                       name = Default;
-               };
-               156EB5FB0905594A00EEF749 /* Development */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = InterfaceNamer;
-                       };
-                       name = Development;
-               };
-               156EB5FC0905594A00EEF749 /* Deployment */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = InterfaceNamer;
                        };
                                PRODUCT_NAME = InterfaceNamer;
                        };
-                       name = Deployment;
+                       name = Debug;
                };
                };
-               156EB5FD0905594A00EEF749 /* Default */ = {
+               156EB5FC0905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist;
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = InterfaceNamer;
                        };
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = InterfaceNamer;
                        };
-                       name = Default;
-               };
-               156EB5FF0905594A00EEF749 /* Development */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = KernelEventMonitor;
-                       };
-                       name = Development;
+                       name = Release;
                };
                };
-               156EB6000905594A00EEF749 /* Deployment */ = {
+               156EB5FF0905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist;
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = KernelEventMonitor;
                        };
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = KernelEventMonitor;
                        };
-                       name = Deployment;
+                       name = Debug;
                };
                };
-               156EB6010905594A00EEF749 /* Default */ = {
+               156EB6000905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist;
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = KernelEventMonitor;
                        };
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = KernelEventMonitor;
                        };
-                       name = Default;
+                       name = Release;
                };
                };
-               156EB6030905594A00EEF749 /* Development */ = {
+               156EB6030905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = NO;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = NO;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
                                PRODUCT_NAME = KernelEventMonitor;
                                PRODUCT_NAME = KernelEventMonitor;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
                        };
                        };
-                       name = Development;
+                       name = Debug;
                };
                };
-               156EB6040905594A00EEF749 /* Deployment */ = {
+               156EB6040905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = YES;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = KernelEventMonitor;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
-                       };
-                       name = Deployment;
-               };
-               156EB6050905594A00EEF749 /* Default */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
                                PRODUCT_NAME = KernelEventMonitor;
                                PRODUCT_NAME = KernelEventMonitor;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
-                       };
-                       name = Default;
-               };
-               156EB6070905594A00EEF749 /* Development */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               COPY_PHASE_STRIP = NO;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = Kicker;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
-                       };
-                       name = Development;
-               };
-               156EB6080905594A00EEF749 /* Deployment */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               COPY_PHASE_STRIP = YES;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = Kicker;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
-                       };
-                       name = Deployment;
-               };
-               156EB6090905594A00EEF749 /* Default */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = Kicker;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
-                       };
-                       name = Default;
-               };
-               156EB60B0905594A00EEF749 /* Development */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               INFOPLIST_FILE = Plugins/Kicker/Info.plist;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
-                               PRODUCT_NAME = Kicker;
                        };
                        };
-                       name = Development;
+                       name = Release;
                };
                };
-               156EB60C0905594A00EEF749 /* Deployment */ = {
+               156EB60B0905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/Kicker/Info.plist;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/Kicker/Info.plist;
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = Kicker;
                        };
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = Kicker;
                        };
-                       name = Deployment;
+                       name = Debug;
                };
                };
-               156EB60D0905594A00EEF749 /* Default */ = {
+               156EB60C0905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/Kicker/Info.plist;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/Kicker/Info.plist;
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = Kicker;
                        };
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = Kicker;
                        };
-                       name = Default;
+                       name = Release;
                };
                };
-               156EB60F0905594A00EEF749 /* Development */ = {
+               156EB60F0905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = NO;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = NO;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
                                PRODUCT_NAME = LinkConfiguration;
                                PRODUCT_NAME = LinkConfiguration;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
                        };
                        };
-                       name = Development;
+                       name = Debug;
                };
                };
-               156EB6100905594A00EEF749 /* Deployment */ = {
+               156EB6100905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = YES;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = LinkConfiguration;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
-                       };
-                       name = Deployment;
-               };
-               156EB6110905594A00EEF749 /* Default */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = LinkConfiguration;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
-                       };
-                       name = Default;
-               };
-               156EB6130905594A00EEF749 /* Development */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               INFOPLIST_FILE = Plugins/LinkConfiguration/Info.plist;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = LinkConfiguration;
                        };
                                PRODUCT_NAME = LinkConfiguration;
                        };
-                       name = Development;
+                       name = Release;
                };
                };
-               156EB6140905594A00EEF749 /* Deployment */ = {
+               156EB6130905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/LinkConfiguration/Info.plist;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/LinkConfiguration/Info.plist;
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = LinkConfiguration;
                        };
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = LinkConfiguration;
                        };
-                       name = Deployment;
+                       name = Debug;
                };
                };
-               156EB6150905594A00EEF749 /* Default */ = {
+               156EB6140905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/LinkConfiguration/Info.plist;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/LinkConfiguration/Info.plist;
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = LinkConfiguration;
                        };
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = LinkConfiguration;
                        };
-                       name = Default;
+                       name = Release;
                };
                };
-               156EB6170905594A00EEF749 /* Development */ = {
+               156EB6170905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = NO;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = NO;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
                                PRODUCT_NAME = PreferencesMonitor;
                                PRODUCT_NAME = PreferencesMonitor;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
                        };
                        };
-                       name = Development;
+                       name = Debug;
                };
                };
-               156EB6180905594A00EEF749 /* Deployment */ = {
+               156EB6180905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                COPY_PHASE_STRIP = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = PreferencesMonitor;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
-                       };
-                       name = Deployment;
-               };
-               156EB6190905594A00EEF749 /* Default */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = PreferencesMonitor;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
-                       };
-                       name = Default;
-               };
-               156EB61B0905594A00EEF749 /* Development */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               INFOPLIST_FILE = Plugins/PreferencesMonitor/Info.plist;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = PreferencesMonitor;
                        };
                                PRODUCT_NAME = PreferencesMonitor;
                        };
-                       name = Development;
+                       name = Release;
                };
                };
-               156EB61C0905594A00EEF749 /* Deployment */ = {
+               156EB61B0905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/PreferencesMonitor/Info.plist;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/PreferencesMonitor/Info.plist;
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = PreferencesMonitor;
                        };
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = PreferencesMonitor;
                        };
-                       name = Deployment;
+                       name = Debug;
                };
                };
-               156EB61D0905594A00EEF749 /* Default */ = {
+               156EB61C0905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/PreferencesMonitor/Info.plist;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/PreferencesMonitor/Info.plist;
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = PreferencesMonitor;
                        };
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = PreferencesMonitor;
                        };
-                       name = Default;
-               };
-               156EB61F0905594A00EEF749 /* Development */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               COPY_PHASE_STRIP = NO;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
-                               PRODUCT_NAME = Plugins;
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
-                       };
-                       name = Development;
+                       name = Release;
                };
                };
-               156EB6200905594A00EEF749 /* Deployment */ = {
+               156EB61F0905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               COPY_PHASE_STRIP = YES;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
-                               PRODUCT_NAME = Plugins;
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
+                               PRODUCT_NAME = configd_plugins;
                        };
                        };
-                       name = Deployment;
+                       name = Debug;
                };
                };
-               156EB6210905594A00EEF749 /* Default */ = {
+               156EB6200905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               PRODUCT_NAME = Plugins;
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
+                               PRODUCT_NAME = configd_plugins;
                        };
                        };
-                       name = Default;
+                       name = Release;
                };
                };
-               156EB6230905594A00EEF749 /* Development */ = {
+               156EB6230905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               CODE_SIGN_IDENTITY = "-";
                                COPY_PHASE_STRIP = NO;
                                DEAD_CODE_STRIPPING = YES;
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                COPY_PHASE_STRIP = NO;
                                DEAD_CODE_STRIPPING = YES;
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/sbin;
+                               INSTALL_PATH = /usr/libexec;
                                LIBRARY_SEARCH_PATHS = (
                                        "$(SYMROOT)",
                                        /usr/local/lib/SystemConfiguration,
                                );
                                LIBRARY_SEARCH_PATHS = (
                                        "$(SYMROOT)",
                                        /usr/local/lib/SystemConfiguration,
                                );
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               OTHER_LDFLAGS = "-prebind_all_twolevel_modules";
                                PRODUCT_NAME = configd;
                                PRODUCT_NAME = configd;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
                        };
                        };
-                       name = Development;
+                       name = Debug;
                };
                };
-               156EB6240905594A00EEF749 /* Deployment */ = {
+               156EB6240905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               CODE_SIGN_IDENTITY = "-";
                                DEAD_CODE_STRIPPING = YES;
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                DEAD_CODE_STRIPPING = YES;
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/sbin;
-                               LIBRARY_SEARCH_PATHS = (
-                                       "$(SYMROOT)",
-                                       /usr/local/lib/SystemConfiguration,
-                               );
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               OTHER_LDFLAGS = "-prebind_all_twolevel_modules";
-                               PRODUCT_NAME = configd;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
-                       };
-                       name = Deployment;
-               };
-               156EB6250905594A00EEF749 /* Default */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               DEAD_CODE_STRIPPING = YES;
-                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/sbin;
+                               INSTALL_PATH = /usr/libexec;
                                LIBRARY_SEARCH_PATHS = (
                                        "$(SYMROOT)",
                                        /usr/local/lib/SystemConfiguration,
                                );
                                LIBRARY_SEARCH_PATHS = (
                                        "$(SYMROOT)",
                                        /usr/local/lib/SystemConfiguration,
                                );
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               OTHER_LDFLAGS = "-prebind_all_twolevel_modules";
                                PRODUCT_NAME = configd;
                                PRODUCT_NAME = configd;
-                               STRIPFLAGS = "-S";
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
                        };
                        };
-                       name = Default;
+                       name = Release;
                };
                };
-               156EB6270905594A00EEF749 /* Development */ = {
+               156EB6270905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               CODE_SIGN_IDENTITY = "-";
                                COPY_PHASE_STRIP = NO;
                                DEAD_CODE_STRIPPING = YES;
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
                                INSTALL_PATH = /usr/sbin;
                                COPY_PHASE_STRIP = NO;
                                DEAD_CODE_STRIPPING = YES;
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
                                INSTALL_PATH = /usr/sbin;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
                                PRODUCT_NAME = scselect;
                                STRIPFLAGS = "-S";
                                PRODUCT_NAME = scselect;
                                STRIPFLAGS = "-S";
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
                        };
                        };
-                       name = Development;
+                       name = Debug;
                };
                };
-               156EB6280905594A00EEF749 /* Deployment */ = {
+               156EB6280905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               CODE_SIGN_IDENTITY = "-";
                                COPY_PHASE_STRIP = YES;
                                DEAD_CODE_STRIPPING = YES;
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
                                INSTALL_PATH = /usr/sbin;
                                COPY_PHASE_STRIP = YES;
                                DEAD_CODE_STRIPPING = YES;
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
                                INSTALL_PATH = /usr/sbin;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = scselect;
-                               STRIPFLAGS = "-S";
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
-                       };
-                       name = Deployment;
-               };
-               156EB6290905594A00EEF749 /* Default */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               DEAD_CODE_STRIPPING = YES;
-                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
-                               INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
-                               INSTALL_PATH = /usr/sbin;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
                                PRODUCT_NAME = scselect;
                                STRIPFLAGS = "-S";
                                PRODUCT_NAME = scselect;
                                STRIPFLAGS = "-S";
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
                        };
                        };
-                       name = Default;
+                       name = Release;
                };
                };
-               156EB62B0905594A00EEF749 /* Development */ = {
+               156EB62B0905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               CODE_SIGN_IDENTITY = "-";
                                COPY_PHASE_STRIP = NO;
                                DEAD_CODE_STRIPPING = YES;
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                COPY_PHASE_STRIP = NO;
                                DEAD_CODE_STRIPPING = YES;
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                        "$(SYMROOT)",
                                        /usr/local/lib/SystemConfiguration,
                                );
                                        "$(SYMROOT)",
                                        /usr/local/lib/SystemConfiguration,
                                );
-                               MACOSX_DEPLOYMENT_TARGET = 10.5;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
                                PREBINDING = NO;
                                PRODUCT_NAME = scutil;
                                STRIPFLAGS = "-S";
                                PREBINDING = NO;
                                PRODUCT_NAME = scutil;
                                STRIPFLAGS = "-S";
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
                        };
                        };
-                       name = Development;
+                       name = Debug;
                };
                };
-               156EB62C0905594A00EEF749 /* Deployment */ = {
+               156EB62C0905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               CODE_SIGN_IDENTITY = "-";
                                COPY_PHASE_STRIP = YES;
                                DEAD_CODE_STRIPPING = YES;
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                COPY_PHASE_STRIP = YES;
                                DEAD_CODE_STRIPPING = YES;
                                FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                        "$(SYMROOT)",
                                        /usr/local/lib/SystemConfiguration,
                                );
                                        "$(SYMROOT)",
                                        /usr/local/lib/SystemConfiguration,
                                );
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
                                PREBINDING = YES;
                                PRODUCT_NAME = scutil;
                                STRIPFLAGS = "-S";
                                PREBINDING = YES;
                                PRODUCT_NAME = scutil;
                                STRIPFLAGS = "-S";
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
                        };
                        };
-                       name = Deployment;
+                       name = Release;
                };
                };
-               156EB62D0905594A00EEF749 /* Default */ = {
+               156EB62F0905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               DEAD_CODE_STRIPPING = YES;
-                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/sbin;
-                               LIBRARY_SEARCH_PATHS = (
-                                       "$(SYMROOT)",
-                                       /usr/local/lib/SystemConfiguration,
-                               );
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PREBINDING = YES;
-                               PRODUCT_NAME = scutil;
-                               STRIPFLAGS = "-S";
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
+                               PRODUCT_NAME = configd_executables;
                        };
                        };
-                       name = Default;
+                       name = Debug;
                };
                };
-               156EB62F0905594A00EEF749 /* Development */ = {
+               156EB6300905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               COPY_PHASE_STRIP = NO;
-                               DEAD_CODE_STRIPPING = YES;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
                                PRODUCT_NAME = configd_executables;
                                PRODUCT_NAME = configd_executables;
-                               STRIPFLAGS = "-S";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
                        };
                        };
-                       name = Development;
+                       name = Release;
                };
                };
-               156EB6300905594A00EEF749 /* Deployment */ = {
+               156EB6330905594A00EEF749 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               COPY_PHASE_STRIP = YES;
-                               DEAD_CODE_STRIPPING = YES;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
-                               PRODUCT_NAME = configd_executables;
+                               PRODUCT_NAME = "configd (Aggregate)";
+                       };
+                       name = Debug;
+               };
+               156EB6340905594A00EEF749 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = "configd (Aggregate)";
+                       };
+                       name = Release;
+               };
+               156EB63F0905594A00EEF749 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               CURRENT_PROJECT_VERSION = "$(RC_ProjectSourceVersion)";
+                               DEAD_CODE_STRIPPING = YES;
+                               DYLIB_COMPATIBILITY_VERSION = 1;
+                               DYLIB_CURRENT_VERSION = "$(RC_ProjectSourceVersion)";
+                               GCC_OPTIMIZATION_LEVEL = 0;
+                               INSTALL_GROUP = wheel;
+                               INSTALL_MODE_FLAG = "u+s,ugo-w,o+rX";
+                               INSTALL_OWNER = root;
+                               INSTALL_PATH = /usr/sbin;
+                               OTHER_CFLAGS = (
+                                       "-fconstant-cfstrings",
+                                       "-fstack-protector",
+                                       "-D_FORTIFY_SOURCE=2",
+                               );
                                STRIPFLAGS = "-S";
                                STRIPFLAGS = "-S";
+                               VERSIONING_SYSTEM = "apple-generic";
                                WARNING_CFLAGS = (
                                        "-Wall",
                                WARNING_CFLAGS = (
                                        "-Wall",
+                                       "-Wno-four-char-constants",
                                        "-Wno-unknown-pragmas",
                                        "-Wno-unknown-pragmas",
+                                       "-Wformat-security",
                                );
                        };
                                );
                        };
-                       name = Deployment;
+                       name = Debug;
                };
                };
-               156EB6310905594A00EEF749 /* Default */ = {
+               156EB6400905594A00EEF749 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               CURRENT_PROJECT_VERSION = "$(RC_ProjectSourceVersion)";
                                DEAD_CODE_STRIPPING = YES;
                                DEAD_CODE_STRIPPING = YES;
-                               PRODUCT_NAME = configd_executables;
+                               DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+                               DYLIB_COMPATIBILITY_VERSION = 1;
+                               DYLIB_CURRENT_VERSION = "$(RC_ProjectSourceVersion)";
+                               INSTALL_GROUP = wheel;
+                               INSTALL_MODE_FLAG = "u+s,ugo-w,o+rX";
+                               INSTALL_OWNER = root;
+                               INSTALL_PATH = /usr/sbin;
+                               OTHER_CFLAGS = (
+                                       "-fconstant-cfstrings",
+                                       "-fstack-protector",
+                                       "-D_FORTIFY_SOURCE=2",
+                               );
                                STRIPFLAGS = "-S";
                                STRIPFLAGS = "-S";
+                               VERSIONING_SYSTEM = "apple-generic";
                                WARNING_CFLAGS = (
                                        "-Wall",
                                WARNING_CFLAGS = (
                                        "-Wall",
+                                       "-Wno-four-char-constants",
                                        "-Wno-unknown-pragmas",
                                        "-Wno-unknown-pragmas",
+                                       "-Wformat-security",
                                );
                        };
                                );
                        };
-                       name = Default;
+                       name = Release;
+               };
+               1572C52A0CFB55B400E2776E /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
+                               INFOPLIST_FILE = "SystemConfiguration.fproj/Info-Embedded.plist";
+                               INSTALLHDRS_SCRIPT_PHASE = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
+                               LIBRARY_SEARCH_PATHS = "$(SYMROOT)";
+                               PRODUCT_NAME = SystemConfiguration;
+                               WRAPPER_EXTENSION = framework;
+                       };
+                       name = Debug;
+               };
+               1572C52B0CFB55B400E2776E /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
+                               INFOPLIST_FILE = "SystemConfiguration.fproj/Info-Embedded.plist";
+                               INSTALLHDRS_SCRIPT_PHASE = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
+                               LIBRARY_SEARCH_PATHS = "$(SYMROOT)";
+                               PRODUCT_NAME = SystemConfiguration;
+                               WRAPPER_EXTENSION = framework;
+                       };
+                       name = Release;
                };
                };
-               156EB6330905594A00EEF749 /* Development */ = {
+               157433E90D4A8122002ACA73 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
                                COPY_PHASE_STRIP = NO;
                        buildSettings = {
                                COPY_PHASE_STRIP = NO;
+                               DEAD_CODE_STRIPPING = YES;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
-                               PRODUCT_NAME = "configd (Aggregate)";
+                               INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
+                               INSTALL_PATH = /usr/sbin;
+                               PRODUCT_NAME = scselect;
+                               STRIPFLAGS = "-S";
+                       };
+                       name = Debug;
+               };
+               157433EA0D4A8122002ACA73 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               DEAD_CODE_STRIPPING = YES;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX,u+s";
+                               INSTALL_PATH = /usr/sbin;
+                               PRODUCT_NAME = scselect;
+                               STRIPFLAGS = "-S";
+                       };
+                       name = Release;
+               };
+               157434170D4A8137002ACA73 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               DEAD_CODE_STRIPPING = YES;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/sbin;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       "$(SDKROOT)/usr/local/lib/SystemConfiguration",
+                               );
+                               PREBINDING = NO;
+                               PRODUCT_NAME = scutil;
+                               STRIPFLAGS = "-S";
+                       };
+                       name = Debug;
+               };
+               157434180D4A8137002ACA73 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               DEAD_CODE_STRIPPING = YES;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/sbin;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       "$(SDKROOT)/usr/local/lib/SystemConfiguration",
+                               );
+                               PREBINDING = YES;
+                               PRODUCT_NAME = scutil;
+                               STRIPFLAGS = "-S";
+                       };
+                       name = Release;
+               };
+               157A84E50D56C63900B6F1A0 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               BUILD_VARIANTS = (
+                                       normal,
+                                       debug,
+                                       profile,
+                               );
+                               COPY_PHASE_STRIP = NO;
+                               GENERATE_PROFILING_CODE_profile = YES;
+                               INSTALLHDRS_COPY_PHASE = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/system;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS_debug = "-O0";
+                               OTHER_CFLAGS_normal = "";
+                               OTHER_CFLAGS_profile = "";
+                               OTHER_MIGFLAGS = "-DLIBDNSINFO";
+                               PRODUCT_NAME = dnsinfo;
+                               STRIPFLAGS = "";
+                               STRIP_INSTALLED_PRODUCT_debug = NO;
+                               STRIP_INSTALLED_PRODUCT_normal = YES;
+                               STRIP_INSTALLED_PRODUCT_profile = NO;
+                       };
+                       name = Debug;
+               };
+               157A84E60D56C63900B6F1A0 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               BUILD_VARIANTS = (
+                                       normal,
+                                       debug,
+                                       profile,
+                               );
+                               COPY_PHASE_STRIP = YES;
+                               GENERATE_PROFILING_CODE_profile = YES;
+                               INSTALLHDRS_COPY_PHASE = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/system;
+                               LIBRARY_STYLE = STATIC;
+                               OTHER_CFLAGS_debug = "-O0";
+                               OTHER_CFLAGS_normal = "";
+                               OTHER_CFLAGS_profile = "";
+                               OTHER_MIGFLAGS = "-DLIBDNSINFO";
+                               PRODUCT_NAME = dnsinfo;
+                               STRIPFLAGS = "";
+                               STRIP_INSTALLED_PRODUCT_debug = NO;
+                               STRIP_INSTALLED_PRODUCT_normal = YES;
+                               STRIP_INSTALLED_PRODUCT_profile = NO;
+                       };
+                       name = Release;
+               };
+               157A84FF0D56C7E800B6F1A0 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = IPMonitor;
+                       };
+                       name = Debug;
+               };
+               157A85000D56C7E800B6F1A0 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = IPMonitor;
+                       };
+                       name = Release;
+               };
+               157A850A0D56C8AA00B6F1A0 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = InterfaceNamer;
+                       };
+                       name = Debug;
+               };
+               157A850B0D56C8AA00B6F1A0 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = InterfaceNamer;
+                       };
+                       name = Release;
+               };
+               157A85200D56C8E000B6F1A0 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = KernelEventMonitor;
+                       };
+                       name = Debug;
+               };
+               157A85210D56C8E000B6F1A0 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = KernelEventMonitor;
+                       };
+                       name = Release;
+               };
+               157A852B0D56C91100B6F1A0 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = LinkConfiguration;
+                       };
+                       name = Debug;
+               };
+               157A852C0D56C91100B6F1A0 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = LinkConfiguration;
+                       };
+                       name = Release;
+               };
+               157A85360D56C94F00B6F1A0 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = NetworkIdentification;
+                       };
+                       name = Debug;
+               };
+               157A85370D56C94F00B6F1A0 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = NetworkIdentification;
+                       };
+                       name = Release;
+               };
+               157A85410D56C96F00B6F1A0 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = PreferencesMonitor;
+                       };
+                       name = Debug;
+               };
+               157A85420D56C96F00B6F1A0 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
+                               PRODUCT_NAME = PreferencesMonitor;
+                       };
+                       name = Release;
+               };
+               158316D90CFB774B006F62B9 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = "configd_base (Embedded)";
+                       };
+                       name = Debug;
+               };
+               158316DA0CFB774B006F62B9 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = "configd_base (Embedded)";
+                       };
+                       name = Release;
+               };
+               158317010CFB7761006F62B9 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = "configd_plugins (Embedded)";
+                       };
+                       name = Debug;
+               };
+               158317020CFB7761006F62B9 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = "configd_plugins (Embedded)";
+                       };
+                       name = Release;
+               };
+               1583170C0CFB7782006F62B9 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = "configd_executables (Embedded)";
+                       };
+                       name = Debug;
+               };
+               1583170D0CFB7782006F62B9 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               PRODUCT_NAME = "configd_executables (Embedded)";
+                       };
+                       name = Release;
+               };
+               1583175E0CFB80A1006F62B9 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               APPLY_RULES_IN_COPY_FILES = YES;
+                               CODE_SIGN_ENTITLEMENTS = configd.tproj/entitlements.plist;
+                               COPY_PHASE_STRIP = NO;
+                               DEAD_CODE_STRIPPING = YES;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/libexec;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       "$(SDKROOT)/usr/local/lib/SystemConfiguration",
+                               );
+                               PRODUCT_NAME = configd;
+                       };
+                       name = Debug;
+               };
+               1583175F0CFB80A1006F62B9 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               APPLY_RULES_IN_COPY_FILES = YES;
+                               CODE_SIGN_ENTITLEMENTS = configd.tproj/entitlements.plist;
+                               DEAD_CODE_STRIPPING = YES;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = /usr/libexec;
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(SYMROOT)",
+                                       "$(SDKROOT)/usr/local/lib/SystemConfiguration",
+                               );
+                               PRODUCT_NAME = configd;
+                       };
+                       name = Release;
+               };
+               158317810CFB85C8006F62B9 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/IPMonitor/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = IPMonitor;
+                       };
+                       name = Debug;
+               };
+               158317820CFB85C8006F62B9 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/IPMonitor/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = IPMonitor;
+                       };
+                       name = Release;
+               };
+               1583178A0CFB85DD006F62B9 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = InterfaceNamer;
+                       };
+                       name = Debug;
+               };
+               1583178B0CFB85DD006F62B9 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/InterfaceNamer/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = InterfaceNamer;
+                       };
+                       name = Release;
+               };
+               158317930CFB85F7006F62B9 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = KernelEventMonitor;
+                       };
+                       name = Debug;
+               };
+               158317940CFB85F7006F62B9 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/KernelEventMonitor/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = KernelEventMonitor;
+                       };
+                       name = Release;
+               };
+               1583179B0CFB860C006F62B9 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/LinkConfiguration/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = LinkConfiguration;
+                       };
+                       name = Debug;
+               };
+               1583179C0CFB860C006F62B9 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/LinkConfiguration/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = LinkConfiguration;
+                       };
+                       name = Release;
+               };
+               158317A30CFB8626006F62B9 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/NetworkIdentification/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = NetworkIdentification;
+                       };
+                       name = Debug;
+               };
+               158317A40CFB8626006F62B9 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/NetworkIdentification/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = NetworkIdentification;
+                       };
+                       name = Release;
+               };
+               158317AB0CFB8639006F62B9 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/PreferencesMonitor/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = PreferencesMonitor;
+                       };
+                       name = Debug;
+               };
+               158317AC0CFB8639006F62B9 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               INFOPLIST_FILE = Plugins/PreferencesMonitor/Info.plist;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               PRODUCT_NAME = PreferencesMonitor;
+                       };
+                       name = Release;
+               };
+               158337A70CFB6B9E0033AB93 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
+                       buildSettings = {
+                               APPLY_RULES_IN_COPY_FILES = YES;
+                               COPY_PHASE_STRIP = NO;
+                               DEAD_CODE_STRIPPING = YES;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
+                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework";
+                               PRODUCT_NAME = SCHelper;
+                               STRIPFLAGS = "-S";
                        };
                        };
-                       name = Development;
+                       name = Debug;
                };
                };
-               156EB6340905594A00EEF749 /* Deployment */ = {
+               158337A80CFB6B9E0033AB93 /* Release */ = {
                        isa = XCBuildConfiguration;
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15AEABBC0DAD5B3000D1C969 /* AspenSDK.xcconfig */;
                        buildSettings = {
                        buildSettings = {
+                               APPLY_RULES_IN_COPY_FILES = YES;
                                COPY_PHASE_STRIP = YES;
                                COPY_PHASE_STRIP = YES;
+                               DEAD_CODE_STRIPPING = YES;
+                               FRAMEWORK_SEARCH_PATHS = "$(SYMROOT)";
                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
-                               PRODUCT_NAME = "configd (Aggregate)";
-                       };
-                       name = Deployment;
-               };
-               156EB6350905594A00EEF749 /* Default */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               PRODUCT_NAME = "configd (Aggregate)";
+                               INSTALL_MODE_FLAG = "a-w,a+rX";
+                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/SystemConfiguration.framework";
+                               PRODUCT_NAME = SCHelper;
+                               STRIPFLAGS = "-S";
                        };
                        };
-                       name = Default;
+                       name = Release;
                };
                };
-               156EB63B0905594A00EEF749 /* Development */ = {
+               15A5A2670D5B94190087BDA0 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */;
                        buildSettings = {
                                COPY_PHASE_STRIP = NO;
                        buildSettings = {
                                COPY_PHASE_STRIP = NO;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
                                HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
                                HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
+                               INFOPLIST_FILE = "SystemConfiguration.fproj/Info-Embedded.plist";
+                               INSTALLHDRS_SCRIPT_PHASE = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = ATconfig;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
+                               INSTALL_PATH_ACTUAL = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
+                               LIBRARY_SEARCH_PATHS = "$(SYMROOT)";
+                               PRODUCT_NAME = SystemConfiguration;
+                               WRAPPER_EXTENSION = framework;
                        };
                        };
-                       name = Development;
+                       name = Debug;
                };
                };
-               156EB63C0905594A00EEF749 /* Deployment */ = {
+               15A5A2680D5B94190087BDA0 /* Release */ = {
                        isa = XCBuildConfiguration;
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */;
                        buildSettings = {
                                COPY_PHASE_STRIP = YES;
                        buildSettings = {
                                COPY_PHASE_STRIP = YES;
-                               GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
                                HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
                                HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
+                               INFOPLIST_FILE = "SystemConfiguration.fproj/Info-Embedded.plist";
+                               INSTALLHDRS_SCRIPT_PHASE = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = ATconfig;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
+                               INSTALL_PATH_ACTUAL = "$(SYSTEM_LIBRARY_DIR)/Frameworks";
+                               LIBRARY_SEARCH_PATHS = "$(SYMROOT)";
+                               PRODUCT_NAME = SystemConfiguration;
+                               WRAPPER_EXTENSION = framework;
                        };
                        };
-                       name = Deployment;
+                       name = Release;
                };
                };
-               156EB63D0905594A00EEF749 /* Default */ = {
+               15C64A1F0F684C3300D78394 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               HEADER_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/Frameworks/System.framework/PrivateHeaders";
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = ATconfig;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
+                               INSTALL_PATH = /usr/local/lib/system;
+                               PRODUCT_NAME = configd_libSystem;
                        };
                        };
-                       name = Default;
+                       name = Debug;
                };
                };
-               156EB63F0905594A00EEF749 /* Development */ = {
+               15C64A200F684C3300D78394 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               CURRENT_PROJECT_VERSION = 212.2;
-                               DEAD_CODE_STRIPPING = YES;
-                               INSTALL_GROUP = wheel;
-                               INSTALL_MODE_FLAG = "u+s,ugo-w,o+rX";
-                               INSTALL_OWNER = root;
-                               INSTALL_PATH = /usr/sbin;
-                               MACOSX_DEPLOYMENT_TARGET = 10.5;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               STRIPFLAGS = "-S";
-                               VERSIONING_SYSTEM = "apple-generic";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-four-char-constants",
-                                       "-Wno-unknown-pragmas",
-                               );
+                               INSTALL_PATH = /usr/local/lib/system;
+                               PRODUCT_NAME = configd_libSystem;
                        };
                        };
-                       name = Development;
+                       name = Release;
                };
                };
-               156EB6400905594A00EEF749 /* Deployment */ = {
+               15C64A2C0F684C6B00D78394 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               CURRENT_PROJECT_VERSION = 212.2;
-                               DEAD_CODE_STRIPPING = YES;
-                               INSTALL_GROUP = wheel;
-                               INSTALL_MODE_FLAG = "u+s,ugo-w,o+rX";
-                               INSTALL_OWNER = root;
-                               INSTALL_PATH = /usr/sbin;
-                               MACOSX_DEPLOYMENT_TARGET = 10.5;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               STRIPFLAGS = "-S";
-                               VERSIONING_SYSTEM = "apple-generic";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-four-char-constants",
-                                       "-Wno-unknown-pragmas",
-                               );
+                               INSTALL_PATH = /usr/local/lib/system;
+                               PRODUCT_NAME = "configd_libSystem (Embedded)";
                        };
                        };
-                       name = Deployment;
+                       name = Debug;
                };
                };
-               156EB6410905594A00EEF749 /* Default */ = {
+               15C64A2D0F684C6B00D78394 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               CURRENT_PROJECT_VERSION = 212.2;
-                               DEAD_CODE_STRIPPING = YES;
-                               INSTALL_GROUP = wheel;
-                               INSTALL_MODE_FLAG = "u+s,ugo-w,o+rX";
-                               INSTALL_OWNER = root;
-                               INSTALL_PATH = /usr/sbin;
-                               MACOSX_DEPLOYMENT_TARGET = 10.5;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               STRIPFLAGS = "-S";
-                               VERSIONING_SYSTEM = "apple-generic";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-four-char-constants",
-                                       "-Wno-unknown-pragmas",
-                               );
+                               INSTALL_PATH = /usr/local/lib/system;
+                               PRODUCT_NAME = "configd_libSystem (Embedded)";
                        };
                        };
-                       name = Default;
+                       name = Release;
                };
                };
-               F95B8A620B03F83200993BA3 /* Development */ = {
+               15FD13C70D59485000F9409C /* Debug */ = {
                        isa = XCBuildConfiguration;
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */;
                        buildSettings = {
                        buildSettings = {
-                               COPY_PHASE_STRIP = NO;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = NetworkIdentification;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
+                               PRODUCT_NAME = "configd (Aggregate/EmbeddedSimulator)";
                        };
                        };
-                       name = Development;
+                       name = Debug;
                };
                };
-               F95B8A630B03F83200993BA3 /* Deployment */ = {
+               15FD13C80D59485000F9409C /* Release */ = {
                        isa = XCBuildConfiguration;
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 15FD147B0D594FE700F9409C /* IndigoSDK.xcconfig */;
                        buildSettings = {
                        buildSettings = {
-                               COPY_PHASE_STRIP = YES;
-                               INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
-                               LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
-                               PRODUCT_NAME = NetworkIdentification;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
+                               PRODUCT_NAME = "configd (Aggregate/EmbeddedSimulator)";
                        };
                        };
-                       name = Deployment;
+                       name = Release;
                };
                };
-               F95B8A640B03F83200993BA3 /* Default */ = {
+               F95B8A620B03F83200993BA3 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               COPY_PHASE_STRIP = NO;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_PATH = /usr/local/lib/SystemConfiguration;
                                LIBRARY_STYLE = STATIC;
-                               OTHER_CFLAGS = "-fconstant-cfstrings";
                                PRODUCT_NAME = NetworkIdentification;
                                PRODUCT_NAME = NetworkIdentification;
-                               VALID_ARCHS = "ppc i386";
-                               WARNING_CFLAGS = (
-                                       "-Wall",
-                                       "-Wno-unknown-pragmas",
-                               );
                        };
                        };
-                       name = Default;
+                       name = Debug;
                };
                };
-               F95B8A6D0B03F9D100993BA3 /* Development */ = {
+               F95B8A630B03F83200993BA3 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               INFOPLIST_FILE = Plugins/NetworkIdentification/Info.plist;
+                               COPY_PHASE_STRIP = YES;
                                INSTALL_MODE_FLAG = "a-w,a+rX";
                                INSTALL_MODE_FLAG = "a-w,a+rX";
-                               INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
+                               INSTALL_PATH = /usr/local/lib/SystemConfiguration;
+                               LIBRARY_STYLE = STATIC;
                                PRODUCT_NAME = NetworkIdentification;
                        };
                                PRODUCT_NAME = NetworkIdentification;
                        };
-                       name = Development;
+                       name = Release;
                };
                };
-               F95B8A6E0B03F9D100993BA3 /* Deployment */ = {
+               F95B8A6D0B03F9D100993BA3 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/NetworkIdentification/Info.plist;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/NetworkIdentification/Info.plist;
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = NetworkIdentification;
                        };
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = NetworkIdentification;
                        };
-                       name = Deployment;
+                       name = Debug;
                };
                };
-               F95B8A6F0B03F9D100993BA3 /* Default */ = {
+               F95B8A6E0B03F9D100993BA3 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/NetworkIdentification/Info.plist;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                INFOPLIST_FILE = Plugins/NetworkIdentification/Info.plist;
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = NetworkIdentification;
                        };
                                INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/SystemConfiguration";
                                PRODUCT_NAME = NetworkIdentification;
                        };
-                       name = Default;
+                       name = Release;
                };
 /* End XCBuildConfiguration section */
 
 /* Begin XCConfigurationList section */
                };
 /* End XCBuildConfiguration section */
 
 /* Begin XCConfigurationList section */
+               151C1CD60CFB48E300C5AFD6 /* Build configuration list for PBXAggregateTarget "All-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               151C1CC70CFB487000C5AFD6 /* Debug */,
+                               151C1CC80CFB487000C5AFD6 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
                151F5D9F0CCE98E60093AC3B /* Build configuration list for PBXNativeTarget "SCMonitor" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                151F5D9F0CCE98E60093AC3B /* Build configuration list for PBXNativeTarget "SCMonitor" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               151F5D9C0CCE98E60093AC3B /* Development */,
-                               151F5D9D0CCE98E60093AC3B /* Deployment */,
-                               151F5D9E0CCE98E60093AC3B /* Default */,
+                               151F5D9C0CCE98E60093AC3B /* Debug */,
+                               151F5D9D0CCE98E60093AC3B /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                151F63DC09328A3C0096DCC9 /* Build configuration list for PBXNativeTarget "Schema" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                151F63DC09328A3C0096DCC9 /* Build configuration list for PBXNativeTarget "Schema" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               151F63DD09328A3C0096DCC9 /* Development */,
-                               151F63DE09328A3C0096DCC9 /* Deployment */,
-                               151F63DF09328A3C0096DCC9 /* Default */,
+                               151F63DD09328A3C0096DCC9 /* Debug */,
+                               151F63DE09328A3C0096DCC9 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               151FE2E40D5B7046000D6DB1 /* Build configuration list for PBXAggregateTarget "configd_base-EmbeddedSimulator" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               151FE2E50D5B7046000D6DB1 /* Debug */,
+                               151FE2E60D5B7046000D6DB1 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               15213FFF0E93E9F600DACD2C /* Build configuration list for PBXNativeTarget "Logger.bundle" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               15213FFC0E93E9F600DACD2C /* Debug */,
+                               15213FFD0E93E9F600DACD2C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               156CA4820EF853BB00C59A18 /* Build configuration list for PBXNativeTarget "Logger.bundle-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               156CA4830EF853BB00C59A18 /* Debug */,
+                               156CA4840EF853BB00C59A18 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB5DA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "DNSConfiguration" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB5DA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "DNSConfiguration" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB5DB0905594A00EEF749 /* Development */,
-                               156EB5DC0905594A00EEF749 /* Deployment */,
-                               156EB5DD0905594A00EEF749 /* Default */,
+                               156EB5DB0905594A00EEF749 /* Debug */,
+                               156EB5DC0905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB5DE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "SystemConfiguration.framework" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB5DE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "SystemConfiguration.framework" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB5DF0905594A00EEF749 /* Development */,
-                               156EB5E00905594A00EEF749 /* Deployment */,
-                               156EB5E10905594A00EEF749 /* Default */,
+                               156EB5DF0905594A00EEF749 /* Debug */,
+                               156EB5E00905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB5E20905594A00EEF749 /* Build configuration list for PBXNativeTarget "SCHelper" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB5E20905594A00EEF749 /* Build configuration list for PBXNativeTarget "SCHelper" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB5E30905594A00EEF749 /* Development */,
-                               156EB5E40905594A00EEF749 /* Deployment */,
-                               156EB5E50905594A00EEF749 /* Default */,
+                               156EB5E30905594A00EEF749 /* Debug */,
+                               156EB5E40905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB5E60905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_base" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB5E60905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_base" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB5E70905594A00EEF749 /* Development */,
-                               156EB5E80905594A00EEF749 /* Deployment */,
-                               156EB5E90905594A00EEF749 /* Default */,
+                               156EB5E70905594A00EEF749 /* Debug */,
+                               156EB5E80905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB5EA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "ATconfig.bundle" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB5EA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "ATconfig.bundle" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB5EB0905594A00EEF749 /* Development */,
-                               156EB5EC0905594A00EEF749 /* Deployment */,
-                               156EB5ED0905594A00EEF749 /* Default */,
+                               156EB5EB0905594A00EEF749 /* Debug */,
+                               156EB5EC0905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB5EE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "IPMonitor" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB5EE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "IPMonitor" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB5EF0905594A00EEF749 /* Development */,
-                               156EB5F00905594A00EEF749 /* Deployment */,
-                               156EB5F10905594A00EEF749 /* Default */,
+                               156EB5EF0905594A00EEF749 /* Debug */,
+                               156EB5F00905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB5F20905594A00EEF749 /* Build configuration list for PBXNativeTarget "IPMonitor.bundle" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB5F20905594A00EEF749 /* Build configuration list for PBXNativeTarget "IPMonitor.bundle" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB5F30905594A00EEF749 /* Development */,
-                               156EB5F40905594A00EEF749 /* Deployment */,
-                               156EB5F50905594A00EEF749 /* Default */,
+                               156EB5F30905594A00EEF749 /* Debug */,
+                               156EB5F40905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB5F60905594A00EEF749 /* Build configuration list for PBXNativeTarget "InterfaceNamer" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB5F60905594A00EEF749 /* Build configuration list for PBXNativeTarget "InterfaceNamer" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB5F70905594A00EEF749 /* Development */,
-                               156EB5F80905594A00EEF749 /* Deployment */,
-                               156EB5F90905594A00EEF749 /* Default */,
+                               156EB5F70905594A00EEF749 /* Debug */,
+                               156EB5F80905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB5FA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "InterfaceNamer.bundle" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB5FA0905594A00EEF749 /* Build configuration list for PBXNativeTarget "InterfaceNamer.bundle" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB5FB0905594A00EEF749 /* Development */,
-                               156EB5FC0905594A00EEF749 /* Deployment */,
-                               156EB5FD0905594A00EEF749 /* Default */,
+                               156EB5FB0905594A00EEF749 /* Debug */,
+                               156EB5FC0905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB5FE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "KernelEventMonitor.bundle" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB5FE0905594A00EEF749 /* Build configuration list for PBXNativeTarget "KernelEventMonitor.bundle" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB5FF0905594A00EEF749 /* Development */,
-                               156EB6000905594A00EEF749 /* Deployment */,
-                               156EB6010905594A00EEF749 /* Default */,
+                               156EB5FF0905594A00EEF749 /* Debug */,
+                               156EB6000905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB6020905594A00EEF749 /* Build configuration list for PBXNativeTarget "KernelEventMonitor" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB6020905594A00EEF749 /* Build configuration list for PBXNativeTarget "KernelEventMonitor" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB6030905594A00EEF749 /* Development */,
-                               156EB6040905594A00EEF749 /* Deployment */,
-                               156EB6050905594A00EEF749 /* Default */,
-                       );
-                       defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
-               };
-               156EB6060905594A00EEF749 /* Build configuration list for PBXNativeTarget "Kicker" */ = {
-                       isa = XCConfigurationList;
-                       buildConfigurations = (
-                               156EB6070905594A00EEF749 /* Development */,
-                               156EB6080905594A00EEF749 /* Deployment */,
-                               156EB6090905594A00EEF749 /* Default */,
+                               156EB6030905594A00EEF749 /* Debug */,
+                               156EB6040905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB60A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "Kicker.bundle" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB60A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "Kicker.bundle" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB60B0905594A00EEF749 /* Development */,
-                               156EB60C0905594A00EEF749 /* Deployment */,
-                               156EB60D0905594A00EEF749 /* Default */,
+                               156EB60B0905594A00EEF749 /* Debug */,
+                               156EB60C0905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB60E0905594A00EEF749 /* Build configuration list for PBXNativeTarget "LinkConfiguration" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB60E0905594A00EEF749 /* Build configuration list for PBXNativeTarget "LinkConfiguration" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB60F0905594A00EEF749 /* Development */,
-                               156EB6100905594A00EEF749 /* Deployment */,
-                               156EB6110905594A00EEF749 /* Default */,
+                               156EB60F0905594A00EEF749 /* Debug */,
+                               156EB6100905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB6120905594A00EEF749 /* Build configuration list for PBXNativeTarget "LinkConfiguration.bundle" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB6120905594A00EEF749 /* Build configuration list for PBXNativeTarget "LinkConfiguration.bundle" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB6130905594A00EEF749 /* Development */,
-                               156EB6140905594A00EEF749 /* Deployment */,
-                               156EB6150905594A00EEF749 /* Default */,
+                               156EB6130905594A00EEF749 /* Debug */,
+                               156EB6140905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB6160905594A00EEF749 /* Build configuration list for PBXNativeTarget "PreferencesMonitor" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB6160905594A00EEF749 /* Build configuration list for PBXNativeTarget "PreferencesMonitor" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB6170905594A00EEF749 /* Development */,
-                               156EB6180905594A00EEF749 /* Deployment */,
-                               156EB6190905594A00EEF749 /* Default */,
+                               156EB6170905594A00EEF749 /* Debug */,
+                               156EB6180905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB61A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "PreferencesMonitor.bundle" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB61A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "PreferencesMonitor.bundle" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB61B0905594A00EEF749 /* Development */,
-                               156EB61C0905594A00EEF749 /* Deployment */,
-                               156EB61D0905594A00EEF749 /* Default */,
+                               156EB61B0905594A00EEF749 /* Debug */,
+                               156EB61C0905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB61E0905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_plugins" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB61E0905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_plugins" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB61F0905594A00EEF749 /* Development */,
-                               156EB6200905594A00EEF749 /* Deployment */,
-                               156EB6210905594A00EEF749 /* Default */,
+                               156EB61F0905594A00EEF749 /* Debug */,
+                               156EB6200905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB6220905594A00EEF749 /* Build configuration list for PBXNativeTarget "configd" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB6220905594A00EEF749 /* Build configuration list for PBXNativeTarget "configd" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB6230905594A00EEF749 /* Development */,
-                               156EB6240905594A00EEF749 /* Deployment */,
-                               156EB6250905594A00EEF749 /* Default */,
+                               156EB6230905594A00EEF749 /* Debug */,
+                               156EB6240905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB6260905594A00EEF749 /* Build configuration list for PBXNativeTarget "scselect" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB6260905594A00EEF749 /* Build configuration list for PBXNativeTarget "scselect" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB6270905594A00EEF749 /* Development */,
-                               156EB6280905594A00EEF749 /* Deployment */,
-                               156EB6290905594A00EEF749 /* Default */,
+                               156EB6270905594A00EEF749 /* Debug */,
+                               156EB6280905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB62A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "scutil" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB62A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "scutil" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB62B0905594A00EEF749 /* Development */,
-                               156EB62C0905594A00EEF749 /* Deployment */,
-                               156EB62D0905594A00EEF749 /* Default */,
+                               156EB62B0905594A00EEF749 /* Debug */,
+                               156EB62C0905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB62E0905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_executables" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB62E0905594A00EEF749 /* Build configuration list for PBXAggregateTarget "configd_executables" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB62F0905594A00EEF749 /* Development */,
-                               156EB6300905594A00EEF749 /* Deployment */,
-                               156EB6310905594A00EEF749 /* Default */,
+                               156EB62F0905594A00EEF749 /* Debug */,
+                               156EB6300905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                156EB6320905594A00EEF749 /* Build configuration list for PBXAggregateTarget "All" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                156EB6320905594A00EEF749 /* Build configuration list for PBXAggregateTarget "All" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB6330905594A00EEF749 /* Development */,
-                               156EB6340905594A00EEF749 /* Deployment */,
-                               156EB6350905594A00EEF749 /* Default */,
+                               156EB6330905594A00EEF749 /* Debug */,
+                               156EB6340905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                };
-               156EB63A0905594A00EEF749 /* Build configuration list for PBXNativeTarget "ATconfig" */ = {
+               156EB63E0905594A00EEF749 /* Build configuration list for PBXProject "configd" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB63B0905594A00EEF749 /* Development */,
-                               156EB63C0905594A00EEF749 /* Deployment */,
-                               156EB63D0905594A00EEF749 /* Default */,
+                               156EB63F0905594A00EEF749 /* Debug */,
+                               156EB6400905594A00EEF749 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                };
-               156EB63E0905594A00EEF749 /* Build configuration list for PBXProject "configd" */ = {
+               1572C5290CFB55B400E2776E /* Build configuration list for PBXNativeTarget "SystemConfiguration.framework-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1572C52A0CFB55B400E2776E /* Debug */,
+                               1572C52B0CFB55B400E2776E /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               157433E80D4A8122002ACA73 /* Build configuration list for PBXNativeTarget "scselect-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               157433E90D4A8122002ACA73 /* Debug */,
+                               157433EA0D4A8122002ACA73 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               157434160D4A8137002ACA73 /* Build configuration list for PBXNativeTarget "scutil-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               157434170D4A8137002ACA73 /* Debug */,
+                               157434180D4A8137002ACA73 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               157A84E40D56C63900B6F1A0 /* Build configuration list for PBXNativeTarget "DNSConfiguration-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               157A84E50D56C63900B6F1A0 /* Debug */,
+                               157A84E60D56C63900B6F1A0 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               157A84FE0D56C7E800B6F1A0 /* Build configuration list for PBXNativeTarget "IPMonitor-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               157A84FF0D56C7E800B6F1A0 /* Debug */,
+                               157A85000D56C7E800B6F1A0 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               157A85090D56C8AA00B6F1A0 /* Build configuration list for PBXNativeTarget "InterfaceNamer-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               157A850A0D56C8AA00B6F1A0 /* Debug */,
+                               157A850B0D56C8AA00B6F1A0 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               157A851F0D56C8E000B6F1A0 /* Build configuration list for PBXNativeTarget "KernelEventMonitor-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               157A85200D56C8E000B6F1A0 /* Debug */,
+                               157A85210D56C8E000B6F1A0 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               157A852A0D56C91100B6F1A0 /* Build configuration list for PBXNativeTarget "LinkConfiguration-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               157A852B0D56C91100B6F1A0 /* Debug */,
+                               157A852C0D56C91100B6F1A0 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               157A85350D56C94F00B6F1A0 /* Build configuration list for PBXNativeTarget "NetworkIdentification-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               157A85360D56C94F00B6F1A0 /* Debug */,
+                               157A85370D56C94F00B6F1A0 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               157A85400D56C96F00B6F1A0 /* Build configuration list for PBXNativeTarget "PreferencesMonitor-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               157A85410D56C96F00B6F1A0 /* Debug */,
+                               157A85420D56C96F00B6F1A0 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               158316D80CFB774B006F62B9 /* Build configuration list for PBXAggregateTarget "configd_base-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               158316D90CFB774B006F62B9 /* Debug */,
+                               158316DA0CFB774B006F62B9 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               158317000CFB7761006F62B9 /* Build configuration list for PBXAggregateTarget "configd_plugins-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               158317010CFB7761006F62B9 /* Debug */,
+                               158317020CFB7761006F62B9 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583170B0CFB7782006F62B9 /* Build configuration list for PBXAggregateTarget "configd_executables-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583170C0CFB7782006F62B9 /* Debug */,
+                               1583170D0CFB7782006F62B9 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583175D0CFB80A1006F62B9 /* Build configuration list for PBXNativeTarget "configd-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583175E0CFB80A1006F62B9 /* Debug */,
+                               1583175F0CFB80A1006F62B9 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               158317800CFB85C8006F62B9 /* Build configuration list for PBXNativeTarget "IPMonitor.bundle-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               158317810CFB85C8006F62B9 /* Debug */,
+                               158317820CFB85C8006F62B9 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               158317890CFB85DD006F62B9 /* Build configuration list for PBXNativeTarget "InterfaceNamer.bundle-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583178A0CFB85DD006F62B9 /* Debug */,
+                               1583178B0CFB85DD006F62B9 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               158317920CFB85F7006F62B9 /* Build configuration list for PBXNativeTarget "KernelEventMonitor.bundle-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               158317930CFB85F7006F62B9 /* Debug */,
+                               158317940CFB85F7006F62B9 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1583179A0CFB860C006F62B9 /* Build configuration list for PBXNativeTarget "LinkConfiguration.bundle-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1583179B0CFB860C006F62B9 /* Debug */,
+                               1583179C0CFB860C006F62B9 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               158317A20CFB8626006F62B9 /* Build configuration list for PBXNativeTarget "NetworkIdentification.bundle-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               158317A30CFB8626006F62B9 /* Debug */,
+                               158317A40CFB8626006F62B9 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               158317AA0CFB8639006F62B9 /* Build configuration list for PBXNativeTarget "PreferencesMonitor.bundle-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               158317AB0CFB8639006F62B9 /* Debug */,
+                               158317AC0CFB8639006F62B9 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               158337A60CFB6B9E0033AB93 /* Build configuration list for PBXNativeTarget "SCHelper-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               158337A70CFB6B9E0033AB93 /* Debug */,
+                               158337A80CFB6B9E0033AB93 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               15A5A2660D5B94190087BDA0 /* Build configuration list for PBXNativeTarget "SystemConfiguration.framework-EmbeddedSimulator" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               15A5A2670D5B94190087BDA0 /* Debug */,
+                               15A5A2680D5B94190087BDA0 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               15C64A270F684C6B00D78394 /* Build configuration list for PBXAggregateTarget "configd_libSystem" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               15C64A1F0F684C3300D78394 /* Debug */,
+                               15C64A200F684C3300D78394 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               15C64A2B0F684C6B00D78394 /* Build configuration list for PBXAggregateTarget "configd_libSystem-Embedded" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               15C64A2C0F684C6B00D78394 /* Debug */,
+                               15C64A2D0F684C6B00D78394 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               15FD13C60D59485000F9409C /* Build configuration list for PBXAggregateTarget "All-EmbeddedSimulator" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               156EB63F0905594A00EEF749 /* Development */,
-                               156EB6400905594A00EEF749 /* Deployment */,
-                               156EB6410905594A00EEF749 /* Default */,
+                               15FD13C70D59485000F9409C /* Debug */,
+                               15FD13C80D59485000F9409C /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                F95B8A610B03F83200993BA3 /* Build configuration list for PBXNativeTarget "NetworkIdentification" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                F95B8A610B03F83200993BA3 /* Build configuration list for PBXNativeTarget "NetworkIdentification" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               F95B8A620B03F83200993BA3 /* Development */,
-                               F95B8A630B03F83200993BA3 /* Deployment */,
-                               F95B8A640B03F83200993BA3 /* Default */,
+                               F95B8A620B03F83200993BA3 /* Debug */,
+                               F95B8A630B03F83200993BA3 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
                F95B8A6C0B03F9D100993BA3 /* Build configuration list for PBXNativeTarget "NetworkIdentification.bundle" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                };
                F95B8A6C0B03F9D100993BA3 /* Build configuration list for PBXNativeTarget "NetworkIdentification.bundle" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
-                               F95B8A6D0B03F9D100993BA3 /* Development */,
-                               F95B8A6E0B03F9D100993BA3 /* Deployment */,
-                               F95B8A6F0B03F9D100993BA3 /* Default */,
+                               F95B8A6D0B03F9D100993BA3 /* Debug */,
+                               F95B8A6E0B03F9D100993BA3 /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Default;
+                       defaultConfigurationName = Release;
                };
 /* End XCConfigurationList section */
        };
                };
 /* End XCConfigurationList section */
        };
index 82e0c30286ad5093aaf2d651d655d3308b0cae89..792591edb414a9b8a4c0971f96eaa5ab87f2ed12 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2006, 2008, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  * These routines provide access to the systems DNS configuration
  */
 
  * These routines provide access to the systems DNS configuration
  */
 
-#include <AvailabilityMacros.h>
+#include <Availability.h>
 #include <sys/cdefs.h>
 #include <stdint.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 
 #include <sys/cdefs.h>
 #include <stdint.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-
 #define DEFAULT_SEARCH_ORDER    200000   /* search order for the "default" resolver domain name */
 
 #define        DNS_PTR(type, name)                             \
 #define DEFAULT_SEARCH_ORDER    200000   /* search order for the "default" resolver domain name */
 
 #define        DNS_PTR(type, name)                             \
@@ -89,12 +87,15 @@ __BEGIN_DECLS
 /*
  * DNS configuration access APIs
  */
 /*
  * DNS configuration access APIs
  */
-const char *   dns_configuration_notify_key    (void)                  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
-dns_config_t * dns_configuration_copy          (void)                  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
-void           dns_configuration_free          (dns_config_t *config)  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+const char *
+dns_configuration_notify_key    ()                             __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
 
 
-__END_DECLS
+dns_config_t *
+dns_configuration_copy         ()                              __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
 
 
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */
+void
+dns_configuration_free         (dns_config_t   *config)        __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
+
+__END_DECLS
 
 #endif /* __DNSINFO_H__ */
 
 #endif /* __DNSINFO_H__ */
index b5ed70d3242c5fb4af556c0e75222c3e694cc1c0..ab536e786f38783177282e1148a9c54d4e20161c 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -28,7 +28,9 @@
  * - initial revision
  */
 
  * - initial revision
  */
 
+#include <stdio.h>
 #include <stdlib.h>
 #include <stdlib.h>
+#include <pthread.h>
 #include <mach/mach.h>
 #include <mach/mach_error.h>
 
 #include <mach/mach.h>
 #include <mach/mach_error.h>
 
 #include "shared_dns_info.h"
 
 
 #include "shared_dns_info.h"
 
 
+static pthread_once_t  _dns_initialized        = PTHREAD_ONCE_INIT;
+static pthread_mutex_t _dns_lock               = PTHREAD_MUTEX_INITIALIZER;
+static mach_port_t     _dns_server             = MACH_PORT_NULL;
+
+
+static void
+__dns_fork_handler()
+{
+       // the process has forked (and we are the child process)
+       _dns_server = MACH_PORT_NULL;
+       return;
+}
+
+
+static void
+__dns_initialize(void)
+{
+       // add handler to cleanup after fork()
+       (void) pthread_atfork(NULL, NULL, __dns_fork_handler);
+
+       return;
+}
+
+
 static boolean_t
 add_list(void **padding, uint32_t *n_padding, int32_t count, int32_t size, void **list)
 {
 static boolean_t
 add_list(void **padding, uint32_t *n_padding, int32_t count, int32_t size, void **list)
 {
@@ -63,16 +89,47 @@ copy_dns_info()
        mach_port_t             server;
        kern_return_t           status;
 
        mach_port_t             server;
        kern_return_t           status;
 
-       server = _dns_configuration_server_port();
-       if (server == MACH_PORT_NULL) {
-               return NULL;
-       }
+       // initialize runtime
+       pthread_once(&_dns_initialized, __dns_initialize);
 
 
-       status = shared_dns_infoGet(server, &dataRef, &dataLen);
-       (void)mach_port_deallocate(mach_task_self(), server);
-       if (status != KERN_SUCCESS) {
-               mach_error("shared_dns_infoGet():", status);
-               return NULL;
+       // open a new session with the DNS configuration server
+       server = _dns_server;
+       while (TRUE) {
+               if (server != MACH_PORT_NULL) {
+                       status = shared_dns_infoGet(server, &dataRef, &dataLen);
+                       if (status == KERN_SUCCESS) {
+                               break;
+                       }
+
+                       // our [cached] server port is not valid
+                       if (status != MACH_SEND_INVALID_DEST) {
+                               // if we got an unexpected error, don't retry
+                               fprintf(stderr,
+                                       "dns_configuration_copy shared_dns_infoGet(): %s\n",
+                                       mach_error_string(status));
+                               break;
+                       }
+               }
+
+               pthread_mutex_lock(&_dns_lock);
+               if (_dns_server != MACH_PORT_NULL) {
+                       if (server == _dns_server) {
+                               // if the server we tried returned the error
+                               (void)mach_port_deallocate(mach_task_self(), server);
+                               _dns_server = _dns_configuration_server_port();
+                       } else {
+                               // another thread has refreshed the DNS server port
+                       }
+               } else {
+                       _dns_server = _dns_configuration_server_port();
+               }
+               server = _dns_server;
+               pthread_mutex_unlock(&_dns_lock);
+
+               if (server == MACH_PORT_NULL) {
+                       // if server not available
+                       break;
+               }
        }
 
        if (dataRef != NULL) {
        }
 
        if (dataRef != NULL) {
@@ -295,7 +352,6 @@ expand_config(_dns_config_buf_t *buf)
 }
 
 
 }
 
 
-__private_extern__
 const char *
 dns_configuration_notify_key()
 {
 const char *
 dns_configuration_notify_key()
 {
@@ -303,7 +359,6 @@ dns_configuration_notify_key()
 }
 
 
 }
 
 
-__private_extern__
 dns_config_t *
 dns_configuration_copy()
 {
 dns_config_t *
 dns_configuration_copy()
 {
@@ -325,7 +380,6 @@ dns_configuration_copy()
 }
 
 
 }
 
 
-__private_extern__
 void
 dns_configuration_free(dns_config_t *config)
 {
 void
 dns_configuration_free(dns_config_t *config)
 {
index f26efafd7acb002dd9f33aaf82c5dc4cb5850c2d..6cd07e064b182bb7d3d06c4398e145178a9feba6 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004, 2006, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -49,7 +49,6 @@
  */
 
 
  */
 
 
-__private_extern__
 dns_create_config_t
 _dns_configuration_create()
 {
 dns_create_config_t
 _dns_configuration_create()
 {
@@ -109,7 +108,6 @@ config_add_attribute(dns_create_config_t    *_config,
 }
 
 
 }
 
 
-__private_extern__
 void
 _dns_configuration_add_resolver(dns_create_config_t     *_config,
                                dns_create_resolver_t   _resolver)
 void
 _dns_configuration_add_resolver(dns_create_config_t     *_config,
                                dns_create_resolver_t   _resolver)
@@ -146,7 +144,6 @@ _dns_configuration_add_resolver(dns_create_config_t     *_config,
 }
 
 
 }
 
 
-__private_extern__
 _Bool
 _dns_configuration_store(dns_create_config_t *_config)
 {
 _Bool
 _dns_configuration_store(dns_create_config_t *_config)
 {
@@ -180,7 +177,6 @@ _dns_configuration_store(dns_create_config_t *_config)
 }
 
 
 }
 
 
-__private_extern__
 void
 _dns_configuration_free(dns_create_config_t *_config)
 {
 void
 _dns_configuration_free(dns_create_config_t *_config)
 {
@@ -196,7 +192,6 @@ _dns_configuration_free(dns_create_config_t *_config)
  * DNS resolver configuration functions
  */
 
  * DNS resolver configuration functions
  */
 
-__private_extern__
 dns_create_resolver_t
 _dns_resolver_create()
 {
 dns_create_resolver_t
 _dns_resolver_create()
 {
@@ -251,7 +246,6 @@ _dns_resolver_add_attribute(dns_create_resolver_t   *_resolver,
 }
 
 
 }
 
 
-__private_extern__
 void
 _dns_resolver_set_domain(dns_create_resolver_t *_resolver, const char *domain)
 {
 void
 _dns_resolver_set_domain(dns_create_resolver_t *_resolver, const char *domain)
 {
@@ -260,7 +254,6 @@ _dns_resolver_set_domain(dns_create_resolver_t *_resolver, const char *domain)
 }
 
 
 }
 
 
-__private_extern__
 void
 _dns_resolver_add_nameserver(dns_create_resolver_t *_resolver, struct sockaddr *nameserver)
 {
 void
 _dns_resolver_add_nameserver(dns_create_resolver_t *_resolver, struct sockaddr *nameserver)
 {
@@ -272,7 +265,6 @@ _dns_resolver_add_nameserver(dns_create_resolver_t *_resolver, struct sockaddr *
 }
 
 
 }
 
 
-__private_extern__
 void
 _dns_resolver_set_port(dns_create_resolver_t *_resolver, uint16_t port)
 {
 void
 _dns_resolver_set_port(dns_create_resolver_t *_resolver, uint16_t port)
 {
@@ -283,7 +275,6 @@ _dns_resolver_set_port(dns_create_resolver_t *_resolver, uint16_t port)
 }
 
 
 }
 
 
-__private_extern__
 void
 _dns_resolver_add_search(dns_create_resolver_t *_resolver, const char *search)
 {
 void
 _dns_resolver_add_search(dns_create_resolver_t *_resolver, const char *search)
 {
@@ -295,7 +286,6 @@ _dns_resolver_add_search(dns_create_resolver_t *_resolver, const char *search)
 }
 
 
 }
 
 
-__private_extern__
 void
 _dns_resolver_add_sortaddr(dns_create_resolver_t *_resolver, dns_sortaddr_t *sortaddr)
 {
 void
 _dns_resolver_add_sortaddr(dns_create_resolver_t *_resolver, dns_sortaddr_t *sortaddr)
 {
@@ -307,7 +297,6 @@ _dns_resolver_add_sortaddr(dns_create_resolver_t *_resolver, dns_sortaddr_t *sor
 }
 
 
 }
 
 
-__private_extern__
 void
 _dns_resolver_set_options(dns_create_resolver_t *_resolver, const char *options)
 {
 void
 _dns_resolver_set_options(dns_create_resolver_t *_resolver, const char *options)
 {
@@ -316,7 +305,6 @@ _dns_resolver_set_options(dns_create_resolver_t *_resolver, const char *options)
 }
 
 
 }
 
 
-__private_extern__
 void
 _dns_resolver_set_timeout(dns_create_resolver_t *_resolver, uint32_t timeout)
 {
 void
 _dns_resolver_set_timeout(dns_create_resolver_t *_resolver, uint32_t timeout)
 {
@@ -327,7 +315,6 @@ _dns_resolver_set_timeout(dns_create_resolver_t *_resolver, uint32_t timeout)
 }
 
 
 }
 
 
-__private_extern__
 void
 _dns_resolver_set_order(dns_create_resolver_t *_resolver, uint32_t order)
 {
 void
 _dns_resolver_set_order(dns_create_resolver_t *_resolver, uint32_t order)
 {
@@ -338,7 +325,6 @@ _dns_resolver_set_order(dns_create_resolver_t *_resolver, uint32_t order)
 }
 
 
 }
 
 
-__private_extern__
 void
 _dns_resolver_free(dns_create_resolver_t *_resolver)
 {
 void
 _dns_resolver_free(dns_create_resolver_t *_resolver)
 {
index 77840dbc7bb22c56df4d926ea6dd9830581dbc35..2e01860d1cae9fe88e3dba1f8781010f7bca3cb3 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2006, 2008, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -28,7 +28,8 @@
  * These routines provide access to the systems DNS configuration
  */
 
  * These routines provide access to the systems DNS configuration
  */
 
-#include <AvailabilityMacros.h>
+#include <TargetConditionals.h>
+#include <Availability.h>
 #include <sys/cdefs.h>
 #include <stdint.h>
 #include <sys/types.h>
 #include <sys/cdefs.h>
 #include <stdint.h>
 #include <sys/types.h>
 
 #include <dnsinfo.h>
 
 
 #include <dnsinfo.h>
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-
 typedef const struct __dns_create_config *      dns_create_config_t;
 typedef const struct __dns_create_resolver *    dns_create_resolver_t;
 
 typedef const struct __dns_create_config *      dns_create_config_t;
 typedef const struct __dns_create_resolver *    dns_create_resolver_t;
 
+#if    !TARGET_OS_IPHONE
+#ifndef _PATH_RESOLVER_DIR
+#define _PATH_RESOLVER_DIR "/etc/resolver"
+#endif
+#endif /* !TARGET_OS_IPHONE */
+
 __BEGIN_DECLS
 
 __BEGIN_DECLS
 
+/*
+ * NOTE: __private_extern__ and __OSX_AVAILABLE_STARTING() cannot be mixed
+ *       due to a "visibility" conflict
+ */
+
 /*
  * DNS configuration creation APIs
  */
 /*
  * DNS configuration creation APIs
  */
-dns_create_config_t     _dns_configuration_create       (void);
-void                   _dns_configuration_add_resolver (dns_create_config_t *_config, dns_create_resolver_t _resolver);
-_Bool                  _dns_configuration_store        (dns_create_config_t *_config);
-void                   _dns_configuration_free         (dns_create_config_t *_config);
+__private_extern__
+dns_create_config_t
+_dns_configuration_create       (void)                                         /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
+
+__private_extern__
+void
+_dns_configuration_add_resolver (dns_create_config_t   *_config,
+                                dns_create_resolver_t  _resolver)              /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
+
+__private_extern__
+_Bool
+_dns_configuration_store       (dns_create_config_t    *_config)               /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
+
+__private_extern__
+void
+_dns_configuration_free                (dns_create_config_t    *_config)               /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
 
 /*
  * DNS [resolver] configuration creation APIs
  */
 
 /*
  * DNS [resolver] configuration creation APIs
  */
-dns_create_resolver_t   _dns_resolver_create           (void);
-void                   _dns_resolver_set_domain        (dns_create_resolver_t *_resolver, const char *domain);
-void                   _dns_resolver_add_nameserver    (dns_create_resolver_t *_resolver, struct sockaddr *nameserver);
-void                   _dns_resolver_set_port          (dns_create_resolver_t *_resolver, uint16_t port);      // host byte order
-void                   _dns_resolver_add_search        (dns_create_resolver_t *_resolver, const char *search);
-void                   _dns_resolver_add_sortaddr      (dns_create_resolver_t *_resolver, dns_sortaddr_t *sortaddr);
-void                   _dns_resolver_set_options       (dns_create_resolver_t *_resolver, const char *options);
-void                   _dns_resolver_set_timeout       (dns_create_resolver_t *_resolver, uint32_t timeout);
-void                   _dns_resolver_set_order         (dns_create_resolver_t *_resolver, uint32_t order);
-void                   _dns_resolver_free              (dns_create_resolver_t *_resolver);
+__private_extern__
+dns_create_resolver_t
+_dns_resolver_create           (void)                                          /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
 
 
-__END_DECLS
+__private_extern__
+void
+_dns_resolver_set_domain       (dns_create_resolver_t  *_resolver,
+                                const char             *domain)                /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
+
+__private_extern__
+void
+_dns_resolver_add_nameserver   (dns_create_resolver_t  *_resolver,
+                                struct sockaddr        *nameserver)            /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
+
+__private_extern__
+void
+_dns_resolver_set_port         (dns_create_resolver_t  *_resolver,
+                                uint16_t               port)                   /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;  // host byte order
 
 
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */
+__private_extern__
+void
+_dns_resolver_add_search       (dns_create_resolver_t  *_resolver,
+                                const char             *search)                /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
+
+__private_extern__
+void
+_dns_resolver_add_sortaddr     (dns_create_resolver_t  *_resolver,
+                                dns_sortaddr_t         *sortaddr)              /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
+
+__private_extern__
+void
+_dns_resolver_set_options      (dns_create_resolver_t  *_resolver,
+                                const char             *options)               /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
+
+__private_extern__
+void
+_dns_resolver_set_timeout      (dns_create_resolver_t  *_resolver,
+                                uint32_t               timeout)                /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
+
+__private_extern__
+void
+_dns_resolver_set_order                (dns_create_resolver_t  *_resolver,
+                                uint32_t               order)                  /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
+
+__private_extern__
+void
+_dns_resolver_free             (dns_create_resolver_t  *_resolver)             /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
+
+#if    !TARGET_OS_IPHONE
+/*
+ * DNS [resolver] flat-file configuration creation APIs
+ */
+__private_extern__
+void
+_dnsinfo_flatfile_add_resolvers        (dns_create_config_t    *config)                /*__OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)*/;
+#endif // !TARGET_OS_IPHONE
+
+__END_DECLS
 
 #endif /* __DNSINFO_CREATE_H__ */
 
 #endif /* __DNSINFO_CREATE_H__ */
diff --git a/dnsinfo/dnsinfo_flatfile.c b/dnsinfo/dnsinfo_flatfile.c
new file mode 100644 (file)
index 0000000..378be84
--- /dev/null
@@ -0,0 +1,475 @@
+/*
+ * Copyright (c) 2009 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include <dirent.h>
+#include <fcntl.h>
+#include <libgen.h>
+#include <netdb.h>
+#include <resolv.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/dir.h>
+#include <unistd.h>
+
+#include "dnsinfo.h"
+#include "dnsinfo_private.h"
+#include "dnsinfo_create.h"
+
+enum {
+       TOKEN_NAMESERVER,
+       TOKEN_PORT,
+       TOKEN_DOMAIN,
+       TOKEN_SEARCH,
+       TOKEN_SEARCH_ORDER,
+       TOKEN_SORTLIST,
+       TOKEN_TIMEOUT,
+       TOKEN_OPTIONS,
+       TOKEN_MAX
+};
+
+/*
+ * tokens
+ * The supported configuration token strings and enumerated values.
+ */
+static const struct {
+       const char      *name;
+       int             token;
+       int             max_count;
+} tokens [] = {
+       { "nameserver",         TOKEN_NAMESERVER,       MAXNS   },
+       { "port",               TOKEN_PORT,             1       },
+       { "domain",             TOKEN_DOMAIN,           1       },
+       { "search",             TOKEN_SEARCH,           1       },
+       { "search_order",       TOKEN_SEARCH_ORDER,     1       },
+       { "sortlist",           TOKEN_SORTLIST,         1       },
+       { "timeout",            TOKEN_TIMEOUT,          1       },
+       { "options",            TOKEN_OPTIONS,          1       },
+};
+
+
+/*
+ * _dnsinfo_parse_address
+ *
+ * Parse IP address
+ */
+static struct sockaddr *
+_dnsinfo_parse_address(char *nameserver)
+{
+       struct addrinfo *ai;
+       struct addrinfo hints;
+       int             res;
+       struct sockaddr *sa     = NULL;
+
+       memset(&hints, 0, sizeof(hints));
+       hints.ai_flags = AI_NUMERICHOST;
+
+       res = getaddrinfo(nameserver, NULL, &hints, &ai);
+       if (res == 0) {
+               if ((ai->ai_family == AF_INET) || (ai->ai_family == AF_INET6)) {
+                       sa = malloc(ai->ai_addrlen);
+                       memcpy(sa, ai->ai_addr, ai->ai_addrlen);
+               }
+               freeaddrinfo(ai);
+       }
+
+       return sa;
+}
+
+
+/*
+ * _dnsinfo_parse_nameserver
+ *
+ * Parse arguments to the nameserver token. This is essentially a getaddrinfo(3)
+ * with AI_NUMERICHOST. However, if the conversion fails, check if the address
+ * contains an optional trailing '.' followed by a numeric port number.  If found,
+ * remove the port number and retry the conversion (e.g. 127.0.0.1.55 or ::1.55).
+ */
+static struct sockaddr *
+_dnsinfo_parse_nameserver(char *token)
+{
+       char            *dot;
+       long            number;
+       struct sockaddr *sa;
+
+       sa = _dnsinfo_parse_address(token);
+       if (sa != NULL) {
+               return sa;
+       }
+
+       // if we could not parse address, attempt to remove
+       // an optional trailing port number
+       dot = strrchr(token, '.');
+       if (dot == NULL) {
+               return NULL;
+       }
+
+       number = strtol(dot + 1, NULL, 10);
+       if ((number < 0) || (number > UINT16_MAX)) {
+               return NULL;
+       }
+
+       *dot = '\0';
+       sa = _dnsinfo_parse_address(token);
+       if (sa != NULL) {
+               in_port_t       port    = htons(number);
+
+               switch (sa->sa_family) {
+                       case AF_INET :
+                               ((struct sockaddr_in *)sa)->sin_port = port;
+                               break;
+                       case AF_INET6 :
+                               ((struct sockaddr_in6 *)sa)->sin6_port = port;
+                               break;
+               }
+       }
+
+       return sa;
+}
+
+
+/*
+ * _dnsinfo_parse_sortaddr
+ *
+ * Parse arguments to the sortlist token.
+ */
+static dns_sortaddr_t *
+_dnsinfo_parse_sortaddr(char *token)
+{
+       struct in_addr          addr;
+       struct in_addr          mask;
+       struct sockaddr         *sa;
+       char                    *slash;
+       dns_sortaddr_t          *sortaddr       = NULL;
+
+       slash = strchr(token, '/');
+       if (slash != NULL) {
+               *slash = '\0';
+       }
+
+       sa = _dnsinfo_parse_address(token);
+       if (sa == NULL) {
+               // if we could not parse the address
+               goto done;
+       } else if (sa->sa_family != AF_INET) {
+               // if not AF_INET
+               goto done;
+       } else {
+               addr = ((struct sockaddr_in *)sa)->sin_addr;
+               free(sa);
+               sa = NULL;
+       }
+
+       if (slash != NULL) {
+               sa = _dnsinfo_parse_address(slash + 1);
+               if (sa == NULL) {
+                       // if we could not parse the provided mask
+                       goto done;
+               } else if (sa->sa_family != AF_INET) {
+                       // if mask not AF_INET
+                       goto done;
+               } else {
+                       mask = ((struct sockaddr_in *)sa)->sin_addr;
+                       free(sa);
+                       sa = NULL;
+               }
+       } else {
+               in_addr_t       a;
+               in_addr_t       m;
+
+               a = ntohl(addr.s_addr);
+               if (IN_CLASSA(a)) {
+                       m = IN_CLASSA_NET;
+               } else if (IN_CLASSB(a)) {
+                       m = IN_CLASSB_NET;
+               } else if (IN_CLASSC(a)) {
+                       m = IN_CLASSC_NET;
+               } else {
+                       goto done;
+               }
+
+               mask.s_addr = htonl(m);
+       }
+
+       sortaddr = malloc(sizeof(*sortaddr));
+       sortaddr->address = addr;
+       sortaddr->mask    = mask;
+
+    done :
+
+       if (sa != NULL) free(sa);
+       return sortaddr;
+}
+
+
+/*
+ * _dnsinfo_flatfile_create_resolver
+ *
+ * Create a new dns resolver configuration from the configuration file at the
+ * specified path. (e.g. /etc/resolv.conf or /etc/resolver/apple.com)
+ */
+static dns_create_resolver_t
+_dnsinfo_flatfile_create_resolver(const char *dir, const char *path)
+{
+       char                    *buf;
+       FILE                    *f;
+       char                    filename[FILENAME_MAX];
+       size_t                  len                     = 0;
+       char                    *line                   = NULL;
+       dns_create_resolver_t   res                     = NULL;
+       const char              *sep                    = " \t";
+       int                     token_count[TOKEN_MAX]  = { 0 };
+
+       filename[0] = 0;
+       if (dir != NULL) {
+               strlcpy(filename, dir, sizeof(filename));
+               strlcat(filename, "/", sizeof(filename));
+       }
+       strlcat(filename, path, sizeof(filename));
+
+       f = fopen(filename, "r");
+       if (f == NULL) return NULL;
+
+       while ((buf = fgetln(f, &len)) != NULL) {
+               int     i;
+               char    *lineptr;
+               int     max_count;
+               int     token;
+               char    *word;
+
+               if (len == 0) continue;
+               if (buf[len-1] == '\n') buf[len-1] = '\0';
+
+               line = reallocf(line, len+1);
+               if (line == NULL) continue;
+
+               strncpy(line, buf, len);
+               line[len] = '\0';
+
+               // parse the first word of the line (the config token)
+               lineptr = line;
+               word = strsep(&lineptr, sep);
+               if (word == NULL) {
+                       // if empty line
+                       continue;
+               }
+               if (word[0] == ';' || word[0] == '#') {
+                       // if comment
+                       continue;
+               }
+
+               // translate config token to enumerated value
+               token = -1;
+               for (i = 0; i < sizeof(tokens) / sizeof(tokens[0]); i++) {
+                       if (strcasecmp(word, tokens[i].name) == 0) {
+                               token     = tokens[i].token;
+                               max_count = tokens[i].max_count;
+                               break;
+                       }
+               }
+               if (token == -1) {
+                       // if not a recognized token
+                       continue;
+               }
+
+               // parse the next word of the line (the config option)
+               word = strsep(&lineptr, sep);
+               if (word == NULL) {
+                       // if no option
+                       continue;
+               }
+               if (++token_count[token] > max_count) {
+                       // if too many options
+                       continue;
+               }
+
+               // create resolver
+               if (res == NULL) {
+                       res = _dns_resolver_create();
+                       if (res == NULL) {
+                               // if we could not create a resolver
+                               goto done;
+                       }
+               }
+
+               switch (token) {
+                       case TOKEN_DOMAIN:
+                               _dns_resolver_set_domain(&res, word);
+                               break;
+
+                       case TOKEN_NAMESERVER: {
+                               struct sockaddr *sa;
+
+                               sa = _dnsinfo_parse_nameserver(word);
+                               if (sa != NULL) {
+                                       _dns_resolver_add_nameserver(&res, sa);
+                                       free(sa);
+                               }
+                               break;
+                       }
+
+                       case TOKEN_PORT: {
+                               long    number  = -1;
+
+                               number = strtol(word, NULL, 0);
+                               if (number < 0 || number > UINT16_MAX) break;
+                               _dns_resolver_set_port(&res, number);
+                               break;
+                       }
+
+                       case TOKEN_SEARCH: {
+                               int     n       = 0;
+
+                               // multiple search domains are supported
+                               while ((word != NULL) && (n++ < MAXDNSRCH)) {
+                                       _dns_resolver_add_search(&res, word);
+                                       word = strsep(&lineptr, sep);
+                               }
+                               break;
+                       }
+
+                       case TOKEN_SORTLIST: {
+                               int     n       = 0;
+
+                               while ((word != NULL) && (n++ < MAXRESOLVSORT)) {
+                                       dns_sortaddr_t  *sortaddr;
+
+                                       sortaddr = _dnsinfo_parse_sortaddr(word);
+                                       if (sortaddr == NULL) break;
+                                       _dns_resolver_add_sortaddr(&res, sortaddr);
+                                       free(sortaddr);
+                                       word = strsep(&lineptr, sep);
+                               }
+                               break;
+                       }
+
+                       case TOKEN_OPTIONS:
+                               _dns_resolver_set_options(&res, lineptr);
+                               break;
+
+                       case TOKEN_TIMEOUT: {
+                               long    number  = -1;
+
+                               number = strtol(word, NULL, 0);
+                               if (number < 0 || number > UINT32_MAX) break;
+                               _dns_resolver_set_timeout(&res, number);
+                               break;
+                       }
+
+                       case TOKEN_SEARCH_ORDER: {
+                               long    number  = -1;
+
+                               number = strtol(word, NULL, 0);
+                               if (number < 0 || number > UINT32_MAX) break;
+                               _dns_resolver_set_order(&res, number);
+                               break;
+                       }
+               }
+       }
+       if (line != NULL) free(line);
+
+       // set the domain to the basename of the path if not specified
+       if ((res != NULL) && (token_count[TOKEN_DOMAIN] == 0)) {
+               const char      *domain;
+
+               domain = strrchr(path, '/');
+               if (domain == NULL) {
+                       domain = path;
+               } else {
+                       domain = domain + 1;
+               }
+               _dns_resolver_set_domain(&res, domain);
+       }
+
+    done :
+
+       fclose(f);
+       return res;
+}
+
+
+/*
+ * _dnsinfo_flatfile_add_resolvers
+ *
+ * Parse the files in the resolver config directory (/etc/resolver) and add each
+ * resolver to the dns config.
+ */
+void
+_dnsinfo_flatfile_add_resolvers(dns_create_config_t *config)
+{
+       struct dirent           *de;
+       DIR                     *dp;
+       dns_create_resolver_t   res;
+
+       dp = opendir(_PATH_RESOLVER_DIR);
+       if (dp == NULL) {
+               return;
+       }
+
+       while ((de = readdir(dp)) != NULL) {
+               if (strcmp(de->d_name, ".") == 0 ||
+                   strcmp(de->d_name, "..") == 0) continue;
+
+               res = _dnsinfo_flatfile_create_resolver(_PATH_RESOLVER_DIR, de->d_name);
+               if (res != NULL) {
+                       _dns_configuration_add_resolver(config, res);
+                       _dns_resolver_free(&res);
+               }
+       }
+
+       closedir(dp);
+       return;
+}
+
+
+#ifdef MAIN
+
+#include "dnsinfo_copy.c"
+
+int
+main(int argc, char **argv)
+{
+       uint8_t                 *buf;
+       dns_config_t            *config;
+       dns_create_config_t     create_config;
+       _dns_config_buf_t       *config_buf;
+       uint32_t                n_config;
+       uint32_t                n_padding;
+       dns_create_resolver_t   resolver;
+
+       resolver = _dnsinfo_flatfile_create_resolver(NULL, _PATH_RESCONF);
+
+       create_config = _dns_configuration_create();
+       _dnsinfo_flatfile_add_resolvers(&create_config);
+
+       config_buf = (_dns_config_buf_t *)create_config;
+       n_config  = sizeof(_dns_config_buf_t) + ntohl(config_buf->n_attribute);
+       n_padding = ntohl(config_buf->n_padding);
+       buf = malloc(n_config + n_padding);
+       bcopy((void *)config_buf, buf, n_config);
+       bzero(&buf[n_config], n_padding);
+       config = expand_config((_dns_config_buf_t *)buf);
+
+       return 0;
+}
+#endif
index d2156520d78348c3443685ff2db980c3f552ba38..4d7c2dd93a3a7087be8c81697f2c0f124396ac77 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004, 2005, 2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2004, 2005, 2007, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 03d50f3cc57bb560923deb49b3648c2c75d500b8..52b885e302e22e1a2971ca341776386496474073 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2006, 2008, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -25,7 +25,7 @@
 #define __DNSINFO_PRIVATE_H__
 
 
 #define __DNSINFO_PRIVATE_H__
 
 
-#include <AvailabilityMacros.h>
+#include <Availability.h>
 #include <sys/cdefs.h>
 #include <stdint.h>
 #include <sys/types.h>
 #include <sys/cdefs.h>
 #include <stdint.h>
 #include <sys/types.h>
@@ -35,8 +35,6 @@
 
 #include "dnsinfo.h"
 
 
 #include "dnsinfo.h"
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
-
 /*
  * What's all of this stuff about???
  *
 /*
  * What's all of this stuff about???
  *
@@ -189,11 +187,19 @@ typedef struct {
 
 __BEGIN_DECLS
 
 
 __BEGIN_DECLS
 
-const char *    _dns_configuration_notify_key  (void)  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
-mach_port_t    _dns_configuration_server_port  (void)  AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+/*
+ * NOTE: __private_extern__ and __OSX_AVAILABLE_STARTING() cannot be mixed
+ *       due to a "visibility" conflict
+ */
+
+__private_extern__
+const char *
+_dns_configuration_notify_key  ()      /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
 
 
-__END_DECLS
+__private_extern__
+mach_port_t
+_dns_configuration_server_port ()      /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
 
 
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */
+__END_DECLS
 
 #endif /* __DNSINFO_PRIVATE_H__ */
 
 #endif /* __DNSINFO_PRIVATE_H__ */
index 17c5560cc3f95b870177a8f7f234d0ee418a3f21..9613311029c85d55db705b49d23c4c460cd43c46 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -70,9 +70,9 @@ _shared_dns_infoSet(mach_port_t                       server,
                    mach_msg_type_number_t      dataLen,
                    audit_token_t               audit_token)
 {
                    mach_msg_type_number_t      dataLen,
                    audit_token_t               audit_token)
 {
-       uid_t                   euid            = 0;
-       CFDataRef               new_dns_info    = NULL;
-       const char              *notify_key;
+       uid_t           euid            = 0;
+       CFDataRef       new_dns_info    = NULL;
+       const char      *notify_key;
 
        if ((dataRef != NULL) && (dataLen > 0)) {
                if (!_SCUnserializeData(&new_dns_info, (void *)dataRef, dataLen)) {
 
        if ((dataRef != NULL) && (dataLen > 0)) {
                if (!_SCUnserializeData(&new_dns_info, (void *)dataRef, dataLen)) {
index d3f12836a1bcabce24cb4727c38838235faaf2be..44350a8bccb8924e45396a157b94118554a0f836 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004, 2005, 2009 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 
 __BEGIN_DECLS
 
 
 __BEGIN_DECLS
 
+__private_extern__
 kern_return_t  _shared_dns_infoGet     (mach_port_t            server,
                                         dnsDataOut_t           *dataRef,
                                         mach_msg_type_number_t *dataLen);
 
 kern_return_t  _shared_dns_infoGet     (mach_port_t            server,
                                         dnsDataOut_t           *dataRef,
                                         mach_msg_type_number_t *dataLen);
 
+__private_extern__
 kern_return_t  _shared_dns_infoSet     (mach_port_t            server,
                                         dnsData_t              dataRef,
                                         mach_msg_type_number_t dataLen,
 kern_return_t  _shared_dns_infoSet     (mach_port_t            server,
                                         dnsData_t              dataRef,
                                         mach_msg_type_number_t dataLen,
index fa22f5d813cc2127fb5122b0e027b3b0c520952b..bbb1e84d906bc85c165696659893982e3a87183c 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004, 2005, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -55,6 +55,10 @@ type dnsDataOut = ^ array [] of MACH_MSG_TYPE_BYTE
 routine shared_dns_infoGet     (       server          : mach_port_t;
                                 out    data            : dnsDataOut, dealloc);
 
 routine shared_dns_infoGet     (       server          : mach_port_t;
                                 out    data            : dnsDataOut, dealloc);
 
+#ifndef        LIBDNSINFO_A
 routine shared_dns_infoSet     (       server          : mach_port_t;
                                        data            : dnsData;
                    ServerAuditToken    audit_token     : audit_token_t);
 routine shared_dns_infoSet     (       server          : mach_port_t;
                                        data            : dnsData;
                    ServerAuditToken    audit_token     : audit_token_t);
+#else  // LIBDNSINFO_A
+       skip;           /* shared_dns_infoSet */
+#endif LIBDNSINFO_A
index f28f2c3375c4529fead08680a4be51d3195a4ae1..780cf7789ee24f53efee86a14513ee75d99a060d 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004, 2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -33,6 +33,9 @@
 #define mig_external __private_extern__
 
 /* Turn MIG type checking on by default */
 #define mig_external __private_extern__
 
 /* Turn MIG type checking on by default */
+#ifdef __MigTypeCheck
+#undef __MigTypeCheck
+#endif
 #define __MigTypeCheck 1
 
 /*
 #define __MigTypeCheck 1
 
 /*
index c7e15964a1479f6d26b277a8d91b633aefa1af78..d0fcbffd1ce45db35c40cb5d7d457a605f0d5861 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
 #!/bin/sh
-# Copyright (c) 2004-2007 Apple Inc.
+# Copyright (c) 2004-2009 Apple Inc.
 #
 # get-mobility-info
 #
 #
 # get-mobility-info
 #
@@ -17,6 +17,9 @@ OUT="mobility-info-`date +'%m.%d.%Y.%H%M%S'`"
 OUTDIR="/var/tmp"
 if [ -d ~/Desktop ]; then
        OUTDIR=~/Desktop
 OUTDIR="/var/tmp"
 if [ -d ~/Desktop ]; then
        OUTDIR=~/Desktop
+elif [ "`readlink /tmp`" = "private/var/tmp" ]; then
+       OUTDIR=/Library/Logs/CrashReporter/SystemConfiguration
+       mkdir -p ${OUTDIR}
 fi
 
 umask 077
 fi
 
 umask 077
@@ -27,7 +30,14 @@ if [ $? -ne 0 ]; then
        exit 1
 fi
 
        exit 1
 fi
 
-ARCHIVE=`mktemp -q "${OUTDIR}/${OUT}.tar.gz"`
+GZ_EXT=""
+GZ_OPT=""
+if [ -x /usr/bin/gzip ]; then
+       GZ_EXT=".gz"
+       GZ_OPT="-z"
+fi
+
+ARCHIVE=`mktemp -q "${OUTDIR}/${OUT}.tar${GZ_EXT}"`
 if [ $? -ne 0 ]; then
        echo "Could not create snapshot archive"
        rm -rf "${WORKDIR}"
 if [ $? -ne 0 ]; then
        echo "Could not create snapshot archive"
        rm -rf "${WORKDIR}"
@@ -86,7 +96,8 @@ fi
 #
 # IOKit info
 #
 #
 # IOKit info
 #
-ioreg -i -l -w 0                                       > ioreg                 2>&1
+ioreg -i -l -w 0                                       >  ioreg                2>&1
+ioreg -i -l -p IODeviceTree -w 0                       >> ioreg                2>&1
 
 #
 # Host name
 
 #
 # Host name
@@ -127,7 +138,9 @@ for f in                                                                            \
        /Library/Preferences/SystemConfiguration/com.apple.nat.plist                    \
        /Library/Preferences/SystemConfiguration/com.apple.network.identification.plist \
        /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist             \
        /Library/Preferences/SystemConfiguration/com.apple.nat.plist                    \
        /Library/Preferences/SystemConfiguration/com.apple.network.identification.plist \
        /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist             \
+       /Library/Preferences/SystemConfiguration/com.apple.wifi.plist                   \
        /Library/Preferences/SystemConfiguration/preferences.plist                      \
        /Library/Preferences/SystemConfiguration/preferences.plist                      \
+       /Library/Preferences/com.apple.alf.plist                                        \
        /Library/Preferences/com.apple.sharing.firewall.plist                           \
 
 do
        /Library/Preferences/com.apple.sharing.firewall.plist                           \
 
 do
@@ -162,8 +175,8 @@ fi
 # network reachability
 #
 scutil -d -v -r www.apple.com                          > reachability-info     2>&1
 # network reachability
 #
 scutil -d -v -r www.apple.com                          > reachability-info     2>&1
-if [ -x /usr/bin/dig ]; then
-       dig -t any -c any www.apple.com                 > dig-results           2>&1
+if [ -x /usr/bin/dig -a -f /etc/resolv.conf ]; then
+       /usr/bin/dig -t any -c any www.apple.com        > dig-results           2>/dev/null
 fi
 
 #
 fi
 
 #
@@ -179,10 +192,33 @@ if [ -f /var/run/mDNSResponder.pid ]; then
 fi
 
 #
 fi
 
 #
-# system log, early boot log messages
+# system log, kernel.log, early boot log messages
+#
+if [ -x /usr/bin/syslog ]; then
+       ${PRIV} syslog | tail -n 25000                                  > syslog
+       if [ -d /var/log/DiagnosticMessages ]; then
+               ${PRIV} syslog  -d /var/log/DiagnosticMessages  \
+                               -F raw                          \
+                               -T local                        \
+                       | tail -n 25000                                 > DiagnosticMessages
+       fi
+else
+       if [ -f /var/log/system.log ]; then
+               ${PRIV} tail -n 25000 /var/log/system.log               > system.log
+       fi
+       if [ -f /var/log/kernel.log ]; then
+               ${PRIV} tail -n 25000 /var/log/kernel.log               > kernel.log
+       fi
+fi
+${PRIV} dmesg                                                          > dmesg
+
+#
+# IPConfiguration log
 #
 #
-${PRIV} tail -n 2000 /var/log/system.log               > system.log
-${PRIV} dmesg                                          > dmesg
+if [ -f /var/log/com.apple.IPConfiguration.bootp ]; then
+       ${PRIV} tail -n 2000 /var/log/com.apple.IPConfiguration.bootp   \
+                                                       > com.apple.IPConfiguration.bootp
+fi
 
 #
 # ppp log file(s)
 
 #
 # ppp log file(s)
@@ -208,7 +244,7 @@ do
        if [ -f "${logFile}" ]; then
                b="`basename ${logFile}`"
                cat "${logFile}"                        > "${b}"                2>&1
        if [ -f "${logFile}" ]; then
                b="`basename ${logFile}`"
                cat "${logFile}"                        > "${b}"                2>&1
-       fi                                      
+       fi
 done
 
 #
 done
 
 #
@@ -231,14 +267,21 @@ fi
 # network statistics
 #
 echo "#"                                               >  network-statistics
 # network statistics
 #
 echo "#"                                               >  network-statistics
-echo "# netstat -n -a -A -f inet"                      >> network-statistics
+echo "# arp -n -a"                                     >> network-statistics
 echo "#"                                               >> network-statistics
 echo "#"                                               >> network-statistics
-netstat -n -a -A -f inet                               >> network-statistics   2>&1
+arp -n -a                                              >> network-statistics   2>&1
 
 echo "#"                                               >> network-statistics
 
 echo "#"                                               >> network-statistics
-echo "# lsof -i -n -P"                                 >> network-statistics
+echo "# netstat -n -a -A"                              >> network-statistics
 echo "#"                                               >> network-statistics
 echo "#"                                               >> network-statistics
-${PRIV} lsof -i -n -P                                  >> network-statistics   2>&1
+netstat -n -a -A                                       >> network-statistics   2>&1
+
+if [ -x /usr/sbin/lsof ]; then
+       echo "#"                                        >> network-statistics
+       echo "# lsof -i -n -P"                          >> network-statistics
+       echo "#"                                        >> network-statistics
+       ${PRIV} lsof -i -n -P                           >> network-statistics   2>&1
+fi
 
 echo "#"                                               >> network-statistics
 echo "# netstat -s"                                    >> network-statistics
 
 echo "#"                                               >> network-statistics
 echo "# netstat -s"                                    >> network-statistics
@@ -255,15 +298,19 @@ echo "# netstat -i -n -d"                         >> network-statistics
 echo "#"                                               >> network-statistics
 netstat -i -n -d                                       >> network-statistics   2>&1
 
 echo "#"                                               >> network-statistics
 netstat -i -n -d                                       >> network-statistics   2>&1
 
-echo "#"                                               >> network-statistics
-echo "# ipfw -at show"                                 >> network-statistics
-echo "#"                                               >> network-statistics
-ipfw -at show                                          >> network-statistics   2>&1
+if [ -x /sbin/ipfw ]; then
+       echo "#"                                        >> network-statistics
+       echo "# ipfw -at show"                          >> network-statistics
+       echo "#"                                        >> network-statistics
+       ipfw -at show                                   >> network-statistics   2>&1
+fi
 
 
-echo "#"                                               >> network-statistics
-echo "# appletalk -s"                                  >> network-statistics
-echo "#"                                               >> network-statistics
-appletalk -s                                           >> network-statistics   2>&1
+if [ -x /usr/sbin/appletalk ]; then
+       echo "#"                                        >> network-statistics
+       echo "# appletalk -s"                           >> network-statistics
+       echo "#"                                        >> network-statistics
+       appletalk -s                                    >> network-statistics   2>&1
+fi
 
 #
 # system usage statistics
 
 #
 # system usage statistics
@@ -333,8 +380,12 @@ echo "# setkey -Pp -D"                                     >> ipsec
 echo "#"                                               >> ipsec
 ${PRIV} setkey -Pp -D                                  >> ipsec
 
 echo "#"                                               >> ipsec
 ${PRIV} setkey -Pp -D                                  >> ipsec
 
-for CF in /etc/racoon/remote/*.conf
+for CF in /var/run/racoon/*.conf
 do
 do
+       if [ ! -r "${CF}" ]; then
+               continue
+       fi
+
        echo ""                                         >> ipsec
        echo "#"                                        >> ipsec
        echo "# ${CF}"                                  >> ipsec
        echo ""                                         >> ipsec
        echo "#"                                        >> ipsec
        echo "# ${CF}"                                  >> ipsec
@@ -353,22 +404,24 @@ done
 #
 # Kerberos configuration
 #
 #
 # Kerberos configuration
 #
-echo "#"                                               >  kerberos
-echo "# klist -e -c -A -f -a -n"                       >> kerberos
-echo "#"                                               >> kerberos
-${PRIV} klist -e -c -A -f -a -n                                >> kerberos
+if [ -x /usr/bin/klist ]; then
+       echo "#"                                        >  kerberos
+       echo "# klist -e -c -A -f -a -n"                >> kerberos
+       echo "#"                                        >> kerberos
+       ${PRIV} klist -e -c -A -f -a -n                 >> kerberos     2>&1
 
 
-echo "#"                                               >> kerberos
-echo "# klist -e -k -t -K"                             >> kerberos
-echo "#"                                               >> kerberos
-${PRIV} klist -e -k -t -K                              >> kerberos
+       echo "#"                                        >> kerberos
+       echo "# klist -e -k -t -K"                      >> kerberos
+       echo "#"                                        >> kerberos
+       ${PRIV} klist -e -k -t -K                       >> kerberos     2>&1
+fi
 
 #
 # BTMM configuration
 #
 DIG()
 {
 
 #
 # BTMM configuration
 #
 DIG()
 {
-       /usr/bin/dig @pm-members.mac.com -y "${DOMAIN}:${TSIG}" +short "${1}" "${2}"
+       /usr/bin/dig @pm-members.mac.com -y "${DOMAIN}:${TSIG}" +short "${1}" "${2}" 2>/dev/null
 }
 
 scutil <<_END_OF_INPUT                                 \
 }
 
 scutil <<_END_OF_INPUT                                 \
@@ -386,7 +439,7 @@ do
        # lookup TSIG in base64 format
        TSIG=`                                                          \
                ${PRIV} security find-generic-password                  \
        # lookup TSIG in base64 format
        TSIG=`                                                          \
                ${PRIV} security find-generic-password                  \
-                       -a ${DOMAIN}                                    \
+                       -s dns:${DOMAIN}                                \
                        -g /Library/Keychains/System.keychain 2>&1      \
                | grep "^password: "                                    \
                | cut -d '"' -f 2                                       \
                        -g /Library/Keychains/System.keychain 2>&1      \
                | grep "^password: "                                    \
                | cut -d '"' -f 2                                       \
@@ -401,10 +454,15 @@ do
                continue
        fi
 
                continue
        fi
 
+       KEYHASH="[SHA-1:`echo ${TSIG} | openssl sha1`]"
+       echo ""                                                 >> btmm
+       echo "  KEY: ${KEYHASH}"                                >> btmm
+
        for TYPE in                     \
                _afpovertcp._tcp        \
                _airport._tcp           \
                _adisk._tcp             \
        for TYPE in                     \
                _afpovertcp._tcp        \
                _airport._tcp           \
                _adisk._tcp             \
+               _http._tcp              \
                _rfb._tcp               \
                _smb._tcp               \
                _ssh._tcp
                _rfb._tcp               \
                _smb._tcp               \
                _ssh._tcp
@@ -440,30 +498,38 @@ do
                        fi
 
                        HOST=`/bin/echo "${SRV}" | cut -d ' ' -f 4-`
                        fi
 
                        HOST=`/bin/echo "${SRV}" | cut -d ' ' -f 4-`
+                       if [ -n "${HOST}" ]; then
                        V4=`DIG ${HOST} a`
                        V4=`DIG ${HOST} a`
+                               V6=`DIG ${HOST} aaaa`
+                               KRB=`DIG _kerberos.${HOST} txt`
+                               TUN=`DIG _autotunnel._udp.${HOST} srv`
+                       else
+                               V4=""
+                               V6=""
+                               KRB=""
+                               TUN=""
+                       fi
                        if [ -n "${V4}" ]; then
                                echo "     v4: ${V4}"           >> btmm
                        fi
                        if [ -n "${V4}" ]; then
                                echo "     v4: ${V4}"           >> btmm
                        fi
-                       V6=`DIG ${HOST} aaaa`
                        if [ -n "${V6}" ]; then
                                echo "     v6: ${V6}"           >> btmm
                        fi
                        if [ -n "${V6}" ]; then
                                echo "     v6: ${V6}"           >> btmm
                        fi
-
-                       KRB=`DIG _kerberos.${HOST} txt`
                        echo "    KRB: ${KRB}"                  >> btmm
                        echo "    KRB: ${KRB}"                  >> btmm
-
-                       TUN=`DIG _autotunnel._udp.${HOST} srv`
                        echo "    TUN: ${TUN}"                  >> btmm
                        echo "    TUN: ${TUN}"                  >> btmm
-
+                       if [ -n "${TUN}" ]; then
                        HOST=`/bin/echo "${TUN}" | cut -d ' ' -f 4-`
                        HOST=`/bin/echo "${TUN}" | cut -d ' ' -f 4-`
+                               if [ -n "${HOST}" ]; then
                        V4=`DIG ${HOST} a`
                        V4=`DIG ${HOST} a`
+                                       V6=`DIG ${HOST} aaaa`
+                               fi
                        if [ -n "${V4}" ]; then
                                echo "     v4: ${V4}"           >> btmm
                        fi
                        if [ -n "${V4}" ]; then
                                echo "     v4: ${V4}"           >> btmm
                        fi
-                       V6=`DIG ${HOST} aaaa`
                        if [ -n "${V6}" ]; then
                                echo "     v6: ${V6}"           >> btmm
                        fi
                        if [ -n "${V6}" ]; then
                                echo "     v6: ${V6}"           >> btmm
                        fi
+                       fi
                done
        done
 done
                done
        done
 done
@@ -471,10 +537,22 @@ done
 #
 # collect crash reports
 #
 #
 # collect crash reports
 #
-CRASH_DIR=/Library/Logs/CrashReporter
-for daemon in bootpd configd pppd
+for daemon in                          \
+               bootpd                  \
+               configd                 \
+               eapolclient             \
+               mDNSResponder           \
+               mDNSResponderHelper     \
+               pppd                    \
+               racoon                  \
+               socketfilterfw          \
+               SCHelper                \
+               SCMonitor               \
+
 do
 do
-       /bin/ls -1 ${CRASH_DIR}/${daemon}_*.crash 2>/dev/null   \
+       /bin/ls -1      /Library/Logs/CrashReporter/${daemon}_*.crash           \
+                       /Library/Logs/DiagnosticReports/${daemon}/*.crash       \
+                       2>/dev/null                                             \
        | while read log
        do
                b="`basename ${log}`"
        | while read log
        do
                b="`basename ${log}`"
@@ -486,7 +564,7 @@ done
 # collect everything into a single archive
 #
 cd "${WORKDIR}/.."
 # collect everything into a single archive
 #
 cd "${WORKDIR}/.."
-tar cfz "${ARCHIVE}" "${OUT}"
+pax -w ${GZ_OPT} -f "${ARCHIVE}" "${OUT}"
 rm -rf "${WORKDIR}"
 
 if [ ${UID} -eq 0 ]; then
 rm -rf "${WORKDIR}"
 
 if [ ${UID} -eq 0 ]; then
@@ -498,3 +576,11 @@ if [ ${UID} -eq 0 ]; then
 fi
 
 echo "Network data collected to \"${ARCHIVE}\""
 fi
 
 echo "Network data collected to \"${ARCHIVE}\""
+
+#
+# if requested, generate a crash report
+#
+if [ "${OUTDIR}" = "/Library/Logs/CrashReporter/SystemConfiguration" -a "${1}" = "CRASH" ]; then
+       kill -ABRT $$
+fi
+
diff --git a/preferences.xml b/preferences.xml
deleted file mode 100644 (file)
index 11d7d02..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-       <key>CurrentSet</key>
-       <string>/Sets/0</string>
-       <key>NetworkServices</key>
-       <dict>
-               <key>0</key>
-               <dict>
-                       <key>AppleTalk</key>
-                       <dict>
-                               <key>ConfigMethod</key>
-                               <string>Node</string>
-                               <key>__INACTIVE__</key>
-                               <integer>1</integer>
-                       </dict>
-                       <key>DNS</key>
-                       <dict/>
-                       <key>Ethernet</key>
-                       <dict/>
-                       <key>IPv4</key>
-                       <dict>
-                               <key>ConfigMethod</key>
-                               <string>DHCP</string>
-                       </dict>
-                       <key>IPv6</key>
-                       <dict>
-                               <key>ConfigMethod</key>
-                               <string>Automatic</string>
-                       </dict>
-                       <key>Interface</key>
-                       <dict>
-                               <key>DeviceName</key>
-                               <string>en0</string>
-                               <key>Hardware</key>
-                               <string>Ethernet</string>
-                               <key>Type</key>
-                               <string>Ethernet</string>
-                               <key>UserDefinedName</key>
-                               <string>Built-in Ethernet</string>
-                       </dict>
-                       <key>PPP</key>
-                       <dict>
-                               <key>CommDisplayTerminalWindow</key>
-                               <integer>0</integer>
-                               <key>CommRedialCount</key>
-                               <integer>1</integer>
-                               <key>CommRedialEnabled</key>
-                               <integer>1</integer>
-                               <key>CommRedialInterval</key>
-                               <integer>30</integer>
-                               <key>DialOnDemand</key>
-                               <integer>0</integer>
-                               <key>DisconnectOnIdle</key>
-                               <integer>1</integer>
-                               <key>DisconnectOnIdleTimer</key>
-                               <integer>600</integer>
-                               <key>DisconnectOnLogout</key>
-                               <integer>0</integer>
-                               <key>IPCPCompressionVJ</key>
-                               <integer>1</integer>
-                               <key>IdleReminder</key>
-                               <integer>1</integer>
-                               <key>IdleReminderTimer</key>
-                               <integer>900</integer>
-                               <key>LCPEchoEnabled</key>
-                               <integer>1</integer>
-                               <key>LCPEchoFailure</key>
-                               <integer>4</integer>
-                               <key>LCPEchoInterval</key>
-                               <integer>10</integer>
-                               <key>Logfile</key>
-                               <string>/var/log/ppp.log</string>
-                               <key>VerboseLogging</key>
-                               <integer>0</integer>
-                               <key>__INACTIVE__</key>
-                               <integer>1</integer>
-                       </dict>
-                       <key>Proxies</key>
-                       <dict>
-                               <key>FTPEnable</key>
-                               <integer>0</integer>
-                               <key>FTPPassive</key>
-                               <integer>1</integer>
-                               <key>GopherEnable</key>
-                               <integer>0</integer>
-                               <key>HTTPEnable</key>
-                               <integer>0</integer>
-                               <key>HTTPSEnable</key>
-                               <integer>0</integer>
-                               <key>RTSPEnable</key>
-                               <integer>0</integer>
-                               <key>SOCKSEnable</key>
-                               <integer>0</integer>
-                       </dict>
-                       <key>UserDefinedName</key>
-                       <string>Built-in Ethernet</string>
-               </dict>
-       </dict>
-       <key>Sets</key>
-       <dict>
-               <key>0</key>
-               <dict>
-                       <key>Network</key>
-                       <dict>
-                               <key>Global</key>
-                               <dict>
-                                       <key>IPv4</key>
-                                       <dict>
-                                               <key>PPPOverridePrimary</key>
-                                               <integer>0</integer>
-                                               <key>ServiceOrder</key>
-                                               <array>
-                                                       <string>0</string>
-                                               </array>
-                                       </dict>
-                               </dict>
-                               <key>Service</key>
-                               <dict>
-                                       <key>0</key>
-                                       <dict>
-                                               <key>__LINK__</key>
-                                               <string>/NetworkServices/0</string>
-                                       </dict>
-                               </dict>
-                       </dict>
-                       <key>UserDefinedName</key>
-                       <string>Automatic</string>
-               </dict>
-       </dict>
-       <key>System</key>
-       <dict/>
-</dict>
-</plist>
index e490e832797932cd83abfa1c6585ea8c402da2fc..5c42fb3780f65fd6608598e634f86e0a5c4b3e21 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -48,8 +48,9 @@
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCPrivate.h>
 
-#include <Security/Security.h>
+#if    !TARGET_OS_IPHONE
 #include <Security/AuthSession.h>
 #include <Security/AuthSession.h>
+#endif /* !TARGET_OS_IPHONE */
 
 
 static Boolean apply   = TRUE;
 
 
 static Boolean apply   = TRUE;
@@ -103,6 +104,7 @@ isAdmin()
 }
 
 
 }
 
 
+#if    !TARGET_OS_IPHONE
 static void *
 __loadSecurity(void) {
        static void *image = NULL;
 static void *
 __loadSecurity(void) {
        static void *image = NULL;
@@ -136,11 +138,12 @@ _SessionGetInfo(SecuritySessionId session, SecuritySessionId *sessionId, Session
        return dyfunc ? dyfunc(session, sessionId, attributes) : -1;
 }
 #define SessionGetInfo _SessionGetInfo
        return dyfunc ? dyfunc(session, sessionId, attributes) : -1;
 }
 #define SessionGetInfo _SessionGetInfo
-
+#endif /* !TARGET_OS_IPHONE */
 
 static Boolean
 hasLocalConsoleAccess()
 {
 
 static Boolean
 hasLocalConsoleAccess()
 {
+#if    !TARGET_OS_IPHONE
        OSStatus                error;
        SecuritySessionId       sessionID       = 0;
        SessionAttributeBits    attributeBits   = 0;
        OSStatus                error;
        SecuritySessionId       sessionID       = 0;
        SessionAttributeBits    attributeBits   = 0;
@@ -152,6 +155,9 @@ hasLocalConsoleAccess()
        }
 
        return (attributeBits & (sessionHasGraphicAccess|sessionIsRemote)) == sessionHasGraphicAccess;
        }
 
        return (attributeBits & (sessionHasGraphicAccess|sessionIsRemote)) == sessionHasGraphicAccess;
+#else  /* !TARGET_OS_IPHONE */
+       return TRUE;
+#endif /* !TARGET_OS_IPHONE */
 }
 
 
 }
 
 
@@ -198,7 +204,7 @@ main(int argc, char **argv)
 
        newSet = (argc == 1)
                        ? CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingMacRoman)
 
        newSet = (argc == 1)
                        ? CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingMacRoman)
-                       : CFSTR("");
+                       : CFRetain(CFSTR(""));
 
        prefs = SCPreferencesCreate(NULL, CFSTR("Select Set Command"), NULL);
        if (prefs == NULL) {
 
        prefs = SCPreferencesCreate(NULL, CFSTR("Select Set Command"), NULL);
        if (prefs == NULL) {
@@ -239,10 +245,11 @@ main(int argc, char **argv)
                        CFStringDelete(tmp, CFRangeMake(0, CFStringGetLength(prefix)));
                        current = tmp;
                } else {
                        CFStringDelete(tmp, CFRangeMake(0, CFStringGetLength(prefix)));
                        current = tmp;
                } else {
+                       CFRetain(current);
                        currentMatched = -1;    /* not prefixed */
                }
        } else {
                        currentMatched = -1;    /* not prefixed */
                }
        } else {
-               current = CFSTR("");
+               current = CFRetain(CFSTR(""));
                currentMatched = -2;    /* not defined */
        }
 
                currentMatched = -2;    /* not defined */
        }
 
@@ -265,7 +272,6 @@ main(int argc, char **argv)
                if (CFEqual(newSet, key)) {
                        newSetUDN = CFDictionaryGetValue(dict, kSCPropUserDefinedName);
                        if (newSetUDN != NULL) CFRetain(newSetUDN);
                if (CFEqual(newSet, key)) {
                        newSetUDN = CFDictionaryGetValue(dict, kSCPropUserDefinedName);
                        if (newSetUDN != NULL) CFRetain(newSetUDN);
-                       current = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@%@"), prefix, newSet);
                        goto found;
                }
        }
                        goto found;
                }
        }
@@ -280,7 +286,6 @@ main(int argc, char **argv)
                        CFRelease(newSet);
                        newSet = CFRetain(key);
                        CFRetain(newSetUDN);
                        CFRelease(newSet);
                        newSet = CFRetain(key);
                        CFRetain(newSetUDN);
-                       current = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@%@"), prefix, newSet);
                        goto found;
                }
        }
                        goto found;
                }
        }
@@ -329,6 +334,9 @@ main(int argc, char **argv)
                exit (EX_NOPERM);
        }
 
                exit (EX_NOPERM);
        }
 
+       CFRelease(current);
+       current = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@%@"), prefix, newSet);
+
        if (!SCPreferencesSetValue(prefs, kSCPrefCurrentSet, current)) {
                SCPrint(TRUE, stderr,
                        CFSTR("SCPreferencesSetValue(...,%@,%@) failed\n"),
        if (!SCPreferencesSetValue(prefs, kSCPrefCurrentSet, current)) {
                SCPrint(TRUE, stderr,
                        CFSTR("SCPreferencesSetValue(...,%@,%@) failed\n"),
@@ -349,14 +357,18 @@ main(int argc, char **argv)
                }
        }
 
                }
        }
 
-       CFRelease(prefs);
-
        SCPrint(TRUE, stdout,
                CFSTR("%@ updated to %@ (%@)\n"),
                kSCPrefCurrentSet,
                newSet,
                newSetUDN ? newSetUDN : CFSTR(""));
 
        SCPrint(TRUE, stdout,
                CFSTR("%@ updated to %@ (%@)\n"),
                kSCPrefCurrentSet,
                newSet,
                newSetUDN ? newSetUDN : CFSTR(""));
 
+       CFRelease(current);
+       CFRelease(newSet);
+       if (newSetUDN != NULL)  CFRelease(newSetUDN);
+       CFRelease(prefix);
+       CFRelease(prefs);
+
        exit (0);
        return 0;
 }
        exit (0);
        return 0;
 }
index e50043a0cdf21e4efe630f2b75583132a367d344..c7c8d70ae3583dc85606aa7cbdb1eff6caa70bcd 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -45,8 +45,6 @@
 #include "net.h"
 #include "prefs.h"
 
 #include "net.h"
 #include "prefs.h"
 
-#include "SCDynamicStoreInternal.h"
-
 
 __private_extern__
 const cmdInfo commands_store[] = {
 
 __private_extern__
 const cmdInfo commands_store[] = {
@@ -133,8 +131,8 @@ const cmdInfo commands_store[] = {
        { "n.changes",  0,      0,      do_notify_changes,      5,      0,
                " n.changes                     : list changed keys"                            },
 
        { "n.changes",  0,      0,      do_notify_changes,      5,      0,
                " n.changes                     : list changed keys"                            },
 
-       { "n.watch",    0,      1,      do_notify_watch,        5,      0,
-               " n.watch [verbose]             : watch for changes"                            },
+       { "n.watch",    0,      0,      do_notify_watch,        5,      0,
+               " n.watch                       : watch for changes"                            },
 
        { "n.wait",     0,      0,      do_notify_wait,         5,      2,
                " n.wait                        : wait for changes"                             },
 
        { "n.wait",     0,      0,      do_notify_wait,         5,      2,
                " n.wait                        : wait for changes"                             },
@@ -211,8 +209,8 @@ const cmdInfo commands_net[] = {
                " remove service   [ <serviceName> | <service#> ]\n"
                " remove set       [ <setName> | <set#> ]"                                      },
 
                " remove service   [ <serviceName> | <service#> ]\n"
                " remove set       [ <setName> | <set#> ]"                                      },
 
-       { "select",     2,      2,      do_net_select,          7,      0,
-               " select interface <interfaceName> | <interface#> | $child | $service\n"
+       { "select",     2,      3,      do_net_select,          7,      0,
+               " select interface <interfaceName> | <interface#> | $child | $service | $vlan | $bond <memberName>\n"
                " select protocol  <protocolType>\n"
                " select service   <serviceName> | <service#>\n"
                " select set       <setName> | <set#>"                                          },
                " select protocol  <protocolType>\n"
                " select service   <serviceName> | <service#>\n"
                " select set       <setName> | <set#>"                                          },
@@ -220,7 +218,7 @@ const cmdInfo commands_net[] = {
        { "set",        2,      101,    do_net_set,             8,      0,
                " set interface context-sensitive-arguments (or ? for help)\n"
                " set protocol  context-sensitive-arguments (or ? for help)\n"
        { "set",        2,      101,    do_net_set,             8,      0,
                " set interface context-sensitive-arguments (or ? for help)\n"
                " set protocol  context-sensitive-arguments (or ? for help)\n"
-               " set service   [ name <serviceName> ] [ order new-order ]\n"
+               " set service   [ name <serviceName> ] [ order new-order ] [ rank ("" | First | Last | Never) [temp] ]\n"
                " set set       [ name setName ]"                                               },
 
        { "show",       1,      2,      do_net_show,            9,      0,
                " set set       [ name setName ]"                                               },
 
        { "show",       1,      2,      do_net_show,            9,      0,
@@ -282,7 +280,7 @@ const cmdInfo commands_prefs[] = {
        /* data store manipulation commands */
 
        { "open",       0,      1,      do_prefs_open,          2,      1,
        /* data store manipulation commands */
 
        { "open",       0,      1,      do_prefs_open,          2,      1,
-               " open [\"prefsID\"]            : open a \"preferences\" session"                       },
+               " open [\"prefsID\"]            : open a \"preferences\" session"               },
 
        { "lock",       0,      1,      do_prefs_lock,          3,      1,
                " lock [wait]                   : locks write access to preferences"            },
 
        { "lock",       0,      1,      do_prefs_lock,          3,      1,
                " lock [wait]                   : locks write access to preferences"            },
@@ -301,7 +299,7 @@ const cmdInfo commands_prefs[] = {
 
        { "synchronize",0,      1,      do_prefs_synchronize,   2,      0,
                " synchronize            : synchronize a \"preferences\" session"               },
 
        { "synchronize",0,      1,      do_prefs_synchronize,   2,      0,
                " synchronize            : synchronize a \"preferences\" session"               },
-       
+
        { "list",       0,      1,      do_prefs_list,          4,      0,
                " list [path]                   : list preference paths"                        },
 
        { "list",       0,      1,      do_prefs_list,          4,      0,
                " list [path]                   : list preference paths"                        },
 
@@ -410,9 +408,13 @@ do_readFile(int argc, char **argv)
        SCPrint(TRUE, stdout, CFSTR("f.read: reading file (%s).\n"), argv[0]);
        nesting++;
 
        SCPrint(TRUE, stdout, CFSTR("f.read: reading file (%s).\n"), argv[0]);
        nesting++;
 
-       while (process_line(src) == TRUE) {
-              /* debug information, diagnostics */
-               __showMachPortStatus();
+       while (TRUE) {
+               Boolean ok;
+
+               ok = process_line(src);
+               if (!ok) {
+                       break;
+               }
        }
 
        (void)fclose(src->fp);
        }
 
        (void)fclose(src->fp);
index ec17cd8a93e2e073db940028917c482ee14d7935..032c59109c71c7c171916ddeeb57c4ac374cad82 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -76,12 +76,13 @@ __private_extern__
 void
 do_dictSetKey(int argc, char **argv)
 {
 void
 do_dictSetKey(int argc, char **argv)
 {
-       CFMutableArrayRef       array     = NULL;
-       Boolean                 doArray   = FALSE;
-       Boolean                 doBoolean = FALSE;
-       Boolean                 doNumeric = FALSE;
+       CFMutableArrayRef       array           = NULL;
+       Boolean                 doArray         = FALSE;
+       Boolean                 doBoolean       = FALSE;
+       Boolean                 doNumeric       = FALSE;
        CFStringRef             key;
        CFStringRef             key;
-       CFTypeRef               val;
+       CFMutableDictionaryRef  newValue;
+       CFTypeRef               val             = NULL;
 
        if (value == NULL) {
                SCPrint(TRUE, stdout, CFSTR("d.add: dictionary must be initialized.\n"));
 
        if (value == NULL) {
                SCPrint(TRUE, stdout, CFSTR("d.add: dictionary must be initialized.\n"));
@@ -93,10 +94,6 @@ do_dictSetKey(int argc, char **argv)
                return;
        }
 
                return;
        }
 
-       val = CFDictionaryCreateMutableCopy(NULL, 0, value);
-       CFRelease(value);
-       value = val;
-
        key = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
        argv++; argc--;
 
        key = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
        argv++; argc--;
 
@@ -123,6 +120,7 @@ do_dictSetKey(int argc, char **argv)
                doArray = TRUE;
        } else if (!doArray && (argc == 0)) {
                SCPrint(TRUE, stdout, CFSTR("d.add: no values.\n"));
                doArray = TRUE;
        } else if (!doArray && (argc == 0)) {
                SCPrint(TRUE, stdout, CFSTR("d.add: no values.\n"));
+               CFRelease(key);
                return;
        }
 
                return;
        }
 
@@ -146,9 +144,8 @@ do_dictSetKey(int argc, char **argv)
                                val = CFRetain(kCFBooleanFalse);
                        } else {
                                SCPrint(TRUE, stdout, CFSTR("d.add: invalid data.\n"));
                                val = CFRetain(kCFBooleanFalse);
                        } else {
                                SCPrint(TRUE, stdout, CFSTR("d.add: invalid data.\n"));
-                               if (doArray) {
-                                       CFRelease(array);
-                               }
+                               if (doArray) CFRelease(array);
+                               CFRelease(key);
                                return;
                        }
                } else if (doNumeric) {
                                return;
                        }
                } else if (doNumeric) {
@@ -158,9 +155,8 @@ do_dictSetKey(int argc, char **argv)
                                val = CFNumberCreate(NULL, kCFNumberIntType, &intValue);
                        } else {
                                SCPrint(TRUE, stdout, CFSTR("d.add: invalid data.\n"));
                                val = CFNumberCreate(NULL, kCFNumberIntType, &intValue);
                        } else {
                                SCPrint(TRUE, stdout, CFSTR("d.add: invalid data.\n"));
-                               if (doArray) {
-                                       CFRelease(array);
-                               }
+                               if (doArray) CFRelease(array);
+                               CFRelease(key);
                                return;
                        }
                } else {
                                return;
                        }
                } else {
@@ -169,18 +165,24 @@ do_dictSetKey(int argc, char **argv)
 
                if (doArray) {
                        CFArrayAppendValue(array, val);
 
                if (doArray) {
                        CFArrayAppendValue(array, val);
+                       CFRelease(val);
+                       argv++; argc--;
+               } else {
+                       break;
                }
                }
-
-               argv++; argc--;
        }
 
        }
 
+       newValue = CFDictionaryCreateMutableCopy(NULL, 0, value);
        if (doArray) {
        if (doArray) {
-               val = array;
+               CFDictionarySetValue(newValue, key, array);
+               CFRelease(array);
+       } else {
+               CFDictionarySetValue(newValue, key, val);
+               CFRelease(val);
        }
        }
-
-       CFDictionarySetValue((CFMutableDictionaryRef)value, key, val);
-       CFRelease(val);
        CFRelease(key);
        CFRelease(key);
+       CFRelease(value);
+       value = newValue;
 
        return;
 }
 
        return;
 }
index 31ff83161d839206d430a2586ff45da6c9fbdf06..c7825b95958618c9cd9278132370d7ce20b10356 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2007, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -401,11 +401,20 @@ _show_entity(CFDictionaryRef entity, CFStringRef prefix)
                key   = CFArrayGetValueAtIndex(sorted, i);
                value = CFDictionaryGetValue(entity, key);
                if (isA_CFArray(value)) {
                key   = CFArrayGetValueAtIndex(sorted, i);
                value = CFDictionaryGetValue(entity, key);
                if (isA_CFArray(value)) {
-                       CFStringRef     str;
+                       CFIndex         i;
+                       CFIndex         n       = CFArrayGetCount(value);
 
 
-                       str = CFStringCreateByCombiningStrings(NULL, value, CFSTR(", "));
-                       SCPrint(TRUE, stdout, CFSTR("%@    %@ = (%@)\n"), prefix, key, str);
-                       CFRelease(str);
+                       SCPrint(TRUE, stdout, CFSTR("%@    %@ = ("), prefix, key);
+                       for (i = 0; i < n; i++) {
+                               CFTypeRef       val;
+
+                               val = CFArrayGetValueAtIndex(value, i);
+                               SCPrint(TRUE, stdout,
+                                       CFSTR("%s%@"),
+                                       (i > 0) ? ", " : "",
+                                       val);
+                       }
+                       SCPrint(TRUE, stdout, CFSTR(")\n"));
                } else {
                        SCPrint(TRUE, stdout, CFSTR("%@    %@ = %@\n"), prefix, key, value);
                }
                } else {
                        SCPrint(TRUE, stdout, CFSTR("%@    %@ = %@\n"), prefix, key, value);
                }
@@ -913,7 +922,6 @@ do_net_update(int argc, char **argv)
                        net_set = set;
 
                        setCreated = TRUE;
                        net_set = set;
 
                        setCreated = TRUE;
-                       setUpdated = TRUE;
 
                        CFRelease(setName);
                        CFRetain(set);
 
                        CFRelease(setName);
                        CFRetain(set);
index c42c4b892e28d6b7b3d79bcc138145730b7fb465..9cd9f3885e03a77104a0783c310f613dfc26b469 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -36,7 +36,8 @@
 #include <SystemConfiguration/LinkConfiguration.h>
 
 
 #include <SystemConfiguration/LinkConfiguration.h>
 
 
-/* -------------------- */
+#pragma mark -
+#pragma mark Interface management
 
 
 static CFArrayRef
 
 
 static CFArrayRef
@@ -75,15 +76,23 @@ _copy_interfaces()
 
 __private_extern__
 SCNetworkInterfaceRef
 
 __private_extern__
 SCNetworkInterfaceRef
-_find_interface(char *match)
+_find_interface(int argc, char **argv, int *nArgs)
 {
        Boolean                 allowIndex      = TRUE;
        CFIndex                 i;
 {
        Boolean                 allowIndex      = TRUE;
        CFIndex                 i;
+       CFArrayRef              myInterfaces    = interfaces;
        CFIndex                 n;
        CFStringRef             select_name     = NULL;
        SCNetworkInterfaceRef   selected        = NULL;
 
        CFIndex                 n;
        CFStringRef             select_name     = NULL;
        SCNetworkInterfaceRef   selected        = NULL;
 
-       if (strcasecmp(match, "$child") == 0) {
+       if (argc < 1) {
+               SCPrint(TRUE, stdout, CFSTR("no interface specified\n"));
+               return NULL;
+       }
+
+       if (nArgs != NULL) *nArgs = 1;
+
+       if (strcasecmp(argv[0], "$child") == 0) {
                if (net_interface == NULL) {
                        SCPrint(TRUE, stdout, CFSTR("interface not selected\n"));
                        goto done;
                if (net_interface == NULL) {
                        SCPrint(TRUE, stdout, CFSTR("interface not selected\n"));
                        goto done;
@@ -95,7 +104,7 @@ _find_interface(char *match)
                }
 
                goto done;
                }
 
                goto done;
-       } else if (strcasecmp(match, "$service") == 0) {
+       } else if (strcasecmp(argv[0], "$service") == 0) {
                if (net_service == NULL) {
                        SCPrint(TRUE, stdout, CFSTR("service not selected\n"));
                        goto done;
                if (net_service == NULL) {
                        SCPrint(TRUE, stdout, CFSTR("service not selected\n"));
                        goto done;
@@ -107,26 +116,77 @@ _find_interface(char *match)
                }
 
                goto done;
                }
 
                goto done;
+#if    !TARGET_OS_IPHONE
+       } else if (strcasecmp(argv[0], "$bond") == 0) {
+               CFStringRef     interfaceType;
+
+               if (net_interface == NULL) {
+                       SCPrint(TRUE, stdout, CFSTR("interface not selected\n"));
+                       goto done;
+               }
+
+               interfaceType = SCNetworkInterfaceGetInterfaceType(net_interface);
+               if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeBond)) {
+                       SCPrint(TRUE, stdout, CFSTR("interface not Bond\n"));
+                       goto done;
+               }
+
+               if (argc < 2) {
+                       SCPrint(TRUE, stdout, CFSTR("no member interface specified\n"));
+                       return NULL;
+               }
+               argv++;
+               argc--;
+               if (nArgs != NULL) *nArgs += 1;
+
+               myInterfaces = SCBondInterfaceGetMemberInterfaces(net_interface);
+               if (myInterfaces == NULL) {
+                       SCPrint(TRUE, stdout, CFSTR("no member interfaces\n"));
+                       goto done;
+               }
+               allowIndex = FALSE;
+       } else if (strcasecmp(argv[0], "$vlan") == 0) {
+               CFStringRef     interfaceType;
+
+               if (net_interface == NULL) {
+                       SCPrint(TRUE, stdout, CFSTR("interface not selected\n"));
+                       goto done;
+               }
+
+               interfaceType = SCNetworkInterfaceGetInterfaceType(net_interface);
+               if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeVLAN)) {
+                       SCPrint(TRUE, stdout, CFSTR("interface not VLAN\n"));
+                       goto done;
+               }
+
+               selected = SCVLANInterfaceGetPhysicalInterface(net_interface);
+               if(selected == NULL) {
+                       SCPrint(TRUE, stdout, CFSTR("no physical interface\n"));
+               }
+
+               goto done;
+#endif // !TARGET_OS_IPHONE
        }
 
        }
 
-       if (interfaces == NULL) {
+       if ((myInterfaces == NULL) && (interfaces == NULL)) {
                interfaces = _copy_interfaces();
                if (interfaces == NULL) {
                        return NULL;
                }
                interfaces = _copy_interfaces();
                if (interfaces == NULL) {
                        return NULL;
                }
+               myInterfaces = interfaces;
                allowIndex = FALSE;
        }
 
        // try to select the interface by its display name
 
                allowIndex = FALSE;
        }
 
        // try to select the interface by its display name
 
-       select_name = CFStringCreateWithCString(NULL, match, kCFStringEncodingUTF8);
+       select_name = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
 
 
-       n = CFArrayGetCount(interfaces);
+       n = (myInterfaces != NULL) ? CFArrayGetCount(myInterfaces) : 0;
        for (i = 0; i < n; i++) {
                SCNetworkInterfaceRef   interface;
                CFStringRef             interfaceName;
 
        for (i = 0; i < n; i++) {
                SCNetworkInterfaceRef   interface;
                CFStringRef             interfaceName;
 
-               interface = CFArrayGetValueAtIndex(interfaces, i);
+               interface = CFArrayGetValueAtIndex(myInterfaces, i);
                interfaceName = SCNetworkInterfaceGetLocalizedDisplayName(interface);
                if ((interfaceName != NULL) && CFEqual(select_name, interfaceName)) {
                        if (selected == NULL) {
                interfaceName = SCNetworkInterfaceGetLocalizedDisplayName(interface);
                if ((interfaceName != NULL) && CFEqual(select_name, interfaceName)) {
                        if (selected == NULL) {
@@ -150,7 +210,7 @@ _find_interface(char *match)
                SCNetworkInterfaceRef   interface;
                CFStringRef             bsd_name        = NULL;
 
                SCNetworkInterfaceRef   interface;
                CFStringRef             bsd_name        = NULL;
 
-               interface = CFArrayGetValueAtIndex(interfaces, i);
+               interface = CFArrayGetValueAtIndex(myInterfaces, i);
                while ((interface != NULL) && (bsd_name == NULL)) {
                        bsd_name = SCNetworkInterfaceGetBSDName(interface);
                        if (bsd_name == NULL) {
                while ((interface != NULL) && (bsd_name == NULL)) {
                        bsd_name = SCNetworkInterfaceGetBSDName(interface);
                        if (bsd_name == NULL) {
@@ -180,7 +240,7 @@ _find_interface(char *match)
                SCNetworkInterfaceRef   interface;
                CFStringRef             interfaceType;
 
                SCNetworkInterfaceRef   interface;
                CFStringRef             interfaceType;
 
-               interface = CFArrayGetValueAtIndex(interfaces, i);
+               interface = CFArrayGetValueAtIndex(myInterfaces, i);
                interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
                if (CFEqual(select_name, interfaceType)) {
                        if (selected == NULL) {
                interfaceType = SCNetworkInterfaceGetInterfaceType(interface);
                if (CFEqual(select_name, interfaceType)) {
                        if (selected == NULL) {
@@ -200,7 +260,7 @@ _find_interface(char *match)
 
        if (allowIndex) {
                char    *end;
 
        if (allowIndex) {
                char    *end;
-               char    *str    = match;
+               char    *str    = argv[0];
                long    val;
 
                // try to select the interface by its index
                long    val;
 
                // try to select the interface by its index
@@ -211,7 +271,7 @@ _find_interface(char *match)
                    ((*end == '\0') || (*end == '.')) &&
                    (errno == 0)) {
                        if ((val > 0) && (val <= n)) {
                    ((*end == '\0') || (*end == '.')) &&
                    (errno == 0)) {
                        if ((val > 0) && (val <= n)) {
-                               selected = CFArrayGetValueAtIndex(interfaces, val - 1);
+                               selected = CFArrayGetValueAtIndex(myInterfaces, val - 1);
 
                                if (*end == '.') {
                                        str = end + 1;
 
                                if (*end == '.') {
                                        str = end + 1;
@@ -260,36 +320,39 @@ create_interface(int argc, char **argv)
        }
 
        interfaceType = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
        }
 
        interfaceType = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+       argv++;
+       argc--;
 
 
+#if    !TARGET_OS_IPHONE
+       if (CFEqual(interfaceType, kSCNetworkInterfaceTypeBond)) {
+               SCPrint(TRUE, stdout, CFSTR("bond creation not yet supported\n"));
+               goto done;
+       }
        if (CFEqual(interfaceType, kSCNetworkInterfaceTypeVLAN)) {
        if (CFEqual(interfaceType, kSCNetworkInterfaceTypeVLAN)) {
-// xxxxx
-SCPrint(TRUE, stdout, CFSTR("vlan creation not yet supported\n"));
-goto done;
-       } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeBond)) {
-// xxxxx
-SCPrint(TRUE, stdout, CFSTR("bond creation not yet supported\n"));
-goto done;
-       } else {
-               if (argc < 2) {
-                       if (net_interface == NULL) {
-                               SCPrint(TRUE, stdout, CFSTR("no network interface selected\n"));
-                               goto done;
-                       }
+               SCPrint(TRUE, stdout, CFSTR("vlan creation not yet supported\n"));
+               goto done;
+       }
+#endif // !TARGET_OS_IPHONE
 
 
-                       interface = net_interface;
-               } else {
-                       interface = _find_interface(argv[1]);
+       if (argc < 1) {
+               if (net_interface == NULL) {
+                       SCPrint(TRUE, stdout, CFSTR("no network interface selected\n"));
+                       goto done;
                }
 
                }
 
-               if (interface == NULL) {
-                       return;
-               }
+               interface = net_interface;
+       } else {
+               interface = _find_interface(argc, argv, NULL);
+       }
 
 
-               new_interface = SCNetworkInterfaceCreateWithInterface(interface, interfaceType);
-               if (new_interface == NULL) {
-                       SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
-                       goto done;
-               }
+       if (interface == NULL) {
+               goto done;
+       }
+
+       new_interface = SCNetworkInterfaceCreateWithInterface(interface, interfaceType);
+       if (new_interface == NULL) {
+               SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
+               goto done;
        }
 
        if (new_interfaces == NULL) {
        }
 
        if (new_interfaces == NULL) {
@@ -325,8 +388,7 @@ select_interface(int argc, char **argv)
 {
        SCNetworkInterfaceRef   interface;
 
 {
        SCNetworkInterfaceRef   interface;
 
-       interface = _find_interface(argv[0]);
-
+       interface = _find_interface(argc, argv, NULL);
        if (interface != NULL) {
                CFStringRef     interfaceName;
 
        if (interface != NULL) {
                CFStringRef     interfaceName;
 
@@ -410,7 +472,7 @@ _show_interface(SCNetworkInterfaceRef interface, CFStringRef prefix, Boolean sho
                                }
                        }
 
                                }
                        }
 
-                       SCPrint(TRUE, stdout, CFSTR("%@  mtu                %c = %ld (%ld < n < %ld)\n"),
+                       SCPrint(TRUE, stdout, CFSTR("%@  mtu                %c = %d (%d < n < %d)\n"),
                                prefix,
                                isCurrent,
                                mtu_cur,
                                prefix,
                                isCurrent,
                                mtu_cur,
@@ -527,6 +589,7 @@ _show_interface(SCNetworkInterfaceRef interface, CFStringRef prefix, Boolean sho
                                        }
                                        CFRelease(subtype_options);
                                }
                                        }
                                        CFRelease(subtype_options);
                                }
+                               if (subtypes != NULL) CFRelease(subtypes);
                        }
                } else {
                        SCPrint(TRUE, stdout, CFSTR("\n"));
                        }
                } else {
                        SCPrint(TRUE, stdout, CFSTR("\n"));
@@ -582,6 +645,27 @@ _show_interface(SCNetworkInterfaceRef interface, CFStringRef prefix, Boolean sho
                CFRelease(effective);
        }
 
                CFRelease(effective);
        }
 
+       if (CFEqual(if_type, kSCNetworkInterfaceTypePPP)) {
+               SCNetworkInterfaceRef   childInterface;
+
+               childInterface = SCNetworkInterfaceGetInterface(interface);
+               if (childInterface != NULL) {
+                       CFStringRef     childInterfaceType;
+
+                       childInterfaceType = SCNetworkInterfaceGetInterfaceType(childInterface);
+                       if (CFEqual(childInterfaceType, kSCNetworkInterfaceTypeL2TP)) {
+                               CFDictionaryRef         ipsec_configuration;
+
+                               ipsec_configuration = SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetIPSec);
+                               if (isA_CFDictionary(ipsec_configuration) &&
+                                   (CFDictionaryGetCount(ipsec_configuration) > 0)) {
+                                       SCPrint(TRUE, stdout, CFSTR("\n%@  per-interface IPSec configuration\n"), prefix);
+                                       _show_entity(ipsec_configuration, prefix);
+                               }
+                       }
+               }
+       }
+
        if (_sc_debug) {
                SCPrint(TRUE, stdout, CFSTR("\n%@\n"), interface);
        }
        if (_sc_debug) {
                SCPrint(TRUE, stdout, CFSTR("\n%@\n"), interface);
        }
@@ -756,7 +840,11 @@ show_interfaces(int argc, char **argv)
 }
 
 
 }
 
 
-/* -------------------- */
+#pragma mark -
+#pragma mark Bond options
+
+
+#if    !TARGET_OS_IPHONE
 
 
 static options bondOptions[] = {
 
 
 static options bondOptions[] = {
@@ -796,7 +884,11 @@ set_interface_bond(int argc, char **argv, CFMutableDictionaryRef newConfiguratio
 }
 
 
 }
 
 
-/* -------------------- */
+#endif // !TARGET_OS_IPHONE
+
+
+#pragma mark -
+#pragma mark AirPort options
 
 
 static options airportOptions[] = {
 
 
 static options airportOptions[] = {
@@ -836,7 +928,8 @@ set_interface_airport(int argc, char **argv, CFMutableDictionaryRef newConfigura
 }
 
 
 }
 
 
-/* -------------------- */
+#pragma mark -
+#pragma mark Ethernet options
 
 
 static options ethernetOptions[] = {
 
 
 static options ethernetOptions[] = {
@@ -876,7 +969,376 @@ set_interface_ethernet(int argc, char **argv, CFMutableDictionaryRef newConfigur
 }
 
 
 }
 
 
-/* -------------------- */
+#pragma mark -
+#pragma mark IPSec options
+
+
+static void
+replaceOne(const void *key, const void *value, void *context)
+{
+       CFMutableDictionaryRef  newConfiguration        = (CFMutableDictionaryRef)context;
+
+       CFDictionarySetValue(newConfiguration, key, value);
+       return;
+}
+
+
+static void
+updateInterfaceConfiguration(CFMutableDictionaryRef newConfiguration)
+{
+       CFDictionaryRef configuration;
+
+       CFDictionaryRemoveAllValues(newConfiguration);
+
+       configuration = SCNetworkInterfaceGetConfiguration(net_interface);
+       if (configuration != NULL) {
+               CFDictionaryApplyFunction(configuration, replaceOne, (void *)newConfiguration);
+       }
+
+       return;
+}
+
+
+static int
+__doIPSecSharedSecret(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
+{
+       if (argc < 1) {
+               SCPrint(TRUE, stdout, CFSTR("IPSec shared secret not specified\n"));
+               return -1;
+       }
+
+       if (strlen(argv[0]) > 0) {
+               CFStringRef     encryptionType;
+
+               encryptionType = CFDictionaryGetValue(newConfiguration, kSCPropNetIPSecSharedSecretEncryption);
+               if (encryptionType == NULL) {
+                       CFIndex                 n;
+                       CFMutableDataRef        pw;
+                       CFStringRef             str;
+
+                       str = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+                       n = CFStringGetLength(str);
+                       pw = CFDataCreateMutable(NULL, n * sizeof(UniChar));
+                       CFDataSetLength(pw, n * sizeof(UniChar));
+                       CFStringGetCharacters(str,
+                                             CFRangeMake(0, n),
+                                             (UniChar *)CFDataGetMutableBytePtr(pw));
+                       CFRelease(str);
+
+                       CFDictionarySetValue(newConfiguration, key, pw);
+                       CFRelease(pw);
+               } else if (CFEqual(encryptionType, kSCValNetIPSecSharedSecretEncryptionKeychain)) {
+                       Boolean         ok;
+                       CFDataRef       pw;
+                       CFStringRef     str;
+
+                       str = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+                       pw = CFStringCreateExternalRepresentation(NULL, str, kCFStringEncodingUTF8, 0);
+                       ok = SCNetworkInterfaceSetPassword(net_interface,
+                                                          kSCNetworkInterfacePasswordTypeIPSecSharedSecret,
+                                                          pw,
+                                                          NULL);
+                       CFRelease(pw);
+                       CFRelease(str);
+                       if (ok) {
+                               updateInterfaceConfiguration(newConfiguration);
+                       } else {
+                               return -1;
+                       }
+               } else {
+                       SCPrint(TRUE, stdout, CFSTR("IPSec shared secret type \"%@\" not supported\n"), encryptionType);
+                       return -1;
+               }
+       } else {
+               CFDictionaryRemoveValue(newConfiguration, key);
+       }
+
+       return 1;
+}
+
+
+static int
+__doIPSecSharedSecretType(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
+{
+       if (argc < 1) {
+               SCPrint(TRUE, stdout, CFSTR("IPSec shared secret type mode not specified\n"));
+               return -1;
+       }
+
+       if (strlen(argv[0]) > 0) {
+               if (strcasecmp(argv[0], "keychain") == 0) {
+                       CFDictionarySetValue(newConfiguration, key, kSCValNetIPSecSharedSecretEncryptionKeychain);
+               } else {
+                       SCPrint(TRUE, stdout, CFSTR("invalid shared secret type\n"));
+                       return -1;
+               }
+       } else {
+               CFDictionaryRemoveValue(newConfiguration, key);
+       }
+
+       // encryption type changed, reset shared secret
+       CFDictionaryRemoveValue(newConfiguration, kSCPropNetIPSecSharedSecret);
+
+       return 1;
+}
+
+
+static int
+__doIPSecXAuthPassword(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
+{
+       if (argc < 1) {
+               SCPrint(TRUE, stdout, CFSTR("IPSec XAuth password not specified\n"));
+               return -1;
+       }
+
+       if (strlen(argv[0]) > 0) {
+               CFStringRef     encryptionType;
+
+               encryptionType = CFDictionaryGetValue(newConfiguration, kSCPropNetIPSecXAuthPasswordEncryption);
+               if (encryptionType == NULL) {
+                       CFIndex                 n;
+                       CFMutableDataRef        pw;
+                       CFStringRef             str;
+
+                       str = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+                       n = CFStringGetLength(str);
+                       pw = CFDataCreateMutable(NULL, n * sizeof(UniChar));
+                       CFDataSetLength(pw, n * sizeof(UniChar));
+                       CFStringGetCharacters(str,
+                                             CFRangeMake(0, n),
+                                             (UniChar *)CFDataGetMutableBytePtr(pw));
+                       CFRelease(str);
+
+                       CFDictionarySetValue(newConfiguration, key, pw);
+                       CFRelease(pw);
+               } else if (CFEqual(encryptionType, kSCValNetIPSecXAuthPasswordEncryptionKeychain)) {
+                       Boolean         ok;
+                       CFDataRef       pw;
+                       CFStringRef     str;
+
+                       str = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+                       pw = CFStringCreateExternalRepresentation(NULL, str, kCFStringEncodingUTF8, 0);
+                       ok = SCNetworkInterfaceSetPassword(net_interface,
+                                                          kSCNetworkInterfacePasswordTypeIPSecXAuth,
+                                                          pw,
+                                                          NULL);
+                       CFRelease(pw);
+                       CFRelease(str);
+                       if (ok) {
+                               updateInterfaceConfiguration(newConfiguration);
+                       } else {
+                               return -1;
+                       }
+               } else {
+                       SCPrint(TRUE, stdout, CFSTR("IPSec XAuthPassword type \"%@\" not supported\n"), encryptionType);
+                       return -1;
+               }
+       } else {
+               CFDictionaryRemoveValue(newConfiguration, key);
+       }
+
+       return 1;
+}
+
+
+static int
+__doIPSecXAuthPasswordType(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
+{
+       if (argc < 1) {
+               SCPrint(TRUE, stdout, CFSTR("IPSec XAuth password type mode not specified\n"));
+               return -1;
+       }
+
+       if (strlen(argv[0]) > 0) {
+               if (strcasecmp(argv[0], "keychain") == 0) {
+                       CFDictionarySetValue(newConfiguration, key, kSCValNetIPSecXAuthPasswordEncryptionKeychain);
+               } else {
+                       SCPrint(TRUE, stdout, CFSTR("invalid XAuth password type\n"));
+                       return -1;
+               }
+       } else {
+               CFDictionaryRemoveValue(newConfiguration, key);
+       }
+
+       // encryption type changed, reset XAuthPassword
+       CFDictionaryRemoveValue(newConfiguration, kSCPropNetIPSecXAuthPassword);
+
+       return 1;
+}
+
+
+static CFStringRef
+__cleanupDomainName(CFStringRef domain)
+{
+       CFMutableStringRef      newDomain;
+
+       newDomain = CFStringCreateMutableCopy(NULL, 0, domain);
+       CFStringTrimWhitespace(newDomain);
+       CFStringTrim(newDomain, CFSTR("."));
+       if (CFStringGetLength(newDomain) == 0) {
+               CFRelease(newDomain);
+               newDomain = NULL;
+       }
+
+       return newDomain;
+}
+
+
+static int
+__doOnDemandDomains(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
+{
+       CFMutableArrayRef       domains;
+
+       if (argc < 1) {
+               SCPrint(TRUE, stdout, CFSTR("OnDemand domain name(s) not specified\n"));
+               return -1;
+       }
+
+       domains = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+
+       if (strlen(argv[0]) > 0) {
+               CFArrayRef      array;
+               CFStringRef     str;
+
+               str = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+               array = CFStringCreateArrayBySeparatingStrings(NULL, str, CFSTR(","));
+               CFRelease(str);
+
+               if (array != NULL) {
+                       CFIndex i;
+                       CFIndex n       = CFArrayGetCount(array);
+
+                       for (i = 0; i < n; i++) {
+                               CFStringRef     domain;
+
+                               domain = __cleanupDomainName(CFArrayGetValueAtIndex(array, i));
+                               if (domain != NULL) {
+                                       CFArrayAppendValue(domains, domain);
+                                       CFRelease(domain);
+                               } else {
+                                       CFRelease(array);
+                                       CFRelease(domains);
+                                       SCPrint(TRUE, stdout, CFSTR("invalid OnDemand domain name\n"));
+                                       return -1;
+                               }
+                       }
+                       CFRelease(array);
+               }
+       }
+
+       if (CFArrayGetCount(domains) > 0) {
+               CFDictionarySetValue(newConfiguration, key, domains);
+       } else {
+               CFDictionaryRemoveValue(newConfiguration, key);
+       }
+
+       CFRelease(domains);
+       return 1;
+}
+
+
+static options ipsecOnDemandOptions[] = {
+       { "OnDemandMatchDomainsAlways" , "domain", isOther  , &kSCPropNetIPSecOnDemandMatchDomainsAlways , __doOnDemandDomains, NULL },
+       {   "always"                   , "domain", isOther  , &kSCPropNetIPSecOnDemandMatchDomainsAlways , __doOnDemandDomains, NULL },
+       { "OnDemandMatchDomainsOnRetry", "domain", isOther  , &kSCPropNetIPSecOnDemandMatchDomainsOnRetry, __doOnDemandDomains, NULL },
+       {   "retry"                    , "domain", isOther  , &kSCPropNetIPSecOnDemandMatchDomainsOnRetry, __doOnDemandDomains, NULL },
+       { "OnDemandMatchDomainsNever"  , "domain", isOther  , &kSCPropNetIPSecOnDemandMatchDomainsNever  , __doOnDemandDomains, NULL },
+       {   "never"                    , "domain", isOther  , &kSCPropNetIPSecOnDemandMatchDomainsNever  , __doOnDemandDomains, NULL },
+
+       { "?"                          , NULL    , isHelp , NULL                                       , NULL               ,
+           "\nOnDemandMatch configuration commands\n\n"
+           " set interface OnDemandMatch always domain-name[,domain-name]\n"
+           " set interface OnDemandMatch retry  domain-name[,domain-name]\n"
+           " set interface OnDemandMatch never  domain-name[,domain-name]\n"
+       }
+};
+#define        N_IPSEC_ONDEMAND_OPTIONS        (sizeof(ipsecOnDemandOptions) / sizeof(ipsecOnDemandOptions[0]))
+
+
+static int
+__doIPSecOnDemandMatch(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
+{
+       Boolean ok;
+
+       if (argc < 1) {
+               SCPrint(TRUE, stdout, CFSTR("set what?\n"));
+               return -1;
+       }
+
+       ok = _process_options(ipsecOnDemandOptions, N_IPSEC_ONDEMAND_OPTIONS, argc, argv, newConfiguration);
+       if (!ok) {
+               goto done;
+       }
+
+    done :
+
+       return argc;
+}
+
+
+static selections ipsecAuthenticationMethodSelections[] = {
+       { CFSTR("SharedSecret"), &kSCValNetIPSecAuthenticationMethodSharedSecret, 0 },
+       { CFSTR("Certificate") , &kSCValNetIPSecAuthenticationMethodCertificate , 0 },
+       { CFSTR("Hybrid")      , &kSCValNetIPSecAuthenticationMethodHybrid      , 0 },
+       { NULL                 , NULL                                           , 0 }
+};
+
+
+static selections ipsecLocalIdentifierTypeSelections[] = {
+       { CFSTR("KeyID")       , &kSCValNetIPSecLocalIdentifierTypeKeyID        , 0 },
+       { NULL                 , NULL                                           , 0 }
+};
+
+
+static options ipsecOptions[] = {
+       { "AuthenticationMethod"   , NULL, isChooseOne  , &kSCPropNetIPSecAuthenticationMethod   , NULL                      , (void *)ipsecAuthenticationMethodSelections },
+       { "LocalIdentifier"        , NULL, isString     , &kSCPropNetIPSecLocalIdentifier        , NULL                      , NULL                                        },
+       {   "group"                , NULL, isString     , &kSCPropNetIPSecLocalIdentifier        , NULL                      , NULL                                        },
+       { "LocalIdentifierType"    , NULL, isChooseOne  , &kSCPropNetIPSecLocalIdentifierType    , NULL                      , (void *)ipsecLocalIdentifierTypeSelections  },
+       { "RemoteAddress"          , NULL, isString     , &kSCPropNetIPSecRemoteAddress          , NULL                      , NULL                                        },
+       { "SharedSecret"           , NULL, isOther      , &kSCPropNetIPSecSharedSecret           , __doIPSecSharedSecret     , NULL                                        },
+       { "SharedSecretEncryption" , NULL, isOther      , &kSCPropNetIPSecSharedSecretEncryption , __doIPSecSharedSecretType , NULL                                        },
+
+       // --- XAuth: ---
+       { "XAuthEnabled"           , NULL, isBoolean    , &kSCPropNetIPSecXAuthEnabled           , NULL                      , NULL                                        },
+       { "XAuthName"              , NULL, isString     , &kSCPropNetIPSecXAuthName              , NULL                      , NULL                                        },
+       { "XAuthPassword"          , NULL, isOther      , &kSCPropNetIPSecXAuthPassword          , __doIPSecXAuthPassword    , NULL                                        },
+       { "XAuthPasswordEncryption", NULL, isOther      , &kSCPropNetIPSecXAuthPasswordEncryption, __doIPSecXAuthPasswordType, NULL                                        },
+
+       // --- OnDemand: ---
+       { "OnDemandEnabled"        , NULL, isBoolean    , &kSCPropNetIPSecOnDemandEnabled        , NULL                      , NULL },
+       { "OnDemandMatch"          , NULL, isOther      , NULL                                   , __doIPSecOnDemandMatch    , NULL },
+
+       { "?"         , NULL , isHelp     , NULL                            , NULL,
+               "\nIPSec configuration commands\n\n"
+               " set interface [AuthenticationMethod {SharedSecret|Certificate|Hybrid}]\n"
+               " set interface [LocalIdentifier group]\n"
+               " set interface [LocalIdentifierType {KeyID}]\n"
+               " set interface [RemoteAddress name-or-address]\n"
+               " set interface [SharedSecret secret]\n"
+               " set interface [SharedSecretEncryption {Keychain}]\n"
+               " set interface [XAuthEnabled {enable|disable}]\n"
+               " set interface [XAuthPassword password]\n"
+               " set interface [XAuthPasswordEncryption {Keychain}]\n"
+               " set interface [OnDemandEnabled {enable|disable}]\n"
+               " set interface [OnDemandMatch <match-options>]\n"
+       }
+};
+#define        N_IPSEC_OPTIONS (sizeof(ipsecOptions) / sizeof(ipsecOptions[0]))
+
+
+static Boolean
+set_interface_ipsec(int argc, char **argv, CFMutableDictionaryRef newConfiguration)
+{
+       Boolean         ok;
+
+       ok = _process_options(ipsecOptions, N_IPSEC_OPTIONS, argc, argv, newConfiguration);
+       return ok;
+}
+
+
+#pragma mark -
+#pragma mark FireWire options
 
 
 static options firewireOptions[] = {
 
 
 static options firewireOptions[] = {
@@ -916,7 +1378,8 @@ set_interface_firewire(int argc, char **argv, CFMutableDictionaryRef newConfigur
 }
 
 
 }
 
 
-/* -------------------- */
+#pragma mark -
+#pragma mark Modem options
 
 
 static selections modemDialSelections[] = {
 
 
 static selections modemDialSelections[] = {
@@ -951,7 +1414,7 @@ static options modemOptions[] = {
            " set interface [HoldReminder {enable|disable}]\n"
            " set interface [HoldReminderTime n]\n"
            " set interface [PulseDial {enable|disable}]\n"
            " set interface [HoldReminder {enable|disable}]\n"
            " set interface [HoldReminderTime n]\n"
            " set interface [PulseDial {enable|disable}]\n"
-           " set interface [Speaker {enable|disable}]"
+           " set interface [Speaker {enable|disable}]\n"
        }
 };
 #define        N_MODEM_OPTIONS (sizeof(modemOptions) / sizeof(modemOptions[0]))
        }
 };
 #define        N_MODEM_OPTIONS (sizeof(modemOptions) / sizeof(modemOptions[0]))
@@ -967,7 +1430,8 @@ set_interface_modem(int argc, char **argv, CFMutableDictionaryRef newConfigurati
 }
 
 
 }
 
 
-/* -------------------- */
+#pragma mark -
+#pragma mark PPP options
 
 
 static int
 
 
 static int
@@ -1036,6 +1500,123 @@ __doPPPAuthPWType(CFStringRef key, const char *description, void *info, int argc
 }
 
 
 }
 
 
+static options l2tp_ipsecOptions[] = {
+       { "SharedSecret"          , NULL, isOther      , &kSCPropNetIPSecSharedSecret          , __doIPSecSharedSecret    , NULL                                        },
+       { "SharedSecretEncryption", NULL, isOther      , &kSCPropNetIPSecSharedSecretEncryption, __doIPSecSharedSecretType, NULL                                        },
+
+       { "?"         , NULL , isHelp     , NULL                            , NULL,
+               "\nIPSec configuration commands\n\n"
+               " set interface ipsec [SharedSecret secret]\n"
+               " set interface ipsec [SharedSecretEncryption {Keychain}]\n"
+       }
+};
+#define        N_L2TP_IPSEC_OPTIONS    (sizeof(l2tp_ipsecOptions) / sizeof(l2tp_ipsecOptions[0]))
+
+
+static int
+__doPPPIPSec(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newPPPConfiguration)
+{
+       SCNetworkInterfaceRef   childInterface;
+       CFStringRef             childInterfaceType;
+       CFDictionaryRef         configuration;
+       CFMutableDictionaryRef  newConfiguration;
+       Boolean                 ok;
+
+       if (argc < 1) {
+               SCPrint(TRUE, stdout, CFSTR("set what?\n"));
+               return -1;
+       }
+
+       childInterface = SCNetworkInterfaceGetInterface(net_interface);
+       if (childInterface == NULL) {
+               SCPrint(TRUE, stdout, CFSTR("this interfaces configuration cannot be changed\n"));
+               return -1;
+       }
+
+       childInterfaceType = SCNetworkInterfaceGetInterfaceType(childInterface);
+       if (!CFEqual(childInterfaceType, kSCNetworkInterfaceTypeL2TP)) {
+               SCPrint(TRUE, stdout, CFSTR("this interfaces configuration cannot be changed\n"));
+               return -1;
+       }
+
+       configuration = SCNetworkInterfaceGetExtendedConfiguration(net_interface, kSCEntNetIPSec);
+       if (configuration == NULL) {
+               newConfiguration = CFDictionaryCreateMutable(NULL,
+                                                            0,
+                                                            &kCFTypeDictionaryKeyCallBacks,
+                                                            &kCFTypeDictionaryValueCallBacks);
+       } else {
+               newConfiguration = CFDictionaryCreateMutableCopy(NULL, 0, configuration);
+               CFDictionaryRemoveValue(newConfiguration, kSCResvInactive);
+       }
+
+       ok = _process_options(l2tp_ipsecOptions, N_L2TP_IPSEC_OPTIONS, argc, argv, newConfiguration);
+       if (!ok) {
+               goto done;
+       }
+
+       if (((configuration == NULL) && (CFDictionaryGetCount(newConfiguration) > 0)) ||
+           ((configuration != NULL) && !CFEqual(configuration, newConfiguration))) {
+               if (!SCNetworkInterfaceSetExtendedConfiguration(net_interface, kSCEntNetIPSec, newConfiguration)) {
+                       if (SCError() == kSCStatusNoKey) {
+                               SCPrint(TRUE, stdout, CFSTR("could not update per-service interface configuration\n"));
+                       } else {
+                               SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
+                       }
+                       goto done;
+               }
+
+               _prefs_changed = TRUE;
+       }
+
+    done :
+
+       if (newConfiguration != NULL) CFRelease(newConfiguration);
+       return argc;
+}
+
+
+#ifdef NOTYET
+static options pppOnDemandOptions[] = {
+       { "OnDemandMatchDomainsAlways" , "domain", isOther  , &kSCPropNetPPPOnDemandMatchDomainsAlways , __doOnDemandDomains, NULL },
+       {   "always"                   , "domain", isOther  , &kSCPropNetPPPOnDemandMatchDomainsAlways , __doOnDemandDomains, NULL },
+       { "OnDemandMatchDomainsOnRetry", "domain", isOther  , &kSCPropNetPPPOnDemandMatchDomainsOnRetry, __doOnDemandDomains, NULL },
+       {   "retry"                    , "domain", isOther  , &kSCPropNetPPPOnDemandMatchDomainsOnRetry, __doOnDemandDomains, NULL },
+       { "OnDemandMatchDomainsNever"  , "domain", isOther  , &kSCPropNetPPPOnDemandMatchDomainsNever  , __doOnDemandDomains, NULL },
+       {   "never"                    , "domain", isOther  , &kSCPropNetPPPOnDemandMatchDomainsNever  , __doOnDemandDomains, NULL },
+
+       { "?"                          , NULL    , isHelp , NULL                                     , NULL               ,
+           "\nOnDemandMatch configuration commands\n\n"
+           " set interface OnDemand always domain-name[,domain-name]\n"
+           " set interface OnDemand retry  domain-name[,domain-name]\n"
+           " set interface OnDemand never  domain-name[,domain-name]\n"
+       }
+};
+#define        N_PPP_ONDEMAND_OPTIONS  (sizeof(pppOnDemandOptions) / sizeof(pppOnDemandOptions[0]))
+
+
+static int
+__doPPPOnDemandMatch(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
+{
+       Boolean ok;
+
+       if (argc < 1) {
+               SCPrint(TRUE, stdout, CFSTR("set what?\n"));
+               return -1;
+       }
+
+       ok = _process_options(pppOnDemandOptions, N_PPP_ONDEMAND_OPTIONS, argc, argv, newConfiguration);
+       if (!ok) {
+               goto done;
+       }
+
+    done :
+
+       return argc;
+}
+#endif // NOTYET
+
+
 static selections authPromptSelections[] = {
        { CFSTR("before"), &kSCValNetPPPAuthPromptBefore, 0 },
        { CFSTR("after") , &kSCValNetPPPAuthPromptAfter , 0 },
 static selections authPromptSelections[] = {
        { CFSTR("before"), &kSCValNetPPPAuthPromptBefore, 0 },
        { CFSTR("after") , &kSCValNetPPPAuthPromptAfter , 0 },
@@ -1054,67 +1635,76 @@ static selections authProtocolSelections[] = {
 
 
 static options pppOptions[] = {
 
 
 static options pppOptions[] = {
-       { "ACSP"                      , NULL          , isBoolean        , &kSCPropNetPPPACSPEnabled               , NULL             , NULL                           },
-       { "ConnectTime"               , "?time"       , isNumber         , &kSCPropNetPPPConnectTime               , NULL             , NULL                           },
-       { "DialOnDemand"              , NULL          , isBoolean        , &kSCPropNetPPPDialOnDemand              , NULL             , NULL                           },
-       { "DisconnectOnFastUserSwitch", NULL          , isBoolean        , &kSCPropNetPPPDisconnectOnFastUserSwitch, NULL             , NULL                           },
-       { "DisconnectOnIdle"          , NULL          , isBoolean        , &kSCPropNetPPPDisconnectOnIdle          , NULL             , NULL                           },
-       { "DisconnectOnIdleTimer"     , "timeout"     , isNumber         , &kSCPropNetPPPDisconnectOnIdleTimer     , NULL             , NULL                           },
-       { "DisconnectOnLogout"        , NULL          , isBoolean        , &kSCPropNetPPPDisconnectOnLogout        , NULL             , NULL                           },
-       { "DisconnectOnSleep"         , NULL          , isBoolean        , &kSCPropNetPPPDisconnectOnSleep         , NULL             , NULL                           },
-       { "DisconnectTime"            , "?time"       , isNumber         , &kSCPropNetPPPDisconnectTime            , NULL             , NULL                           },
-       { "IdleReminder"              , NULL          , isBoolean        , &kSCPropNetPPPIdleReminder              , NULL             , NULL                           },
-       { "IdleReminderTimer"         , "time"        , isNumber         , &kSCPropNetPPPIdleReminderTimer         , NULL             , NULL                           },
-       { "Logfile"                   , "path"        , isString         , &kSCPropNetPPPLogfile                   , NULL             , NULL                           },
-       { "Plugins"                   , "plugin"      , isStringArray    , &kSCPropNetPPPPlugins                   , NULL             , NULL                           },
-       { "RetryConnectTime"          , "time"        , isNumber         , &kSCPropNetPPPRetryConnectTime          , NULL             , NULL                           },
-       { "SessionTimer"              , "time"        , isNumber         , &kSCPropNetPPPSessionTimer              , NULL             , NULL                           },
-       { "UseSessionTimer"           , NULL          , isBoolean        , &kSCPropNetPPPUseSessionTimer           , NULL             , NULL                           },
-       { "VerboseLogging"            , NULL          , isBoolean        , &kSCPropNetPPPVerboseLogging            , NULL             , NULL                           },
+       { "ACSP"                      , NULL          , isBoolean        , &kSCPropNetPPPACSPEnabled               , NULL                , NULL                           },
+       { "ConnectTime"               , "?time"       , isNumber         , &kSCPropNetPPPConnectTime               , NULL                , NULL                           },
+       { "DialOnDemand"              , NULL          , isBoolean        , &kSCPropNetPPPDialOnDemand              , NULL                , NULL                           },
+       { "DisconnectOnFastUserSwitch", NULL          , isBoolean        , &kSCPropNetPPPDisconnectOnFastUserSwitch, NULL                , NULL                           },
+       { "DisconnectOnIdle"          , NULL          , isBoolean        , &kSCPropNetPPPDisconnectOnIdle          , NULL                , NULL                           },
+       { "DisconnectOnIdleTimer"     , "timeout"     , isNumber         , &kSCPropNetPPPDisconnectOnIdleTimer     , NULL                , NULL                           },
+       { "DisconnectOnLogout"        , NULL          , isBoolean        , &kSCPropNetPPPDisconnectOnLogout        , NULL                , NULL                           },
+       { "DisconnectOnSleep"         , NULL          , isBoolean        , &kSCPropNetPPPDisconnectOnSleep         , NULL                , NULL                           },
+       { "DisconnectTime"            , "?time"       , isNumber         , &kSCPropNetPPPDisconnectTime            , NULL                , NULL                           },
+       { "IdleReminder"              , NULL          , isBoolean        , &kSCPropNetPPPIdleReminder              , NULL                , NULL                           },
+       { "IdleReminderTimer"         , "time"        , isNumber         , &kSCPropNetPPPIdleReminderTimer         , NULL                , NULL                           },
+       { "Logfile"                   , "path"        , isString         , &kSCPropNetPPPLogfile                   , NULL                , NULL                           },
+       { "Plugins"                   , "plugin"      , isStringArray    , &kSCPropNetPPPPlugins                   , NULL                , NULL                           },
+       { "RetryConnectTime"          , "time"        , isNumber         , &kSCPropNetPPPRetryConnectTime          , NULL                , NULL                           },
+       { "SessionTimer"              , "time"        , isNumber         , &kSCPropNetPPPSessionTimer              , NULL                , NULL                           },
+       { "UseSessionTimer"           , NULL          , isBoolean        , &kSCPropNetPPPUseSessionTimer           , NULL                , NULL                           },
+       { "VerboseLogging"            , NULL          , isBoolean        , &kSCPropNetPPPVerboseLogging            , NULL                , NULL                           },
 
        // --- Auth: ---
 
        // --- Auth: ---
-       { "AuthEAPPlugins"            , "plugin"      , isStringArray    , &kSCPropNetPPPAuthEAPPlugins            , NULL             , NULL                           },
-       { "AuthName"                  , "account"     , isString         , &kSCPropNetPPPAuthName                  , NULL             , NULL                           },
-       {   "Account"                 , "account"     , isString         , &kSCPropNetPPPAuthName                  , NULL             , NULL                           },
-       { "AuthPassword"              , "password"    , isOther          , &kSCPropNetPPPAuthPassword              , __doPPPAuthPW    , NULL                           },
-       {   "Password"                , "password"    , isOther          , &kSCPropNetPPPAuthPassword              , __doPPPAuthPW    , NULL                           },
-       { "AuthPasswordEncryption"    , "type"        , isOther          , &kSCPropNetPPPAuthPasswordEncryption    , __doPPPAuthPWType, NULL                           },
-       { "AuthPrompt"                , "before/after", isChooseOne      , &kSCPropNetPPPAuthPrompt                , NULL             , (void *)authPromptSelections   },
-       { "AuthProtocol"              , "protocol"    , isChooseMultiple , &kSCPropNetPPPAuthProtocol              , NULL             , (void *)authProtocolSelections },
+       { "AuthEAPPlugins"            , "plugin"      , isStringArray    , &kSCPropNetPPPAuthEAPPlugins            , NULL                , NULL                           },
+       { "AuthName"                  , "account"     , isString         , &kSCPropNetPPPAuthName                  , NULL                , NULL                           },
+       {   "Account"                 , "account"     , isString         , &kSCPropNetPPPAuthName                  , NULL                , NULL                           },
+       { "AuthPassword"              , "password"    , isOther          , &kSCPropNetPPPAuthPassword              , __doPPPAuthPW       , NULL                           },
+       {   "Password"                , "password"    , isOther          , &kSCPropNetPPPAuthPassword              , __doPPPAuthPW       , NULL                           },
+       { "AuthPasswordEncryption"    , "type"        , isOther          , &kSCPropNetPPPAuthPasswordEncryption    , __doPPPAuthPWType   , NULL                           },
+       { "AuthPrompt"                , "before/after", isChooseOne      , &kSCPropNetPPPAuthPrompt                , NULL                , (void *)authPromptSelections   },
+       { "AuthProtocol"              , "protocol"    , isChooseMultiple , &kSCPropNetPPPAuthProtocol              , NULL                , (void *)authProtocolSelections },
 
        // --- Comm: ---
 
        // --- Comm: ---
-       { "CommRemoteAddress"         , "phone#"      , isString         , &kSCPropNetPPPCommRemoteAddress         , NULL             , NULL                           },
-       { "CommAlternateRemoteAddress", "phone#"      , isString         , &kSCPropNetPPPCommAlternateRemoteAddress, NULL             , NULL                           },
-       { "CommConnectDelay"          , "time"        , isNumber         , &kSCPropNetPPPCommConnectDelay          , NULL             , NULL                           },
-       { "CommDisplayTerminalWindow" , NULL          , isBoolean        , &kSCPropNetPPPCommDisplayTerminalWindow , NULL             , NULL                           },
-       { "CommRedialCount"           , "retry count" , isNumber         , &kSCPropNetPPPCommRedialCount           , NULL             , NULL                           },
-       { "CommRedialEnabled"         , NULL          , isBoolean        , &kSCPropNetPPPCommRedialEnabled         , NULL             , NULL                           },
-       { "CommRedialInterval"        , "retry delay" , isNumber         , &kSCPropNetPPPCommRedialInterval        , NULL             , NULL                           },
-       { "CommTerminalScript"        , "script"      , isString         , &kSCPropNetPPPCommTerminalScript        , NULL             , NULL                           },
-       { "CommUseTerminalScript"     , NULL          , isBoolean        , &kSCPropNetPPPCommUseTerminalScript     , NULL             , NULL                           },
+       { "CommRemoteAddress"         , "phone#"      , isString         , &kSCPropNetPPPCommRemoteAddress         , NULL                , NULL                           },
+       { "CommAlternateRemoteAddress", "phone#"      , isString         , &kSCPropNetPPPCommAlternateRemoteAddress, NULL                , NULL                           },
+       { "CommConnectDelay"          , "time"        , isNumber         , &kSCPropNetPPPCommConnectDelay          , NULL                , NULL                           },
+       { "CommDisplayTerminalWindow" , NULL          , isBoolean        , &kSCPropNetPPPCommDisplayTerminalWindow , NULL                , NULL                           },
+       { "CommRedialCount"           , "retry count" , isNumber         , &kSCPropNetPPPCommRedialCount           , NULL                , NULL                           },
+       { "CommRedialEnabled"         , NULL          , isBoolean        , &kSCPropNetPPPCommRedialEnabled         , NULL                , NULL                           },
+       { "CommRedialInterval"        , "retry delay" , isNumber         , &kSCPropNetPPPCommRedialInterval        , NULL                , NULL                           },
+       { "CommTerminalScript"        , "script"      , isString         , &kSCPropNetPPPCommTerminalScript        , NULL                , NULL                           },
+       { "CommUseTerminalScript"     , NULL          , isBoolean        , &kSCPropNetPPPCommUseTerminalScript     , NULL                , NULL                           },
 
        // --- CCP: ---
 
        // --- CCP: ---
-       { "CCPEnabled"                , NULL          , isBoolean        , &kSCPropNetPPPCCPEnabled                , NULL             , NULL                           },
-       { "CCPMPPE40Enabled"          , NULL          , isBoolean        , &kSCPropNetPPPCCPMPPE40Enabled          , NULL             , NULL                           },
-       { "CCPMPPE128Enabled"         , NULL          , isBoolean        , &kSCPropNetPPPCCPMPPE128Enabled         , NULL             , NULL                           },
+       { "CCPEnabled"                , NULL          , isBoolean        , &kSCPropNetPPPCCPEnabled                , NULL                , NULL                           },
+       { "CCPMPPE40Enabled"          , NULL          , isBoolean        , &kSCPropNetPPPCCPMPPE40Enabled          , NULL                , NULL                           },
+       { "CCPMPPE128Enabled"         , NULL          , isBoolean        , &kSCPropNetPPPCCPMPPE128Enabled         , NULL                , NULL                           },
 
        // --- IPCP: ---
 
        // --- IPCP: ---
-       { "IPCPCompressionVJ"         , NULL          , isBoolean        , &kSCPropNetPPPIPCPCompressionVJ         , NULL             , NULL                           },
-       { "IPCPUsePeerDNS"            , NULL          , isBoolean        , &kSCPropNetPPPIPCPUsePeerDNS            , NULL             , NULL                           },
+       { "IPCPCompressionVJ"         , NULL          , isBoolean        , &kSCPropNetPPPIPCPCompressionVJ         , NULL                , NULL                           },
+       { "IPCPUsePeerDNS"            , NULL          , isBoolean        , &kSCPropNetPPPIPCPUsePeerDNS            , NULL                , NULL                           },
 
        // --- LCP: ---
 
        // --- LCP: ---
-       { "LCPEchoEnabled"            , NULL          , isBoolean        , &kSCPropNetPPPLCPEchoEnabled            , NULL             , NULL                           },
-       { "LCPEchoFailure"            , NULL          , isNumber         , &kSCPropNetPPPLCPEchoFailure            , NULL             , NULL                           },
-       { "LCPEchoInterval"           , NULL          , isNumber         , &kSCPropNetPPPLCPEchoInterval           , NULL             , NULL                           },
-       { "LCPCompressionACField"     , NULL          , isBoolean        , &kSCPropNetPPPLCPCompressionACField     , NULL             , NULL                           },
-       { "LCPCompressionPField"      , NULL          , isBoolean        , &kSCPropNetPPPLCPCompressionPField      , NULL             , NULL                           },
-       { "LCPMRU"                    , NULL          , isNumber         , &kSCPropNetPPPLCPMRU                    , NULL             , NULL                           },
-       { "LCPMTU"                    , NULL          , isNumber         , &kSCPropNetPPPLCPMTU                    , NULL             , NULL                           },
-       { "LCPReceiveACCM"            , NULL          , isNumber         , &kSCPropNetPPPLCPReceiveACCM            , NULL             , NULL                           },
-       { "LCPTransmitACCM"           , NULL          , isNumber         , &kSCPropNetPPPLCPTransmitACCM           , NULL             , NULL                           },
+       { "LCPEchoEnabled"            , NULL          , isBoolean        , &kSCPropNetPPPLCPEchoEnabled            , NULL                , NULL                           },
+       { "LCPEchoFailure"            , NULL          , isNumber         , &kSCPropNetPPPLCPEchoFailure            , NULL                , NULL                           },
+       { "LCPEchoInterval"           , NULL          , isNumber         , &kSCPropNetPPPLCPEchoInterval           , NULL                , NULL                           },
+       { "LCPCompressionACField"     , NULL          , isBoolean        , &kSCPropNetPPPLCPCompressionACField     , NULL                , NULL                           },
+       { "LCPCompressionPField"      , NULL          , isBoolean        , &kSCPropNetPPPLCPCompressionPField      , NULL                , NULL                           },
+       { "LCPMRU"                    , NULL          , isNumber         , &kSCPropNetPPPLCPMRU                    , NULL                , NULL                           },
+       { "LCPMTU"                    , NULL          , isNumber         , &kSCPropNetPPPLCPMTU                    , NULL                , NULL                           },
+       { "LCPReceiveACCM"            , NULL          , isNumber         , &kSCPropNetPPPLCPReceiveACCM            , NULL                , NULL                           },
+       { "LCPTransmitACCM"           , NULL          , isNumber         , &kSCPropNetPPPLCPTransmitACCM           , NULL                , NULL                           },
+
+       // --- IPSec: ---
+       { "IPSec"                     , NULL          , isOther          , NULL                                    , __doPPPIPSec        , NULL                           },
+
+#ifdef NOTYET
+       // --- OnDemand: ---
+       { "OnDemandEnabled"            , NULL         , isBoolean        , &kSCPropNetPPPOnDemandEnabled           , NULL                , NULL },
+       { "OnDemandMatch"              , NULL         , isOther          , NULL                                    , __doPPPOnDemandMatch, NULL },
+#endif // NOTYET
 
        // --- Help ---
 
        // --- Help ---
-       { "?"                         , NULL          , isHelp           , NULL                                    , NULL             ,
+       { "?"                         , NULL          , isHelp           , NULL                                    , NULL                ,
            "\nPPP configuration commands\n\n"
            " set interface [Account account]\n"
            " set interface [Password password]\n"
            "\nPPP configuration commands\n\n"
            " set interface [Account account]\n"
            " set interface [Password password]\n"
@@ -1124,7 +1714,12 @@ static options pppOptions[] = {
            " set interface [IdleReminderTimer time-in-seconds]\n"
            " set interface [DisconnectOnIdle {enable|disable}]\n"
            " set interface [DisconnectOnIdleTimer time-in-seconds]\n"
            " set interface [IdleReminderTimer time-in-seconds]\n"
            " set interface [DisconnectOnIdle {enable|disable}]\n"
            " set interface [DisconnectOnIdleTimer time-in-seconds]\n"
-           " set interface [DisconnectOnLogout {enable|disable}]"
+           " set interface [DisconnectOnLogout {enable|disable}]\n"
+           " set interface [IPSec <ipsec-options>]\n"
+#ifdef NOTYET
+           " set interface [OnDemandEnabled {enable|disable}]\n"
+           " set interface [OnDemandMatch <match-options>]\n"
+#endif // NOTYET
        }
 };
 #define        N_PPP_OPTIONS   (sizeof(pppOptions) / sizeof(pppOptions[0]))
        }
 };
 #define        N_PPP_OPTIONS   (sizeof(pppOptions) / sizeof(pppOptions[0]))
@@ -1140,7 +1735,11 @@ set_interface_ppp(int argc, char **argv, CFMutableDictionaryRef newConfiguration
 }
 
 
 }
 
 
-/* -------------------- */
+#pragma mark -
+#pragma mark VLAN options
+
+
+#if    !TARGET_OS_IPHONE
 
 
 static Boolean
 
 
 static Boolean
@@ -1152,7 +1751,11 @@ SCPrint(TRUE, stdout, CFSTR("vlan interface management not yet supported\n"));
 }
 
 
 }
 
 
-/* -------------------- */
+#endif // !TARGET_OS_IPHONE
+
+
+#pragma mark -
+#pragma mark [more] Interface management
 
 
 __private_extern__
 
 
 __private_extern__
@@ -1175,32 +1778,37 @@ set_interface(int argc, char **argv)
        }
 
        configuration = SCNetworkInterfaceGetConfiguration(net_interface);
        }
 
        configuration = SCNetworkInterfaceGetConfiguration(net_interface);
-       if (configuration == NULL) {
+       if (configuration != NULL) {
+               configuration = CFDictionaryCreateCopy(NULL, configuration);
+               newConfiguration = CFDictionaryCreateMutableCopy(NULL, 0, configuration);
+               CFDictionaryRemoveValue(newConfiguration, kSCResvInactive);
+       } else {
                newConfiguration = CFDictionaryCreateMutable(NULL,
                                                             0,
                                                             &kCFTypeDictionaryKeyCallBacks,
                                                             &kCFTypeDictionaryValueCallBacks);
                newConfiguration = CFDictionaryCreateMutable(NULL,
                                                             0,
                                                             &kCFTypeDictionaryKeyCallBacks,
                                                             &kCFTypeDictionaryValueCallBacks);
-       } else {
-               newConfiguration = CFDictionaryCreateMutableCopy(NULL, 0, configuration);
-               CFDictionaryRemoveValue(newConfiguration, kSCResvInactive);
        }
 
        interfaceType = SCNetworkInterfaceGetInterfaceType(net_interface);
 
        }
 
        interfaceType = SCNetworkInterfaceGetInterfaceType(net_interface);
 
-       if (CFEqual(interfaceType, kSCNetworkInterfaceTypeBond)) {
-               ok = set_interface_bond(argc, argv, newConfiguration);
-       } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeEthernet)) {
+       if (CFEqual(interfaceType, kSCNetworkInterfaceTypeEthernet)) {
                ok = set_interface_ethernet(argc, argv, newConfiguration);
        } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeFireWire)) {
                ok = set_interface_firewire(argc, argv, newConfiguration);
                ok = set_interface_ethernet(argc, argv, newConfiguration);
        } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeFireWire)) {
                ok = set_interface_firewire(argc, argv, newConfiguration);
+       } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeIPSec)) {
+               ok = set_interface_ipsec(argc, argv, newConfiguration);
        } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeModem)) {
                ok = set_interface_modem(argc, argv, newConfiguration);
        } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeIEEE80211)) {
                ok = set_interface_airport(argc, argv, newConfiguration);
        } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) {
                ok = set_interface_ppp(argc, argv, newConfiguration);
        } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeModem)) {
                ok = set_interface_modem(argc, argv, newConfiguration);
        } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeIEEE80211)) {
                ok = set_interface_airport(argc, argv, newConfiguration);
        } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypePPP)) {
                ok = set_interface_ppp(argc, argv, newConfiguration);
+#if    !TARGET_OS_IPHONE
+       } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeBond)) {
+               ok = set_interface_bond(argc, argv, newConfiguration);
        } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeVLAN)) {
                ok = set_interface_vlan(argc, argv, newConfiguration);
        } else if (CFEqual(interfaceType, kSCNetworkInterfaceTypeVLAN)) {
                ok = set_interface_vlan(argc, argv, newConfiguration);
+#endif // !TARGET_OS_IPHONE
        } else {
                SCPrint(TRUE, stdout, CFSTR("this interfaces configuration cannot be changed\n"));
        }
        } else {
                SCPrint(TRUE, stdout, CFSTR("this interfaces configuration cannot be changed\n"));
        }
@@ -1225,6 +1833,7 @@ set_interface(int argc, char **argv)
 
     done :
 
 
     done :
 
+       if (configuration != NULL) CFRelease(configuration);
        if (newConfiguration != NULL) CFRelease(newConfiguration);
        return;
 }
        if (newConfiguration != NULL) CFRelease(newConfiguration);
        return;
 }
@@ -1239,8 +1848,8 @@ show_interface(int argc, char **argv)
 {
        SCNetworkInterfaceRef   interface;
 
 {
        SCNetworkInterfaceRef   interface;
 
-       if (argc == 1) {
-               interface = _find_interface(argv[0]);
+       if (argc >= 1) {
+               interface = _find_interface(argc, argv, NULL);
        } else {
                if (net_interface != NULL) {
                        interface = net_interface;
        } else {
                if (net_interface != NULL) {
                        interface = net_interface;
index 780a84c678696bd53c9cd009f2340689273c66b2..af429567046be1cbe2d29d19ab8419f7f1bca5c4 100644 (file)
@@ -36,7 +36,7 @@
 __BEGIN_DECLS
 
 CFStringRef            _interface_description  (SCNetworkInterfaceRef interface);
 __BEGIN_DECLS
 
 CFStringRef            _interface_description  (SCNetworkInterfaceRef interface);
-SCNetworkInterfaceRef  _find_interface         (char *match);
+SCNetworkInterfaceRef  _find_interface         (int argc, char **argv, int *nArgs);
 
 void   create_interface        (int argc, char **argv);
 void   select_interface        (int argc, char **argv);
 
 void   create_interface        (int argc, char **argv);
 void   select_interface        (int argc, char **argv);
index 77e2752686e57c02118b7e2b94bd14b153569d53..0272c118640142ffcaeb63048f827196d4d1890a 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -421,6 +421,9 @@ select_protocol(int argc, char **argv)
 #pragma mark AppleTalk
 
 
 #pragma mark AppleTalk
 
 
+#if    !TARGET_OS_IPHONE && INCLUDE_APPLETALK
+
+
 static selections appletalkConfigMethods[] = {
        { CFSTR("node")      , &kSCValNetAppleTalkConfigMethodNode      , 0 },
        { CFSTR("router")    , &kSCValNetAppleTalkConfigMethodRouter    , 0 },
 static selections appletalkConfigMethods[] = {
        { CFSTR("node")      , &kSCValNetAppleTalkConfigMethodNode      , 0 },
        { CFSTR("router")    , &kSCValNetAppleTalkConfigMethodRouter    , 0 },
@@ -533,6 +536,9 @@ set_protocol_appletalk(int argc, char **argv, CFMutableDictionaryRef newConfigur
 }
 
 
 }
 
 
+#endif // !TARGET_OS_IPHONE && INCLUDE_APPLETALK
+
+
 #pragma mark -
 #pragma mark DNS
 
 #pragma mark -
 #pragma mark DNS
 
@@ -712,7 +718,7 @@ static options dnsOptions[] = {
        { "?"              , NULL     , isHelp , NULL                         , NULL,
            "\nDNS configuration commands\n\n"
            " set protocol search domain-name[,domain-name-2]\n"
        { "?"              , NULL     , isHelp , NULL                         , NULL,
            "\nDNS configuration commands\n\n"
            " set protocol search domain-name[,domain-name-2]\n"
-           " set protocol nameserver x1.x1.x1.x1[,x2.x2.x2.x2]"
+           " set protocol nameserver x1.x1.x1.x1[,x2.x2.x2.x2]\n"
        }
 };
 #define        N_DNS_OPTIONS   (sizeof(dnsOptions) / sizeof(dnsOptions[0]))
        }
 };
 #define        N_DNS_OPTIONS   (sizeof(dnsOptions) / sizeof(dnsOptions[0]))
@@ -968,23 +974,6 @@ __doIPv6Addresses(CFStringRef key, const char *description, void *info, int argc
 }
 
 
 }
 
 
-static int
-__doIPv6PrefixLength(CFStringRef key, const char *description, void *info, int argc, char **argv, CFMutableDictionaryRef newConfiguration)
-{
-       CFNumberRef     num;
-       int             prefixLength;
-
-       num = CFDictionaryGetValue(newConfiguration, kSCPropNetPPPAuthPasswordEncryption);
-       if (isA_CFNumber(num) &&
-           CFNumberGetValue(num, kCFNumberIntType, &prefixLength) &&
-           (prefixLength >= 0) && (prefixLength <= (sizeof(struct in6_addr) * 8))) {
-               return 0;
-       }
-
-       return -1;
-}
-
-
 static options ipv6Options[] = {
        { "ConfigMethod", "configuration method"
                                         , isChooseOne, &kSCPropNetIPv6ConfigMethod, __doIPv6ConfigMethod, (void *)ipv6ConfigMethods },
 static options ipv6Options[] = {
        { "ConfigMethod", "configuration method"
                                         , isChooseOne, &kSCPropNetIPv6ConfigMethod, __doIPv6ConfigMethod, (void *)ipv6ConfigMethods },
@@ -992,7 +981,7 @@ static options ipv6Options[] = {
                                         , isChooseOne, &kSCPropNetIPv6ConfigMethod, __doIPv6ConfigMethod, (void *)ipv6ConfigMethods },
        { "Addresses"   , "address"      , isOther    , &kSCPropNetIPv6Addresses   , __doIPv6Addresses   , (void *)TRUE              },
        {   "address"   , "address"      , isOther    , &kSCPropNetIPv6Addresses   , __doIPv6Addresses   , (void *)TRUE              },
                                         , isChooseOne, &kSCPropNetIPv6ConfigMethod, __doIPv6ConfigMethod, (void *)ipv6ConfigMethods },
        { "Addresses"   , "address"      , isOther    , &kSCPropNetIPv6Addresses   , __doIPv6Addresses   , (void *)TRUE              },
        {   "address"   , "address"      , isOther    , &kSCPropNetIPv6Addresses   , __doIPv6Addresses   , (void *)TRUE              },
-       { "PrefixLength", "prefix length", isNumber   , &kSCPropNetIPv6PrefixLength, __doIPv6PrefixLength, NULL                      },
+       { "PrefixLength", "prefix length", isNumber   , &kSCPropNetIPv6PrefixLength, NULL                , NULL                      },
        { "Router"      , "address"      , isOther    , &kSCPropNetIPv6Router      , __doIPv6Addresses   , (void *)FALSE             },
 
        { "?"           , NULL           , isHelp     , NULL                       , NULL                ,
        { "Router"      , "address"      , isOther    , &kSCPropNetIPv6Router      , __doIPv6Addresses   , (void *)FALSE             },
 
        { "?"           , NULL           , isHelp     , NULL                       , NULL                ,
@@ -1191,7 +1180,7 @@ __doProxyEnable(CFStringRef key, const char *description, void *info, int argc,
        if (enabled) {
                CFDictionarySetValue(newConfiguration, *(currentProxy->keyEnable), CFNumberRef_1);
        } else {
        if (enabled) {
                CFDictionarySetValue(newConfiguration, *(currentProxy->keyEnable), CFNumberRef_1);
        } else {
-               CFDictionarySetValue(newConfiguration, *(currentProxy->keyEnable), CFNumberRef_0);
+               CFDictionaryRemoveValue(newConfiguration, *(currentProxy->keyEnable));
 
                if (currentProxy->keyProxy != NULL) {
                        CFDictionaryRemoveValue(newConfiguration, *(currentProxy->keyProxy));
 
                if (currentProxy->keyProxy != NULL) {
                        CFDictionaryRemoveValue(newConfiguration, *(currentProxy->keyProxy));
@@ -1381,6 +1370,9 @@ set_protocol_proxies(int argc, char **argv, CFMutableDictionaryRef newConfigurat
 #pragma mark SMB
 
 
 #pragma mark SMB
 
 
+#if    !TARGET_OS_IPHONE
+
+
 static CFStringRef
 __cleanupName(CFStringRef name)
 {
 static CFStringRef
 __cleanupName(CFStringRef name)
 {
@@ -1544,7 +1536,7 @@ static options smbOptions[] = {
            " set protocol name NetBIOS-name\n"
            " set protocol type (Broadcast|Peer|Mixed|Hybrid)\n"
            " set protocol workgroup SMB-workgroup\n"
            " set protocol name NetBIOS-name\n"
            " set protocol type (Broadcast|Peer|Mixed|Hybrid)\n"
            " set protocol workgroup SMB-workgroup\n"
-           " set protocol wins x1.x1.x1.x1[,x2.x2.x2.x2]"
+           " set protocol wins x1.x1.x1.x1[,x2.x2.x2.x2]\n"
        }
 };
 #define        N_SMB_OPTIONS   (sizeof(smbOptions) / sizeof(smbOptions[0]))
        }
 };
 #define        N_SMB_OPTIONS   (sizeof(smbOptions) / sizeof(smbOptions[0]))
@@ -1560,6 +1552,9 @@ set_protocol_smb(int argc, char **argv, CFMutableDictionaryRef newConfiguration)
 }
 
 
 }
 
 
+#endif // !TARGET_OS_IPHONE
+
+
 #pragma mark -
 #pragma mark *Protocol*
 
 #pragma mark -
 #pragma mark *Protocol*
 
@@ -1595,9 +1590,7 @@ set_protocol(int argc, char **argv)
        }
 
        protocolType = SCNetworkProtocolGetProtocolType(net_protocol);
        }
 
        protocolType = SCNetworkProtocolGetProtocolType(net_protocol);
-       if (CFEqual(protocolType, kSCNetworkProtocolTypeAppleTalk)) {
-               ok = set_protocol_appletalk(argc, argv, newConfiguration);
-       } else if (CFEqual(protocolType, kSCNetworkProtocolTypeDNS)) {
+       if (CFEqual(protocolType, kSCNetworkProtocolTypeDNS)) {
                ok = set_protocol_dns(argc, argv, newConfiguration);
        } else if (CFEqual(protocolType, kSCNetworkProtocolTypeIPv4)) {
                ok = set_protocol_ipv4(argc, argv, newConfiguration);
                ok = set_protocol_dns(argc, argv, newConfiguration);
        } else if (CFEqual(protocolType, kSCNetworkProtocolTypeIPv4)) {
                ok = set_protocol_ipv4(argc, argv, newConfiguration);
@@ -1605,8 +1598,14 @@ set_protocol(int argc, char **argv)
                ok = set_protocol_ipv6(argc, argv, newConfiguration);
        } else if (CFEqual(protocolType, kSCNetworkProtocolTypeProxies)) {
                ok = set_protocol_proxies(argc, argv, newConfiguration);
                ok = set_protocol_ipv6(argc, argv, newConfiguration);
        } else if (CFEqual(protocolType, kSCNetworkProtocolTypeProxies)) {
                ok = set_protocol_proxies(argc, argv, newConfiguration);
+#if    !TARGET_OS_IPHONE && INCLUDE_APPLETALK
+       } else if (CFEqual(protocolType, kSCNetworkProtocolTypeAppleTalk)) {
+               ok = set_protocol_appletalk(argc, argv, newConfiguration);
+#endif // !TARGET_OS_IPHONE && INCLUDE_APPLETALK
+#if    !TARGET_OS_IPHONE
        } else if (CFEqual(protocolType, kSCNetworkProtocolTypeSMB)) {
                ok = set_protocol_smb(argc, argv, newConfiguration);
        } else if (CFEqual(protocolType, kSCNetworkProtocolTypeSMB)) {
                ok = set_protocol_smb(argc, argv, newConfiguration);
+#endif // !TARGET_OS_IPHONE
        } else {
                SCPrint(TRUE, stdout, CFSTR("this protocols configuration cannot be changed\n"));
        }
        } else {
                SCPrint(TRUE, stdout, CFSTR("this protocols configuration cannot be changed\n"));
        }
@@ -1768,17 +1767,7 @@ _protocol_description(SCNetworkProtocolRef protocol, Boolean skipEmpty)
        }
 
        protocolType = SCNetworkProtocolGetProtocolType(protocol);
        }
 
        protocolType = SCNetworkProtocolGetProtocolType(protocol);
-       if (CFEqual(protocolType, kSCNetworkProtocolTypeAppleTalk)) {
-               CFStringRef     method;
-
-               method = CFDictionaryGetValue(configuration, kSCPropNetAppleTalkConfigMethod);
-               if (isA_CFString(method)) {
-                       CFStringAppendFormat(description,
-                                            NULL,
-                                            CFSTR("%@"),
-                                            method);
-               }
-       } else if (CFEqual(protocolType, kSCNetworkProtocolTypeDNS)) {
+       if (CFEqual(protocolType, kSCNetworkProtocolTypeDNS)) {
                CFStringRef     domain;
                CFArrayRef      search;
                CFArrayRef      servers;
                CFStringRef     domain;
                CFArrayRef      search;
                CFArrayRef      servers;
@@ -1880,6 +1869,19 @@ _protocol_description(SCNetworkProtocolRef protocol, Boolean skipEmpty)
                                             CFStringGetLength(description) > 0 ? ", " : "",
                                             currentProxy->proxy);
                }
                                             CFStringGetLength(description) > 0 ? ", " : "",
                                             currentProxy->proxy);
                }
+#if    !TARGET_OS_IPHONE && INCLUDE_APPLETALK
+       } else if (CFEqual(protocolType, kSCNetworkProtocolTypeAppleTalk)) {
+               CFStringRef     method;
+
+               method = CFDictionaryGetValue(configuration, kSCPropNetAppleTalkConfigMethod);
+               if (isA_CFString(method)) {
+                       CFStringAppendFormat(description,
+                                            NULL,
+                                            CFSTR("%@"),
+                                            method);
+               }
+#endif // !TARGET_OS_IPHONE && INCLUDE_APPLETALK
+#if    !TARGET_OS_IPHONE
        } else if (CFEqual(protocolType, kSCNetworkProtocolTypeSMB)) {
                CFStringRef     name;
                CFArrayRef      servers;
        } else if (CFEqual(protocolType, kSCNetworkProtocolTypeSMB)) {
                CFStringRef     name;
                CFArrayRef      servers;
@@ -1913,6 +1915,7 @@ _protocol_description(SCNetworkProtocolRef protocol, Boolean skipEmpty)
                                             str);
                        CFRelease(str);
                }
                                             str);
                        CFRelease(str);
                }
+#endif // !TARGET_OS_IPHONE
        }
 
     done :
        }
 
     done :
index af198bb0cb738f96d7a860e6bcf5d60b26d3d099..507ccff1f7f333210092cdc924e4d6e335725ba5 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -266,9 +266,11 @@ create_service(int argc, char **argv)
 
                interface = net_interface;
        } else {
 
                interface = net_interface;
        } else {
-               interface = _find_interface(argv[0]);
-               argv++;
-               argc--;
+               int     nArgs;
+
+               interface = _find_interface(argc, argv, &nArgs);
+               argv += nArgs;
+               argc -= nArgs;
        }
 
        if (interface == NULL) {
        }
 
        if (interface == NULL) {
@@ -291,8 +293,8 @@ create_service(int argc, char **argv)
                Boolean         ok;
 
                serviceName = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
                Boolean         ok;
 
                serviceName = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
-               argv++;
-               argc--;
+//             argv++;
+//             argc--;
 
                ok = SCNetworkServiceSetName(service, serviceName);
                CFRelease(serviceName);
 
                ok = SCNetworkServiceSetName(service, serviceName);
                CFRelease(serviceName);
@@ -303,6 +305,13 @@ create_service(int argc, char **argv)
                }
        }
 
                }
        }
 
+       ok = SCNetworkServiceEstablishDefaultConfiguration(service);
+       if (!ok) {
+               SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
+               (void)SCNetworkServiceRemove(service);
+               goto done;
+       }
+
        ok = SCNetworkSetAddService(net_set, service);
        if (!ok) {
                SCPrint(TRUE, stdout, CFSTR("service not created: %s\n"), SCErrorString(SCError()));
        ok = SCNetworkSetAddService(net_set, service);
        if (!ok) {
                SCPrint(TRUE, stdout, CFSTR("service not created: %s\n"), SCErrorString(SCError()));
@@ -336,7 +345,8 @@ create_service(int argc, char **argv)
        }
 
        if (net_interface != NULL) CFRelease(net_interface);
        }
 
        if (net_interface != NULL) CFRelease(net_interface);
-       net_interface = CFRetain(interface);
+       net_interface = SCNetworkServiceGetInterface(net_service);
+       CFRetain(net_interface);
 
        interfaceName = SCNetworkInterfaceGetLocalizedDisplayName(interface);
        if (interfaceName == NULL) {
 
        interfaceName = SCNetworkInterfaceGetLocalizedDisplayName(interface);
        if (interfaceName == NULL) {
@@ -690,6 +700,54 @@ set_service(int argc, char **argv)
                                SCPrint(TRUE, stdout, CFSTR("set what?\n"));
                                return;
                        }
                                SCPrint(TRUE, stdout, CFSTR("set what?\n"));
                                return;
                        }
+               } else if (strcmp(command, "rank") == 0) {
+                       SCNetworkServicePrimaryRank     rank    = kSCNetworkServicePrimaryRankDefault;
+                       SCNetworkServiceRef             service = (argc < 2) ? net_service : NULL;
+
+                       if (argc < 1) {
+                               SCPrint(TRUE, stdout, CFSTR("rank not specified\n"));
+                               return;
+                       }
+
+                       if (strlen(argv[0]) > 0) {
+                               if (strcasecmp(argv[0], "Never") == 0) {
+                                       rank = kSCNetworkServicePrimaryRankNever;
+                               } else if ((service != net_service) && (strcasecmp(argv[0], "First") == 0)) {
+                                       rank = kSCNetworkServicePrimaryRankFirst;
+                               } else if ((service != net_service) && (strcasecmp(argv[0], "Last") == 0)) {
+                                       rank = kSCNetworkServicePrimaryRankLast;
+                               } else {
+                                       SCPrint(TRUE, stdout, CFSTR("rank not valid\n"));
+                                       return;
+                               }
+                       }
+                       argv++;
+                       argc--;
+
+                       if (service == NULL) {
+                               CFStringRef             serviceID;
+                               SCDynamicStoreRef       store;
+
+                               store = SCDynamicStoreCreate(NULL,
+                                                            CFSTR("scutil (set primary rank)"),
+                                                            NULL,
+                                                            NULL);
+                               serviceID = SCNetworkServiceGetServiceID(net_service);
+                               service = _SCNetworkServiceCopyActive(store, serviceID);
+                               CFRelease(store);
+
+                               argv++;
+                               argc--;
+                       }
+
+                       ok = SCNetworkServiceSetPrimaryRank(service, rank);
+                       if (service != net_service) CFRelease(service);
+                       if (ok) {
+                               if (service == net_service) _prefs_changed = TRUE;
+                       } else {
+                               SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError()));
+                               return;
+                       }
                } else {
                        SCPrint(TRUE, stdout, CFSTR("set what?\n"));
                }
                } else {
                        SCPrint(TRUE, stdout, CFSTR("set what?\n"));
                }
@@ -772,10 +830,11 @@ __private_extern__
 void
 show_service(int argc, char **argv)
 {
 void
 show_service(int argc, char **argv)
 {
-       SCNetworkInterfaceRef   interface;
-       CFArrayRef              protocols;
-       SCNetworkServiceRef     service;
-       CFStringRef             serviceName;
+       SCNetworkInterfaceRef           interface;
+       CFArrayRef                      protocols;
+       SCNetworkServiceRef             service;
+       CFStringRef                     serviceName;
+       SCNetworkServicePrimaryRank     serviceRank;
 
        if (argc == 1) {
                service = _find_service(argv[0]);
 
        if (argc == 1) {
                service = _find_service(argv[0]);
@@ -798,6 +857,25 @@ show_service(int argc, char **argv)
        SCPrint(TRUE, stdout, CFSTR("name                 = %@\n"),
                (serviceName != NULL) ? serviceName : CFSTR(""));
 
        SCPrint(TRUE, stdout, CFSTR("name                 = %@\n"),
                (serviceName != NULL) ? serviceName : CFSTR(""));
 
+       serviceRank = SCNetworkServiceGetPrimaryRank(service);
+       switch (serviceRank) {
+               case kSCNetworkServicePrimaryRankDefault :
+                       // nothing to report
+                       break;
+               case kSCNetworkServicePrimaryRankFirst :
+                       SCPrint(TRUE, stdout, CFSTR("primary rank         = FIRST\n"));
+                       break;
+               case kSCNetworkServicePrimaryRankLast :
+                       SCPrint(TRUE, stdout, CFSTR("primary rank         = LAST\n"));
+                       break;
+               case kSCNetworkServicePrimaryRankNever :
+                       SCPrint(TRUE, stdout, CFSTR("primary rank         = NEVER\n"));
+                       break;
+               default :
+                       SCPrint(TRUE, stdout, CFSTR("primary rank         = %d\n"), serviceRank);
+                       break;
+       }
+
        interface = SCNetworkServiceGetInterface(service);
        if (interface != NULL) {
                CFStringRef     interfaceName;
        interface = SCNetworkServiceGetInterface(service);
        if (interface != NULL) {
                CFStringRef     interfaceName;
index 7677279f2b8efc27ea1174b03b714352230e0a99..fa528f45d4bbbb9399991c39956fb5600e060774 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004, 2005, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -242,8 +242,8 @@ create_set(int argc, char **argv)
                Boolean         ok;
 
                setName = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
                Boolean         ok;
 
                setName = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
-               argv++;
-               argc--;
+//             argv++;
+//             argc--;
 
                ok = SCNetworkSetSetName(set, setName);
                CFRelease(setName);
 
                ok = SCNetworkSetSetName(set, setName);
                CFRelease(setName);
@@ -529,7 +529,6 @@ show_set(int argc, char **argv)
                CFIndex                 n;
                CFIndex                 nOrder  = 0;
                CFArrayRef              order;
                CFIndex                 n;
                CFIndex                 nOrder  = 0;
                CFArrayRef              order;
-               CFMutableArrayRef       sorted  = (CFMutableArrayRef)services;
 
                order = SCNetworkSetGetServiceOrder(set);
                if (order != NULL) {
 
                order = SCNetworkSetGetServiceOrder(set);
                if (order != NULL) {
@@ -538,11 +537,15 @@ show_set(int argc, char **argv)
 
                n = CFArrayGetCount(services);
                if (n > 1) {
 
                n = CFArrayGetCount(services);
                if (n > 1) {
+                       CFMutableArrayRef       sorted;
+
                        sorted = CFArrayCreateMutableCopy(NULL, 0, services);
                        CFArraySortValues(sorted,
                                          CFRangeMake(0, CFArrayGetCount(sorted)),
                                          _compare_services,
                                          (void *)order);
                        sorted = CFArrayCreateMutableCopy(NULL, 0, services);
                        CFArraySortValues(sorted,
                                          CFRangeMake(0, CFArrayGetCount(sorted)),
                                          _compare_services,
                                          (void *)order);
+                       CFRelease(services);
+                       services = sorted;
                }
 
                SCPrint(TRUE, stdout, CFSTR("services =\n"));
                }
 
                SCPrint(TRUE, stdout, CFSTR("services =\n"));
@@ -553,7 +556,7 @@ show_set(int argc, char **argv)
                        CFStringRef             serviceName;
                        CFStringRef             serviceID;
 
                        CFStringRef             serviceName;
                        CFStringRef             serviceID;
 
-                       service     = CFArrayGetValueAtIndex(sorted, i);
+                       service     = CFArrayGetValueAtIndex(services, i);
                        serviceID   = SCNetworkServiceGetServiceID(service);
                        serviceName = SCNetworkServiceGetName(service);
                        if (serviceName == NULL) serviceName = CFSTR("");
                        serviceID   = SCNetworkServiceGetServiceID(service);
                        serviceName = SCNetworkServiceGetName(service);
                        if (serviceName == NULL) serviceName = CFSTR("");
@@ -582,8 +585,6 @@ show_set(int argc, char **argv)
                }
 
                CFRelease(services);
                }
 
                CFRelease(services);
-
-               if (sorted != services) CFRelease(sorted);
        }
 
        if (_sc_debug) {
        }
 
        if (_sc_debug) {
index 8cb779ff109c224125ea287184259c3c819815a1..8bf91c2c234f57cfdf10aa4e754639d0d4b14239 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2008, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -309,7 +309,7 @@ notificationWatcherVerbose(SCDynamicStoreRef store, void *arg)
 {
        SCPrint(TRUE, stdout, CFSTR("notification callback (store address = %p).\n"), store);
        SCPrint(TRUE, stdout, CFSTR("  arg = %s.\n"), (char *)arg);
 {
        SCPrint(TRUE, stdout, CFSTR("notification callback (store address = %p).\n"), store);
        SCPrint(TRUE, stdout, CFSTR("  arg = %s.\n"), (char *)arg);
-       do_notify_changes(0, NULL);     /* report the keys which changed */
+       do_notify_changes(0, NULL);     /* report the keys that changed */
        return TRUE;
 }
 
        return TRUE;
 }
 
@@ -386,6 +386,9 @@ do_notify_file(int argc, char **argv)
                SCPrint(TRUE, stdout, CFSTR("  Received notification, identifier = %d.\n"), buf.gotID);
        }
 
                SCPrint(TRUE, stdout, CFSTR("  Received notification, identifier = %d.\n"), buf.gotID);
        }
 
+       /* report the keys that changed */
+       do_notify_changes(0, NULL);
+
        /* this utility only allows processes one notification per "n.file" request */
        (void) SCDynamicStoreNotifyCancel(store);
 
        /* this utility only allows processes one notification per "n.file" request */
        (void) SCDynamicStoreNotifyCancel(store);
 
@@ -412,7 +415,6 @@ do_notify_signal(int argc, char **argv)
        int                     sig;
        pid_t                   pid;
        struct sigaction        nact;
        int                     sig;
        pid_t                   pid;
        struct sigaction        nact;
-       int                     ret;
 
        if (isdigit(*argv[0])) {
                if ((sscanf(argv[0], "%d", &sig) != 1) || (sig <= 0) || (sig >= NSIG)) {
 
        if (isdigit(*argv[0])) {
                if ((sscanf(argv[0], "%d", &sig) != 1) || (sig <= 0) || (sig >= NSIG)) {
@@ -451,7 +453,7 @@ do_notify_signal(int argc, char **argv)
        }
 
        if (oact != NULL) {
        }
 
        if (oact != NULL) {
-               ret = sigaction(osig, oact, NULL);      /* restore original signal handler */
+               (void) sigaction(osig, oact, NULL);     /* restore original signal handler */
        } else {
                oact = malloc(sizeof(struct sigaction));
        }
        } else {
                oact = malloc(sizeof(struct sigaction));
        }
@@ -459,7 +461,7 @@ do_notify_signal(int argc, char **argv)
        nact.sa_handler = signalCatcher;
        sigemptyset(&nact.sa_mask);
        nact.sa_flags = SA_RESTART;
        nact.sa_handler = signalCatcher;
        sigemptyset(&nact.sa_mask);
        nact.sa_flags = SA_RESTART;
-       ret = sigaction(sig, &nact, oact);
+       (void) sigaction(sig, &nact, oact);
        osig = sig;
        SCPrint(TRUE, stdout, CFSTR("signal handler started.\n"));
 
        osig = sig;
        SCPrint(TRUE, stdout, CFSTR("signal handler started.\n"));
 
@@ -476,8 +478,6 @@ __private_extern__
 void
 do_notify_cancel(int argc, char **argv)
 {
 void
 do_notify_cancel(int argc, char **argv)
 {
-       int                     ret;
-
        if (notifyRls) {
                CFRunLoopSourceInvalidate(notifyRls);
                CFRelease(notifyRls);
        if (notifyRls) {
                CFRunLoopSourceInvalidate(notifyRls);
                CFRelease(notifyRls);
@@ -495,7 +495,7 @@ do_notify_cancel(int argc, char **argv)
        }
 
        if (oact != NULL) {
        }
 
        if (oact != NULL) {
-               ret = sigaction(osig, oact, NULL);      /* restore original signal handler */
+               (void) sigaction(osig, oact, NULL);     /* restore original signal handler */
                free(oact);
                oact = NULL;
        }
                free(oact);
                oact = NULL;
        }
index 7137e0c121ec8ee31e9b56bf11b5b53188b5c9f1..1ecf86e9166c82da7a09197d3cbb70c711a63d8c 100644 (file)
@@ -35,7 +35,9 @@
 #include <dlfcn.h>
 
 #include <SystemConfiguration/SCPreferencesSetSpecific.h>
 #include <dlfcn.h>
 
 #include <SystemConfiguration/SCPreferencesSetSpecific.h>
+#if    !TARGET_OS_IPHONE
 #include <Security/Authorization.h>
 #include <Security/Authorization.h>
+#endif /* !TARGET_OS_IPHONE */
 
 #include "scutil.h"
 #include "commands.h"
 
 #include "scutil.h"
 #include "commands.h"
@@ -45,6 +47,7 @@
 /* -------------------- */
 
 
 /* -------------------- */
 
 
+#if    !TARGET_OS_IPHONE
 static void *
 __loadSecurity(void) {
        static void *image = NULL;
 static void *
 __loadSecurity(void) {
        static void *image = NULL;
@@ -118,7 +121,7 @@ _createAuthorization()
 
        return authorization;
 }
 
        return authorization;
 }
-
+#endif /* !TARGET_OS_IPHONE */
 
 /* -------------------- */
 
 
 /* -------------------- */
 
@@ -133,7 +136,11 @@ _prefs_open(CFStringRef name, CFStringRef prefsID)
        if (geteuid() == 0) {
                prefs = SCPreferencesCreate(NULL, name, prefsID);
        } else {
        if (geteuid() == 0) {
                prefs = SCPreferencesCreate(NULL, name, prefsID);
        } else {
+#if    !TARGET_OS_IPHONE
                authorization = _createAuthorization();
                authorization = _createAuthorization();
+#else  /* !TARGET_OS_IPHONE */
+               authorization = NULL;
+#endif /* !TARGET_OS_IPHONE */
                prefs = SCPreferencesCreateWithAuthorization(NULL, name, prefsID, authorization);
        }
 
                prefs = SCPreferencesCreateWithAuthorization(NULL, name, prefsID, authorization);
        }
 
@@ -190,8 +197,12 @@ _prefs_close()
        }
 
        if (authorization != NULL) {
        }
 
        if (authorization != NULL) {
+#if    !TARGET_OS_IPHONE
                AuthorizationFree(authorization, kAuthorizationFlagDefaults);
 //             AuthorizationFree(authorization, kAuthorizationFlagDestroyRights);
                AuthorizationFree(authorization, kAuthorizationFlagDefaults);
 //             AuthorizationFree(authorization, kAuthorizationFlagDestroyRights);
+#else  /* !TARGET_OS_IPHONE */
+               // Uh...if authorization isn't NULL, something went horribly wrong.
+#endif /* !TARGET_OS_IPHONE */
                authorization = NULL;
        }
 
                authorization = NULL;
        }
 
@@ -287,7 +298,6 @@ get_ComputerName(int argc, char **argv)
 static void
 set_ComputerName(int argc, char **argv)
 {
 static void
 set_ComputerName(int argc, char **argv)
 {
-       CFStringEncoding        encoding;
        CFStringRef             hostname;
        Boolean                 ok;
 
        CFStringRef             hostname;
        Boolean                 ok;
 
@@ -302,13 +312,11 @@ set_ComputerName(int argc, char **argv)
 
        if (argc == 0) {
                hostname = _copyStringFromSTDIN();
 
        if (argc == 0) {
                hostname = _copyStringFromSTDIN();
-               encoding = kCFStringEncodingUTF8;
        } else {
        } else {
-               hostname = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingASCII);
-               encoding = kCFStringEncodingASCII;
+               hostname = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
        }
 
        }
 
-       ok = SCPreferencesSetComputerName(prefs, hostname, encoding);
+       ok = SCPreferencesSetComputerName(prefs, hostname, kCFStringEncodingUTF8);
        if (hostname != NULL) CFRelease(hostname);
        if (!ok) {
                SCPrint(TRUE,
        if (hostname != NULL) CFRelease(hostname);
        if (!ok) {
                SCPrint(TRUE,
@@ -385,7 +393,7 @@ set_HostName(int argc, char **argv)
        if (argc == 0) {
                hostname = _copyStringFromSTDIN();
        } else {
        if (argc == 0) {
                hostname = _copyStringFromSTDIN();
        } else {
-               hostname = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingASCII);
+               hostname = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
        }
 
        ok = SCPreferencesSetHostName(prefs, hostname);
        }
 
        ok = SCPreferencesSetHostName(prefs, hostname);
@@ -455,7 +463,7 @@ set_LocalHostName(int argc, char **argv)
        if (argc == 0) {
                hostname = _copyStringFromSTDIN();
        } else {
        if (argc == 0) {
                hostname = _copyStringFromSTDIN();
        } else {
-               hostname = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingASCII);
+               hostname = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
        }
 
        ok = SCPreferencesSetLocalHostName(prefs, hostname);
        }
 
        ok = SCPreferencesSetLocalHostName(prefs, hostname);
index 3db9c7c8043241e1fc4bde258a1b8421e9047e44..3350639259bc65fa31f6dc04390508989bdacaf6 100644 (file)
@@ -1,7 +1,7 @@
 .\"
 .\"     @(#)scutil.8
 .\"
 .\"
 .\"     @(#)scutil.8
 .\"
-.Dd November 4, 2003
+.Dd January 23, 2008
 .Dt SCUTIL 8
 .Os "Mac OS X"
 .Sh NAME
 .Dt SCUTIL 8
 .Os "Mac OS X"
 .Sh NAME
@@ -14,7 +14,9 @@
 .Fl -prefs Op preference-file
 .Br
 .Nm
 .Fl -prefs Op preference-file
 .Br
 .Nm
-.Fl r Bro "" Ar nodename | Ar address | Ar local-address remote-address "" Brc
+.Fl r
+.Op Fl W
+.Bro "" Ar nodename | Ar address | Ar local-address remote-address "" Brc
 .Br
 .Nm
 .Fl w Ar dynamic-store-key Op Fl t Ar timeout
 .Br
 .Nm
 .Fl w Ar dynamic-store-key Op Fl t Ar timeout
@@ -70,7 +72,7 @@ the current host and the specified host.
 The
 .Fl w
 option provides a means of checking for (and optionally waiting for the
 The
 .Fl w
 option provides a means of checking for (and optionally waiting for the
-creation of) a dynamic store key.
+creation of or posting of a notification to) a dynamic store key.
 .Pp
 The
 .Fl -get
 .Pp
 The
 .Fl -get
@@ -105,7 +107,7 @@ option reports the current system proxy configuration.
 .\"option provides a means of managing the system's network configuration.
 .Sh OPTIONS
 .Bl -tag -width xx
 .\"option provides a means of managing the system's network configuration.
 .Sh OPTIONS
 .Bl -tag -width xx
-.It Fl r Bro "" Ar nodename | Ar address | Ar local-address remote-address "" Brc
+.It Fl r Oo Fl W Oc Bro "" Ar nodename | Ar address | Ar local-address remote-address "" Brc
 Check the network reachability of the specified host name, IP address, or a
 pair of local and remote IP addresses.
 One or more of the following strings will be reported to standard output.
 Check the network reachability of the specified host name, IP address, or a
 pair of local and remote IP addresses.
 One or more of the following strings will be reported to standard output.
@@ -139,6 +141,12 @@ Network traffic to the specified nodename/address will not go through a
 gateway but is routed directly to one of the interfaces on the system.
 .El
 .Pp
 gateway but is routed directly to one of the interfaces on the system.
 .El
 .Pp
+The reachability can also be monitored by specifying the
+.Fl W
+(watch) option.
+This will result in the current status being reported as well as the
+status when/if the network configuration changes.
+.Pp
 A zero exit status will be returned when the reachability status is reported correctly.
 A non-zero exit status will be returned if errors are detected with an error reported to standard error.
 .It Fl w Ar dynamic-store-key Op Fl t Ar timeout
 A zero exit status will be returned when the reachability status is reported correctly.
 A non-zero exit status will be returned if errors are detected with an error reported to standard error.
 .It Fl w Ar dynamic-store-key Op Fl t Ar timeout
@@ -151,8 +159,10 @@ If present,
 will return with a zero exit status.
 If not present,
 .Nm
 will return with a zero exit status.
 If not present,
 .Nm
-will wait for the specified time for the key to be established.
-A non-zero exit status will be returned if the key was not created within the specified time.
+will wait for the specified time for data to be associated with or a notification
+to be posted using the key.
+A non-zero exit status will be returned if the key was not created/posted
+within the specified time.
 .Pp
 .Nm
 will wait indefinitely if a timeout of 0 seconds is specified.
 .Pp
 .Nm
 will wait indefinitely if a timeout of 0 seconds is specified.
index 9776c29aa984df160b68c653263cf48ff7caf60e..4e7f3a1b4b10ffb7564440525d91ed7b9399893c 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -67,8 +67,6 @@
 #include "session.h"
 #include "tests.h"
 
 #include "session.h"
 #include "tests.h"
 
-#include "SCDynamicStoreInternal.h"
-
 
 #define LINE_LENGTH 256
 
 
 #define LINE_LENGTH 256
 
@@ -252,10 +250,10 @@ usage(const char *command)
        SCPrint(TRUE, stderr, CFSTR("   or: %s --prefs\n"), command);
        SCPrint(TRUE, stderr, CFSTR("\tinteractive access to the [raw] stored preferences.\n"));
        SCPrint(TRUE, stderr, CFSTR("\n"));
        SCPrint(TRUE, stderr, CFSTR("   or: %s --prefs\n"), command);
        SCPrint(TRUE, stderr, CFSTR("\tinteractive access to the [raw] stored preferences.\n"));
        SCPrint(TRUE, stderr, CFSTR("\n"));
-       SCPrint(TRUE, stderr, CFSTR("   or: %s -r nodename\n"), command);
-       SCPrint(TRUE, stderr, CFSTR("   or: %s -r address\n"), command);
-       SCPrint(TRUE, stderr, CFSTR("   or: %s -r local-address remote-address\n"), command);
-       SCPrint(TRUE, stderr, CFSTR("\tcheck reachability of node, address, or address pair.\n"));
+       SCPrint(TRUE, stderr, CFSTR("   or: %s [-W] -r nodename\n"), command);
+       SCPrint(TRUE, stderr, CFSTR("   or: %s [-W] -r address\n"), command);
+       SCPrint(TRUE, stderr, CFSTR("   or: %s [-W] -r local-address remote-address\n"), command);
+       SCPrint(TRUE, stderr, CFSTR("\tcheck reachability of node, address, or address pair (-W to \"watch\").\n"));
        SCPrint(TRUE, stderr, CFSTR("\n"));
        SCPrint(TRUE, stderr, CFSTR("   or: %s -w dynamic-store-key [ -t timeout ]\n"), command);
        SCPrint(TRUE, stderr, CFSTR("\t-w\twait for presense of dynamic store key\n"));
        SCPrint(TRUE, stderr, CFSTR("\n"));
        SCPrint(TRUE, stderr, CFSTR("   or: %s -w dynamic-store-key [ -t timeout ]\n"), command);
        SCPrint(TRUE, stderr, CFSTR("\t-w\twait for presense of dynamic store key\n"));
@@ -309,11 +307,12 @@ main(int argc, char * const argv[])
        InputRef                src;
        int                     timeout = 15;   /* default timeout (in seconds) */
        char                    *wait   = NULL;
        InputRef                src;
        int                     timeout = 15;   /* default timeout (in seconds) */
        char                    *wait   = NULL;
+       Boolean                 watch   = FALSE;
        int                     xStore  = 0;    /* non dynamic store command line options */
 
        /* process any arguments */
 
        int                     xStore  = 0;    /* non dynamic store command line options */
 
        /* process any arguments */
 
-       while ((opt = getopt_long(argc, argv, "dvprt:w:", longopts, &opti)) != -1)
+       while ((opt = getopt_long(argc, argv, "dvprt:w:W", longopts, &opti)) != -1)
                switch(opt) {
                case 'd':
                        _sc_debug = TRUE;
                switch(opt) {
                case 'd':
                        _sc_debug = TRUE;
@@ -337,6 +336,9 @@ main(int argc, char * const argv[])
                        wait = optarg;
                        xStore++;
                        break;
                        wait = optarg;
                        xStore++;
                        break;
+               case 'W':
+                       watch = TRUE;
+                       break;
                case 0:
                        if        (strcmp(longopts[opti].name, "dns") == 0) {
                                doDNS = TRUE;
                case 0:
                        if        (strcmp(longopts[opti].name, "dns") == 0) {
                                doDNS = TRUE;
@@ -370,12 +372,16 @@ main(int argc, char * const argv[])
                usage(prog);
        }
 
                usage(prog);
        }
 
-       /* are we checking the reachability of a host/address */
+       /* are we checking (or watching) the reachability of a host/address */
        if (doReach) {
        if (doReach) {
-               if ((argc < 1) || (argc > 2)) {
+               if (argc < 1) {
                        usage(prog);
                }
                        usage(prog);
                }
-               do_checkReachability(argc, (char **)argv);
+               if (watch) {
+                       do_watchReachability(argc, (char **)argv);
+               } else {
+                       do_checkReachability(argc, (char **)argv);
+               }
                /* NOT REACHED */
        }
 
                /* NOT REACHED */
        }
 
@@ -484,9 +490,13 @@ main(int argc, char * const argv[])
                }
        }
 
                }
        }
 
-       while (process_line(src) == TRUE) {
-              /* debug information, diagnostics */
-               __showMachPortStatus();
+       while (TRUE) {
+               Boolean ok;
+
+               ok = process_line(src);
+               if (!ok) {
+                       break;
+               }
        }
 
        /* close the socket, free resources */
        }
 
        /* close the socket, free resources */
index 333d2079c151433031cec60904afafc296e7705a..d9d316ac55e08b37a3698955914b3c2200a3e165 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2003-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2003-2005, 2007-2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -39,6 +39,8 @@
 #include "scutil.h"
 #include "tests.h"
 
 #include "scutil.h"
 #include "tests.h"
 
+#include <netdb.h>
+#include <netdb_async.h>
 #include <sys/time.h>
 #include <net/if.h>
 #include <netinet/in.h>
 #include <sys/time.h>
 #include <net/if.h>
 #include <netinet/in.h>
 
 #include <dnsinfo.h>
 
 
 #include <dnsinfo.h>
 
-__private_extern__
-void
-do_checkReachability(int argc, char **argv)
+static SCNetworkReachabilityRef
+_setupReachability(int argc, char **argv, SCNetworkReachabilityContext *context)
 {
 {
-       SCNetworkConnectionFlags        flags   = 0;
+       struct sockaddr_in              sin;
+       struct sockaddr_in6             sin6;
        SCNetworkReachabilityRef        target  = NULL;
 
        SCNetworkReachabilityRef        target  = NULL;
 
-       if (argc == 1) {
-               struct sockaddr_in      sin;
-               struct sockaddr_in6     sin6;
-
-               bzero(&sin, sizeof(sin));
-               sin.sin_len         = sizeof(sin);
-               sin.sin_family      = AF_INET;
+       bzero(&sin, sizeof(sin));
+       sin.sin_len    = sizeof(sin);
+       sin.sin_family = AF_INET;
 
 
-               bzero(&sin6, sizeof(sin6));
-               sin6.sin6_len = sizeof(sin6);
-               sin6.sin6_family = AF_INET6;
+       bzero(&sin6, sizeof(sin6));
+       sin6.sin6_len    = sizeof(sin6);
+       sin6.sin6_family = AF_INET6;
 
 
-               if (inet_aton(argv[0], &sin.sin_addr) == 1) {
+       if (inet_aton(argv[0], &sin.sin_addr) == 1) {
+               if (argc == 1) {
                        target = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&sin);
                        target = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&sin);
-               } else if (inet_pton(AF_INET6, argv[0], &sin6.sin6_addr) == 1) {
-                       char    *p;
+                       if (context != NULL) {
+                               context->info = "by address";
+                       }
+               } else {
+                       struct sockaddr_in      r_sin;
+
+                       bzero(&r_sin, sizeof(r_sin));
+                       r_sin.sin_len    = sizeof(r_sin);
+                       r_sin.sin_family = AF_INET;
+                       if (inet_aton(argv[1], &r_sin.sin_addr) == 0) {
+                               SCPrint(TRUE, stderr, CFSTR("Could not interpret address \"%s\"\n"), argv[1]);
+                               exit(1);
+                       }
 
 
-                       p = strchr(argv[0], '%');
-                       if (p != NULL) {
-                               sin6.sin6_scope_id = if_nametoindex(p + 1);
+                       target = SCNetworkReachabilityCreateWithAddressPair(NULL,
+                                                                           (struct sockaddr *)&sin,
+                                                                           (struct sockaddr *)&r_sin);
+                       if (context != NULL) {
+                               context->info = "by address pair";
                        }
                        }
+               }
+       } else if (inet_pton(AF_INET6, argv[0], &sin6.sin6_addr) == 1) {
+               char    *p;
+
+               p = strchr(argv[0], '%');
+               if (p != NULL) {
+                       sin6.sin6_scope_id = if_nametoindex(p + 1);
+               }
 
 
+               if (argc == 1) {
                        target = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&sin6);
                        target = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&sin6);
+                       if (context != NULL) {
+                               context->info = "by (v6) address";
+                       }
                } else {
                } else {
-                       target = SCNetworkReachabilityCreateWithName(NULL, argv[0]);
-               }
-       } else /* if (argc == 2) */ {
-               struct sockaddr_in      l_sin;
-               struct sockaddr_in      r_sin;
-
-               bzero(&l_sin, sizeof(l_sin));
-               l_sin.sin_len         = sizeof(l_sin);
-               l_sin.sin_family      = AF_INET;
-               if (inet_aton(argv[0], &l_sin.sin_addr) == 0) {
-                       SCPrint(TRUE, stderr, CFSTR("Could not interpret address \"%s\"\n"), argv[0]);
-                       exit(1);
-               }
+                       struct sockaddr_in6     r_sin6;
+
+                       bzero(&r_sin6, sizeof(r_sin6));
+                       r_sin6.sin6_len         = sizeof(r_sin6);
+                       r_sin6.sin6_family      = AF_INET6;
+                       if (inet_pton(AF_INET6, argv[1], &r_sin6.sin6_addr) == 0) {
+                               SCPrint(TRUE, stderr, CFSTR("Could not interpret address \"%s\"\n"), argv[1]);
+                               exit(1);
+                       }
 
 
-               bzero(&r_sin, sizeof(r_sin));
-               r_sin.sin_len         = sizeof(r_sin);
-               r_sin.sin_family      = AF_INET;
-               if (inet_aton(argv[1], &r_sin.sin_addr) == 0) {
-                       SCPrint(TRUE, stderr, CFSTR("Could not interpret address \"%s\"\n"), argv[1]);
-                       exit(1);
-               }
+                       p = strchr(argv[1], '%');
+                       if (p != NULL) {
+                               r_sin6.sin6_scope_id = if_nametoindex(p + 1);
+                       }
 
 
-               target = SCNetworkReachabilityCreateWithAddressPair(NULL,
-                                                                   (struct sockaddr *)&l_sin,
-                                                                   (struct sockaddr *)&r_sin);
+                       target = SCNetworkReachabilityCreateWithAddressPair(NULL,
+                                                                           (struct sockaddr *)&sin6,
+                                                                           (struct sockaddr *)&r_sin6);
+                       if (context != NULL) {
+                               context->info = "by (v6) address pair";
+                       }
+               }
+       } else {
+               if (argc == 1) {
+                       target = SCNetworkReachabilityCreateWithName(NULL, argv[0]);
+                       if (context != NULL) {
+                               context->info = "by name";
+                       }
+               } else {
+                       CFStringRef             str;
+                       CFMutableDictionaryRef  options;
+
+                       options = CFDictionaryCreateMutable(NULL,
+                                                           0,
+                                                           &kCFTypeDictionaryKeyCallBacks,
+                                                           &kCFTypeDictionaryValueCallBacks);
+                       if (strlen(argv[0]) > 0) {
+                               str  = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
+                               CFDictionarySetValue(options, kSCNetworkReachabilityOptionNodeName, str);
+                               CFRelease(str);
+                       }
+                       if (strlen(argv[1]) > 0) {
+                               str  = CFStringCreateWithCString(NULL, argv[1], kCFStringEncodingUTF8);
+                               CFDictionarySetValue(options, kSCNetworkReachabilityOptionServName, str);
+                               CFRelease(str);
+                       }
+                       if (argc > 2) {
+                               CFDataRef               data;
+                               struct addrinfo         hints   = { 0 };
+                               int                     i;
+
+                               for (i = 2; i < argc; i++) {
+                                       if (strcasecmp(argv[i], "AI_ADDRCONFIG") == 0) {
+                                               hints.ai_flags |= AI_ADDRCONFIG;
+                                       } else if (strcasecmp(argv[i], "AI_ALL") == 0) {
+                                               hints.ai_flags |= AI_ALL;
+                                       } else if (strcasecmp(argv[i], "AI_V4MAPPED") == 0) {
+                                               hints.ai_flags |= AI_V4MAPPED;
+                                       } else if (strcasecmp(argv[i], "AI_V4MAPPED_CFG") == 0) {
+                                               hints.ai_flags |= AI_V4MAPPED_CFG;
+                                       } else if (strcasecmp(argv[i], "AI_ADDRCONFIG") == 0) {
+                                               hints.ai_flags |= AI_ADDRCONFIG;
+                                       } else if (strcasecmp(argv[i], "AI_V4MAPPED") == 0) {
+                                               hints.ai_flags |= AI_V4MAPPED;
+                                       } else if (strcasecmp(argv[i], "AI_DEFAULT") == 0) {
+                                               hints.ai_flags |= AI_DEFAULT;
+#ifdef AI_PARALLEL
+                                       } else if (strcasecmp(argv[i], "AI_PARALLEL") == 0) {
+                                               hints.ai_flags |= AI_PARALLEL;
+#endif // AI_PARALLEL
+                                       } else if (strcasecmp(argv[i], "PF_INET") == 0) {
+                                               hints.ai_family = PF_INET;
+                                       } else if (strcasecmp(argv[i], "PF_INET6") == 0) {
+                                               hints.ai_family = PF_INET6;
+                                       } else if (strcasecmp(argv[i], "SOCK_STREAM") == 0) {
+                                               hints.ai_socktype = SOCK_STREAM;
+                                       } else if (strcasecmp(argv[i], "SOCK_DGRAM") == 0) {
+                                               hints.ai_socktype = SOCK_DGRAM;
+                                       } else if (strcasecmp(argv[i], "SOCK_RAW") == 0) {
+                                               hints.ai_socktype = SOCK_RAW;
+                                       } else if (strcasecmp(argv[i], "IPPROTO_TCP") == 0) {
+                                               hints.ai_protocol = IPPROTO_TCP;
+                                       } else if (strcasecmp(argv[i], "IPPROTO_UDP") == 0) {
+                                               hints.ai_protocol = IPPROTO_UDP;
+                                       } else {
+                                               SCPrint(TRUE, stderr, CFSTR("Unrecognized hint: %s\n"), argv[i]);
+                                               exit(1);
+                                       }
+                               }
+
+                               data = CFDataCreate(NULL, (const UInt8 *)&hints, sizeof(hints));
+                               CFDictionarySetValue(options, kSCNetworkReachabilityOptionHints, data);
+                               CFRelease(data);
+                       }
+                       if (CFDictionaryGetCount(options) > 0) {
+                               target = SCNetworkReachabilityCreateWithOptions(NULL, options);
+                               if (context != NULL) {
+                                       context->info = "by (node and/or serv) name";
+                               }
+                       } else {
+                               SCPrint(TRUE, stderr, CFSTR("Must specify nodename or servname\n"));
+                               exit(1);
+                       }
+                       CFRelease(options);
+               }
        }
 
        }
 
-       if (!target) {
-               SCPrint(TRUE, stderr, CFSTR("  Could not determine status: %s\n"), SCErrorString(SCError()));
-               exit(1);
-       }
+       return target;
+}
 
 
-       if (!SCNetworkReachabilityGetFlags(target, &flags)) {
-               SCPrint(TRUE, stderr, CFSTR("  Could not determine status: %s\n"), SCErrorString(SCError()));
-               exit(1);
+static void
+_printReachability(SCNetworkReachabilityRef target)
+{
+       SCNetworkReachabilityFlags      flags;
+       Boolean                         ok;
+
+       ok = SCNetworkReachabilityGetFlags(target, &flags);
+       if (!ok) {
+               printf("    could not determine reachability, %s\n", SCErrorString(SCError()));
+               return;
        }
 
        }
 
-       SCPrint(_sc_debug, stdout, CFSTR("flags = 0x%x"), flags);
+       SCPrint(_sc_debug, stdout, CFSTR("flags = 0x%08x"), flags);
        if (flags != 0) {
                SCPrint(_sc_debug, stdout, CFSTR(" ("));
        if (flags != 0) {
                SCPrint(_sc_debug, stdout, CFSTR(" ("));
-               if (flags & kSCNetworkFlagsReachable) {
+               if (flags & kSCNetworkReachabilityFlagsReachable) {
                        SCPrint(TRUE, stdout, CFSTR("Reachable"));
                        SCPrint(TRUE, stdout, CFSTR("Reachable"));
-                       flags &= ~kSCNetworkFlagsReachable;
+                       flags &= ~kSCNetworkReachabilityFlagsReachable;
                        SCPrint(flags != 0, stdout, CFSTR(","));
                }
                        SCPrint(flags != 0, stdout, CFSTR(","));
                }
-               if (flags & kSCNetworkFlagsTransientConnection) {
+               if (flags & kSCNetworkReachabilityFlagsTransientConnection) {
                        SCPrint(TRUE, stdout, CFSTR("Transient Connection"));
                        SCPrint(TRUE, stdout, CFSTR("Transient Connection"));
-                       flags &= ~kSCNetworkFlagsTransientConnection;
+                       flags &= ~kSCNetworkReachabilityFlagsTransientConnection;
                        SCPrint(flags != 0, stdout, CFSTR(","));
                }
                        SCPrint(flags != 0, stdout, CFSTR(","));
                }
-               if (flags & kSCNetworkFlagsConnectionRequired) {
+               if (flags & kSCNetworkReachabilityFlagsConnectionRequired) {
                        SCPrint(TRUE, stdout, CFSTR("Connection Required"));
                        SCPrint(TRUE, stdout, CFSTR("Connection Required"));
-                       flags &= ~kSCNetworkFlagsConnectionRequired;
+                       flags &= ~kSCNetworkReachabilityFlagsConnectionRequired;
+                       SCPrint(flags != 0, stdout, CFSTR(","));
+               }
+               if (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) {
+                       SCPrint(TRUE, stdout, CFSTR("Automatic Connection On Traffic"));
+                       flags &= ~kSCNetworkReachabilityFlagsConnectionOnTraffic;
                        SCPrint(flags != 0, stdout, CFSTR(","));
                }
                        SCPrint(flags != 0, stdout, CFSTR(","));
                }
-               if (flags & kSCNetworkFlagsConnectionAutomatic) {
-                       SCPrint(TRUE, stdout, CFSTR("Connection Automatic"));
-                       flags &= ~kSCNetworkFlagsConnectionAutomatic;
+               if (flags & kSCNetworkReachabilityFlagsConnectionOnDemand) {
+                       SCPrint(TRUE, stdout, CFSTR("Automatic Connection On Demand"));
+                       flags &= ~kSCNetworkReachabilityFlagsConnectionOnDemand;
                        SCPrint(flags != 0, stdout, CFSTR(","));
                }
                        SCPrint(flags != 0, stdout, CFSTR(","));
                }
-               if (flags & kSCNetworkFlagsInterventionRequired) {
+               if (flags & kSCNetworkReachabilityFlagsInterventionRequired) {
                        SCPrint(TRUE, stdout, CFSTR("Intervention Required"));
                        SCPrint(TRUE, stdout, CFSTR("Intervention Required"));
-                       flags &= ~kSCNetworkFlagsInterventionRequired;
+                       flags &= ~kSCNetworkReachabilityFlagsInterventionRequired;
                        SCPrint(flags != 0, stdout, CFSTR(","));
                }
                        SCPrint(flags != 0, stdout, CFSTR(","));
                }
-               if (flags & kSCNetworkFlagsIsLocalAddress) {
+               if (flags & kSCNetworkReachabilityFlagsIsLocalAddress) {
                        SCPrint(TRUE, stdout, CFSTR("Local Address"));
                        SCPrint(TRUE, stdout, CFSTR("Local Address"));
-                       flags &= ~kSCNetworkFlagsIsLocalAddress;
+                       flags &= ~kSCNetworkReachabilityFlagsIsLocalAddress;
                        SCPrint(flags != 0, stdout, CFSTR(","));
                }
                        SCPrint(flags != 0, stdout, CFSTR(","));
                }
-               if (flags & kSCNetworkFlagsIsDirect) {
+               if (flags & kSCNetworkReachabilityFlagsIsDirect) {
                        SCPrint(TRUE, stdout, CFSTR("Directly Reachable Address"));
                        SCPrint(TRUE, stdout, CFSTR("Directly Reachable Address"));
-                       flags &= ~kSCNetworkFlagsIsDirect;
+                       flags &= ~kSCNetworkReachabilityFlagsIsDirect;
                        SCPrint(flags != 0, stdout, CFSTR(","));
                }
                        SCPrint(flags != 0, stdout, CFSTR(","));
                }
+#if    TARGET_OS_IPHONE
+               if (flags & kSCNetworkReachabilityFlagsIsWWAN) {
+                       SCPrint(TRUE, stdout, CFSTR("WWAN"));
+                       flags &= ~kSCNetworkReachabilityFlagsIsWWAN;
+                       SCPrint(flags != 0, stdout, CFSTR(","));
+               }
+#endif // TARGET_OS_IPHONE
+               if (flags != 0) {
+                       SCPrint(TRUE, stdout, CFSTR("0x%08x"), flags);
+               }
                SCPrint(_sc_debug, stdout, CFSTR(")"));
        } else {
                SCPrint(_sc_debug, stdout, CFSTR(" ("));
                SCPrint(_sc_debug, stdout, CFSTR(")"));
        } else {
                SCPrint(_sc_debug, stdout, CFSTR(" ("));
@@ -159,6 +283,114 @@ do_checkReachability(int argc, char **argv)
                SCPrint(_sc_debug, stdout, CFSTR(")"));
        }
        SCPrint(TRUE, stdout, CFSTR("\n"));
                SCPrint(_sc_debug, stdout, CFSTR(")"));
        }
        SCPrint(TRUE, stdout, CFSTR("\n"));
+
+       return;
+}
+
+
+__private_extern__
+void
+do_checkReachability(int argc, char **argv)
+{
+       SCNetworkReachabilityRef        target;
+
+       target = _setupReachability(argc, argv, NULL);
+       if (target == NULL) {
+               SCPrint(TRUE, stderr, CFSTR("  Could not determine status: %s\n"), SCErrorString(SCError()));
+               exit(1);
+       }
+
+       _printReachability(target);
+       CFRelease(target);
+       exit(0);
+}
+
+
+static void
+callout(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *info)
+{
+       static int      n = 3;
+       struct tm       tm_now;
+       struct timeval  tv_now;
+
+       (void)gettimeofday(&tv_now, NULL);
+       (void)localtime_r(&tv_now.tv_sec, &tm_now);
+
+       SCPrint(TRUE, stdout, CFSTR("\n*** %2d:%02d:%02d.%03d\n\n"),
+               tm_now.tm_hour,
+               tm_now.tm_min,
+               tm_now.tm_sec,
+               tv_now.tv_usec / 1000);
+       SCPrint(TRUE, stdout, CFSTR("%2d: callback w/flags=0x%08x (info=\"%s\")\n"), n++, flags, (char *)info);
+       SCPrint(TRUE, stdout, CFSTR("    %@\n"), target);
+       _printReachability(target);
+       SCPrint(TRUE, stdout, CFSTR("\n"));
+       return;
+}
+
+
+__private_extern__
+void
+do_watchReachability(int argc, char **argv)
+{
+       SCNetworkReachabilityContext    context = { 0, NULL, NULL, NULL, NULL };
+       SCNetworkReachabilityRef        target;
+       SCNetworkReachabilityRef        target_async;
+
+       target = _setupReachability(argc, argv, NULL);
+       if (target == NULL) {
+               SCPrint(TRUE, stderr, CFSTR("  Could not determine status: %s\n"), SCErrorString(SCError()));
+               exit(1);
+       }
+
+       target_async = _setupReachability(argc, argv, &context);
+       if (target_async == NULL) {
+               SCPrint(TRUE, stderr, CFSTR("  Could not determine status: %s\n"), SCErrorString(SCError()));
+               exit(1);
+       }
+
+       // Normally, we don't want to make any calls to SCNetworkReachabilityGetFlags()
+       // until after the "target" has been scheduled on a run loop.  Otherwise, we'll
+       // end up making a synchronous DNS request and that's not what we want.
+       //
+       // But, to test the case were an application call SCNetworkReachabilityGetFlags()
+       // we provide the "CHECK_REACHABILITY_BEFORE_SCHEDULING" environment variable.
+       if (getenv("CHECK_REACHABILITY_BEFORE_SCHEDULING") != NULL) {
+               CFRelease(target_async);
+               target_async = CFRetain(target);
+       }
+
+       // Direct check of reachability
+       SCPrint(TRUE, stdout, CFSTR(" 0: direct\n"));
+       SCPrint(TRUE, stdout, CFSTR("   %@\n"), target);
+       _printReachability(target);
+       CFRelease(target);
+       SCPrint(TRUE, stdout, CFSTR("\n"));
+
+       // schedule the target
+       SCPrint(TRUE, stdout, CFSTR(" 1: start\n"));
+       SCPrint(TRUE, stdout, CFSTR("   %@\n"), target_async);
+       //_printReachability(target_async);
+       SCPrint(TRUE, stdout, CFSTR("\n"));
+
+       if (!SCNetworkReachabilitySetCallback(target_async, callout, &context)) {
+               printf("SCNetworkReachabilitySetCallback() failed: %s\n", SCErrorString(SCError()));
+               exit(1);
+       }
+
+       if (!SCNetworkReachabilityScheduleWithRunLoop(target_async, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)) {
+               printf("SCNetworkReachabilityScheduleWithRunLoop() failed: %s\n", SCErrorString(SCError()));
+               exit(1);
+       }
+
+       // Note: now that we are scheduled on a run loop we can call SCNetworkReachabilityGetFlags()
+       //       to get the current status.  For "names", a DNS lookup has already been initiated.
+       SCPrint(TRUE, stdout, CFSTR(" 2: on runloop\n"));
+       SCPrint(TRUE, stdout, CFSTR("   %@\n"), target_async);
+       _printReachability(target_async);
+       SCPrint(TRUE, stdout, CFSTR("\n"));
+
+       CFRunLoopRun();
        exit(0);
 }
 
        exit(0);
 }
 
@@ -197,10 +429,12 @@ do_showDNSConfiguration(int argc, char **argv)
                        }
 
                        for (i = 0; i < resolver->n_sortaddr; i++) {
                        }
 
                        for (i = 0; i < resolver->n_sortaddr; i++) {
-                               SCPrint(TRUE, stdout, CFSTR("  sortaddr[%d] : %s/%s\n"),
-                                       i,
-                                       inet_ntoa(resolver->sortaddr[i]->address),
-                                       inet_ntoa(resolver->sortaddr[i]->mask));
+                               char    abuf[32];
+                               char    mbuf[32];
+
+                               (void)inet_ntop(AF_INET, &resolver->sortaddr[i]->address, abuf, sizeof(abuf));
+                               (void)inet_ntop(AF_INET, &resolver->sortaddr[i]->mask,    mbuf, sizeof(mbuf));
+                               SCPrint(TRUE, stdout, CFSTR("  sortaddr[%d] : %s/%s\n"), i, abuf, mbuf);
                        }
 
                        if (resolver->options != NULL) {
                        }
 
                        if (resolver->options != NULL) {
@@ -238,6 +472,7 @@ do_showProxyConfiguration(int argc, char **argv)
        proxies = SCDynamicStoreCopyProxies(NULL);
        if (proxies != NULL) {
                SCPrint(TRUE, stdout, CFSTR("%@\n"), proxies);
        proxies = SCDynamicStoreCopyProxies(NULL);
        if (proxies != NULL) {
                SCPrint(TRUE, stdout, CFSTR("%@\n"), proxies);
+               CFRelease(proxies);
        } else {
                SCPrint(TRUE, stdout, CFSTR("No proxy configuration available\n"));
        }
        } else {
                SCPrint(TRUE, stdout, CFSTR("No proxy configuration available\n"));
        }
@@ -278,6 +513,7 @@ do_wait(char *waitKey, int timeout)
        struct itimerval        itv;
        CFStringRef             key;
        CFMutableArrayRef       keys;
        struct itimerval        itv;
        CFStringRef             key;
        CFMutableArrayRef       keys;
+       Boolean                 ok;
 
        store = SCDynamicStoreCreate(NULL, CFSTR("scutil (wait)"), waitKeyFound, NULL);
        if (store == NULL) {
 
        store = SCDynamicStoreCreate(NULL, CFSTR("scutil (wait)"), waitKeyFound, NULL);
        if (store == NULL) {
@@ -286,11 +522,13 @@ do_wait(char *waitKey, int timeout)
                exit(1);
        }
 
                exit(1);
        }
 
-       keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
        key  = CFStringCreateWithCString(NULL, waitKey, kCFStringEncodingUTF8);
        key  = CFStringCreateWithCString(NULL, waitKey, kCFStringEncodingUTF8);
-       CFArrayAppendValue(keys, key);
 
 
-       if (!SCDynamicStoreSetNotificationKeys(store, keys, NULL)) {
+       keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+       CFArrayAppendValue(keys, key);
+       ok = SCDynamicStoreSetNotificationKeys(store, keys, NULL);
+       CFRelease(keys);
+       if (!ok) {
                SCPrint(TRUE, stderr,
                        CFSTR("SCDynamicStoreSetNotificationKeys() failed: %s\n"), SCErrorString(SCError()));
                exit(1);
                SCPrint(TRUE, stderr,
                        CFSTR("SCDynamicStoreSetNotificationKeys() failed: %s\n"), SCErrorString(SCError()));
                exit(1);
@@ -331,7 +569,7 @@ do_wait(char *waitKey, int timeout)
 CFRunLoopSourceRef     notifyRls       = NULL;
 SCDynamicStoreRef      store           = NULL;
 CFPropertyListRef      value           = NULL;
 CFRunLoopSourceRef     notifyRls       = NULL;
 SCDynamicStoreRef      store           = NULL;
 CFPropertyListRef      value           = NULL;
-       
+
 int
 main(int argc, char **argv)
 {
 int
 main(int argc, char **argv)
 {
index f1ea81925771fe954777c687876b099b1f75846e..6de629b3d0422bfbaee4599cd5d076ea4d8b0dfd 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000, 2001, 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2001, 2004, 2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -41,6 +41,7 @@
 __BEGIN_DECLS
 
 void   do_checkReachability            (int argc, char **argv);
 __BEGIN_DECLS
 
 void   do_checkReachability            (int argc, char **argv);
+void   do_watchReachability            (int argc, char **argv);
 void   do_showDNSConfiguration         (int argc, char **argv);
 void   do_showProxyConfiguration       (int argc, char **argv);
 void   do_snapshot                     (int argc, char **argv);
 void   do_showDNSConfiguration         (int argc, char **argv);
 void   do_showProxyConfiguration       (int argc, char **argv);
 void   do_snapshot                     (int argc, char **argv);