]>
Commit | Line | Data |
---|---|---|
edebe297 | 1 | /* |
78403150 | 2 | * Copyright (c) 2005-2014 Apple Inc. All rights reserved. |
edebe297 A |
3 | * |
4 | * @APPLE_LICENSE_HEADER_START@ | |
78403150 | 5 | * |
edebe297 A |
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. | |
78403150 | 12 | * |
edebe297 A |
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. | |
78403150 | 20 | * |
edebe297 A |
21 | * @APPLE_LICENSE_HEADER_END@ |
22 | */ | |
23 | ||
24 | #ifndef _SCNETWORKCONFIGURATIONPRIVATE_H | |
25 | #define _SCNETWORKCONFIGURATIONPRIVATE_H | |
26 | ||
a40a14f8 A |
27 | #include <Availability.h> |
28 | #include <TargetConditionals.h> | |
edebe297 A |
29 | #include <sys/cdefs.h> |
30 | #include <CoreFoundation/CoreFoundation.h> | |
31 | #include <SystemConfiguration/SystemConfiguration.h> | |
32 | #include <SystemConfiguration/SCValidation.h> | |
33 | #include <IOKit/IOKitLib.h> | |
34 | ||
edebe297 A |
35 | /*! |
36 | @header SCNetworkConfigurationPrivate | |
37 | */ | |
38 | ||
39 | __BEGIN_DECLS | |
40 | ||
41 | ||
6bb65964 A |
42 | /*! |
43 | @group Interface configuration | |
44 | */ | |
45 | ||
edebe297 | 46 | #pragma mark - |
17d3ee29 | 47 | #pragma mark SCNetworkInterface configuration (typedefs, consts, enums) |
6bb65964 A |
48 | |
49 | /*! | |
50 | @const kSCNetworkInterfaceTypeBridge | |
51 | */ | |
52 | extern const CFStringRef kSCNetworkInterfaceTypeBridge __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/); | |
53 | ||
78403150 | 54 | |
6bb65964 A |
55 | /*! |
56 | @const kSCNetworkInterfaceTypeLoopback | |
57 | */ | |
58 | extern const CFStringRef kSCNetworkInterfaceTypeLoopback __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/); | |
edebe297 | 59 | |
6bb65964 A |
60 | /*! |
61 | @const kSCNetworkInterfaceLoopback | |
62 | @discussion A network interface representing the loopback | |
63 | interface (lo0). | |
64 | */ | |
65 | extern const SCNetworkInterfaceRef kSCNetworkInterfaceLoopback __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/); | |
66 | ||
67 | /*! | |
68 | @const kSCNetworkInterfaceTypeVPN | |
69 | */ | |
70 | extern const CFStringRef kSCNetworkInterfaceTypeVPN __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/); | |
71 | ||
72 | /*! | |
73 | @group Interface configuration (Bridge) | |
74 | */ | |
75 | ||
76 | /*! | |
77 | @typedef SCBridgeInterfaceRef | |
78 | @discussion This is the type of a reference to an object that represents | |
79 | a bridge interface. | |
80 | */ | |
81 | typedef SCNetworkInterfaceRef SCBridgeInterfaceRef; | |
82 | ||
78403150 | 83 | typedef CF_ENUM(uint32_t, SCNetworkServicePrimaryRank) { |
17d3ee29 A |
84 | kSCNetworkServicePrimaryRankDefault = 0, |
85 | kSCNetworkServicePrimaryRankFirst = 1, | |
86 | kSCNetworkServicePrimaryRankLast = 2, | |
78403150 A |
87 | kSCNetworkServicePrimaryRankNever = 3, |
88 | kSCNetworkServicePrimaryRankScoped = 4 | |
17d3ee29 | 89 | }; |
17d3ee29 | 90 | |
6bb65964 A |
91 | #pragma mark - |
92 | #pragma mark SCNetworkInterface configuration (SPI) | |
edebe297 A |
93 | |
94 | /*! | |
95 | @group Interface configuration | |
96 | */ | |
97 | ||
98 | static __inline__ CFTypeRef | |
99 | isA_SCNetworkInterface(CFTypeRef obj) | |
100 | { | |
101 | return (isA_CFType(obj, SCNetworkInterfaceGetTypeID())); | |
102 | } | |
103 | ||
104 | static __inline__ CFTypeRef | |
105 | isA_SCBondInterface(CFTypeRef obj) | |
106 | { | |
107 | CFStringRef interfaceType; | |
108 | ||
109 | if (!isA_SCNetworkInterface(obj)) { | |
110 | // if not an SCNetworkInterface | |
111 | return NULL; | |
112 | } | |
113 | ||
114 | interfaceType = SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef)obj); | |
115 | if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeBond)) { | |
116 | // if not a Bond | |
117 | return NULL; | |
118 | } | |
119 | ||
120 | return obj; | |
121 | } | |
122 | ||
6bb65964 A |
123 | static __inline__ CFTypeRef |
124 | isA_SCBridgeInterface(CFTypeRef obj) | |
125 | { | |
126 | CFStringRef interfaceType; | |
127 | ||
128 | if (!isA_SCNetworkInterface(obj)) { | |
129 | // if not an SCNetworkInterface | |
130 | return NULL; | |
131 | } | |
132 | ||
133 | interfaceType = SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef)obj); | |
134 | if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeBridge)) { | |
135 | // if not a bridge | |
136 | return NULL; | |
137 | } | |
138 | ||
139 | return obj; | |
140 | } | |
141 | ||
edebe297 A |
142 | static __inline__ CFTypeRef |
143 | isA_SCVLANInterface(CFTypeRef obj) | |
144 | { | |
145 | CFStringRef interfaceType; | |
146 | ||
147 | if (!isA_SCNetworkInterface(obj)) { | |
148 | // if not an SCNetworkInterface | |
149 | return NULL; | |
150 | } | |
151 | ||
152 | interfaceType = SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef)obj); | |
153 | if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeVLAN)) { | |
154 | // if not a VLAN | |
155 | return NULL; | |
156 | } | |
157 | ||
158 | return obj; | |
159 | } | |
160 | ||
161 | /*! | |
162 | @function _SCNetworkInterfaceCompare | |
163 | @discussion Compares two SCNetworkInterface objects. | |
164 | @param val1 The SCNetworkInterface object. | |
165 | @param val2 The SCNetworkInterface object. | |
166 | @param context Not used. | |
167 | @result A comparison result. | |
168 | */ | |
169 | CFComparisonResult | |
170 | _SCNetworkInterfaceCompare (const void *val1, | |
171 | const void *val2, | |
a40a14f8 A |
172 | void *context) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); |
173 | ||
17d3ee29 A |
174 | /*! |
175 | @function _SCNetworkInterfaceCopyActive | |
176 | @discussion Creates an SCNetworkInterface and associated with interface name | |
177 | and SCDynamicStoreRef | |
178 | @param the interface name | |
179 | @param the SCDynamicStoreRef | |
180 | @result the SCNetworkInterface | |
181 | */ | |
182 | SCNetworkInterfaceRef | |
183 | _SCNetworkInterfaceCopyActive (SCDynamicStoreRef store, | |
184 | CFStringRef bsdName) __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_5_0); | |
185 | ||
6bb65964 A |
186 | /*! |
187 | @function _SCNetworkInterfaceCopyAllWithPreferences | |
188 | Returns all network capable interfaces on the system. | |
189 | @param prefs The "preferences" session. | |
190 | @result The list of interfaces on the system. | |
191 | You must release the returned value. | |
192 | */ | |
193 | CFArrayRef /* of SCNetworkInterfaceRef's */ | |
194 | _SCNetworkInterfaceCopyAllWithPreferences (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/); | |
195 | ||
5e9ce69e A |
196 | /*! |
197 | @function _SCNetworkInterfaceCopyBTPANInterface | |
198 | @discussion Returns the SCNetworkInterface associated with the BT-PAN interface | |
199 | @result The BT-PAN interface; NULL if the interface is not (yet) known. | |
200 | */ | |
201 | SCNetworkInterfaceRef | |
78403150 | 202 | _SCNetworkInterfaceCopyBTPANInterface (void) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_NA); |
5e9ce69e | 203 | |
a40a14f8 A |
204 | /*! |
205 | @function _SCNetworkInterfaceCopySlashDevPath | |
206 | @discussion Returns the /dev pathname for the interface. | |
207 | @param interface The network interface. | |
208 | @result The /dev pathname associated with the interface (e.g. "/dev/modem"); | |
209 | NULL if no path is available. | |
210 | */ | |
211 | CFStringRef | |
212 | _SCNetworkInterfaceCopySlashDevPath (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0); | |
edebe297 A |
213 | |
214 | #define kIncludeNoVirtualInterfaces 0x0 | |
215 | #define kIncludeVLANInterfaces 0x1 | |
216 | #define kIncludeBondInterfaces 0x2 | |
6bb65964 | 217 | #define kIncludeBridgeInterfaces 0x4 |
edebe297 A |
218 | #define kIncludeAllVirtualInterfaces 0xffffffff |
219 | ||
220 | /*! | |
221 | @function _SCNetworkInterfaceCreateWithBSDName | |
222 | @discussion Create a new network interface associated with the provided | |
6bb65964 | 223 | BSD interface name. This API supports Ethernet, FireWire, and |
edebe297 A |
224 | IEEE 802.11 interfaces. |
225 | @param bsdName The BSD interface name. | |
6bb65964 | 226 | @param flags Indicates whether virtual (Bond, Bridge, VLAN) |
edebe297 A |
227 | network interfaces should be included. |
228 | @result A reference to the new SCNetworkInterface. | |
229 | You must release the returned value. | |
230 | */ | |
231 | SCNetworkInterfaceRef | |
232 | _SCNetworkInterfaceCreateWithBSDName (CFAllocatorRef allocator, | |
233 | CFStringRef bsdName, | |
a40a14f8 | 234 | UInt32 flags) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); |
edebe297 A |
235 | |
236 | /*! | |
237 | @function _SCNetworkInterfaceCreateWithEntity | |
238 | @discussion Create a new network interface associated with the provided | |
239 | SCDynamicStore service entity dictionary. | |
240 | @param interface_entity The entity dictionary. | |
241 | @param service The network service. | |
242 | @result A reference to the new SCNetworkInterface. | |
243 | You must release the returned value. | |
244 | */ | |
245 | SCNetworkInterfaceRef | |
246 | _SCNetworkInterfaceCreateWithEntity (CFAllocatorRef allocator, | |
247 | CFDictionaryRef interface_entity, | |
a40a14f8 | 248 | SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); |
edebe297 A |
249 | |
250 | /*! | |
251 | @function _SCNetworkInterfaceCreateWithIONetworkInterfaceObject | |
252 | @discussion Create a new network interface associated with the provided | |
253 | IORegistry "IONetworkInterface" object. | |
254 | @param if_obj The IONetworkInterface object. | |
255 | @result A reference to the new SCNetworkInterface. | |
256 | You must release the returned value. | |
257 | */ | |
258 | SCNetworkInterfaceRef | |
a40a14f8 A |
259 | _SCNetworkInterfaceCreateWithIONetworkInterfaceObject (io_object_t if_obj) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); |
260 | ||
17d3ee29 A |
261 | /*! |
262 | @function SCNetworkInterfaceGetPrimaryRank | |
263 | @discussion We allow caller to retrieve the rank on an interface. | |
17d3ee29 A |
264 | @param the interface to get the rank |
265 | @result SCNetworkServicePrimaryRank | |
266 | */ | |
267 | SCNetworkServicePrimaryRank | |
268 | SCNetworkInterfaceGetPrimaryRank (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_5_0); | |
269 | ||
270 | /*! | |
271 | @function SCNetworkInterfaceSetPrimaryRank | |
272 | @discussion We allow caller to set an assertion on an interface. | |
78403150 A |
273 | The rank assertion lives as long as the SCNetworkInterfaceRef |
274 | remains valid. | |
17d3ee29 A |
275 | @param the interface to set the rank assertion |
276 | @param the new rank to be set | |
277 | @result TRUE if operation is successful; FALSE if an error was encountered. | |
278 | */ | |
279 | Boolean | |
280 | SCNetworkInterfaceSetPrimaryRank (SCNetworkInterfaceRef interface, | |
281 | SCNetworkServicePrimaryRank newRank) __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_5_0); | |
282 | ||
a40a14f8 A |
283 | #define kSCNetworkInterfaceConfigurationActionKey CFSTR("New Interface Detected Action") |
284 | #define kSCNetworkInterfaceConfigurationActionValueNone CFSTR("None") | |
285 | #define kSCNetworkInterfaceConfigurationActionValuePrompt CFSTR("Prompt") | |
286 | #define kSCNetworkInterfaceConfigurationActionValueConfigure CFSTR("Configure") | |
287 | ||
6bb65964 A |
288 | #define kSCNetworkInterfaceNetworkConfigurationOverridesKey CFSTR("NetworkConfigurationOverrides") |
289 | #define kSCNetworkInterfaceHiddenConfigurationKey CFSTR("HiddenConfiguration") | |
78403150 A |
290 | #define kSCNetworkInterfaceHiddenPortKey CFSTR("HiddenPort") /* for serial ports */ |
291 | #define kSCNetworkInterfaceHiddenInterfaceKey CFSTR("HiddenInterface") /* for network interfaces */ | |
6bb65964 A |
292 | |
293 | // IORegistry property to indicate that a [WWAN] interface is not yet ready | |
294 | #define kSCNetworkInterfaceInitializingKey CFSTR("Initializing") | |
295 | ||
d0784775 A |
296 | /*! |
297 | @function _SCNetworkInterfaceCopyInterfaceInfo | |
298 | @discussion Returns interface details | |
299 | @param interface The network interface. | |
300 | @result A dictionary with details about the network interface. | |
301 | */ | |
302 | CFDictionaryRef | |
303 | _SCNetworkInterfaceCopyInterfaceInfo (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0); | |
304 | ||
a40a14f8 A |
305 | /*! |
306 | @function _SCNetworkInterfaceGetConfigurationAction | |
307 | @discussion Returns a user-notification / auto-configuration action for the interface. | |
308 | @param interface The network interface. | |
309 | @result The user-notification / auto-configuration action; | |
310 | NULL if the default action should be used. | |
311 | */ | |
312 | CFStringRef | |
313 | _SCNetworkInterfaceGetConfigurationAction (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0); | |
edebe297 A |
314 | |
315 | /*! | |
316 | @function _SCNetworkInterfaceGetHardwareAddress | |
317 | @discussion Returns a link layer address for the interface. | |
318 | @param interface The network interface. | |
319 | @result The hardware (MAC) address for the interface. | |
320 | NULL if no hardware address is available. | |
321 | */ | |
322 | CFDataRef | |
a40a14f8 | 323 | _SCNetworkInterfaceGetHardwareAddress (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); |
edebe297 | 324 | |
5e9ce69e A |
325 | /*! |
326 | @function _SCNetworkInterfaceGetIOInterfaceNamePrefix | |
327 | @discussion Returns the IOInterfaceNamePrefix for the interface. | |
328 | @param interface The network interface. | |
329 | @result The IOInterfaceNamePrefix associated with the interface; | |
330 | NULL if no IOInterfaceNamePrefix is available. | |
331 | */ | |
332 | CFStringRef | |
333 | _SCNetworkInterfaceGetIOInterfaceNamePrefix (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_6_0); | |
334 | ||
edebe297 A |
335 | /*! |
336 | @function _SCNetworkInterfaceGetIOInterfaceType | |
337 | @discussion Returns the IOInterfaceType for the interface. | |
338 | @param interface The network interface. | |
339 | @result The IOInterfaceType associated with the interface | |
340 | */ | |
341 | CFNumberRef | |
a40a14f8 | 342 | _SCNetworkInterfaceGetIOInterfaceType (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); |
edebe297 A |
343 | |
344 | /*! | |
345 | @function _SCNetworkInterfaceGetIOInterfaceUnit | |
346 | @discussion Returns the IOInterfaceUnit for the interface. | |
347 | @param interface The network interface. | |
348 | @result The IOInterfaceUnit associated with the interface; | |
5e9ce69e | 349 | NULL if no IOInterfaceUnit is available. |
edebe297 A |
350 | */ |
351 | CFNumberRef | |
a40a14f8 | 352 | _SCNetworkInterfaceGetIOInterfaceUnit (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); |
edebe297 A |
353 | |
354 | /*! | |
355 | @function _SCNetworkInterfaceGetIOPath | |
356 | @discussion Returns the IOPath for the interface. | |
357 | @param interface The network interface. | |
358 | @result The IOPath associated with the interface; | |
359 | NULL if no IOPath is available. | |
360 | */ | |
361 | CFStringRef | |
a40a14f8 A |
362 | _SCNetworkInterfaceGetIOPath (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); |
363 | ||
af243a0d A |
364 | /*! |
365 | @function _SCNetworkInterfaceGetIORegistryEntryID | |
366 | @discussion Returns the IORegistry entry ID for the interface. | |
367 | @param interface The network interface. | |
368 | @result The IORegistry entry ID associated with the interface; | |
369 | Zero if no entry ID is available. | |
370 | */ | |
371 | uint64_t | |
17d3ee29 | 372 | _SCNetworkInterfaceGetIORegistryEntryID (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_5_0); |
af243a0d | 373 | |
a40a14f8 A |
374 | /*! |
375 | @function _SCNetworkInterfaceIsBluetoothPAN | |
6bb65964 | 376 | @discussion Identifies if a network interface is a Bluetooth PAN (GN) device. |
a40a14f8 A |
377 | @param interface The network interface. |
378 | @result TRUE if the interface is a Bluetooth PAN device. | |
379 | */ | |
380 | Boolean | |
381 | _SCNetworkInterfaceIsBluetoothPAN (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0); | |
edebe297 | 382 | |
6bb65964 A |
383 | /*! |
384 | @function _SCNetworkInterfaceIsBluetoothPAN_NAP | |
385 | @discussion Identifies if a network interface is a Bluetooth PAN-NAP device. | |
386 | @param interface The network interface. | |
387 | @result TRUE if the interface is a Bluetooth PAN-NAP device. | |
388 | */ | |
389 | Boolean | |
390 | _SCNetworkInterfaceIsBluetoothPAN_NAP (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0); | |
391 | ||
392 | /*! | |
393 | @function _SCNetworkInterfaceIsBluetoothP2P | |
394 | @discussion Identifies if a network interface is a Bluetooth P2P (PAN-U) device. | |
395 | @param interface The network interface. | |
396 | @result TRUE if the interface is a Bluetooth P2P device. | |
397 | */ | |
398 | Boolean | |
399 | _SCNetworkInterfaceIsBluetoothP2P (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0); | |
400 | ||
edebe297 A |
401 | /*! |
402 | @function _SCNetworkInterfaceIsBuiltin | |
403 | @discussion Identifies if a network interface is "built-in". | |
404 | @param interface The network interface. | |
405 | @result TRUE if the interface is "built-in". | |
406 | */ | |
407 | Boolean | |
a40a14f8 A |
408 | _SCNetworkInterfaceIsBuiltin (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); |
409 | ||
410 | /*! | |
6bb65964 A |
411 | @function _SCNetworkInterfaceIsHiddenConfiguration |
412 | @discussion Identifies if the configuration of a network interface should be | |
413 | hidden from any user interface (e.g. the "Network" pref pane). | |
a40a14f8 | 414 | @param interface The network interface. |
6bb65964 | 415 | @result TRUE if the interface configuration should be hidden. |
a40a14f8 A |
416 | */ |
417 | Boolean | |
6bb65964 | 418 | _SCNetworkInterfaceIsHiddenConfiguration (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0); |
edebe297 A |
419 | |
420 | /*! | |
421 | @function _SCNetworkInterfaceIsModemV92 | |
422 | @discussion Identifies if a modem network interface supports | |
423 | v.92 (hold). | |
424 | @param interface The network interface. | |
425 | @result TRUE if the interface is "v.92" modem. | |
426 | */ | |
427 | Boolean | |
a40a14f8 | 428 | _SCNetworkInterfaceIsModemV92 (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); |
edebe297 | 429 | |
6bb65964 A |
430 | /*! |
431 | @function _SCNetworkInterfaceIsTethered | |
432 | @discussion Identifies if a network interface is an Apple tethered device (e.g. an iPhone). | |
433 | @param interface The network interface. | |
434 | @result TRUE if the interface is a tethered device. | |
435 | */ | |
436 | Boolean | |
437 | _SCNetworkInterfaceIsTethered (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0); | |
438 | ||
5e9ce69e A |
439 | /*! |
440 | @function _SCNetworkInterfaceIsThunderbolt | |
441 | @discussion Identifies if a network interface is a Thunderbolt device | |
442 | @param interface The network interface. | |
443 | @result TRUE if the interface is a Thunderbolt device. | |
444 | */ | |
445 | Boolean | |
446 | _SCNetworkInterfaceIsThunderbolt (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0); | |
447 | ||
6bb65964 A |
448 | /*! |
449 | @function _SCNetworkInterfaceIsPhysicalEthernet | |
450 | @discussion Indicates whether a network interface is a real ethernet interface i.e. one with an ethernet PHY. | |
451 | @param interface The network interface. | |
452 | @result TRUE if the interface is a real ethernet interface. | |
453 | */ | |
454 | Boolean | |
455 | _SCNetworkInterfaceIsPhysicalEthernet (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0); | |
456 | ||
edebe297 A |
457 | /*! |
458 | @function _SCNetworkInterfaceForceConfigurationRefresh | |
459 | @discussion Forces a configuration refresh of the | |
460 | specified interface. | |
461 | @param ifName Network interface name. | |
462 | @result TRUE if the refresh was successfully posted. | |
463 | */ | |
464 | Boolean | |
a40a14f8 | 465 | _SCNetworkInterfaceForceConfigurationRefresh (CFStringRef ifName) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); |
edebe297 | 466 | |
6bb65964 A |
467 | /*! |
468 | @function SCNetworkInterfaceCopyCapability | |
469 | @discussion For the specified network interface, returns information | |
470 | about the currently requested capabilities, the active capabilities, | |
471 | and the capabilities which are available. | |
472 | @param interface The desired network interface. | |
473 | @param capability The desired capability. | |
474 | @result a CFTypeRef representing the current value of requested | |
475 | capability; | |
476 | NULL if the capability is not available for this | |
477 | interface or if an error was encountered. | |
478 | You must release the returned value. | |
479 | */ | |
480 | CFTypeRef | |
481 | SCNetworkInterfaceCopyCapability (SCNetworkInterfaceRef interface, | |
482 | CFStringRef capability) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/); | |
483 | ||
484 | /*! | |
485 | @function SCNetworkInterfaceSetCapability | |
486 | @discussion For the specified network interface, sets the requested | |
487 | capabilities. | |
488 | @param interface The desired network interface. | |
489 | @param capability The desired capability. | |
490 | @param newValue The new requested setting for the capability; | |
491 | NULL to restore the default setting. | |
492 | @result TRUE if the configuration was updated; FALSE if an error was encountered. | |
493 | */ | |
494 | Boolean | |
495 | SCNetworkInterfaceSetCapability (SCNetworkInterfaceRef interface, | |
496 | CFStringRef capability, | |
497 | CFTypeRef newValue) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/); | |
498 | ||
499 | #pragma mark - | |
500 | #pragma mark SCBondInterface configuration (SPIs) | |
501 | ||
edebe297 A |
502 | /*! |
503 | @function _SCBondInterfaceCopyActive | |
504 | @discussion Returns all Ethernet Bond interfaces on the system. | |
505 | @result The list of SCBondInterface interfaces on the system. | |
506 | You must release the returned value. | |
507 | */ | |
508 | CFArrayRef | |
6bb65964 | 509 | _SCBondInterfaceCopyActive (void) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/); |
edebe297 A |
510 | |
511 | /*! | |
512 | @function _SCBondInterfaceUpdateConfiguration | |
513 | @discussion Updates the bond interface configuration. | |
514 | @param prefs The "preferences" session. | |
515 | @result TRUE if the bond interface configuration was updated.; FALSE if the | |
516 | an error was encountered. | |
517 | */ | |
518 | Boolean | |
6bb65964 A |
519 | _SCBondInterfaceUpdateConfiguration (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/); |
520 | ||
521 | /*! | |
522 | @function SCBondInterfaceGetMode | |
523 | @discussion Return the mode for the given bond interface. | |
524 | @param bond The bond interface to get the mode from. | |
525 | @result A CFNumberRef containing the mode (IF_BOND_MODE_{LACP,STATIC}). | |
526 | */ | |
527 | CFNumberRef | |
528 | SCBondInterfaceGetMode (SCBondInterfaceRef bond) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/); | |
edebe297 A |
529 | |
530 | /*! | |
531 | @function SCBondInterfaceSetMode | |
532 | @discussion Set the mode on the bond interface. | |
533 | @param bond The bond interface on which to adjust the mode. | |
534 | @param mode The mode value (0=IF_BOND_MODE_LACP,1=IF_BOND_MODE_STATIC) | |
535 | @result TRUE if operation succeeded. | |
536 | */ | |
537 | Boolean | |
538 | SCBondInterfaceSetMode (SCBondInterfaceRef bond, | |
6bb65964 A |
539 | CFNumberRef mode) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/); |
540 | ||
541 | #pragma mark - | |
542 | #pragma mark SCBridgeInterface configuration (SPIs) | |
edebe297 A |
543 | |
544 | /*! | |
6bb65964 A |
545 | @function SCBridgeInterfaceCopyAll |
546 | @discussion Returns all bridge interfaces on the system. | |
547 | @param prefs The "preferences" session. | |
548 | @result The list of bridge interfaces on the system. | |
549 | You must release the returned value. | |
edebe297 | 550 | */ |
6bb65964 A |
551 | CFArrayRef /* of SCBridgeInterfaceRef's */ |
552 | SCBridgeInterfaceCopyAll (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/); | |
553 | ||
554 | /*! | |
555 | @function SCBridgeInterfaceCopyAvailableMemberInterfaces | |
556 | @discussion Returns all network capable devices on the system | |
557 | that can be added to an bridge interface. | |
558 | @param prefs The "preferences" session. | |
559 | @result The list of interfaces. | |
560 | You must release the returned value. | |
561 | */ | |
562 | CFArrayRef /* of SCNetworkInterfaceRef's */ | |
563 | SCBridgeInterfaceCopyAvailableMemberInterfaces (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/); | |
564 | ||
565 | /*! | |
566 | @function SCBridgeInterfaceCreate | |
567 | @discussion Create a new SCBridgeInterface interface. | |
568 | @param prefs The "preferences" session. | |
569 | @result A reference to the new SCBridgeInterface. | |
570 | You must release the returned value. | |
571 | */ | |
572 | SCBridgeInterfaceRef | |
573 | SCBridgeInterfaceCreate (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/); | |
574 | ||
575 | /*! | |
576 | @function SCBridgeInterfaceRemove | |
577 | @discussion Removes the SCBridgeInterface from the configuration. | |
578 | @param bridge The SCBridgeInterface interface. | |
579 | @result TRUE if the interface was removed; FALSE if an error was encountered. | |
580 | */ | |
581 | Boolean | |
582 | SCBridgeInterfaceRemove (SCBridgeInterfaceRef bridge) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/); | |
583 | ||
584 | /*! | |
585 | @function SCBridgeInterfaceGetMemberInterfaces | |
586 | @discussion Returns the member interfaces for the specified bridge interface. | |
587 | @param bridge The SCBridgeInterface interface. | |
588 | @result The list of interfaces. | |
589 | */ | |
590 | CFArrayRef /* of SCNetworkInterfaceRef's */ | |
591 | SCBridgeInterfaceGetMemberInterfaces (SCBridgeInterfaceRef bridge) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/); | |
592 | ||
593 | /*! | |
594 | @function SCBridgeInterfaceGetOptions | |
595 | @discussion Returns the configuration settings associated with a bridge interface. | |
596 | @param bridge The SCBridgeInterface interface. | |
597 | @result The configuration settings associated with the bridge interface; | |
598 | NULL if no changes to the default configuration have been saved. | |
599 | */ | |
600 | CFDictionaryRef | |
601 | SCBridgeInterfaceGetOptions (SCBridgeInterfaceRef bridge) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/); | |
602 | ||
603 | /*! | |
604 | @function SCBridgeInterfaceSetMemberInterfaces | |
605 | @discussion Sets the member interfaces for the specified bridge interface. | |
606 | @param bridge The SCBridgeInterface interface. | |
607 | @param members The desired member interfaces. | |
608 | @result TRUE if the configuration was stored; FALSE if an error was encountered. | |
609 | */ | |
610 | Boolean | |
611 | SCBridgeInterfaceSetMemberInterfaces (SCBridgeInterfaceRef bridge, | |
612 | CFArrayRef members) /* of SCNetworkInterfaceRef's */ | |
613 | __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/); | |
614 | ||
615 | /*! | |
616 | @function SCBridgeInterfaceSetLocalizedDisplayName | |
617 | @discussion Sets the localized display name for the specified bridge interface. | |
618 | @param bridge The SCBridgeInterface interface. | |
619 | @param newName The new display name. | |
620 | @result TRUE if the configuration was stored; FALSE if an error was encountered. | |
621 | */ | |
622 | Boolean | |
623 | SCBridgeInterfaceSetLocalizedDisplayName (SCBridgeInterfaceRef bridge, | |
624 | CFStringRef newName) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/); | |
625 | ||
626 | /*! | |
627 | @function SCBridgeInterfaceSetOptions | |
628 | @discussion Sets the configuration settings for the specified bridge interface. | |
629 | @param bridge The SCBridgeInterface interface. | |
630 | @param newOptions The new configuration settings. | |
631 | @result TRUE if the configuration was stored; FALSE if an error was encountered. | |
632 | */ | |
633 | Boolean | |
634 | SCBridgeInterfaceSetOptions (SCBridgeInterfaceRef bridge, | |
635 | CFDictionaryRef newOptions) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/); | |
636 | ||
637 | #pragma mark - | |
638 | ||
639 | /*! | |
640 | @function _SCBridgeInterfaceCopyActive | |
641 | @discussion Returns all bridge interfaces on the system. | |
642 | @result The list of SCBridgeInterface interfaces on the system. | |
643 | You must release the returned value. | |
644 | */ | |
645 | CFArrayRef | |
646 | _SCBridgeInterfaceCopyActive (void) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/); | |
647 | ||
648 | /*! | |
649 | @function _SCBridgeInterfaceUpdateConfiguration | |
650 | @discussion Updates the bridge interface configuration. | |
651 | @param prefs The "preferences" session. | |
652 | @result TRUE if the bridge interface configuration was updated.; FALSE if the | |
653 | an error was encountered. | |
654 | */ | |
655 | Boolean | |
656 | _SCBridgeInterfaceUpdateConfiguration (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0/*SPI*/); | |
657 | ||
658 | ||
659 | #pragma mark - | |
660 | #pragma mark SCVLANInterface configuration (SPIs) | |
edebe297 A |
661 | |
662 | /*! | |
663 | @function _SCVLANInterfaceCopyActive | |
664 | @discussion Returns all VLAN interfaces on the system. | |
665 | @result The list of SCVLANInterface interfaces on the system. | |
666 | You must release the returned value. | |
667 | */ | |
668 | CFArrayRef | |
6bb65964 | 669 | _SCVLANInterfaceCopyActive (void) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/); |
edebe297 A |
670 | |
671 | /*! | |
672 | @function _SCVLANInterfaceUpdateConfiguration | |
673 | @discussion Updates the VLAN interface configuration. | |
674 | @param prefs The "preferences" session. | |
675 | @result TRUE if the VLAN interface configuration was updated.; FALSE if the | |
676 | an error was encountered. | |
677 | */ | |
678 | Boolean | |
6bb65964 | 679 | _SCVLANInterfaceUpdateConfiguration (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_4_0/*SPI*/); |
edebe297 A |
680 | |
681 | ||
682 | #pragma mark - | |
683 | #pragma mark SCNetworkInterface Password SPIs | |
684 | ||
685 | ||
686 | enum { | |
687 | kSCNetworkInterfacePasswordTypePPP = 1, | |
688 | kSCNetworkInterfacePasswordTypeIPSecSharedSecret, | |
689 | kSCNetworkInterfacePasswordTypeEAPOL, | |
a40a14f8 | 690 | kSCNetworkInterfacePasswordTypeIPSecXAuth, |
6bb65964 | 691 | kSCNetworkInterfacePasswordTypeVPN, |
edebe297 A |
692 | }; |
693 | typedef uint32_t SCNetworkInterfacePasswordType; | |
694 | ||
695 | Boolean | |
696 | SCNetworkInterfaceCheckPassword (SCNetworkInterfaceRef interface, | |
a40a14f8 | 697 | SCNetworkInterfacePasswordType passwordType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); |
edebe297 A |
698 | |
699 | CFDataRef | |
700 | SCNetworkInterfaceCopyPassword (SCNetworkInterfaceRef interface, | |
a40a14f8 | 701 | SCNetworkInterfacePasswordType passwordType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); |
edebe297 A |
702 | |
703 | Boolean | |
704 | SCNetworkInterfaceRemovePassword (SCNetworkInterfaceRef interface, | |
a40a14f8 | 705 | SCNetworkInterfacePasswordType passwordType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); |
edebe297 A |
706 | |
707 | Boolean | |
708 | SCNetworkInterfaceSetPassword (SCNetworkInterfaceRef interface, | |
709 | SCNetworkInterfacePasswordType passwordType, | |
710 | CFDataRef password, | |
a40a14f8 | 711 | CFDictionaryRef options) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); |
edebe297 A |
712 | |
713 | ||
714 | #pragma mark - | |
715 | #pragma mark SCNetworkProtocol configuration (SPI) | |
716 | ||
717 | ||
718 | /*! | |
719 | @group Protocol configuration | |
720 | */ | |
721 | ||
722 | ||
723 | static __inline__ CFTypeRef | |
724 | isA_SCNetworkProtocol(CFTypeRef obj) | |
725 | { | |
726 | return (isA_CFType(obj, SCNetworkProtocolGetTypeID())); | |
727 | } | |
728 | ||
729 | ||
730 | #pragma mark - | |
731 | #pragma mark SCNetworkService configuration (SPI) | |
732 | ||
733 | ||
734 | /*! | |
735 | @group Service configuration | |
736 | */ | |
737 | ||
738 | ||
739 | static __inline__ CFTypeRef | |
740 | isA_SCNetworkService(CFTypeRef obj) | |
741 | { | |
742 | return (isA_CFType(obj, SCNetworkServiceGetTypeID())); | |
743 | } | |
744 | ||
6bb65964 A |
745 | /*! |
746 | @function _SCNetworkServiceCompare | |
747 | @discussion Compares two SCNetworkService objects. | |
748 | @param val1 The SCNetworkService object. | |
749 | @param val2 The SCNetworkService object. | |
750 | @param context The service order (from SCNetworkSetGetServiceOrder). | |
751 | @result A comparison result. | |
752 | */ | |
753 | CFComparisonResult | |
754 | _SCNetworkServiceCompare (const void *val1, | |
755 | const void *val2, | |
756 | void *context) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0); | |
757 | ||
a40a14f8 A |
758 | /*! |
759 | @function _SCNetworkServiceCopyActive | |
760 | @discussion Returns the network service with the specified identifier. | |
761 | ||
762 | Note: The service returned by this SPI differs from the SCNetworkServiceCopy | |
763 | API in that queries and operations interact with the "active" service | |
764 | represented in the SCDynamicStore. Only a limited subset of the | |
765 | SCNetworkService APIs are supported. | |
766 | @param prefs The dynamic store session. | |
767 | @param serviceID The unique identifier for the service. | |
768 | @result A reference to the SCNetworkService represented in the SCDynamicStore; | |
769 | NULL if the serviceID does not exist in the SCDynamicStore or if an | |
770 | error was encountered. | |
771 | You must release the returned value. | |
772 | */ | |
773 | SCNetworkServiceRef | |
774 | _SCNetworkServiceCopyActive (SCDynamicStoreRef store, | |
775 | CFStringRef serviceID) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_1); | |
776 | ||
777 | /*! | |
778 | @function SCNetworkServiceGetPrimaryRank | |
779 | @discussion Returns the primary service rank associated with a service. | |
780 | @param service The network service. | |
781 | @result The primary service rank associated with the specified application; | |
782 | kSCNetworkServicePrimaryRankDefault if no rank is associated with the | |
783 | application or an error was encountered. | |
784 | */ | |
785 | SCNetworkServicePrimaryRank | |
786 | SCNetworkServiceGetPrimaryRank (SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0); | |
787 | ||
788 | /*! | |
789 | @function SCNetworkServiceSetPrimaryRank | |
790 | @discussion Updates the the primary service rank associated with a service. | |
791 | @param service The network service. | |
792 | @param newRank The new primary service rank; kSCNetworkServicePrimaryRankDefault | |
793 | if the default service rank should be used. | |
794 | @result TRUE if the rank was stored; FALSE if an error was encountered. | |
795 | ||
796 | Notes : The kSCNetworkServicePrimaryRankFirst and kSCNetworkServicePrimaryRankLast | |
797 | values can only valid as a transient setting. | |
798 | */ | |
799 | Boolean | |
800 | SCNetworkServiceSetPrimaryRank (SCNetworkServiceRef service, | |
801 | SCNetworkServicePrimaryRank newRank) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0); | |
802 | ||
6bb65964 A |
803 | /*! |
804 | @function _SCNetworkServiceIsVPN | |
805 | @discussion Identifies a VPN service. | |
806 | @param service The network service. | |
807 | @result TRUE if the service is a VPN. | |
808 | */ | |
809 | Boolean | |
810 | _SCNetworkServiceIsVPN (SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0); | |
edebe297 | 811 | |
5e9ce69e A |
812 | /*! |
813 | @function SCNetworkServiceSetExternalID | |
814 | @discussion Set the external identifier for a network service. | |
815 | @param service A reference to the network service. | |
816 | @param identifierDomain A service can have multiple external identifiers. This string specifies which external identifier to set. | |
817 | @param identifier The new external identifier to assign to the network service. | |
818 | @result Returns TRUE if the external identifier was set successfully, FALSE if an error occurred. | |
819 | */ | |
820 | Boolean | |
821 | SCNetworkServiceSetExternalID (SCNetworkServiceRef service, | |
822 | CFStringRef identifierDomain, | |
823 | CFStringRef identifier); | |
824 | ||
825 | /*! | |
826 | @function SCNetworkServiceCopyExternalID | |
827 | @discussion Copy the external identifier for a network service. | |
828 | @param service The network service. | |
829 | @param identifierDomain A service can have multiple external identifiers. This string specifies which external identifier to copy. | |
830 | @result Returns the service's external identifier, or NULL if the service does not have an external identifier in the given domain. | |
831 | */ | |
832 | CFStringRef | |
833 | SCNetworkServiceCopyExternalID (SCNetworkServiceRef service, | |
834 | CFStringRef identifierDomain); | |
835 | ||
78403150 A |
836 | /*! |
837 | @function _SCNetworkServiceSetServiceID | |
838 | @discussion Sets serviceID of the service to a different value provided. | |
839 | @param service The network service | |
840 | @param newServiceID The new service ID | |
841 | @result TRUE if new service ID is set successfully. | |
842 | */ | |
843 | Boolean | |
844 | _SCNetworkServiceSetServiceID (SCNetworkServiceRef service, | |
845 | CFStringRef newServiceID) __OSX_AVAILABLE_STARTING(__MAC_10_10,__IPHONE_8_0); | |
846 | ||
edebe297 A |
847 | #pragma mark - |
848 | #pragma mark SCNetworkSet configuration (SPI) | |
849 | ||
850 | ||
851 | /*! | |
852 | @group Set configuration | |
853 | */ | |
854 | ||
855 | ||
856 | static __inline__ CFTypeRef | |
857 | isA_SCNetworkSet(CFTypeRef obj) | |
858 | { | |
859 | return (isA_CFType(obj, SCNetworkSetGetTypeID())); | |
860 | } | |
861 | ||
862 | ||
5e9ce69e A |
863 | /*! |
864 | @function SCNetworkSetCopyAvailableInterfaces | |
865 | @discussion Returns all available interfaces for the set. | |
866 | The interfaces excludes those of bond and bridge members. | |
867 | @param set The network set. | |
868 | @result The list of SCNetworkInterfaces. | |
869 | You must release the returned value. | |
870 | */ | |
871 | CFArrayRef | |
872 | SCNetworkSetCopyAvailableInterfaces (SCNetworkSetRef set) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0/*SPI*/); | |
873 | ||
edebe297 A |
874 | /*! |
875 | @function SCNetworkSetEstablishDefaultConfiguration | |
876 | @discussion Updates a network set by adding services for | |
877 | any network interface that is not currently | |
878 | represented. | |
879 | If the provided set contains one (or more) services, new | |
880 | services will only be added for those interfaces that are | |
881 | not represented in *any* set. | |
882 | Otherwise, new services will be added for those interfaces | |
883 | that are not represented in the provided set. | |
884 | The new services are established with "default" configuration | |
885 | options. | |
886 | @param set The network set. | |
887 | @result TRUE if the configuration was updated; FALSE if no | |
888 | changes were required or if an error was encountered. | |
889 | */ | |
890 | Boolean | |
a40a14f8 | 891 | SCNetworkSetEstablishDefaultConfiguration (SCNetworkSetRef set) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); |
edebe297 | 892 | |
6d034b4e A |
893 | /*! |
894 | @function SCNetworkSetEstablishDefaultInterfaceConfiguration | |
895 | @discussion Updates a network set by adding services for | |
896 | the specified network interface if is not currently | |
897 | represented. | |
898 | If the provided set contains one (or more) services, new | |
899 | services will only be added for interfaces that are not | |
900 | represented in *any* set. | |
901 | Otherwise, new services will be added for interfaces that | |
902 | are not represented in the provided set. | |
903 | The new services are established with "default" configuration | |
904 | options. | |
905 | @param set The network set. | |
906 | @param interface The network interface. | |
907 | @result TRUE if the configuration was updated; FALSE if no | |
908 | changes were required or if an error was encountered. | |
909 | */ | |
910 | Boolean | |
911 | SCNetworkSetEstablishDefaultInterfaceConfiguration (SCNetworkSetRef set, | |
a40a14f8 | 912 | SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0); |
edebe297 | 913 | |
6bb65964 A |
914 | /*! |
915 | @function SCNetworkSetCopySelectedVPNService | |
916 | @discussion On the iPhone we only allow a single VPN network service | |
917 | to be selected at any given time. This API will identify | |
918 | the selected VPN service. | |
919 | @param set The network set. | |
920 | @result The selected VPN service; NULL if no service has been | |
921 | selected. | |
922 | You must release the returned value. | |
923 | */ | |
924 | SCNetworkServiceRef | |
925 | SCNetworkSetCopySelectedVPNService (SCNetworkSetRef set) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0); | |
926 | ||
927 | /*! | |
928 | @function SCNetworkSetSetSelectedVPNService | |
929 | @discussion On the iPhone we only allow a single VPN network service | |
930 | to be selected at any given time. This API should be used to | |
931 | select a VPN service. | |
932 | @param set The network set. | |
933 | @param service The VPN service to be selected. | |
934 | @result TRUE if the name was saved; FALSE if an error was encountered. | |
935 | */ | |
936 | Boolean | |
937 | SCNetworkSetSetSelectedVPNService (SCNetworkSetRef set, | |
938 | SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0); | |
939 | ||
78403150 A |
940 | Boolean |
941 | _SCNetworkSetSetSetID (SCNetworkSetRef set, | |
942 | CFStringRef setID) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); | |
943 | ||
5e9ce69e A |
944 | /*! |
945 | @group VPN Service configuration | |
946 | */ | |
947 | ||
948 | #pragma mark - | |
949 | #pragma mark VPN Service configuration | |
950 | ||
951 | typedef SCNetworkServiceRef VPNServiceRef; | |
952 | ||
953 | /*! | |
954 | @function VPNServiceCopyAllMatchingExternalID | |
955 | @discussion Copy the VPN services with the given external identifier. | |
956 | @param prefs A reference to the prefs where the VPN services are stored. | |
957 | @param identifierDomain A service can have multiple external identifiers. This string specifies which one to match with the given identifier. | |
958 | @param identifier The external identifier of the desired services. | |
959 | @result A array of references to the VPN services with the given identifier, or NULL if no such service exists | |
960 | */ | |
961 | CFArrayRef | |
962 | VPNServiceCopyAllMatchingExternalID (SCPreferencesRef prefs, | |
963 | CFStringRef identifierDomain, | |
964 | CFStringRef identifier) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0/*SPI*/); | |
965 | ||
966 | /*! | |
967 | @function VPNServiceCopyAll | |
968 | @discussion Copy all VPN services. | |
969 | @param prefs A reference to the prefs where the VPN services are stored. | |
970 | @result An array containing VPNServiceRefs for all the VPN services. | |
971 | */ | |
972 | CFArrayRef | |
973 | VPNServiceCopyAll (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0/*SPI*/); | |
974 | ||
975 | /*! | |
976 | @function VPNServiceCopyAppRuleIDs | |
977 | @discussion Copy all the app rule identifiers for a VPN service. | |
978 | @param service A reference to the VPN service. | |
979 | @result An array of CFStringRefs, each string containing the identifier of a app rule in the given service. | |
980 | */ | |
981 | CFArrayRef | |
982 | VPNServiceCopyAppRuleIDs (VPNServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0/*SPI*/); | |
983 | ||
984 | /*! | |
985 | @function VPNServiceSetAppRule | |
986 | @discussion Add or modify an app rule in a VPN service. The ruleSettings dictionary must contain one of the following keys: | |
987 | <pre>kSCValNetVPNAppRuleExecutableMatch</pre> | |
988 | <pre>kSCValNetVPNAppRuleAccountIdentifierMatch</pre> | |
989 | The ruleSettings dictionary may also contain the following keys: | |
990 | <pre>kSCValNetVPNAppRuleDNSDomainMatch</pre> | |
991 | See SCSchemaDefinitionsPrivate.h for more details. | |
992 | @param service A reference to the VPN service. | |
993 | @param ruleIdentifier The identifier of the new app rule. | |
994 | @param ruleSettings The settings for the new app rule. See the dictionary keys defined above. | |
995 | @result TRUE if the app rule was set successfully, FALSE if an error occurred. | |
996 | */ | |
997 | Boolean | |
998 | VPNServiceSetAppRule (VPNServiceRef service, | |
999 | CFStringRef ruleIdentifier, | |
1000 | CFDictionaryRef ruleSettings) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0/*SPI*/); | |
1001 | ||
1002 | /*! | |
1003 | @function VPNServiceCopyAppRule | |
1004 | @discussion Copy the settings for a app rule in a VPN service. | |
1005 | @param service The app tunnel service. | |
1006 | @param ruleIdentifier The ID of the app rule. | |
1007 | @result The rule settings, or NULL if the app rule could not be found. | |
1008 | */ | |
1009 | CFDictionaryRef | |
1010 | VPNServiceCopyAppRule (VPNServiceRef service, | |
1011 | CFStringRef ruleIdentifier) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0/*SPI*/); | |
1012 | ||
1013 | /*! | |
1014 | @function VPNServiceRemoveAppRule | |
1015 | @discussion Remove an app rule from a VPN service. | |
1016 | @param service The VPN service. | |
1017 | @param ruleIdentifier The ID of the app rule to remove. | |
1018 | @result Returns TRUE if the app rule was removed successfully; FALSE otherwise. | |
1019 | */ | |
1020 | Boolean | |
1021 | VPNServiceRemoveAppRule (VPNServiceRef service, | |
1022 | CFStringRef ruleIdentifier) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0/*SPI*/); | |
1023 | ||
78403150 A |
1024 | /*! |
1025 | @function VPNServiceIsManagedAppVPN | |
1026 | @discussion Check to see if a VPN service is a managed App VPN service | |
1027 | @param service The VPN servie. | |
1028 | @result Returns TRUE if the service is a managed App VPN service; FALSE otherwise. | |
1029 | */ | |
1030 | Boolean | |
1031 | VPNServiceIsManagedAppVPN (VPNServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0/*SPI*/); | |
1032 | ||
1033 | /*! | |
1034 | @group Migration SPI | |
1035 | */ | |
1036 | #pragma mark - | |
1037 | #pragma mark Migration SPI | |
1038 | ||
1039 | extern const CFStringRef kSCNetworkConfigurationRepair /* CFBoolean */ __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); | |
1040 | ||
1041 | extern const CFStringRef kSCNetworkConfigurationMigrationActionKey /* CFNumber */ __OSX_AVAILABLE_STARTING(__MAC_10_10,__IPHONE_8_0); | |
1042 | ||
1043 | typedef CF_ENUM(uint32_t, SCNetworkConfigurationMigrationAction) { | |
1044 | kSCNetworkConfigurationMigrationAction_CleanInstall = 0, | |
1045 | kSCNetworkConfigurationMigrationAction_Upgrade = 1, | |
1046 | kSCNetworkConfigurationMigrationAction_Restore = 2, | |
1047 | }; | |
1048 | ||
1049 | /*! | |
1050 | @function _SCNetworkConfigurationCopyMigrationPaths | |
1051 | @result Returns an array of paths that we would need from the source | |
1052 | */ | |
1053 | CFArrayRef | |
1054 | _SCNetworkConfigurationCopyMigrationPaths(CFDictionaryRef options) __OSX_AVAILABLE_STARTING(__MAC_10_10,__IPHONE_8_0); | |
1055 | ||
1056 | /*! | |
1057 | @function _SCNetworkConfigurationPerformMigration | |
1058 | @discussion Updates the network configuration of the target system with | |
1059 | configurations from previous system. Both sourceDir and targetDir | |
1060 | cannot be NULL, since NULL indicates API to look at the local system | |
1061 | @param sourceDir A reference which points to the root of a directory populated | |
1062 | with the list of requested directories/path from the "source" volume. Passing NULL | |
1063 | will indicate that sourceDir should point to local system | |
1064 | @param currentDir A reference which points to the root of a directory populated | |
1065 | with the list of requested directories/path from the "destination" volume. Passing | |
1066 | NULL will indicate that currentDir should point to local system. | |
1067 | @param targetDir A reference which points to the root of a directory that we | |
1068 | will populate (update) with new configuration. Passing NULL will mean that we want to | |
1069 | migrate to the currentDir. If not NULL, then this path should exist. | |
1070 | @param options Argument which will tell us what action we are supposed to take | |
1071 | (clean-install, upgrade, migrate/restore settings from another system, ...) | |
1072 | @result Returns array which would consist of those paths that should be moved | |
1073 | from the "targetDir" directory to destination volume. You must release the returned value. | |
1074 | */ | |
1075 | ||
1076 | CF_RETURNS_RETAINED | |
1077 | CFArrayRef | |
1078 | _SCNetworkConfigurationPerformMigration(CFURLRef sourceDir, | |
1079 | CFURLRef currentDir, | |
1080 | CFURLRef targetDir, | |
1081 | CFDictionaryRef options) __OSX_AVAILABLE_STARTING(__MAC_10_10,__IPHONE_8_0); | |
1082 | ||
1083 | ||
1084 | /*! | |
1085 | @function _SCNetworkConfigurationCheckValidity | |
1086 | @discussion Verifies whether the configuration files present in the specified | |
1087 | directory have valid mappings or not | |
1088 | @param configDir A reference which points to the directory where the configuration | |
1089 | files are present | |
1090 | @result TRUE if valid configurations are found | |
1091 | ||
1092 | */ | |
1093 | ||
1094 | Boolean | |
1095 | _SCNetworkConfigurationCheckValidity(CFURLRef configDir, | |
1096 | CFDictionaryRef options) __OSX_AVAILABLE_STARTING(__MAC_10_10,__IPHONE_8_0); | |
1097 | ||
1098 | ||
1099 | /*! | |
1100 | @function _SCNetworkMigrationAreConfigurationsIdentical | |
1101 | @discussion Compares the migration output between network configurations | |
1102 | with the expected output. | |
1103 | @param configPref Preferences pointing toward preferences.plist file to | |
1104 | be compared with expected file. | |
1105 | @param configNetworkInterfacePref Preferences pointing toward NetworkInterfaces.plist | |
1106 | file to be compared with expected file. | |
1107 | @param expectedConfigPref Preferences pointing toward preferences.plist file | |
1108 | which is the expected result. | |
1109 | @param expectedNetworkInterfacePref Preferences pointing toward NetworkInterfaces.plist | |
1110 | file which is the expected file. | |
1111 | @result TRUE if configurations match with the expected configurations | |
1112 | ||
1113 | */ | |
1114 | ||
1115 | Boolean | |
1116 | _SCNetworkMigrationAreConfigurationsIdentical (CFURLRef configurationURL, | |
1117 | CFURLRef expectedConfigurationURL) | |
1118 | __OSX_AVAILABLE_STARTING(__MAC_10_10,__IPHONE_8_0); | |
1119 | ||
1120 | /*! | |
1121 | @function _SCNetworkConfigurationCopyMigrationRemovePaths | |
1122 | @discussion List of paths to files which we want to be removed from the target filesystem after migration | |
1123 | @param targetPaths the CFArray returned by _SCNetworkConfigurationPerformMigration | |
1124 | @param targetDir the CFURL passed to _SCNetworkConfigurationPerformMigration | |
1125 | @result An array of CFURL's; NULL if no paths need to be removed from the target filesystem | |
1126 | ||
1127 | */ | |
1128 | ||
1129 | CFArrayRef // of CFURLRef's | |
1130 | _SCNetworkConfigurationCopyMigrationRemovePaths (CFArrayRef targetPaths, | |
1131 | CFURLRef targetDir) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); | |
1132 | ||
edebe297 | 1133 | __END_DECLS |
edebe297 | 1134 | #endif /* _SCNETWORKCONFIGURATIONPRIVATE_H */ |