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