Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Internet Sharing & SCF



I'm trying to use the SCF to be notified when Internet Sharing is turned on/off. I've installed handlers to be notified when the IPv4 address changes for any interface, but it's never called even though Internet Sharing will assign an (sometimes additional) IPv4 address to an interface. The callback is called when I disable or enable a specific service in the System Preferences networking panel however. Is there a better/different way to be notified when Internet Sharing is enabled/disabled in Jaguar?

Here's the code:
...
CFMutableArrayRef keys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
CFMutableArrayRef patterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);

key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
kSCDynamicStoreDomainState,
kSCEntNetIPv4);
CFArrayAppendValue(keys, key);
CFRelease(key);

key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL,
kSCDynamicStoreDomainState,
kSCCompAnyRegex,
kSCEntNetIPv4);
CFArrayAppendValue(patterns, key);
CFRelease(key);

if (!SCDynamicStoreSetNotificationKeys(store, keys, patterns)) {
fprintf(stderr, "error = %s\n", SCErrorString(SCError()));
CFRelease(store);
CFRelease(keys);
CFRelease(patterns);
return 0;
}

Thanks,
Ryan

email@hidden
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.