2 * Copyright (c) 2015-2018 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
24 #import "controller.h"
27 haveNetworkExtensionFramework()
29 Boolean haveFramework;
31 haveFramework = ([NEPolicy class] != nil);
36 process_AgentMonitor(void)
38 if (!haveNetworkExtensionFramework()) {
42 SC_log(LOG_DEBUG, "Triggering AgentMonitor");
44 AgentController *controller = [AgentController sharedController];
45 if (controller == nil) {
46 SC_log(LOG_ERR, "AgentController could not be initialized");
50 dispatch_sync(controller.controllerQueue, ^{
51 [[AgentController sharedController] processDNSChanges];
52 [[AgentController sharedController] processProxyChanges];
60 process_AgentMonitor_DNS(void)
62 if (!haveNetworkExtensionFramework()) {
66 SC_log(LOG_DEBUG, "Triggering AgentMonitor for DNS");
68 AgentController *controller = [AgentController sharedController];
69 if (controller == nil) {
70 SC_log(LOG_ERR, "AgentController could not be initialized");
74 dispatch_sync(controller.controllerQueue, ^{
75 [[AgentController sharedController] processDNSChanges];
83 process_AgentMonitor_Proxy(void)
85 if (!haveNetworkExtensionFramework()) {
89 SC_log(LOG_DEBUG, "Triggering AgentMonitor for Proxy");
91 AgentController *controller = [AgentController sharedController];
92 if (controller == nil) {
93 SC_log(LOG_ERR, "AgentController could not be initialized");
97 dispatch_sync(controller.controllerQueue, ^{
98 [[AgentController sharedController] processProxyChanges];
106 copy_proxy_information_for_agent_uuid(uuid_t uuid, uint64_t *length)
108 __block const void *buffer = NULL;
110 if (!haveNetworkExtensionFramework()) {
115 AgentController *controller = [AgentController sharedController];
116 if (controller == nil) {
117 SC_log(LOG_ERR, "AgentController could not be initialized");
121 dispatch_sync(controller.controllerQueue, ^{
122 buffer = [[AgentController sharedController] copyProxyAgentData:uuid
131 copy_dns_information_for_agent_uuid(uuid_t uuid, uint64_t *length)
133 __block const void *buffer = NULL;
135 if (!haveNetworkExtensionFramework()) {
140 AgentController *controller = [AgentController sharedController];
141 if (controller == nil) {
142 SC_log(LOG_ERR, "AgentController could not be initialized");
146 dispatch_sync(controller.controllerQueue, ^{
147 buffer = [[AgentController sharedController] copyDNSAgentData:uuid