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