]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/SCNetworkConfigurationPrivate.h
configd-963.200.27.tar.gz
[apple/configd.git] / SystemConfiguration.fproj / SCNetworkConfigurationPrivate.h
1 /*
2 * Copyright (c) 2005-2018 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 _SCNETWORKCONFIGURATIONPRIVATE_H
25 #define _SCNETWORKCONFIGURATIONPRIVATE_H
26
27 #include <os/availability.h>
28 #include <TargetConditionals.h>
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
35 /*!
36 @header SCNetworkConfigurationPrivate
37 */
38
39 __BEGIN_DECLS
40
41
42 /*!
43 @group Interface configuration
44 */
45
46 #pragma mark -
47 #pragma mark SCNetworkInterface configuration (typedefs, consts, enums)
48
49 /*!
50 @const kSCNetworkInterfaceTypeBridge
51 */
52 extern const CFStringRef kSCNetworkInterfaceTypeBridge API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
53
54
55 /*!
56 @const kSCNetworkInterfaceTypeLoopback
57 */
58 extern const CFStringRef kSCNetworkInterfaceTypeLoopback API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
59
60 /*!
61 @const kSCNetworkInterfaceLoopback
62 @discussion A network interface representing the loopback
63 interface (lo0).
64 */
65 extern const SCNetworkInterfaceRef kSCNetworkInterfaceLoopback API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
66
67 /*!
68 @const kSCNetworkInterfaceTypeVPN
69 */
70 extern const CFStringRef kSCNetworkInterfaceTypeVPN API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
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
83 typedef CF_ENUM(uint32_t, SCNetworkServicePrimaryRank) {
84 kSCNetworkServicePrimaryRankDefault = 0,
85 kSCNetworkServicePrimaryRankFirst = 1,
86 kSCNetworkServicePrimaryRankLast = 2,
87 kSCNetworkServicePrimaryRankNever = 3,
88 kSCNetworkServicePrimaryRankScoped = 4
89 };
90
91 #pragma mark -
92 #pragma mark SCNetworkInterface configuration (SPI)
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
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
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,
172 void *context) API_AVAILABLE(macos(10.5), ios(2.0));
173
174 /*!
175 @function _SCNetworkInterfaceCopyActive
176 @discussion Creates an SCNetworkInterface and associated with interface name
177 and SCDynamicStoreRef
178 @param store The SCDynamicStoreRef
179 @param bsdName The interface name
180 @result the SCNetworkInterface
181 */
182 SCNetworkInterfaceRef
183 _SCNetworkInterfaceCopyActive (SCDynamicStoreRef store,
184 CFStringRef bsdName) API_AVAILABLE(macos(10.8), ios(5.0));
185
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) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(5.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
195
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
202 _SCNetworkInterfaceCopyBTPANInterface (void) API_AVAILABLE(macos(10.9)) API_UNAVAILABLE(ios, tvos, watchos, bridgeos);
203
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) API_AVAILABLE(macos(10.6), ios(3.0));
213
214 #define kIncludeNoVirtualInterfaces 0x0
215 #define kIncludeVLANInterfaces 0x1
216 #define kIncludeBondInterfaces 0x2
217 #define kIncludeBridgeInterfaces 0x4
218 #define kIncludeAllVirtualInterfaces 0xffffffff
219
220 /*!
221 @function _SCNetworkInterfaceCreateWithBSDName
222 @discussion Create a new network interface associated with the provided
223 BSD interface name. This API supports Ethernet, FireWire, and
224 IEEE 802.11 interfaces.
225 @param bsdName The BSD interface name.
226 @param flags Indicates whether virtual (Bond, Bridge, VLAN)
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,
234 UInt32 flags) API_AVAILABLE(macos(10.5), ios(2.0));
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,
248 SCNetworkServiceRef service) API_AVAILABLE(macos(10.5), ios(2.0));
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
259 _SCNetworkInterfaceCreateWithIONetworkInterfaceObject (io_object_t if_obj) API_AVAILABLE(macos(10.5), ios(2.0));
260
261 /*!
262 @function SCNetworkInterfaceGetPrimaryRank
263 @discussion We allow caller to retrieve the rank on an interface.
264 @param interface The interface to get the rank
265 @result SCNetworkServicePrimaryRank
266 */
267 SCNetworkServicePrimaryRank
268 SCNetworkInterfaceGetPrimaryRank (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.8), ios(5.0));
269
270 /*!
271 @function SCNetworkInterfaceSetPrimaryRank
272 @discussion We allow caller to set an assertion on an interface.
273 The rank assertion lives as long as the SCNetworkInterfaceRef
274 remains valid.
275 @param interface The interface to set the rank assertion
276 @param newRank 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) API_AVAILABLE(macos(10.8), ios(5.0));
282
283 /**
284 ** SCNetworkInterfaceAdvisory
285 **/
286
287 typedef CF_ENUM(uint32_t, SCNetworkInterfaceAdvisory) {
288 kSCNetworkInterfaceAdvisoryNone = 0,
289 kSCNetworkInterfaceAdvisoryLinkLayerIssue = 1,
290 kSCNetworkInterfaceAdvisoryUplinkIssue = 2,
291 };
292
293 /*!
294 @function SCNetworkInterfaceSetAdvisory
295 @discussion Advise the system of some condition on the network interface
296 that warrants changing how the interface is used for IP networking,
297 and to clear a previously set advisory.
298 Calling this function requires root or having the boolean entitlement
299 "com.apple.SystemConfiguration.SCNetworkInterfaceSetAdvisory" = true.
300 @param interface The interface to assert the advisory on.
301 @param advisory The advisory to indicate on the interface, use
302 kSCNetworkInterfaceAdvisoryNone to clear advisory.
303 @param reason A string indicating the reason for setting the advisory,
304 used to aid debugging.
305 @result TRUE if the advisory change was successful; FALSE otherwise.
306 */
307 Boolean
308 SCNetworkInterfaceSetAdvisory(SCNetworkInterfaceRef interface,
309 SCNetworkInterfaceAdvisory advisory,
310 CFStringRef reason)
311 API_AVAILABLE(macos(10.14), ios(12.0));
312
313 /*!
314 @function SCNetworkInterfaceAdvisoryIsSet
315 @discussion Find out if there is an advisory set on the interface.
316 @param interface The interface to check for an advisory.
317 @result TRUE if an advisory is set; FALSE otherwise.
318 */
319 Boolean
320 SCNetworkInterfaceAdvisoryIsSet(SCNetworkInterfaceRef interface)
321 API_AVAILABLE(macos(10.14), ios(12.0));
322
323 /*!
324 @function SCNetworkInterfaceCopyAdvisoryNotificationKey
325 @discussion Get the SCDynamicStore notication key for advisory changes
326 made on the interface.
327 @param interface The interface for which to get the notification key.
328 @result Key used to receive advisory change notifications on the
329 interface.
330 */
331 CFStringRef
332 SCNetworkInterfaceCopyAdvisoryNotificationKey(SCNetworkInterfaceRef interface)
333 API_AVAILABLE(macos(10.14), ios(12.0));
334
335
336 #define kSCNetworkInterfaceConfigurationActionKey CFSTR("New Interface Detected Action")
337 #define kSCNetworkInterfaceConfigurationActionValueNone CFSTR("None")
338 #define kSCNetworkInterfaceConfigurationActionValuePrompt CFSTR("Prompt")
339 #define kSCNetworkInterfaceConfigurationActionValueConfigure CFSTR("Configure")
340
341 #define kSCNetworkInterfaceNetworkConfigurationOverridesKey CFSTR("NetworkConfigurationOverrides")
342 #define kSCNetworkInterfaceHiddenConfigurationKey CFSTR("HiddenConfiguration")
343 #define kSCNetworkInterfaceHiddenPortKey CFSTR("HiddenPort") /* for serial ports */
344 #define kSCNetworkInterfaceHiddenInterfaceKey CFSTR("HiddenInterface") /* for network interfaces */
345
346 // IORegistry property to indicate that a [WWAN] interface is not yet ready
347 #define kSCNetworkInterfaceInitializingKey CFSTR("Initializing")
348
349 // IORegistry property to indicate that the attached host should be trusted before use
350 #define kSCNetworkInterfaceTrustRequiredKey CFSTR("TrustRequired")
351
352 /*!
353 @function _SCNetworkInterfaceCopyInterfaceInfo
354 @discussion Returns interface details
355 @param interface The network interface.
356 @result A dictionary with details about the network interface.
357 */
358 CFDictionaryRef
359 _SCNetworkInterfaceCopyInterfaceInfo (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.6), ios(3.0));
360
361 /*!
362 @function _SCNetworkInterfaceGetConfigurationAction
363 @discussion Returns a user-notification / auto-configuration action for the interface.
364 @param interface The network interface.
365 @result The user-notification / auto-configuration action;
366 NULL if the default action should be used.
367 */
368 CFStringRef
369 _SCNetworkInterfaceGetConfigurationAction (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.6), ios(2.0));
370
371 /*!
372 @function _SCNetworkInterfaceGetFamilyType
373 @discussion Returns the family type for the interface.
374 @param interface The network interface.
375 @result The family type (ift_family) associated with the interface;
376 NULL if no family type is available.
377 */
378 CFNumberRef
379 _SCNetworkInterfaceGetFamilyType (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.12), ios(10.0));
380
381 /*!
382 @function _SCNetworkInterfaceGetFamilySubType
383 @discussion Returns the family subtype for the interface.
384 @param interface The network interface.
385 @result The family subtype (ift_subfamily) associated with the interface;
386 NULL if no family subtype is available.
387 */
388 CFNumberRef
389 _SCNetworkInterfaceGetFamilySubType (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.12), ios(10.0));
390
391 /*!
392 @function _SCNetworkInterfaceGetHardwareAddress
393 @discussion Returns a link layer address for the interface.
394 @param interface The network interface.
395 @result The hardware (MAC) address for the interface.
396 NULL if no hardware address is available.
397 */
398 CFDataRef
399 _SCNetworkInterfaceGetHardwareAddress (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.5), ios(2.0));
400
401 /*!
402 @function _SCNetworkInterfaceGetIOInterfaceNamePrefix
403 @discussion Returns the IOInterfaceNamePrefix for the interface.
404 @param interface The network interface.
405 @result The IOInterfaceNamePrefix associated with the interface;
406 NULL if no IOInterfaceNamePrefix is available.
407 */
408 CFStringRef
409 _SCNetworkInterfaceGetIOInterfaceNamePrefix (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.8), ios(6.0));
410
411 /*!
412 @function _SCNetworkInterfaceGetIOInterfaceType
413 @discussion Returns the IOInterfaceType for the interface.
414 @param interface The network interface.
415 @result The IOInterfaceType associated with the interface
416 */
417 CFNumberRef
418 _SCNetworkInterfaceGetIOInterfaceType (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.5), ios(2.0));
419
420 /*!
421 @function _SCNetworkInterfaceGetIOInterfaceUnit
422 @discussion Returns the IOInterfaceUnit for the interface.
423 @param interface The network interface.
424 @result The IOInterfaceUnit associated with the interface;
425 NULL if no IOInterfaceUnit is available.
426 */
427 CFNumberRef
428 _SCNetworkInterfaceGetIOInterfaceUnit (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.5), ios(2.0));
429
430 /*!
431 @function _SCNetworkInterfaceGetIOPath
432 @discussion Returns the IOPath for the interface.
433 @param interface The network interface.
434 @result The IOPath associated with the interface;
435 NULL if no IOPath is available.
436 */
437 CFStringRef
438 _SCNetworkInterfaceGetIOPath (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.5), ios(2.0));
439
440 /*!
441 @function _SCNetworkInterfaceGetIORegistryEntryID
442 @discussion Returns the IORegistry entry ID for the interface.
443 @param interface The network interface.
444 @result The IORegistry entry ID associated with the interface;
445 Zero if no entry ID is available.
446 */
447 uint64_t
448 _SCNetworkInterfaceGetIORegistryEntryID (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.8), ios(5.0));
449
450 /*!
451 @function _SCNetworkInterfaceIsApplePreconfigured
452 @discussion Identifies if a network interface is internal/pre-configured.
453 @param interface The network interface.
454 @result TRUE if the interface is an internal/pre-configured.
455 */
456 Boolean
457 _SCNetworkInterfaceIsApplePreconfigured (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.12), ios(10.0));
458
459 /*!
460 @function _SCNetworkInterfaceIsBluetoothPAN
461 @discussion Identifies if a network interface is a Bluetooth PAN (GN) device.
462 @param interface The network interface.
463 @result TRUE if the interface is a Bluetooth PAN device.
464 */
465 Boolean
466 _SCNetworkInterfaceIsBluetoothPAN (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.6), ios(3.0));
467
468 /*!
469 @function _SCNetworkInterfaceIsBluetoothPAN_NAP
470 @discussion Identifies if a network interface is a Bluetooth PAN-NAP device.
471 @param interface The network interface.
472 @result TRUE if the interface is a Bluetooth PAN-NAP device.
473 */
474 Boolean
475 _SCNetworkInterfaceIsBluetoothPAN_NAP (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.7), ios(5.0));
476
477 /*!
478 @function _SCNetworkInterfaceIsBluetoothP2P
479 @discussion Identifies if a network interface is a Bluetooth P2P (PAN-U) device.
480 @param interface The network interface.
481 @result TRUE if the interface is a Bluetooth P2P device.
482 */
483 Boolean
484 _SCNetworkInterfaceIsBluetoothP2P (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.7), ios(5.0));
485
486 /*!
487 @function _SCNetworkInterfaceIsBuiltin
488 @discussion Identifies if a network interface is "built-in".
489 @param interface The network interface.
490 @result TRUE if the interface is "built-in".
491 */
492 Boolean
493 _SCNetworkInterfaceIsBuiltin (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.5), ios(2.0));
494
495 /*!
496 @function _SCNetworkInterfaceIsHiddenConfiguration
497 @discussion Identifies if the configuration of a network interface should be
498 hidden from any user interface (e.g. the "Network" pref pane).
499 @param interface The network interface.
500 @result TRUE if the interface configuration should be hidden.
501 */
502 Boolean
503 _SCNetworkInterfaceIsHiddenConfiguration (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.7), ios(4.0));
504
505 /*!
506 @function _SCNetworkInterfaceIsTethered
507 @discussion Identifies if a network interface is an Apple tethered device (e.g. an iPhone).
508 @param interface The network interface.
509 @result TRUE if the interface is a tethered device.
510 */
511 Boolean
512 _SCNetworkInterfaceIsTethered (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.6), ios(3.0));
513
514 /*!
515 @function _SCNetworkInterfaceIsThunderbolt
516 @discussion Identifies if a network interface is a Thunderbolt device
517 @param interface The network interface.
518 @result TRUE if the interface is a Thunderbolt device.
519 */
520 Boolean
521 _SCNetworkInterfaceIsThunderbolt (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.9), ios(7.0));
522
523 /*!
524 @function _SCNetworkInterfaceIsTrustRequired
525 @discussion Identifies if a network interface requires that the
526 associated host be trusted.
527 @param interface The network interface.
528 @result TRUE if the interface requires trust.
529 */
530 Boolean
531 _SCNetworkInterfaceIsTrustRequired (SCNetworkInterfaceRef interface) SPI_AVAILABLE(macos(10.14)) API_AVAILABLE(ios(12.0));
532
533 /*!
534 @function _SCNetworkInterfaceIsPhysicalEthernet
535 @discussion Indicates whether a network interface is a real ethernet interface i.e. one with an ethernet PHY.
536 @param interface The network interface.
537 @result TRUE if the interface is a real ethernet interface.
538 */
539 Boolean
540 _SCNetworkInterfaceIsPhysicalEthernet (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.7), ios(5.0));
541
542 /*!
543 @function _SCNetworkInterfaceForceConfigurationRefresh
544 @discussion Forces a configuration refresh of the
545 specified interface.
546 @param ifName Network interface name.
547 @result TRUE if the refresh was successfully posted.
548 */
549 Boolean
550 _SCNetworkInterfaceForceConfigurationRefresh (CFStringRef ifName) API_AVAILABLE(macos(10.5), ios(2.0));
551
552 /*!
553 @function SCNetworkInterfaceCopyCapability
554 @discussion For the specified network interface, returns information
555 about the currently requested capabilities, the active capabilities,
556 and the capabilities which are available.
557 @param interface The desired network interface.
558 @param capability The desired capability;
559 NULL to return a CFDictionary of all capabilities.
560 @result a CFTypeRef representing the current value of requested
561 capability;
562 NULL if the capability is not available for this
563 interface or if an error was encountered.
564 You must release the returned value.
565 */
566 CFTypeRef
567 SCNetworkInterfaceCopyCapability (SCNetworkInterfaceRef interface,
568 CFStringRef capability) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(5.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
569
570 /*!
571 @function SCNetworkInterfaceSetCapability
572 @discussion For the specified network interface, sets the requested
573 capabilities.
574 @param interface The desired network interface.
575 @param capability The desired capability.
576 @param newValue The new requested setting for the capability;
577 NULL to restore the default setting.
578 @result TRUE if the configuration was updated; FALSE if an error was encountered.
579 */
580 Boolean
581 SCNetworkInterfaceSetCapability (SCNetworkInterfaceRef interface,
582 CFStringRef capability,
583 CFTypeRef newValue) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(5.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
584
585 Boolean
586 __SCNetworkInterfaceSetDisableUntilNeededValue (SCNetworkInterfaceRef interface,
587 CFTypeRef disable) API_AVAILABLE(macos(10.11)) SPI_AVAILABLE(ios(9.0), tvos(9.0), watchos(2.0), bridgeos(2.0));
588
589
590 int
591 __SCNetworkInterfaceCreateCapabilities (SCNetworkInterfaceRef interface,
592 int capability_base,
593 CFDictionaryRef capability_options) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(5.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
594
595 int
596 __SCNetworkInterfaceCreateMediaOptions (SCNetworkInterfaceRef interface,
597 CFDictionaryRef media_options) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(5.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
598
599
600 #pragma mark -
601 #pragma mark SCBondInterface configuration (SPIs)
602
603 /*!
604 @function _SCBondInterfaceCopyActive
605 @discussion Returns all Ethernet Bond interfaces on the system.
606 @result The list of SCBondInterface interfaces on the system.
607 You must release the returned value.
608 */
609 CFArrayRef
610 _SCBondInterfaceCopyActive (void) API_AVAILABLE(macos(10.5)) API_UNAVAILABLE(ios, tvos, watchos, bridgeos);
611
612 /*!
613 @function _SCBondInterfaceUpdateConfiguration
614 @discussion Updates the bond interface configuration.
615 @param prefs The "preferences" session.
616 @result TRUE if the bond interface configuration was updated.; FALSE if the
617 an error was encountered.
618 */
619 Boolean
620 _SCBondInterfaceUpdateConfiguration (SCPreferencesRef prefs) API_AVAILABLE(macos(10.5)) API_UNAVAILABLE(ios, tvos, watchos, bridgeos);
621
622 /*!
623 @function SCBondInterfaceGetMode
624 @discussion Return the mode for the given bond interface.
625 @param bond The bond interface to get the mode from.
626 @result A CFNumberRef containing the mode (IF_BOND_MODE_{LACP,STATIC}).
627 */
628 CFNumberRef
629 SCBondInterfaceGetMode (SCBondInterfaceRef bond) API_AVAILABLE(macos(10.5)) API_UNAVAILABLE(ios, tvos, watchos, bridgeos);
630
631 /*!
632 @function SCBondInterfaceSetMode
633 @discussion Set the mode on the bond interface.
634 @param bond The bond interface on which to adjust the mode.
635 @param mode The mode value (0=IF_BOND_MODE_LACP,1=IF_BOND_MODE_STATIC)
636 @result TRUE if operation succeeded.
637 */
638 Boolean
639 SCBondInterfaceSetMode (SCBondInterfaceRef bond,
640 CFNumberRef mode) API_AVAILABLE(macos(10.5)) API_UNAVAILABLE(ios, tvos, watchos, bridgeos);
641
642 #pragma mark -
643 #pragma mark SCBridgeInterface configuration (SPIs)
644
645 /*!
646 @function SCBridgeInterfaceCopyAll
647 @discussion Returns all bridge interfaces on the system.
648 @param prefs The "preferences" session.
649 @result The list of bridge interfaces on the system.
650 You must release the returned value.
651 */
652 CFArrayRef /* of SCBridgeInterfaceRef's */
653 SCBridgeInterfaceCopyAll (SCPreferencesRef prefs) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
654
655 /*!
656 @function SCBridgeInterfaceCopyAvailableMemberInterfaces
657 @discussion Returns all network capable devices on the system
658 that can be added to an bridge interface.
659 @param prefs The "preferences" session.
660 @result The list of interfaces.
661 You must release the returned value.
662 */
663 CFArrayRef /* of SCNetworkInterfaceRef's */
664 SCBridgeInterfaceCopyAvailableMemberInterfaces (SCPreferencesRef prefs) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
665
666 /*!
667 @function SCBridgeInterfaceCreate
668 @discussion Create a new SCBridgeInterface interface.
669 @param prefs The "preferences" session.
670 @result A reference to the new SCBridgeInterface.
671 You must release the returned value.
672 */
673 SCBridgeInterfaceRef
674 SCBridgeInterfaceCreate (SCPreferencesRef prefs) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
675
676 /*!
677 @function SCBridgeInterfaceRemove
678 @discussion Removes the SCBridgeInterface from the configuration.
679 @param bridge The SCBridgeInterface interface.
680 @result TRUE if the interface was removed; FALSE if an error was encountered.
681 */
682 Boolean
683 SCBridgeInterfaceRemove (SCBridgeInterfaceRef bridge) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
684
685 /*!
686 @function SCBridgeInterfaceGetMemberInterfaces
687 @discussion Returns the member interfaces for the specified bridge interface.
688 @param bridge The SCBridgeInterface interface.
689 @result The list of interfaces.
690 */
691 CFArrayRef /* of SCNetworkInterfaceRef's */
692 SCBridgeInterfaceGetMemberInterfaces (SCBridgeInterfaceRef bridge) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
693
694 /*!
695 @function SCBridgeInterfaceGetOptions
696 @discussion Returns the configuration settings associated with a bridge interface.
697 @param bridge The SCBridgeInterface interface.
698 @result The configuration settings associated with the bridge interface;
699 NULL if no changes to the default configuration have been saved.
700 */
701 CFDictionaryRef
702 SCBridgeInterfaceGetOptions (SCBridgeInterfaceRef bridge) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
703
704 /*!
705 @function SCBridgeInterfaceSetMemberInterfaces
706 @discussion Sets the member interfaces for the specified bridge interface.
707 @param bridge The SCBridgeInterface interface.
708 @param members The desired member interfaces.
709 @result TRUE if the configuration was stored; FALSE if an error was encountered.
710 */
711 Boolean
712 SCBridgeInterfaceSetMemberInterfaces (SCBridgeInterfaceRef bridge,
713 CFArrayRef members) /* of SCNetworkInterfaceRef's */
714 API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
715
716 /*!
717 @function SCBridgeInterfaceSetLocalizedDisplayName
718 @discussion Sets the localized display name for the specified bridge interface.
719 @param bridge The SCBridgeInterface interface.
720 @param newName The new display name.
721 @result TRUE if the configuration was stored; FALSE if an error was encountered.
722 */
723 Boolean
724 SCBridgeInterfaceSetLocalizedDisplayName (SCBridgeInterfaceRef bridge,
725 CFStringRef newName) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
726
727 /*!
728 @function SCBridgeInterfaceSetOptions
729 @discussion Sets the configuration settings for the specified bridge interface.
730 @param bridge The SCBridgeInterface interface.
731 @param newOptions The new configuration settings.
732 @result TRUE if the configuration was stored; FALSE if an error was encountered.
733 */
734 Boolean
735 SCBridgeInterfaceSetOptions (SCBridgeInterfaceRef bridge,
736 CFDictionaryRef newOptions) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
737
738 #pragma mark -
739
740 /*!
741 @function _SCBridgeInterfaceCopyActive
742 @discussion Returns all bridge interfaces on the system.
743 @result The list of SCBridgeInterface interfaces on the system.
744 You must release the returned value.
745 */
746 CFArrayRef
747 _SCBridgeInterfaceCopyActive (void) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
748
749 /*!
750 @function _SCBridgeInterfaceUpdateConfiguration
751 @discussion Updates the bridge interface configuration.
752 @param prefs The "preferences" session.
753 @result TRUE if the bridge interface configuration was updated.; FALSE if the
754 an error was encountered.
755 */
756 Boolean
757 _SCBridgeInterfaceUpdateConfiguration (SCPreferencesRef prefs) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
758
759
760 #pragma mark -
761 #pragma mark SCVLANInterface configuration (SPIs)
762
763 /*!
764 @function _SCVLANInterfaceCopyActive
765 @discussion Returns all VLAN interfaces on the system.
766 @result The list of SCVLANInterface interfaces on the system.
767 You must release the returned value.
768 */
769 CFArrayRef
770 _SCVLANInterfaceCopyActive (void) API_AVAILABLE(macos(10.5)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
771
772 /*!
773 @function _SCVLANInterfaceUpdateConfiguration
774 @discussion Updates the VLAN interface configuration.
775 @param prefs The "preferences" session.
776 @result TRUE if the VLAN interface configuration was updated.; FALSE if the
777 an error was encountered.
778 */
779 Boolean
780 _SCVLANInterfaceUpdateConfiguration (SCPreferencesRef prefs) API_AVAILABLE(macos(10.5)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
781
782
783 #pragma mark -
784 #pragma mark SCNetworkInterface Password SPIs
785
786
787 enum {
788 kSCNetworkInterfacePasswordTypePPP = 1,
789 kSCNetworkInterfacePasswordTypeIPSecSharedSecret,
790 kSCNetworkInterfacePasswordTypeEAPOL,
791 kSCNetworkInterfacePasswordTypeIPSecXAuth,
792 kSCNetworkInterfacePasswordTypeVPN,
793 };
794 typedef uint32_t SCNetworkInterfacePasswordType;
795
796 Boolean
797 SCNetworkInterfaceCheckPassword (SCNetworkInterfaceRef interface,
798 SCNetworkInterfacePasswordType passwordType) API_AVAILABLE(macos(10.5), ios(2.0));
799
800 CFDataRef
801 SCNetworkInterfaceCopyPassword (SCNetworkInterfaceRef interface,
802 SCNetworkInterfacePasswordType passwordType) API_AVAILABLE(macos(10.5), ios(2.0));
803
804 Boolean
805 SCNetworkInterfaceRemovePassword (SCNetworkInterfaceRef interface,
806 SCNetworkInterfacePasswordType passwordType) API_AVAILABLE(macos(10.5), ios(2.0));
807
808 Boolean
809 SCNetworkInterfaceSetPassword (SCNetworkInterfaceRef interface,
810 SCNetworkInterfacePasswordType passwordType,
811 CFDataRef password,
812 CFDictionaryRef options) API_AVAILABLE(macos(10.5), ios(2.0));
813
814
815 Boolean
816 SCNetworkInterfaceGetDisableUntilNeeded (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.11), ios(9.0));
817
818 Boolean
819 SCNetworkInterfaceSetDisableUntilNeeded (SCNetworkInterfaceRef interface,
820 Boolean disable) API_AVAILABLE(macos(10.11), ios(9.0));
821
822
823 CFDictionaryRef
824 SCNetworkInterfaceGetQoSMarkingPolicy (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.13), ios(10.0));
825
826 Boolean
827 SCNetworkInterfaceSetQoSMarkingPolicy (SCNetworkInterfaceRef interface,
828 CFDictionaryRef policy) API_AVAILABLE(macos(10.13), ios(10.0));
829
830
831 #pragma mark -
832 #pragma mark SCNetworkProtocol configuration (SPI)
833
834
835 /*!
836 @group Protocol configuration
837 */
838
839
840 static __inline__ CFTypeRef
841 isA_SCNetworkProtocol(CFTypeRef obj)
842 {
843 return (isA_CFType(obj, SCNetworkProtocolGetTypeID()));
844 }
845
846 /*!
847 @function _SCNetworkProtocolCompare
848 @discussion Compares two SCNetworkProtocol objects.
849 @param val1 The SCNetworkProtocol object.
850 @param val2 The SCNetworkProtocol object.
851 @param context Not used.
852 @result A comparison result.
853 */
854 CFComparisonResult
855 _SCNetworkProtocolCompare (const void *val1,
856 const void *val2,
857 void *context) API_AVAILABLE(macos(10.13), ios(11.0));
858
859
860 #pragma mark -
861 #pragma mark SCNetworkService configuration (SPI)
862
863
864 /*!
865 @group Service configuration
866 */
867
868
869 static __inline__ CFTypeRef
870 isA_SCNetworkService(CFTypeRef obj)
871 {
872 return (isA_CFType(obj, SCNetworkServiceGetTypeID()));
873 }
874
875 /*!
876 @function _SCNetworkServiceCompare
877 @discussion Compares two SCNetworkService objects.
878 @param val1 The SCNetworkService object.
879 @param val2 The SCNetworkService object.
880 @param context The service order (from SCNetworkSetGetServiceOrder).
881 @result A comparison result.
882 */
883 CFComparisonResult
884 _SCNetworkServiceCompare (const void *val1,
885 const void *val2,
886 void *context) API_AVAILABLE(macos(10.7), ios(4.0));
887
888 /*!
889 @function _SCNetworkServiceCopyActive
890 @discussion Returns the network service with the specified identifier.
891
892 Note: The service returned by this SPI differs from the SCNetworkServiceCopy
893 API in that queries and operations interact with the "active" service
894 represented in the SCDynamicStore. Only a limited subset of the
895 SCNetworkService APIs are supported.
896 @param store The dynamic store session.
897 @param serviceID The unique identifier for the service.
898 @result A reference to the SCNetworkService represented in the SCDynamicStore;
899 NULL if the serviceID does not exist in the SCDynamicStore or if an
900 error was encountered.
901 You must release the returned value.
902 */
903 SCNetworkServiceRef
904 _SCNetworkServiceCopyActive (SCDynamicStoreRef store,
905 CFStringRef serviceID) API_AVAILABLE(macos(10.6), ios(2.1));
906
907 /*!
908 @function SCNetworkServiceGetPrimaryRank
909 @discussion Returns the primary service rank associated with a service.
910 @param service The network service.
911 @result The primary service rank associated with the specified application;
912 kSCNetworkServicePrimaryRankDefault if no rank is associated with the
913 application or an error was encountered.
914 */
915 SCNetworkServicePrimaryRank
916 SCNetworkServiceGetPrimaryRank (SCNetworkServiceRef service) API_AVAILABLE(macos(10.6), ios(2.0));
917
918 /*!
919 @function SCNetworkServiceSetPrimaryRank
920 @discussion Updates the the primary service rank associated with a service.
921 @param service The network service.
922 @param newRank The new primary service rank; kSCNetworkServicePrimaryRankDefault
923 if the default service rank should be used.
924 @result TRUE if the rank was stored; FALSE if an error was encountered.
925
926 Notes : The kSCNetworkServicePrimaryRankFirst and kSCNetworkServicePrimaryRankLast
927 values can only valid as a transient setting.
928 */
929 Boolean
930 SCNetworkServiceSetPrimaryRank (SCNetworkServiceRef service,
931 SCNetworkServicePrimaryRank newRank) API_AVAILABLE(macos(10.6), ios(2.0));
932
933 /*!
934 @function _SCNetworkServiceIsVPN
935 @discussion Identifies a VPN service.
936 @param service The network service.
937 @result TRUE if the service is a VPN.
938 */
939 Boolean
940 _SCNetworkServiceIsVPN (SCNetworkServiceRef service) API_AVAILABLE(macos(10.7), ios(4.0));
941
942 /*!
943 @function SCNetworkServiceSetExternalID
944 @discussion Set the external identifier for a network service.
945 @param service A reference to the network service.
946 @param identifierDomain A service can have multiple external identifiers. This string specifies which external identifier to set.
947 @param identifier The new external identifier to assign to the network service.
948 @result Returns TRUE if the external identifier was set successfully, FALSE if an error occurred.
949 */
950 Boolean
951 SCNetworkServiceSetExternalID (SCNetworkServiceRef service,
952 CFStringRef identifierDomain,
953 CFStringRef identifier);
954
955 /*!
956 @function SCNetworkServiceCopyExternalID
957 @discussion Copy the external identifier for a network service.
958 @param service The network service.
959 @param identifierDomain A service can have multiple external identifiers. This string specifies which external identifier to copy.
960 @result Returns the service's external identifier, or NULL if the service does not have an external identifier in the given domain.
961 */
962 CFStringRef
963 SCNetworkServiceCopyExternalID (SCNetworkServiceRef service,
964 CFStringRef identifierDomain);
965
966 /*!
967 @function _SCNetworkServiceSetServiceID
968 @discussion Sets serviceID of the service to a different value provided.
969 @param service The network service
970 @param newServiceID The new service ID
971 @result TRUE if new service ID is set successfully.
972 */
973 Boolean
974 _SCNetworkServiceSetServiceID (SCNetworkServiceRef service,
975 CFStringRef newServiceID) API_AVAILABLE(macos(10.10), ios(8.0));
976
977 #pragma mark -
978 #pragma mark SCNetworkSet configuration (SPI)
979
980
981 /*!
982 @group Set configuration
983 */
984
985
986 static __inline__ CFTypeRef
987 isA_SCNetworkSet(CFTypeRef obj)
988 {
989 return (isA_CFType(obj, SCNetworkSetGetTypeID()));
990 }
991
992
993 /*!
994 @function _SCNetworkSetCompare
995 @discussion Compares two SCNetworkSet objects.
996 @param val1 The SCNetworkSet object.
997 @param val2 The SCNetworkSet object.
998 @param context Not used.
999 @result A comparison result.
1000 */
1001 CFComparisonResult
1002 _SCNetworkSetCompare (const void *val1,
1003 const void *val2,
1004 void *context) API_AVAILABLE(macos(10.13), ios(11.0));
1005
1006 /*!
1007 @function SCNetworkSetCopyAvailableInterfaces
1008 @discussion Returns all available interfaces for the set.
1009 The interfaces excludes those of bond and bridge members.
1010 @param set The network set.
1011 @result The list of SCNetworkInterfaces.
1012 You must release the returned value.
1013 */
1014 CFArrayRef
1015 SCNetworkSetCopyAvailableInterfaces (SCNetworkSetRef set) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1016
1017 /*!
1018 @function _SCNetworkSetCreateDefault
1019 @discussion Create a new [default] set in the configuration.
1020 @param prefs The "preferences" session.
1021 @result A reference to the new SCNetworkSet.
1022 You must release the returned value.
1023 */
1024 SCNetworkSetRef
1025 _SCNetworkSetCreateDefault (SCPreferencesRef prefs) API_AVAILABLE(macos(10.12)) SPI_AVAILABLE(ios(10.0), tvos(10.0), watchos(3.0), bridgeos(3.0));
1026
1027 /*!
1028 @function SCNetworkSetEstablishDefaultConfiguration
1029 @discussion Updates a network set by adding services for
1030 any network interface that is not currently
1031 represented.
1032 If the provided set contains one (or more) services, new
1033 services will only be added for those interfaces that are
1034 not represented in *any* set.
1035 Otherwise, new services will be added for those interfaces
1036 that are not represented in the provided set.
1037 The new services are established with "default" configuration
1038 options.
1039 @param set The network set.
1040 @result TRUE if the configuration was updated; FALSE if no
1041 changes were required or if an error was encountered.
1042 */
1043 Boolean
1044 SCNetworkSetEstablishDefaultConfiguration (SCNetworkSetRef set) API_AVAILABLE(macos(10.5), ios(2.0));
1045
1046 /*!
1047 @function SCNetworkSetEstablishDefaultInterfaceConfiguration
1048 @discussion Updates a network set by adding services for
1049 the specified network interface if is not currently
1050 represented.
1051 If the provided set contains one (or more) services, new
1052 services will only be added for interfaces that are not
1053 represented in *any* set.
1054 Otherwise, new services will be added for interfaces that
1055 are not represented in the provided set.
1056 The new services are established with "default" configuration
1057 options.
1058 @param set The network set.
1059 @param interface The network interface.
1060 @result TRUE if the configuration was updated; FALSE if no
1061 changes were required or if an error was encountered.
1062 */
1063 Boolean
1064 SCNetworkSetEstablishDefaultInterfaceConfiguration (SCNetworkSetRef set,
1065 SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.5), ios(2.0));
1066
1067 /*!
1068 @function SCNetworkSetCopySelectedVPNService
1069 @discussion On the iPhone we only allow a single VPN network service
1070 to be selected at any given time. This API will identify
1071 the selected VPN service.
1072 @param set The network set.
1073 @result The selected VPN service; NULL if no service has been
1074 selected.
1075 You must release the returned value.
1076 */
1077 SCNetworkServiceRef
1078 SCNetworkSetCopySelectedVPNService (SCNetworkSetRef set) API_AVAILABLE(macos(10.7), ios(4.0));
1079
1080 /*!
1081 @function SCNetworkSetSetSelectedVPNService
1082 @discussion On the iPhone we only allow a single VPN network service
1083 to be selected at any given time. This API should be used to
1084 select a VPN service.
1085 @param set The network set.
1086 @param service The VPN service to be selected.
1087 @result TRUE if the name was saved; FALSE if an error was encountered.
1088 */
1089 Boolean
1090 SCNetworkSetSetSelectedVPNService (SCNetworkSetRef set,
1091 SCNetworkServiceRef service) API_AVAILABLE(macos(10.7), ios(4.0));
1092
1093 Boolean
1094 _SCNetworkSetSetSetID (SCNetworkSetRef set,
1095 CFStringRef setID) API_AVAILABLE(macos(10.10), ios(8.0));
1096
1097 /*!
1098 @group VPN Service configuration
1099 */
1100
1101 #pragma mark -
1102 #pragma mark VPN Service configuration
1103
1104 typedef SCNetworkServiceRef VPNServiceRef;
1105
1106 /*!
1107 @function VPNServiceCopyAllMatchingExternalID
1108 @discussion Copy the VPN services with the given external identifier.
1109 @param prefs A reference to the prefs where the VPN services are stored.
1110 @param identifierDomain A service can have multiple external identifiers. This string specifies which one to match with the given identifier.
1111 @param identifier The external identifier of the desired services.
1112 @result A array of references to the VPN services with the given identifier, or NULL if no such service exists
1113 */
1114 CFArrayRef
1115 VPNServiceCopyAllMatchingExternalID (SCPreferencesRef prefs,
1116 CFStringRef identifierDomain,
1117 CFStringRef identifier) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1118
1119 /*!
1120 @function VPNServiceCopyAll
1121 @discussion Copy all VPN services.
1122 @param prefs A reference to the prefs where the VPN services are stored.
1123 @result An array containing VPNServiceRefs for all the VPN services.
1124 */
1125 CFArrayRef
1126 VPNServiceCopyAll (SCPreferencesRef prefs) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1127
1128 /*!
1129 @function VPNServiceCopyAppRuleIDs
1130 @discussion Copy all the app rule identifiers for a VPN service.
1131 @param service A reference to the VPN service.
1132 @result An array of CFStringRefs, each string containing the identifier of a app rule in the given service.
1133 */
1134 CFArrayRef
1135 VPNServiceCopyAppRuleIDs (VPNServiceRef service) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1136
1137 /*!
1138 @function VPNServiceSetAppRule
1139 @discussion Add or modify an app rule in a VPN service. The ruleSettings dictionary must contain one of the following keys:
1140 <pre>kSCValNetVPNAppRuleExecutableMatch</pre>
1141 <pre>kSCValNetVPNAppRuleAccountIdentifierMatch</pre>
1142 The ruleSettings dictionary may also contain the following keys:
1143 <pre>kSCValNetVPNAppRuleDNSDomainMatch</pre>
1144 See SCSchemaDefinitionsPrivate.h for more details.
1145 @param service A reference to the VPN service.
1146 @param ruleIdentifier The identifier of the new app rule.
1147 @param ruleSettings The settings for the new app rule. See the dictionary keys defined above.
1148 @result TRUE if the app rule was set successfully, FALSE if an error occurred.
1149 */
1150 Boolean
1151 VPNServiceSetAppRule (VPNServiceRef service,
1152 CFStringRef ruleIdentifier,
1153 CFDictionaryRef ruleSettings) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1154
1155 /*!
1156 @function VPNServiceCopyAppRule
1157 @discussion Copy the settings for a app rule in a VPN service.
1158 @param service The app tunnel service.
1159 @param ruleIdentifier The ID of the app rule.
1160 @result The rule settings, or NULL if the app rule could not be found.
1161 */
1162 CFDictionaryRef
1163 VPNServiceCopyAppRule (VPNServiceRef service,
1164 CFStringRef ruleIdentifier) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1165
1166 /*!
1167 @function VPNServiceRemoveAppRule
1168 @discussion Remove an app rule from a VPN service.
1169 @param service The VPN service.
1170 @param ruleIdentifier The ID of the app rule to remove.
1171 @result Returns TRUE if the app rule was removed successfully; FALSE otherwise.
1172 */
1173 Boolean
1174 VPNServiceRemoveAppRule (VPNServiceRef service,
1175 CFStringRef ruleIdentifier) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1176
1177 /*!
1178 @function VPNServiceIsManagedAppVPN
1179 @discussion Check to see if a VPN service is a managed App VPN service
1180 @param service The VPN servie.
1181 @result Returns TRUE if the service is a managed App VPN service; FALSE otherwise.
1182 */
1183 Boolean
1184 VPNServiceIsManagedAppVPN (VPNServiceRef service) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1185
1186 /*!
1187 @group Migration SPI
1188 */
1189 #pragma mark -
1190 #pragma mark Migration SPI
1191
1192 extern const CFStringRef kSCNetworkConfigurationRepair /* CFBoolean */ API_AVAILABLE(macos(10.10), ios(8.0));
1193
1194 extern const CFStringRef kSCNetworkConfigurationMigrationActionKey /* CFNumber */ API_AVAILABLE(macos(10.10), ios(8.0));
1195
1196 typedef CF_ENUM(uint32_t, SCNetworkConfigurationMigrationAction) {
1197 kSCNetworkConfigurationMigrationAction_CleanInstall = 0,
1198 kSCNetworkConfigurationMigrationAction_Upgrade = 1,
1199 kSCNetworkConfigurationMigrationAction_Restore = 2,
1200 };
1201
1202 /*!
1203 @function _SCNetworkConfigurationCopyMigrationPaths
1204 @result Returns an array of paths that we would need from the source
1205 */
1206 CFArrayRef
1207 _SCNetworkConfigurationCopyMigrationPaths(CFDictionaryRef options) API_AVAILABLE(macos(10.10), ios(8.0));
1208
1209 /*!
1210 @function _SCNetworkConfigurationPerformMigration
1211 @discussion Updates the network configuration of the target system with
1212 configurations from previous system. Both sourceDir and targetDir
1213 cannot be NULL, since NULL indicates API to look at the local system
1214 @param sourceDir A reference which points to the root of a directory populated
1215 with the list of requested directories/path from the "source" volume. Passing NULL
1216 will indicate that sourceDir should point to local system
1217 @param currentDir A reference which points to the root of a directory populated
1218 with the list of requested directories/path from the "destination" volume. Passing
1219 NULL will indicate that currentDir should point to local system.
1220 @param targetDir A reference which points to the root of a directory that we
1221 will populate (update) with new configuration. Passing NULL will mean that we want to
1222 migrate to the currentDir. If not NULL, then this path should exist.
1223 @param options Argument which will tell us what action we are supposed to take
1224 (clean-install, upgrade, migrate/restore settings from another system, ...)
1225 @result Returns array which would consist of those paths that should be moved
1226 from the "targetDir" directory to destination volume. You must release the returned value.
1227 */
1228
1229 CF_RETURNS_RETAINED
1230 CFArrayRef
1231 _SCNetworkConfigurationPerformMigration (CFURLRef sourceDir,
1232 CFURLRef currentDir,
1233 CFURLRef targetDir,
1234 CFDictionaryRef options) API_AVAILABLE(macos(10.10), ios(8.0));
1235
1236
1237 /*!
1238 @function _SCNetworkConfigurationCheckValidity
1239 @discussion Verifies whether the configuration files present in the specified
1240 directory have valid mappings or not
1241 @param configDir A reference which points to the directory where the configuration
1242 files are present
1243 @result TRUE if valid configurations are found
1244
1245 */
1246
1247 Boolean
1248 _SCNetworkConfigurationCheckValidity (CFURLRef configDir,
1249 CFDictionaryRef options) API_AVAILABLE(macos(10.10), ios(8.0));
1250
1251
1252 /*!
1253 @function _SCNetworkConfigurationCheckValidityWithPreferences
1254 @discussion Validates the specified preferences.plist against NetworkInterfaces.plist
1255 @param prefs the preferences ref pointing to the said preferences.plist
1256 @param ni_prefs the preferences ref pointing to the said NetworkInterfaces.plist
1257 @result TRUE if the configurations are valid against each other
1258
1259 */
1260
1261 Boolean
1262 _SCNetworkConfigurationCheckValidityWithPreferences
1263 (SCPreferencesRef prefs,
1264 SCPreferencesRef ni_prefs,
1265 CFDictionaryRef options) API_AVAILABLE(macos(10.11), ios(9.0));
1266
1267
1268 /*!
1269 @function _SCNetworkMigrationAreConfigurationsIdentical
1270 @discussion Compares the migration output between network configurations
1271 with the expected output.
1272 @param configurationURL A URL pointing to the top-level directory of the
1273 configuration to compare. This directory is expected to have
1274 a Library/Preferences/SystemConfiguration subdirectoy.
1275 @param expectedConfigurationURL A URL pointing to the top-level directory of
1276 the expected configuration. This directory is expected to have
1277 a Library/Preferences/SystemConfiguration subdirectoy.
1278 @result TRUE if configurations match with the expected configurations
1279
1280 */
1281
1282 Boolean
1283 _SCNetworkMigrationAreConfigurationsIdentical (CFURLRef configurationURL,
1284 CFURLRef expectedConfigurationURL) API_AVAILABLE(macos(10.10), ios(8.0));
1285
1286 /*!
1287 @function _SCNetworkConfigurationCopyMigrationRemovePaths
1288 @discussion List of paths to files which we want to be removed from the target filesystem after migration
1289 @param targetPaths the CFArray returned by _SCNetworkConfigurationPerformMigration
1290 @param targetDir the CFURL passed to _SCNetworkConfigurationPerformMigration
1291 @result An array of CFURL's; NULL if no paths need to be removed from the target filesystem
1292
1293 */
1294
1295 CFArrayRef // of CFURLRef's
1296 _SCNetworkConfigurationCopyMigrationRemovePaths (CFArrayRef targetPaths,
1297 CFURLRef targetDir) API_AVAILABLE(macos(10.10), ios(8.0));
1298
1299 __END_DECLS
1300
1301 #endif /* _SCNETWORKCONFIGURATIONPRIVATE_H */