Internet Sharing & SCF
Internet Sharing & SCF
- Subject: Internet Sharing & SCF
- From: Ryan McGann <email@hidden>
- Date: Mon, 14 Oct 2002 02:20:53 -0700
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.