Commit b9ad6c19 authored by andersca@apple.com's avatar andersca@apple.com

2008-05-14 Anders Carlsson <andersca@apple.com>

        Reviewed by Brady.

        <rdar://problem/5931742> Support navigator.onLine from HTML5
        
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        Add NetworkStateNotifier files.
        
        * dom/EventNames.h:
        Add offline and online events.
        
        * page/Navigator.cpp:
        (WebCore::Navigator::onLine):
        * page/Navigator.h:
        * page/Navigator.idl:
        Add navigator.onLine.
        
        * page/Page.cpp:
        (WebCore::networkStateChanged):
        Dispatch offline/online events to all frames.
        
        (WebCore::Page::Page):
        Set state change callback.
        
        * platform/network/NetworkStateNotifier.cpp: Added.
        * platform/network/NetworkStateNotifier.h: Added.

        * platform/network/mac/NetworkStateNotifierMac.cpp: Added.
        Mac network state notifier.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 90244557
2008-05-14 Anders Carlsson <andersca@apple.com>
Reviewed by Brady.
<rdar://problem/5931742> Support navigator.onLine from HTML5
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
Add NetworkStateNotifier files.
* dom/EventNames.h:
Add offline and online events.
* page/Navigator.cpp:
(WebCore::Navigator::onLine):
* page/Navigator.h:
* page/Navigator.idl:
Add navigator.onLine.
* page/Page.cpp:
(WebCore::networkStateChanged):
Dispatch offline/online events to all frames.
(WebCore::Page::Page):
Set state change callback.
* platform/network/NetworkStateNotifier.cpp: Added.
* platform/network/NetworkStateNotifier.h: Added.
* platform/network/mac/NetworkStateNotifierMac.cpp: Added.
Mac network state notifier.
2008-05-14 Adam Roben <aroben@apple.com>
Fix Bug 18888: REGRESSION (r32731): console.log always prints
......@@ -6300,6 +6300,14 @@
RelativePath="..\platform\network\HTTPParsers.h"
>
</File>
<File
RelativePath="..\platform\network\NetworkStateNotifier.h"
>
</File>
<File
RelativePath="..\platform\network\NetworkStateNotifier.cpp"
>
</File>
<File
RelativePath="..\platform\network\ProtectionSpace.cpp"
>
......
......@@ -181,6 +181,10 @@
1A7CCB1B0CD9469A00B7B64E /* SQLTransactionCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7CCB170CD9469A00B7B64E /* SQLTransactionCallback.h */; };
1A7CCB1C0CD9469A00B7B64E /* SQLTransactionErrorCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7CCB180CD9469A00B7B64E /* SQLTransactionErrorCallback.h */; };
1A7CCB240CD946FD00B7B64E /* SQLTransaction.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7CCB220CD946FD00B7B64E /* SQLTransaction.h */; };
1A7FA6190DDA3B3A0028F8A5 /* NetworkStateNotifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7FA6180DDA3B3A0028F8A5 /* NetworkStateNotifier.h */; };
1A7FA61B0DDA3BBE0028F8A5 /* NetworkStateNotifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7FA61A0DDA3BBE0028F8A5 /* NetworkStateNotifier.cpp */; };
1A7FA6490DDA3CBA0028F8A5 /* NetworkStateNotifierMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7FA6470DDA3CBA0028F8A5 /* NetworkStateNotifierMac.cpp */; };
1A7FA7CC0DDA4B770028F8A5 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7FA7CB0DDA4B770028F8A5 /* SystemConfiguration.framework */; };
1A820D910A13EBA600AF843C /* ImageDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A820D8F0A13EBA600AF843C /* ImageDocument.cpp */; };
1A820D920A13EBA600AF843C /* ImageDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A820D900A13EBA600AF843C /* ImageDocument.h */; };
1A85B18F0A1B18A200D8C87C /* JSHTMLHtmlElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A85B18D0A1B18A200D8C87C /* JSHTMLHtmlElement.cpp */; };
......@@ -4634,6 +4638,10 @@
1A7CCB180CD9469A00B7B64E /* SQLTransactionErrorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLTransactionErrorCallback.h; sourceTree = "<group>"; };
1A7CCB220CD946FD00B7B64E /* SQLTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLTransaction.h; sourceTree = "<group>"; };
1A7CCB230CD946FD00B7B64E /* SQLTransaction.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SQLTransaction.idl; sourceTree = "<group>"; };
1A7FA6180DDA3B3A0028F8A5 /* NetworkStateNotifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkStateNotifier.h; sourceTree = "<group>"; };
1A7FA61A0DDA3BBE0028F8A5 /* NetworkStateNotifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkStateNotifier.cpp; sourceTree = "<group>"; };
1A7FA6470DDA3CBA0028F8A5 /* NetworkStateNotifierMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkStateNotifierMac.cpp; sourceTree = "<group>"; };
1A7FA7CB0DDA4B770028F8A5 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = /System/Library/Frameworks/SystemConfiguration.framework; sourceTree = "<absolute>"; };
1A820D8F0A13EBA600AF843C /* ImageDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ImageDocument.cpp; sourceTree = "<group>"; };
1A820D900A13EBA600AF843C /* ImageDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ImageDocument.h; sourceTree = "<group>"; };
1A85B17D0A1B183600D8C87C /* HTMLHtmlElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLHtmlElement.idl; sourceTree = "<group>"; };
......@@ -8375,6 +8383,7 @@
93F19B1708245E59001E9ABC /* libicucore.dylib in Frameworks */,
1CFAE3230A6D6A3F0032593D /* libobjc.dylib in Frameworks */,
DD763BB20992C2C900740B8E /* libxml2.dylib in Frameworks */,
1A7FA7CC0DDA4B770028F8A5 /* SystemConfiguration.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -8434,6 +8443,7 @@
1CFAE3220A6D6A3F0032593D /* libobjc.dylib */,
DD763BB10992C2C900740B8E /* libxml2.dylib */,
A85D7A2F0879EBA9006A9172 /* QuartzCore.framework */,
1A7FA7CB0DDA4B770028F8A5 /* SystemConfiguration.framework */,
);
name = Frameworks;
sourceTree = "<group>";
......@@ -8890,6 +8900,8 @@
514C765C0CE923A1007EF3CD /* HTTPHeaderMap.h */,
514C765D0CE923A1007EF3CD /* HTTPParsers.cpp */,
514C765E0CE923A1007EF3CD /* HTTPParsers.h */,
1A7FA61A0DDA3BBE0028F8A5 /* NetworkStateNotifier.cpp */,
1A7FA6180DDA3B3A0028F8A5 /* NetworkStateNotifier.h */,
514C765F0CE923A1007EF3CD /* ProtectionSpace.cpp */,
514C76600CE923A1007EF3CD /* ProtectionSpace.h */,
514C76630CE923A1007EF3CD /* ResourceHandle.cpp */,
......@@ -8913,6 +8925,7 @@
514C76430CE9234E007EF3CD /* AuthenticationMac.mm */,
514C76440CE9234E007EF3CD /* FormDataStreamMac.h */,
514C76450CE9234E007EF3CD /* FormDataStreamMac.mm */,
1A7FA6470DDA3CBA0028F8A5 /* NetworkStateNotifierMac.cpp */,
514C76460CE9234E007EF3CD /* ResourceErrorMac.mm */,
514C76470CE9234E007EF3CD /* ResourceHandleMac.mm */,
514C76480CE9234E007EF3CD /* ResourceRequest.h */,
......@@ -15079,6 +15092,7 @@
BC34C33D0DD607DE00090123 /* AccessItem.h in Headers */,
BC34C33F0DD607DE00090123 /* AccessItemRule.h in Headers */,
BC76AC130DD7AD5C00415F34 /* ParserUtilities.h in Headers */,
1A7FA6190DDA3B3A0028F8A5 /* NetworkStateNotifier.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -16793,6 +16807,8 @@
BC34C33A0DD607DE00090123 /* AccessControlList.cpp in Sources */,
BC34C33C0DD607DE00090123 /* AccessItem.cpp in Sources */,
BC34C33E0DD607DE00090123 /* AccessItemRule.cpp in Sources */,
1A7FA61B0DDA3BBE0028F8A5 /* NetworkStateNotifier.cpp in Sources */,
1A7FA6490DDA3CBA0028F8A5 /* NetworkStateNotifierMac.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -65,6 +65,8 @@ namespace WebCore { namespace EventNames {
macro(mouseup) \
macro(mousewheel) \
macro(noupdate) \
macro(offline) \
macro(online) \
macro(overflowchanged) \
macro(paste) \
macro(readystatechange) \
......
......@@ -29,6 +29,7 @@
#include "FrameLoaderClient.h"
#include "Language.h"
#include "MimeTypeArray.h"
#include "NetworkStateNotifier.h"
#include "PlatformString.h"
#include "PluginArray.h"
#include "PluginData.h"
......@@ -169,5 +170,10 @@ bool Navigator::javaEnabled() const
return false;
return m_frame->settings()->isJavaEnabled();
}
bool Navigator::onLine() const
{
return networkStateNotifier().onLine();
}
} // namespace WebCore
......@@ -55,6 +55,7 @@ namespace WebCore {
bool cookieEnabled() const;
bool javaEnabled() const;
bool onLine() const;
private:
Navigator(Frame*);
Frame* m_frame;
......
......@@ -34,6 +34,8 @@ module window {
readonly attribute DOMString vendorSub;
readonly attribute boolean cookieEnabled;
boolean javaEnabled();
readonly attribute boolean onLine;
};
}
......@@ -28,6 +28,7 @@
#include "EditorClient.h"
#include "DOMWindow.h"
#include "DragController.h"
#include "EventNames.h"
#include "FileSystem.h"
#include "FocusController.h"
#include "Frame.h"
......@@ -38,6 +39,7 @@
#include "InspectorController.h"
#include "JavaScriptDebugServer.h"
#include "Logging.h"
#include "NetworkStateNotifier.h"
#include "Navigator.h"
#include "PageGroup.h"
#include "PluginData.h"
......@@ -61,6 +63,8 @@
namespace WebCore {
using namespace EventNames;
static HashSet<Page*>* allPages;
#ifndef NDEBUG
......@@ -78,6 +82,34 @@ int PageCounter::count = 0;
static PageCounter pageCounter;
#endif
static void networkStateChanged()
{
Vector<RefPtr<Frame> > frames;
// Get all the frames of all the pages in all the page groups
HashSet<Page*>::iterator end = allPages->end();
for (HashSet<Page*>::iterator it = allPages->begin(); it != end; ++it) {
for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext())
frames.append(frame);
}
AtomicString eventName = networkStateNotifier().onLine() ? onlineEvent : offlineEvent;
for (unsigned i = 0; i < frames.size(); i++) {
Document* document = frames[i]->document();
if (!document)
continue;
// If the document does not have a body the event should be dispatched to the document
EventTargetNode* eventTarget = document->body();
if (!eventTarget)
eventTarget = document;
eventTarget->dispatchHTMLEvent(eventName, false, false);
}
}
Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, EditorClient* editorClient, DragClient* dragClient, InspectorClient* inspectorClient)
: m_chrome(new Chrome(this, chromeClient))
, m_dragCaretController(new SelectionController(0, true))
......@@ -102,6 +134,8 @@ Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, Edi
if (!allPages) {
allPages = new HashSet<Page*>;
setFocusRingColorChangeFunction(setNeedsReapplyStyles);
networkStateNotifier().setNetworkStateChangedFunction(networkStateChanged);
}
ASSERT(!allPages->contains(this));
......
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "NetworkStateNotifier.h"
namespace WebCore {
NetworkStateNotifier& networkStateNotifier()
{
static NetworkStateNotifier networkStateNotifier;
return networkStateNotifier;
}
void NetworkStateNotifier::setNetworkStateChangedFunction(void(*function)())
{
ASSERT(!m_networkStateChangedFunction);
m_networkStateChangedFunction = function;
}
}
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef NetworkStateNotifier_h
#define NetworkStateNotifier_h
#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
#include "Timer.h"
typedef const struct __CFArray * CFArrayRef;
typedef const struct __SCDynamicStore * SCDynamicStoreRef;
#endif
namespace WebCore {
class NetworkStateNotifier {
public:
NetworkStateNotifier();
void setNetworkStateChangedFunction(void (*)());
bool onLine() const { return m_isOnLine; }
private:
bool m_isOnLine;
void (*m_networkStateChangedFunction)();
#if PLATFORM(MAC)
void updateState();
void networkStateChangeTimerFired(Timer<NetworkStateNotifier>*);
static void dynamicStoreCallback(SCDynamicStoreRef, CFArrayRef changedKeys, void *info);
RetainPtr<SCDynamicStoreRef> m_store;
Timer<NetworkStateNotifier> m_networkStateChangeTimer;
#endif
};
#if !PLATFORM(MAC)
inline void NetworkStateNotifier::NetworkStateNotifier()
: m_onLine(true)
{
}
#endif
NetworkStateNotifier& networkStateNotifier();
};
#endif // NetworkStateNotifier_h
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "NetworkStateNotifier.h"
#include <SystemConfiguration/SystemConfiguration.h>
namespace WebCore {
static const double StateChangeTimerInterval = 2.0;
void NetworkStateNotifier::updateState()
{
// Assume that we're offline until proven otherwise.
m_isOnLine = false;
RetainPtr<CFStringRef> str(AdoptCF, SCDynamicStoreKeyCreateNetworkInterface(0, kSCDynamicStoreDomainState));
RetainPtr<CFPropertyListRef> propertyList(AdoptCF, SCDynamicStoreCopyValue(m_store.get(), str.get()));
if (!propertyList)
return;
if (CFGetTypeID(propertyList.get()) != CFDictionaryGetTypeID())
return;
CFArrayRef netInterfaces = (CFArrayRef)CFDictionaryGetValue((CFDictionaryRef)propertyList.get(), kSCDynamicStorePropNetInterfaces);
if (CFGetTypeID(netInterfaces) != CFArrayGetTypeID())
return;
for (CFIndex i = 0; i < CFArrayGetCount(netInterfaces); i++) {
CFStringRef interface = (CFStringRef)CFArrayGetValueAtIndex(netInterfaces, i);
if (CFGetTypeID(interface) != CFStringGetTypeID())
continue;
// Ignore the loopback interface.
if (CFStringFind(interface, CFSTR("lo"), kCFCompareAnchored).location != kCFNotFound)
continue;
RetainPtr<CFStringRef> key(AdoptCF, SCDynamicStoreKeyCreateNetworkInterfaceEntity(0, kSCDynamicStoreDomainState, interface, kSCEntNetIPv4));
RetainPtr<CFArrayRef> keyList(AdoptCF, SCDynamicStoreCopyKeyList(m_store.get(), key.get()));
if (keyList && CFArrayGetCount(keyList.get())) {
m_isOnLine = true;
break;
}
}
}
void NetworkStateNotifier::dynamicStoreCallback(SCDynamicStoreRef store, CFArrayRef changedKeys, void *info)
{
NetworkStateNotifier* notifier = static_cast<NetworkStateNotifier*>(info);
// Calling updateState() could be expensive so we schedule a timer that will do it
// when things have cooled down.
notifier->m_networkStateChangeTimer.startOneShot(StateChangeTimerInterval);
}
void NetworkStateNotifier::networkStateChangeTimerFired(Timer<NetworkStateNotifier>*)
{
bool oldOnLine = m_isOnLine;
updateState();
if (m_isOnLine == oldOnLine)
return;
if (m_networkStateChangedFunction)
m_networkStateChangedFunction();
}
NetworkStateNotifier::NetworkStateNotifier()
: m_isOnLine(false)
, m_networkStateChangeTimer(this, &NetworkStateNotifier::networkStateChangeTimerFired)
{
SCDynamicStoreContext context = { 0, this, 0, 0, 0 };
m_store.adoptCF(SCDynamicStoreCreate(0, CFSTR("com.apple.WebCore"), dynamicStoreCallback, &context));
RetainPtr<CFRunLoopSourceRef> configSource = SCDynamicStoreCreateRunLoopSource(0, m_store.get(), 0);
CFRunLoopAddSource(CFRunLoopGetCurrent(), configSource.get(), kCFRunLoopCommonModes);
RetainPtr<CFMutableArrayRef> keys(AdoptCF, CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
RetainPtr<CFMutableArrayRef> patterns(AdoptCF, CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
RetainPtr<CFStringRef> key;
RetainPtr<CFStringRef> pattern;
key.adoptCF(SCDynamicStoreKeyCreateNetworkGlobalEntity(0, kSCDynamicStoreDomainState, kSCEntNetIPv4));
CFArrayAppendValue(keys.get(), key.get());
pattern.adoptCF(SCDynamicStoreKeyCreateNetworkInterfaceEntity(0, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv4));
CFArrayAppendValue(patterns.get(), pattern.get());
key.adoptCF(SCDynamicStoreKeyCreateNetworkGlobalEntity(0, kSCDynamicStoreDomainState, kSCEntNetDNS));
CFArrayAppendValue(keys.get(), key.get());
SCDynamicStoreSetNotificationKeys(m_store.get(), keys.get(), patterns.get());
updateState();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment