]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/SCNetworkConnectionPrivate.h
configd-802.20.7.tar.gz
[apple/configd.git] / SystemConfiguration.fproj / SCNetworkConnectionPrivate.h
1 /*
2 * Copyright (c) 2006, 2008, 2009, 2011-2015 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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
11 * file.
12 *
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.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #ifndef _SCNETWORKCONNECTIONPRIVATE_H
25 #define _SCNETWORKCONNECTIONPRIVATE_H
26
27 #include <Availability.h>
28 #include <TargetConditionals.h>
29 #include <sys/cdefs.h>
30 #if !TARGET_IPHONE_SIMULATOR
31 #include <ne_session.h>
32 #endif
33 #include <CoreFoundation/CoreFoundation.h>
34 #include <SystemConfiguration/SystemConfiguration.h>
35 #include <SystemConfiguration/SCNetworkConfigurationPrivate.h>
36
37
38 typedef const struct CF_BRIDGED_TYPE(id) __SCUserPreferencesRef * SCUserPreferencesRef;
39
40
41 __BEGIN_DECLS
42
43
44 #pragma mark -
45 #pragma mark SCNetworkConnection SPIs
46
47 CFArrayRef /* of SCNetworkServiceRef's */
48 SCNetworkConnectionCopyAvailableServices (SCNetworkSetRef set) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
49
50 SCNetworkConnectionRef
51 SCNetworkConnectionCreateWithService (CFAllocatorRef allocator,
52 SCNetworkServiceRef service,
53 SCNetworkConnectionCallBack callout,
54 SCNetworkConnectionContext *context) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
55
56 SCNetworkServiceRef
57 SCNetworkConnectionGetService (SCNetworkConnectionRef connection) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
58
59 CFArrayRef /* of SCUserPreferencesRef's */
60 SCNetworkConnectionCopyAllUserPreferences (SCNetworkConnectionRef connection) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
61
62 SCUserPreferencesRef
63 SCNetworkConnectionCopyCurrentUserPreferences (SCNetworkConnectionRef connection) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
64
65 SCUserPreferencesRef
66 SCNetworkConnectionCreateUserPreferences (SCNetworkConnectionRef connection) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
67
68 Boolean
69 SCNetworkConnectionSuspend (SCNetworkConnectionRef connection) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
70
71 Boolean
72 SCNetworkConnectionResume (SCNetworkConnectionRef connection) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
73
74 Boolean
75 SCNetworkConnectionRefreshOnDemandState (SCNetworkConnectionRef connection) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
76
77 Boolean
78 SCNetworkConnectionSetClientInfo (SCNetworkConnectionRef connection,
79 mach_port_t client_audit_session,
80 uid_t client_uid,
81 gid_t client_gid,
82 pid_t client_pid) __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_5_0);
83
84 /*!
85 @function SCNetworkConnectionCreate
86 @discussion Create a network connection that is not associated with any
87 network service.
88 @param allocator The CFAllocator that should be used to allocate
89 memory for the connection structure. This parameter may be
90 NULL in which case the current default CFAllocator is used.
91 If this reference is not a valid CFAllocator, the behavior
92 is undefined.
93 @param callout The function to be called when the status
94 of the connection changes. If this parameter is NULL, the
95 application will not receive notifications of status change
96 and will need to poll for updates.
97 @param context The SCNetworkConnectionContext associated with the
98 callout.
99 @return The new SCNetworkConnection object.
100 */
101 SCNetworkConnectionRef
102 SCNetworkConnectionCreate (CFAllocatorRef allocator,
103 SCNetworkConnectionCallBack callout,
104 SCNetworkConnectionContext *context) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
105
106 /*!
107 @function SCNetworkConnectionSetClientAuditInfo
108 @discussion Set audit information for the process that is initiating the network traffic
109 that will be transmitted over this network connection.
110 @param connection The SCNetworkConnection object.
111 @param client_audit_token The audit token of the initiator process.
112 @param audit_session The audit session mach port of the initiator process.
113 @param bootstrap_port The bootstrap port of the initiator process.
114 @param pid The PID of the initiator process.
115 @param uuid The Mach-O UUID of the initiator process.
116 @param bundle_id The CFBundleIdentifier of the initiator process.
117 @return TRUE if the audit token was set successfully, FALSE if an error occurred.
118 */
119 Boolean
120 SCNetworkConnectionSetClientAuditInfo (SCNetworkConnectionRef connection,
121 audit_token_t client_audit_token,
122 mach_port_t audit_session,
123 mach_port_t bootstrap_port,
124 pid_t pid,
125 const uuid_t uuid,
126 const char *bundle_id) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
127
128 /*!
129 @defined kSCNetworkConnectionSelectionOptionNoUserPrefs
130 @abstract Indicates whether or not SCNetworkConnectionSelectServiceWithOptions
131 should consult the user preferences to find a network service.
132 */
133 #define kSCNetworkConnectionSelectionOptionNoUserPrefs CFSTR("NoUserPrefs") /* CFBoolean */
134
135 /*!
136 @define kSCNetworkConnectionSelectionOptionOnDemandTrafficClass
137 @abstract The traffic class that is attempting to trigger OnDemand.
138 */
139 #define kSCNetworkConnectionSelectionOptionOnDemandTrafficClass CFSTR("OnDemandTrafficClass") // CFNumber
140 // __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0/*SPI*/)
141 /*!
142 @define kSCNetworkConnectionSelectionOptionOnDemandAccountIdentifier
143 @abstract The account identifier that is attempting to trigger OnDemand.
144 */
145 #define kSCNetworkConnectionSelectionOptionOnDemandAccountIdentifier CFSTR("OnDemandAccountIdentifier") /* CFString */
146
147 /*!
148 @define kSCNetworkConnectionSelectionOptionOnDemandMatchInfo
149 @abstract A dictionary containing information about the On Demand trigger that matched
150 */
151 #define kSCNetworkConnectionSelectionOptionOnDemandMatchInfo CFSTR("OnDemandMatchInfo") /* CFDictionary */
152
153 /*!
154 @define kSCNetworkConnectionOnDemandMatchInfoVPNType
155 @abstract The type of VPN connection associated with the matching trigger.
156 */
157 #define kSCNetworkConnectionOnDemandMatchInfoVPNType CFSTR("OnDemandMatchInfoVPNType") /* CFNumber containing a SCNetworkConnectionType */
158
159 /*!
160 @define kSCNetworkConnectionOnDemandMatchInfoDomain
161 @abstract The specific DNS domain in the trigger's match domains that matched the on demand hostname.
162 */
163 #define kSCNetworkConnectionOnDemandMatchInfoDomain CFSTR("OnDemandMatchInfoDomain") /* CFString */
164
165 /*!
166 @define kSCNetworkConnectionOnDemandMatchInfoAppRuleID
167 @abstract The identifier of the app rule in the matching trigger that matched the calling app.
168 */
169 #define kSCNetworkConnectionOnDemandMatchInfoAppRuleID CFSTR("OnDemandMatchInfoAppRuleID") /* CFString */
170
171 /*
172 @define kSCNetworkConnectionOnDemandMatchInfoOnRetry
173 @abstract A flag indicating if the on demand hostname matched a domain in the "on retry" match domains.
174 */
175 #define kSCNetworkConnectionOnDemandMatchInfoOnRetry CFSTR("OnDemandMatchInfoOnRetry") /* CFString */
176
177
178 /*!
179 @function SCNetworkConnectionSelectServiceWithOptions
180 @discussion Associate a network connection with a network service based on some
181 selection options. This function can only be called on connections that are
182 not already associated with a network service.
183 @param connection The SCNetworkConnection object.
184 @param selectionOptions A dictionary containing some options to be used to
185 select the appropriate service.
186 @return TRUE if an appropriate network service was found and was associated with
187 the connection, FALSE otherwise.
188 */
189 Boolean
190 SCNetworkConnectionSelectServiceWithOptions (SCNetworkConnectionRef connection,
191 CFDictionaryRef selectionOptions) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
192
193 /*!
194 @function SCNetworkConnectionOnDemandShouldRetryOnFailure
195 @discussion After SCNetworkConnectionSelectServiceWithOptions returns FALSE, use
196 this function to determine if an On Demand service was indeed matched for
197 On Retry behavior (try resolving/connecting, and start VPN on failure).
198 @param connection The SCNetworkConnection object.
199 @return TRUE if the selected On Demand connection should be retried on DNS or connection
200 failure, FALSE otherwise.
201 */
202 Boolean
203 SCNetworkConnectionOnDemandShouldRetryOnFailure (SCNetworkConnectionRef connection) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
204
205 /*!
206 @function SCNetworkConnectionCanTunnelAddress
207 @discussion This function should be called on a connection object selected with
208 SCNetworkConnectionSelectServiceWithOptions. If the address belongs to
209 the connection (the tunnel can be used for the address), the function
210 will return TRUE. If startImmediately is set, the address should not be trusted
211 and the VPN should be brought up before attempting to connect.
212 @param connection The SCNetworkConnection object.
213 @param address The address structure to check.
214 @param startImmediately On return, TRUE indicates that the address is not trusted
215 and the VPN should be started immediately.
216 @return TRUE if the selected VPN connection's tunnel routes match the address.
217 */
218 Boolean
219 SCNetworkConnectionCanTunnelAddress (SCNetworkConnectionRef connection,
220 const struct sockaddr *address,
221 Boolean *startImmediately) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
222
223 /*!
224 @function SCNetworkConnectionIsOnDemandSuspended
225 @discussion Indicates whether the On Demand connection is suspended or not. Call
226 SCNetworkConnectionSelectServiceWithOptions before calling this function.
227 @param connection The SCNetworkConnection object.
228 @return TRUE if the On Demand connection is suspended, FALSE otherwise.
229 */
230 Boolean
231 SCNetworkConnectionIsOnDemandSuspended (SCNetworkConnectionRef connection) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
232
233 /*!
234 @function SCNetworkConnectionCopyOnDemandInfo
235 @discussion Indicates whether or not the caller should start the network connection,
236 assuming that the caller has network traffic that needs to use the network connection.
237 @param connection The SCNetworkConnection object.
238 @param onDemandRemoteAddress On return, contains the address of the server providing the
239 network connection. Ownership follows the "Create" rule.
240 @param onDemandConnectionStatus On return, contains the current status of the network
241 connection.
242 @return TRUE if the caller should start the connection upon traffic demand, FALSE otherwise.
243 */
244 Boolean
245 SCNetworkConnectionCopyOnDemandInfo (SCNetworkConnectionRef connection,
246 CFStringRef *onDemandRemoteAddress,
247 SCNetworkConnectionStatus *onDemandConnectionStatus) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
248
249 /*!
250 @function SCNetworkConnectionTriggerOnDemandIfNeeded
251 @discussion Trigger a VPN On Demand connection based on a hostname. This function combines the
252 functionality of calling SCNetworkConnectionCreate, SCNetworkConnectionSelectServiceWithOptions,
253 and SCNetworkConnectionStart. The function blocks until the connection is established,
254 fails, or the timer runs out. Since it blocks, this function should not generally be called on
255 the main runloop. NOTE: This function should only be called from process running
256 in the user's context to ensure that the user's keychain is available.
257 @param hostName The hostname that needs to be resolved and accessed.
258 @param afterDNSFail Pass FALSE if this call is made before trying to resolve the hostname, and
259 TRUE if the hostname resolution already failed.
260 @param timeout Number of seconds to wait for a connection. Passing 0 sets a timeout of forever.
261 @param trafficClass Numeric value of a traffic class. Pass 0 for default traffic class, 'Best Effort'.
262 @return TRUE if the connection was established or was not needed, FALSE otherwise.
263 */
264 Boolean
265 SCNetworkConnectionTriggerOnDemandIfNeeded (CFStringRef hostName,
266 Boolean afterDNSFail,
267 int timeout,
268 int trafficClass) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
269
270 /*!
271 @function SCNetworkConnectionGetReachabilityInfo
272 @discussion Get the reachability info of the connection server.
273 @param connection The SCNetworkConnection object.
274 @param reach_flags On return, contains the reachability flags of the connection server.
275 @param reach_if_index On return, contains the index of the interface through which
276 the connection server is reachable.
277 @return TRUE if the reachability information was available for the connection
278 server, FALSE otherwise.
279 */
280 Boolean
281 SCNetworkConnectionGetReachabilityInfo (SCNetworkConnectionRef connection,
282 SCNetworkReachabilityFlags *reach_flags,
283 unsigned int *reach_if_index) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
284
285
286 /*!
287 @enum SCNetworkConnectionType
288 @discussion Type of the network connection.
289 @constant kSCNetworkConnectionTypeUnknown
290 The type of the network connection has not yet been determined.
291 @constant kSCNetworkConnectionTypePPP
292 The network connection is a Point To Point Protocol connection.
293 @constant kSCNetworkConnectionTypeIPLayerVPN
294 The network connection is a IP-layer Virtual Private Network connection.
295 @constant kSCNetworkConnectionTypeAppLayerVPN
296 The network connection is an Application-layer Virtual Private Network connection.
297 */
298 enum {
299 kSCNetworkConnectionTypeUnknown = 0,
300 kSCNetworkConnectionTypePPP = 1,
301 kSCNetworkConnectionTypeIPLayerVPN = 2,
302 kSCNetworkConnectionTypeAppLayerVPN = 3,
303 };
304
305 typedef int SCNetworkConnectionType;
306
307 /*!
308 @function SCNetworkConnectionGetType
309 @discussion Get the type of the network connection.
310 @param connection The SCNetworkConnection object.
311 @return The type of the network connection.
312 */
313 SCNetworkConnectionType
314 SCNetworkConnectionGetType (SCNetworkConnectionRef connection) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
315
316 /*!
317 @defined kSCNetworkConnectionFlowPropertyHostName
318 @abstract The host name of the flow's destination server.
319 */
320 #define kSCNetworkConnectionFlowPropertyHostName CFSTR("HostName") /* CFString */
321
322 /*!
323 @defined kSCNetworkConnectionFlowPropertyHostAddress
324 @abstract The address of the flow's destination server.
325 */
326 #define kSCNetworkConnectionFlowPropertyHostAddress CFSTR("HostAddress") /* CFData containing a struct sockaddr */
327
328 /*!
329 @defined kSCNetworkConnectionFlowPropertyHostPort
330 @abstract The port of the flow's destination server.
331 */
332 #define kSCNetworkConnectionFlowPropertyHostPort CFSTR("HostPort") /* CFNumber */
333
334 /*!
335 @function SCNetworkConnectionCopyFlowDivertToken
336 @discussion Copy a token that should be used to activate flow divert on
337 a socket, causing data on the socket to be diverted through the
338 Application-layer VPN provided by the given network connection.
339 @param connection The SCNetworkConnection object.
340 @param flowProperties A dictionary containing properties of the socket
341 to be diverted.
342 @return The flow divert token, or NULL if the flow properties are not valid
343 or the connection does not provide Application-Layer VPN services.
344 */
345 CFDataRef
346 SCNetworkConnectionCopyFlowDivertToken (SCNetworkConnectionRef connection,
347 CFDictionaryRef flowProperties) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
348
349 #define kSCNetworkConnectionAppPropertyRuleID CFSTR("RuleID")
350 #define kSCNetworkConnectionAppPropertyCodeDirHash CFSTR("CodeDirHash")
351 #define kSCNetworkConnectionAppPropertySigningID CFSTR("SigningID")
352 #define kSCNetworkConnectionAppPropertyAuditToken CFSTR("AuditToken")
353 #define kSCNetworkConnectionAppPropertyPID CFSTR("ProcessID")
354 #define kSCNetworkConnectionAppPropertyUUID CFSTR("UUID")
355
356 int
357 SCNetworkConnectionGetServiceIdentifier (SCNetworkConnectionRef connection) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
358
359 #pragma mark -
360 #pragma mark SCNetworkConnection "VPN on Demand" SPIs
361
362
363 /* VPN On Demand
364 *
365 * in the SCDynamicStore we will have :
366 *
367 * <key>State:/Network/Global/OnDemand</key>
368 * <dict>
369 * <key>Triggers</key>
370 * <array>
371 * <dict>
372 * <key>ServiceID</key>
373 * <string>A740678C-1983-492B-BF64-B825AAE7101E</string>
374 * <key>Status</key>
375 * <integer>8</integer>
376 * <key>RemoteAddress</key>
377 * <string>vpn.mycompany.com</string>
378 * <key>OnDemandMatchDomainsAlways</key>
379 * <array>
380 * <string>internal.mycompany.com</string>
381 * </array>
382 * <key>OnDemandMatchDomainsOnRetry</key>
383 * <array>
384 * <string>mycompany.com</string>
385 * </array>
386 * <key>kSCNetworkConnectionOnDemandMatchDomainsNever</key>
387 * <array>
388 * <string>external.mycompany.com</string>
389 * </array>
390 * <key>OnDemandMatchAppEnabled</key>
391 * <integer>0</integer>
392 * </dict>
393 * </array>
394 * </dict>
395 */
396
397 // notify(3) key
398 #define kSCNETWORKCONNECTION_ONDEMAND_NOTIFY_KEY "com.apple.system.SCNetworkConnectionOnDemand"
399
400 // SCNetworkConnection status
401 // (included in the dictionary returned by SCNetworkConnectionCopyExtendedStatus)
402 #define kSCNetworkConnectionStatus CFSTR("Status") /* CFNumber */
403
404 // a CFArray[CFDictionary] of VPN on Demand "trigger" configurations
405 #define kSCNetworkConnectionOnDemandTriggers CFSTR("Triggers") /* CFArray[CFDictionary] */
406
407 // VPN service ID
408 #define kSCNetworkConnectionOnDemandServiceID CFSTR("ServiceID") /* CFString */
409
410 // VPN service status (idle, connecting, connected, disconnecting)
411 #define kSCNetworkConnectionOnDemandStatus CFSTR("Status") /* CFNumber */
412
413 // VPN server address
414 #define kSCNetworkConnectionOnDemandRemoteAddress CFSTR("RemoteAddress") /* CFString */
415
416 // Reachability flags for the VPN server
417 #define kSCNetworkConnectionOnDemandReachFlags CFSTR("ReachFlags") /* CFNumber */
418
419 // Reachability interface index for the VPN server
420 #define kSCNetworkConnectionOnDemandReachInterfaceIndex CFSTR("ReachInterfaceIndex") /* CFNumber */
421
422 // Network detection has detected DNS Redirecting (like OpenDNS)
423 #define kSCNetworkConnectionOnDemandDNSRedirectDetected CFSTR("DNSRedirectDetected") /* CFBoolean */
424
425 // a dictionary of address information for known lying results
426 #define kSCNetworkConnectionOnDemandDNSRedirectedAddresses CFSTR("DNSRedirectedAddresses") /* CFDictionary[CFDictionary] */
427
428 // A dictionary of routes tunneled over this service in the past
429 #define kSCNetworkConnectionOnDemandTunneledNetworks CFSTR("TunneledNetworks") /* CFDictionary[CFDictionary] */
430
431 // An array of plugin PIDs
432 #define kSCNetworkConnectionOnDemandPluginPIDs CFSTR("PluginPIDs") /* CFArray[CFNumber] */
433
434 // A dictionary of results, keyed by probe string
435 #define kSCNetworkConnectionOnDemandProbeResults CFSTR("ProbeResults") /* CFDictionary[CFBoolean] */
436
437 /* The following generic NetworkInfo keys are currently used in the dynamic store as follows:
438
439 kSCNetworkConnectionOnDemandTunneledNetworks (CFDictionary)
440 - kSCNetworkConnectionNetworkInfoIPv4 (CFDictionary)
441 - kSCNetworkConnectionNetworkInfoIncludedRoutes (CFDictionary)
442 - kSCNetworkConnectionNetworkInfoAddresses (CFData)
443 - kSCNetworkConnectionNetworkInfoMasks (CFData)
444 - kSCNetworkConnectionNetworkInfoExcludedRoutes (CFDictionary)
445 - kSCNetworkConnectionNetworkInfoAddresses (CFData)
446 - kSCNetworkConnectionNetworkInfoMasks (CFData)
447 - kSCNetworkConnectionNetworkInfoIPv6 (CFDictionary)
448 [Same as for IPv4]
449
450 kSCNetworkConnectionOnDemandDNSRedirectedAddresses (CFDictionary)
451 - kSCNetworkConnectionNetworkInfoIPv4 (CFDictionary)
452 - kSCNetworkConnectionNetworkInfoAddresses (CFData)
453 - kSCNetworkConnectionNetworkInfoIPv6 (CFDictionary)
454 - kSCNetworkConnectionNetworkInfoAddresses (CFData)
455 */
456 #define kSCNetworkConnectionNetworkInfoIPv4 CFSTR("IPv4") /* CFDictionary[CFType] */
457 #define kSCNetworkConnectionNetworkInfoIPv6 CFSTR("IPv6") /* CFDictionary[CFType] */
458 #define kSCNetworkConnectionNetworkInfoIncludedRoutes CFSTR("IncludedRoutes") /* CFDictionary[CFData] */
459 #define kSCNetworkConnectionNetworkInfoExcludedRoutes CFSTR("ExcludedRoutes") /* CFDictionary[CFData] */
460 #define kSCNetworkConnectionNetworkInfoAddresses CFSTR("Addresses") /* CFData */
461 #define kSCNetworkConnectionNetworkInfoMasks CFSTR("Masks") /* CFData */
462
463 // a CFArray[CFString] representing those domain (or host) names that, if
464 // matched to a target hostname, should result in our first establishing
465 // the VPN connection before any DNS queries are issued.
466 #define kSCNetworkConnectionOnDemandMatchDomainsAlways CFSTR("OnDemandMatchDomainsAlways") /* CFArray[CFString] */
467
468 // a CFArray[CFString] representing those domain (or host) names that, if
469 // matched to a target hostname, should result in a DNS query regardless of
470 // whether the VPN connection has been established. If the DNS query returns
471 // an [EAI_NONAME] error then we should establish the VPN connection and
472 // re-issue / retry the query.
473 #define kSCNetworkConnectionOnDemandMatchDomainsOnRetry CFSTR("OnDemandMatchDomainsOnRetry") /* CFArray[CFString] */
474
475 // a CFArray[CFString] representing those domain (or host) names that should
476 // be excluded from those that would be used to establish tje VPN connection.
477 #define kSCNetworkConnectionOnDemandMatchDomainsNever CFSTR("OnDemandMatchDomainsNever") /* CFArray[CFString] */
478
479 // A CFNumber (0 or 1) indicating whether or not the App Layer rules should be
480 // used to decide whether or not to establish the tunnel connection.
481 #define kSCNetworkConnectionOnDemandMatchAppEnabled CFSTR("OnDemandMatchAppEnabled") /* CFNumber */
482
483 Boolean
484 __SCNetworkConnectionCopyOnDemandInfoWithName (SCDynamicStoreRef *storeP,
485 CFStringRef nodeName,
486 Boolean onDemandRetry,
487 CFStringRef *connectionServiceID,
488 SCNetworkConnectionStatus *connectionStatus,
489 CFStringRef *vpnRemoteAddress) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0);
490
491 #if !TARGET_IPHONE_SIMULATOR
492 SCNetworkConnectionStatus
493 SCNetworkConnectionGetStatusFromNEStatus (ne_session_status_t status) __OSX_AVAILABLE_STARTING(__MAC_10_10,__IPHONE_8_0);
494 #endif /* !TARGET_IPHONE_SIMULATOR */
495
496 #pragma mark -
497 #pragma mark SCUserPreferences SPIs
498
499
500 Boolean
501 SCUserPreferencesRemove (SCUserPreferencesRef userPreferences) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
502
503 Boolean
504 SCUserPreferencesSetCurrent (SCUserPreferencesRef userPreferences) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
505
506 CFStringRef
507 SCUserPreferencesCopyName (SCUserPreferencesRef userPreferences) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
508
509 CFTypeID
510 SCUserPreferencesGetTypeID (void) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
511
512 CFStringRef
513 SCUserPreferencesGetUniqueID (SCUserPreferencesRef userPreferences) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
514
515 Boolean
516 SCUserPreferencesIsForced (SCUserPreferencesRef userPreferences) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
517
518 Boolean
519 SCUserPreferencesSetName (SCUserPreferencesRef userPreferences,
520 CFStringRef newName) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
521
522 Boolean
523 SCNetworkConnectionStartWithUserPreferences (SCNetworkConnectionRef connection,
524 SCUserPreferencesRef userPreferences,
525 Boolean linger) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
526
527 CFDictionaryRef
528 SCUserPreferencesCopyInterfaceConfiguration (SCUserPreferencesRef userPreferences,
529 SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
530
531 Boolean
532 SCUserPreferencesSetInterfaceConfiguration (SCUserPreferencesRef userPreferences,
533 SCNetworkInterfaceRef interface,
534 CFDictionaryRef newOptions) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
535
536 CFDictionaryRef
537 SCUserPreferencesCopyExtendedInterfaceConfiguration
538 (SCUserPreferencesRef userPreferences,
539 SCNetworkInterfaceRef interface,
540 CFStringRef extendedType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
541
542 Boolean
543 SCUserPreferencesSetExtendedInterfaceConfiguration
544 (SCUserPreferencesRef userPreferences,
545 SCNetworkInterfaceRef interface,
546 CFStringRef extendedType,
547 CFDictionaryRef newOptions) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
548
549
550 #pragma mark -
551 #pragma mark SCUserPreferences + SCNetworkInterface Password SPIs
552
553
554 Boolean
555 SCUserPreferencesCheckInterfacePassword (SCUserPreferencesRef userPreferences,
556 SCNetworkInterfaceRef interface,
557 SCNetworkInterfacePasswordType passwordType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
558
559 CFDataRef
560 SCUserPreferencesCopyInterfacePassword (SCUserPreferencesRef userPreferences,
561 SCNetworkInterfaceRef interface,
562 SCNetworkInterfacePasswordType passwordType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
563
564 Boolean
565 SCUserPreferencesRemoveInterfacePassword (SCUserPreferencesRef userPreferences,
566 SCNetworkInterfaceRef interface,
567 SCNetworkInterfacePasswordType passwordType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
568
569 Boolean
570 SCUserPreferencesSetInterfacePassword (SCUserPreferencesRef userPreferences,
571 SCNetworkInterfaceRef interface,
572 SCNetworkInterfacePasswordType passwordType,
573 CFDataRef password,
574 CFDictionaryRef options) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
575
576 __END_DECLS
577
578 #endif /* _SCNETWORKCONNECTIONPRIVATE_H */