2 * Copyright (c) 2006, 2008, 2009 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 #ifndef _SCNETWORKCONNECTIONPRIVATE_H
25 #define _SCNETWORKCONNECTIONPRIVATE_H
27 #include <Availability.h>
28 #include <sys/cdefs.h>
29 #include <CoreFoundation/CoreFoundation.h>
30 #include <SystemConfiguration/SystemConfiguration.h>
31 #include <SystemConfiguration/SCNetworkConfigurationPrivate.h>
34 typedef const struct __SCUserPreferencesRef
* SCUserPreferencesRef
;
41 #pragma mark SCNetworkConnection SPIs
44 CFArrayRef
/* of SCNetworkServiceRef's */
45 SCNetworkConnectionCopyAvailableServices (SCNetworkSetRef set
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
47 SCNetworkConnectionRef
48 SCNetworkConnectionCreateWithService (CFAllocatorRef allocator
,
49 SCNetworkServiceRef service
,
50 SCNetworkConnectionCallBack callout
,
51 SCNetworkConnectionContext
*context
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
54 SCNetworkConnectionGetService (SCNetworkConnectionRef connection
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
56 CFArrayRef
/* of SCUserPreferencesRef's */
57 SCNetworkConnectionCopyAllUserPreferences (SCNetworkConnectionRef connection
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
60 SCNetworkConnectionCopyCurrentUserPreferences (SCNetworkConnectionRef connection
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
63 SCNetworkConnectionCreateUserPreferences (SCNetworkConnectionRef connection
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
67 #pragma mark SCNetworkConnection "VPN on Demand" SPIs
72 * in the SCDynamicStore we will have :
74 * <key>State:/Network/Global/OnDemand</key>
79 * <key>ServiceID</key>
80 * <string>A740678C-1983-492B-BF64-B825AAE7101E</string>
82 * <integer>8</integer>
83 * <key>RemoteAddress</key>
84 * <string>vpn.mycompany.com</string>
85 * <key>OnDemandMatchDomainsAlways</key>
87 * <string>internal.mycompany.com</string>
89 * <key>OnDemandMatchDomainsOnRetry</key>
91 * <string>mycompany.com</string>
93 * <key>kSCNetworkConnectionOnDemandMatchDomainsNever</key>
95 * <string>external.mycompany.com</string>
103 #define kSCNETWORKCONNECTION_ONDEMAND_NOTIFY_KEY "com.apple.system.SCNetworkConnectionOnDemand"
105 // a CFArray[CFDictionary] of VPN on Demand "trigger" configurations
106 #define kSCNetworkConnectionOnDemandTriggers CFSTR("Triggers")
109 #define kSCNetworkConnectionOnDemandServiceID CFSTR("ServiceID")
111 // VPN service status (idle, connecting, connected, disconnecting)
112 #define kSCNetworkConnectionOnDemandStatus CFSTR("Status")
114 // VPN server address
115 #define kSCNetworkConnectionOnDemandRemoteAddress CFSTR("RemoteAddress")
117 // a CFArray[CFString] representing those domain (or host) names that, if
118 // matched to a target hostname, should result in our first establishing
119 // the VPN connection before any DNS queries are issued.
120 #define kSCNetworkConnectionOnDemandMatchDomainsAlways CFSTR("OnDemandMatchDomainsAlways")
122 // a CFArray[CFString] representing those domain (or host) names that, if
123 // matched to a target hostname, should result in a DNS query regardless of
124 // whether the VPN connection has been established. If the DNS query returns
125 // an [EAI_NONAME] error then we should establish the VPN connection and
126 // re-issue / retry the query.
127 #define kSCNetworkConnectionOnDemandMatchDomainsOnRetry CFSTR("OnDemandMatchDomainsOnRetry")
129 // a CFArray[CFString] representing those domain (or host) names that should
130 // be excluded from those that would be used to establish tje VPN connection.
131 #define kSCNetworkConnectionOnDemandMatchDomainsNever CFSTR("OnDemandMatchDomainsNever")
136 __SCNetworkConnectionCopyOnDemandInfoWithName (SCDynamicStoreRef
*storeP
,
137 CFStringRef nodeName
,
138 Boolean onDemandRetry
,
139 CFStringRef
*connectionServiceID
,
140 SCNetworkConnectionStatus
*connectionStatus
,
141 CFStringRef
*vpnRemoteAddress
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_2_0
);
145 #pragma mark SCUserPreferences SPIs
149 SCUserPreferencesRemove (SCUserPreferencesRef userPreferences
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
152 SCUserPreferencesSetCurrent (SCUserPreferencesRef userPreferences
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
155 SCUserPreferencesCopyName (SCUserPreferencesRef userPreferences
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
158 SCUserPreferencesGetTypeID (void) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
161 SCUserPreferencesGetUniqueID (SCUserPreferencesRef userPreferences
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
164 SCUserPreferencesIsForced (SCUserPreferencesRef userPreferences
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
167 SCUserPreferencesSetName (SCUserPreferencesRef userPreferences
,
168 CFStringRef newName
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
171 SCNetworkConnectionStartWithUserPreferences (SCNetworkConnectionRef connection
,
172 SCUserPreferencesRef userPreferences
,
173 Boolean linger
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
176 SCUserPreferencesCopyInterfaceConfiguration (SCUserPreferencesRef userPreferences
,
177 SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
180 SCUserPreferencesSetInterfaceConfiguration (SCUserPreferencesRef userPreferences
,
181 SCNetworkInterfaceRef interface
,
182 CFDictionaryRef newOptions
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
185 SCUserPreferencesCopyExtendedInterfaceConfiguration
186 (SCUserPreferencesRef userPreferences
,
187 SCNetworkInterfaceRef interface
,
188 CFStringRef extendedType
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
191 SCUserPreferencesSetExtendedInterfaceConfiguration
192 (SCUserPreferencesRef userPreferences
,
193 SCNetworkInterfaceRef interface
,
194 CFStringRef extendedType
,
195 CFDictionaryRef newOptions
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
199 #pragma mark SCUserPreferences + SCNetworkInterface Password SPIs
203 SCUserPreferencesCheckInterfacePassword (SCUserPreferencesRef userPreferences
,
204 SCNetworkInterfaceRef interface
,
205 SCNetworkInterfacePasswordType passwordType
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
208 SCUserPreferencesCopyInterfacePassword (SCUserPreferencesRef userPreferences
,
209 SCNetworkInterfaceRef interface
,
210 SCNetworkInterfacePasswordType passwordType
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
213 SCUserPreferencesRemoveInterfacePassword (SCUserPreferencesRef userPreferences
,
214 SCNetworkInterfaceRef interface
,
215 SCNetworkInterfacePasswordType passwordType
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
218 SCUserPreferencesSetInterfacePassword (SCUserPreferencesRef userPreferences
,
219 SCNetworkInterfaceRef interface
,
220 SCNetworkInterfacePasswordType passwordType
,
222 CFDictionaryRef options
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
226 #endif /* _SCNETWORKCONNECTIONPRIVATE_H */