2 * Copyright (c) 2005-2020 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
24 #ifndef _SCNETWORKCONFIGURATIONPRIVATE_H
25 #define _SCNETWORKCONFIGURATIONPRIVATE_H
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>
36 @header SCNetworkConfigurationPrivate
43 @group Interface configuration
47 #pragma mark SCNetworkInterface configuration (typedefs, consts, enums)
50 @const kSCNetworkInterfaceTypeBridge
52 extern const CFStringRef kSCNetworkInterfaceTypeBridge
API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
56 @const kSCNetworkInterfaceTypeLoopback
58 extern const CFStringRef kSCNetworkInterfaceTypeLoopback
API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
61 @const kSCNetworkInterfaceLoopback
62 @discussion A network interface representing the loopback
65 extern const SCNetworkInterfaceRef kSCNetworkInterfaceLoopback
API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
68 @const kSCNetworkInterfaceTypeVPN
70 extern const CFStringRef kSCNetworkInterfaceTypeVPN
API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
73 @group Interface configuration (Bridge)
77 @typedef SCBridgeInterfaceRef
78 @discussion This is the type of a reference to an object that represents
81 typedef SCNetworkInterfaceRef SCBridgeInterfaceRef
;
83 typedef CF_ENUM(uint32_t, SCNetworkServicePrimaryRank
) {
84 kSCNetworkServicePrimaryRankDefault
= 0,
85 kSCNetworkServicePrimaryRankFirst
= 1,
86 kSCNetworkServicePrimaryRankLast
= 2,
87 kSCNetworkServicePrimaryRankNever
= 3,
88 kSCNetworkServicePrimaryRankScoped
= 4
92 #pragma mark SCNetworkConfiguration (SPI)
99 __SCNetworkConfigurationReport (int level
,
100 const char *description
,
101 SCPreferencesRef prefs
,
102 SCPreferencesRef ni_prefs
) SPI_AVAILABLE(macos(10.16), ios(14.0), tvos(14.0), watchos(7.0),bridgeos(5.0));
105 _SCNetworkConfigurationBypassSystemInterfaces (SCPreferencesRef prefs
) SPI_AVAILABLE(macos(10.15.4), ios(13.4), tvos(13.4), watchos(6.2), bridgeos(4.0));
108 _SCNetworkConfigurationSetBypassSystemInterfaces (SCPreferencesRef prefs
,
109 Boolean shouldBypass
) SPI_AVAILABLE(macos(10.15.4), ios(13.4), tvos(13.4), watchos(6.2), bridgeos(4.0));
112 __SCNetworkConfigurationClean (SCPreferencesRef prefs
,
113 SCPreferencesRef ni_prefs
) SPI_AVAILABLE(macos(10.15.4), ios(13.4), tvos(13.4), watchos(6.2), bridgeos(4.0));
116 __SCNetworkConfigurationSaveModel (SCPreferencesRef prefs
,
117 CFStringRef model
) SPI_AVAILABLE(macos(10.15.4), ios(13.4), tvos(13.4), watchos(6.2), bridgeos(4.0));
120 __SCNetworkConfigurationUpgrade (SCPreferencesRef
*prefs
,
121 SCPreferencesRef
*ni_prefs
,
122 Boolean commit
) SPI_AVAILABLE(macos(10.15.4), ios(13.4), tvos(13.4), watchos(6.2), bridgeos(4.0));
126 #pragma mark SCNetworkInterface configuration (SPI)
129 @group Interface configuration
132 static __inline__ CFTypeRef
133 isA_SCNetworkInterface(CFTypeRef obj
)
135 return (isA_CFType(obj
, SCNetworkInterfaceGetTypeID()));
138 static __inline__ CFTypeRef
139 isA_SCBondInterface(CFTypeRef obj
)
141 CFStringRef interfaceType
;
143 if (!isA_SCNetworkInterface(obj
)) {
144 // if not an SCNetworkInterface
148 interfaceType
= SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef
)obj
);
149 if (!CFEqual(interfaceType
, kSCNetworkInterfaceTypeBond
)) {
157 static __inline__ CFTypeRef
158 isA_SCBridgeInterface(CFTypeRef obj
)
160 CFStringRef interfaceType
;
162 if (!isA_SCNetworkInterface(obj
)) {
163 // if not an SCNetworkInterface
167 interfaceType
= SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef
)obj
);
168 if (!CFEqual(interfaceType
, kSCNetworkInterfaceTypeBridge
)) {
176 static __inline__ CFTypeRef
177 isA_SCVLANInterface(CFTypeRef obj
)
179 CFStringRef interfaceType
;
181 if (!isA_SCNetworkInterface(obj
)) {
182 // if not an SCNetworkInterface
186 interfaceType
= SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef
)obj
);
187 if (!CFEqual(interfaceType
, kSCNetworkInterfaceTypeVLAN
)) {
196 @function _SCNetworkInterfaceCompare
197 @discussion Compares two SCNetworkInterface objects.
198 @param val1 The SCNetworkInterface object.
199 @param val2 The SCNetworkInterface object.
200 @param context Not used.
201 @result A comparison result.
204 _SCNetworkInterfaceCompare (const void *val1
,
206 void *context
) API_AVAILABLE(macos(10.5), ios(2.0));
209 @function _SCNetworkInterfaceCopyActive
210 @discussion Creates an SCNetworkInterface and associated with interface name
211 and SCDynamicStoreRef
212 @param store The SCDynamicStoreRef
213 @param bsdName The interface name
214 @result the SCNetworkInterface
216 SCNetworkInterfaceRef
217 _SCNetworkInterfaceCopyActive (SCDynamicStoreRef store
,
218 CFStringRef bsdName
) API_AVAILABLE(macos(10.8), ios(5.0));
221 @function _SCNetworkInterfaceCopyAllWithPreferences
222 Returns all network capable interfaces on the system.
223 @param prefs The "preferences" session.
224 @result The list of interfaces on the system.
225 You must release the returned value.
227 CFArrayRef
/* of SCNetworkInterfaceRef's */
228 _SCNetworkInterfaceCopyAllWithPreferences (SCPreferencesRef prefs
) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(5.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
231 @function _SCNetworkInterfaceCopyBTPANInterface
232 @discussion Returns the SCNetworkInterface associated with the BT-PAN interface
233 @result The BT-PAN interface; NULL if the interface is not (yet) known.
235 SCNetworkInterfaceRef
236 _SCNetworkInterfaceCopyBTPANInterface (void) API_AVAILABLE(macos(10.9)) API_UNAVAILABLE(ios
, tvos
, watchos
, bridgeos
);
239 @function _SCNetworkInterfaceCopySlashDevPath
240 @discussion Returns the /dev pathname for the interface.
241 @param interface The network interface.
242 @result The /dev pathname associated with the interface (e.g. "/dev/modem");
243 NULL if no path is available.
246 _SCNetworkInterfaceCopySlashDevPath (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.6), ios(3.0));
249 _SCNetworkServiceCreatePreconfigured (SCPreferencesRef prefs
,
250 SCNetworkInterfaceRef interface
) SPI_AVAILABLE(macos(10.15.4), ios(13.4), tvos(13.4), watchos(6.2), bridgeos(4.0));
252 #define kIncludeNoVirtualInterfaces 0x0
253 #define kIncludeVLANInterfaces 0x1
254 #define kIncludeBondInterfaces 0x2
255 #define kIncludeBridgeInterfaces 0x4
256 #define kIncludeAllVirtualInterfaces 0xffffffff
259 @function _SCNetworkInterfaceCreateWithBSDName
260 @discussion Create a new network interface associated with the provided
261 BSD interface name. This API supports Ethernet, FireWire, and
262 IEEE 802.11 interfaces.
263 @param bsdName The BSD interface name.
264 @param flags Indicates whether virtual (Bond, Bridge, VLAN)
265 network interfaces should be included.
266 @result A reference to the new SCNetworkInterface.
267 You must release the returned value.
269 SCNetworkInterfaceRef
270 _SCNetworkInterfaceCreateWithBSDName (CFAllocatorRef allocator
,
272 UInt32 flags
) API_AVAILABLE(macos(10.5), ios(2.0));
275 @function _SCNetworkInterfaceCreateWithEntity
276 @discussion Create a new network interface associated with the provided
277 SCDynamicStore service entity dictionary.
278 @param interface_entity The entity dictionary.
279 @param service The network service.
280 @result A reference to the new SCNetworkInterface.
281 You must release the returned value.
283 SCNetworkInterfaceRef
284 _SCNetworkInterfaceCreateWithEntity (CFAllocatorRef allocator
,
285 CFDictionaryRef interface_entity
,
286 SCNetworkServiceRef service
) API_AVAILABLE(macos(10.5), ios(2.0));
289 @function _SCNetworkInterfaceCreateWithIONetworkInterfaceObject
290 @discussion Create a new network interface associated with the provided
291 IORegistry "IONetworkInterface" object.
292 @param if_obj The IONetworkInterface object.
293 @result A reference to the new SCNetworkInterface.
294 You must release the returned value.
296 SCNetworkInterfaceRef
297 _SCNetworkInterfaceCreateWithIONetworkInterfaceObject (io_object_t if_obj
) API_AVAILABLE(macos(10.5), ios(2.0));
300 @function SCNetworkInterfaceGetPrimaryRank
301 @discussion We allow caller to retrieve the rank on an interface.
302 @param interface The interface to get the rank
303 @result SCNetworkServicePrimaryRank
305 SCNetworkServicePrimaryRank
306 SCNetworkInterfaceGetPrimaryRank (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.8), ios(5.0));
309 @function SCNetworkInterfaceSetPrimaryRank
310 @discussion We allow caller to set an assertion on an interface.
311 The rank assertion lives as long as the SCNetworkInterfaceRef
313 @param interface The interface to set the rank assertion
314 @param newRank The new rank to be set
315 @result TRUE if operation is successful; FALSE if an error was encountered.
318 SCNetworkInterfaceSetPrimaryRank (SCNetworkInterfaceRef interface
,
319 SCNetworkServicePrimaryRank newRank
) API_AVAILABLE(macos(10.8), ios(5.0));
322 ** SCNetworkInterfaceAdvisory
325 typedef CF_ENUM(uint32_t, SCNetworkInterfaceAdvisory
) {
326 kSCNetworkInterfaceAdvisoryNone
= 0,
327 kSCNetworkInterfaceAdvisoryLinkLayerIssue
= 1,
328 kSCNetworkInterfaceAdvisoryUplinkIssue
= 2,
332 @function SCNetworkInterfaceSetAdvisory
333 @discussion Advise the system of some condition on the network interface
334 that warrants changing how the interface is used for IP networking,
335 and to clear a previously set advisory.
336 Calling this function requires root or having the boolean entitlement
337 "com.apple.SystemConfiguration.SCNetworkInterfaceSetAdvisory" = true.
338 @param interface The interface to assert the advisory on.
339 @param advisory The advisory to indicate on the interface, use
340 kSCNetworkInterfaceAdvisoryNone to clear advisory.
341 @param reason A string indicating the reason for setting the advisory,
342 used to aid debugging.
343 @result TRUE if the advisory change was successful; FALSE otherwise.
346 SCNetworkInterfaceSetAdvisory(SCNetworkInterfaceRef interface
,
347 SCNetworkInterfaceAdvisory advisory
,
349 API_AVAILABLE(macos(10.14), ios(12.0));
352 @function SCNetworkInterfaceAdvisoryIsSet
353 @discussion Find out if there is an advisory set on the interface.
354 @param interface The interface to check for an advisory.
355 @result TRUE if an advisory is set; FALSE otherwise.
358 SCNetworkInterfaceAdvisoryIsSet(SCNetworkInterfaceRef interface
)
359 API_AVAILABLE(macos(10.14), ios(12.0));
362 @function SCNetworkInterfaceCopyAdvisoryNotificationKey
363 @discussion Get the SCDynamicStore notication key for advisory changes
364 made on the interface.
365 @param interface The interface for which to get the notification key.
366 @result Key used to receive advisory change notifications on the
370 SCNetworkInterfaceCopyAdvisoryNotificationKey(SCNetworkInterfaceRef interface
)
371 API_AVAILABLE(macos(10.14), ios(12.0));
374 #define kSCNetworkInterfaceConfigurationActionKey CFSTR("New Interface Detected Action")
375 #define kSCNetworkInterfaceConfigurationActionValueNone CFSTR("None")
376 #define kSCNetworkInterfaceConfigurationActionValuePrompt CFSTR("Prompt")
377 #define kSCNetworkInterfaceConfigurationActionValueConfigure CFSTR("Configure")
379 #define kSCNetworkInterfaceNetworkConfigurationOverridesKey CFSTR("NetworkConfigurationOverrides")
380 #define kSCNetworkInterfaceHiddenConfigurationKey CFSTR("HiddenConfiguration")
381 #define kSCNetworkInterfaceHiddenPortKey CFSTR("HiddenPort") /* for serial ports */
382 #define kSCNetworkInterfaceHiddenInterfaceKey CFSTR("HiddenInterface") /* for network interfaces */
384 // IORegistry property to indicate that a [WWAN] interface is not yet ready
385 #define kSCNetworkInterfaceInitializingKey CFSTR("Initializing")
387 // IORegistry property to indicate that the attached host should be trusted before use
388 #define kSCNetworkInterfaceTrustRequiredKey CFSTR("TrustRequired")
391 @function _SCNetworkInterfaceCopyInterfaceInfo
392 @discussion Returns interface details
393 @param interface The network interface.
394 @result A dictionary with details about the network interface.
397 _SCNetworkInterfaceCopyInterfaceInfo (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.6), ios(3.0));
400 @function _SCNetworkInterfaceGetConfigurationAction
401 @discussion Returns a user-notification / auto-configuration action for the interface.
402 @param interface The network interface.
403 @result The user-notification / auto-configuration action;
404 NULL if the default action should be used.
407 _SCNetworkInterfaceGetConfigurationAction (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.6), ios(2.0));
410 @function _SCNetworkInterfaceGetFamilyType
411 @discussion Returns the family type for the interface.
412 @param interface The network interface.
413 @result The family type (ift_family) associated with the interface;
414 NULL if no family type is available.
417 _SCNetworkInterfaceGetFamilyType (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.12), ios(10.0));
420 @function _SCNetworkInterfaceGetFamilySubType
421 @discussion Returns the family subtype for the interface.
422 @param interface The network interface.
423 @result The family subtype (ift_subfamily) associated with the interface;
424 NULL if no family subtype is available.
427 _SCNetworkInterfaceGetFamilySubType (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.12), ios(10.0));
430 @function _SCNetworkInterfaceGetHardwareAddress
431 @discussion Returns a link layer address for the interface.
432 @param interface The network interface.
433 @result The hardware (MAC) address for the interface.
434 NULL if no hardware address is available.
437 _SCNetworkInterfaceGetHardwareAddress (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.5), ios(2.0));
440 @function _SCNetworkInterfaceGetIOInterfaceNamePrefix
441 @discussion Returns the IOInterfaceNamePrefix for the interface.
442 @param interface The network interface.
443 @result The IOInterfaceNamePrefix associated with the interface;
444 NULL if no IOInterfaceNamePrefix is available.
447 _SCNetworkInterfaceGetIOInterfaceNamePrefix (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.8), ios(6.0));
450 @function _SCNetworkInterfaceGetIOInterfaceType
451 @discussion Returns the IOInterfaceType for the interface.
452 @param interface The network interface.
453 @result The IOInterfaceType associated with the interface
456 _SCNetworkInterfaceGetIOInterfaceType (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.5), ios(2.0));
459 @function _SCNetworkInterfaceGetIOInterfaceUnit
460 @discussion Returns the IOInterfaceUnit for the interface.
461 @param interface The network interface.
462 @result The IOInterfaceUnit associated with the interface;
463 NULL if no IOInterfaceUnit is available.
466 _SCNetworkInterfaceGetIOInterfaceUnit (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.5), ios(2.0));
469 @function _SCNetworkInterfaceGetIOPath
470 @discussion Returns the IOPath for the interface.
471 @param interface The network interface.
472 @result The IOPath associated with the interface;
473 NULL if no IOPath is available.
476 _SCNetworkInterfaceGetIOPath (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.5), ios(2.0));
479 @function _SCNetworkInterfaceGetIORegistryEntryID
480 @discussion Returns the IORegistry entry ID for the interface.
481 @param interface The network interface.
482 @result The IORegistry entry ID associated with the interface;
483 Zero if no entry ID is available.
486 _SCNetworkInterfaceGetIORegistryEntryID (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.8), ios(5.0));
489 @function _SCNetworkInterfaceIsApplePreconfigured
490 @discussion Identifies if a network interface is internal/pre-configured.
491 @param interface The network interface.
492 @result TRUE if the interface is an internal/pre-configured.
495 _SCNetworkInterfaceIsApplePreconfigured (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.12), ios(10.0));
498 @function _SCNetworkInterfaceIsBluetoothPAN
499 @discussion Identifies if a network interface is a Bluetooth PAN (GN) device.
500 @param interface The network interface.
501 @result TRUE if the interface is a Bluetooth PAN device.
504 _SCNetworkInterfaceIsBluetoothPAN (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.6), ios(3.0));
507 @function _SCNetworkInterfaceIsBluetoothPAN_NAP
508 @discussion Identifies if a network interface is a Bluetooth PAN-NAP device.
509 @param interface The network interface.
510 @result TRUE if the interface is a Bluetooth PAN-NAP device.
513 _SCNetworkInterfaceIsBluetoothPAN_NAP (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.7), ios(5.0));
516 @function _SCNetworkInterfaceIsBluetoothP2P
517 @discussion Identifies if a network interface is a Bluetooth P2P (PAN-U) device.
518 @param interface The network interface.
519 @result TRUE if the interface is a Bluetooth P2P device.
522 _SCNetworkInterfaceIsBluetoothP2P (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.7), ios(5.0));
525 @function _SCNetworkInterfaceIsBuiltin
526 @discussion Identifies if a network interface is "built-in".
527 @param interface The network interface.
528 @result TRUE if the interface is "built-in".
531 _SCNetworkInterfaceIsBuiltin (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.5), ios(2.0));
534 @function _SCNetworkInterfaceIsCarPlay
535 @discussion Identifies if a network interface is a CarPlay device.
536 @param interface The network interface.
537 @result TRUE if the interface is a CarPlay device.
540 _SCNetworkInterfaceIsCarPlay (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.15), ios(13.0));
543 @function _SCNetworkInterfaceIsHiddenConfiguration
544 @discussion Identifies if the configuration of a network interface should be
545 hidden from any user interface (e.g. the "Network" pref pane).
546 @param interface The network interface.
547 @result TRUE if the interface configuration should be hidden.
550 _SCNetworkInterfaceIsHiddenConfiguration (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.7), ios(4.0));
553 @function _SCNetworkInterfaceIsHiddenInterface
554 @discussion Identifies if this is a [fully] hidden network interface.
555 @param interface The network interface.
556 @result TRUE if this is a hidden interface.
559 _SCNetworkInterfaceIsHiddenInterface (SCNetworkInterfaceRef interface
) SPI_AVAILABLE(macos(10.16), ios(14.0), tvos(14.0), watchos(7.0));
563 @function _SCNetworkInterfaceIsQoSMarkingProfileInstalled
564 @discussion Identifies if a network interface has a QoSMarking profile installed
565 @param interface The network interface.
566 @result TRUE if the interface is a tethered device.
569 _SCNetworkInterfaceIsQoSMarkingProfileInstalled (SCNetworkInterfaceRef interface
) SPI_AVAILABLE(macos(10.16), ios(14.0), tvos(14.0), watchos(7.0));
572 @function _SCNetworkInterfaceIsTethered
573 @discussion Identifies if a network interface is an Apple tethered device (e.g. an iPhone).
574 @param interface The network interface.
575 @result TRUE if the interface is a tethered device.
578 _SCNetworkInterfaceIsTethered (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.6), ios(3.0));
581 @function _SCNetworkInterfaceIsThunderbolt
582 @discussion Identifies if a network interface is a Thunderbolt device
583 @param interface The network interface.
584 @result TRUE if the interface is a Thunderbolt device.
587 _SCNetworkInterfaceIsThunderbolt (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.9), ios(7.0));
590 @function _SCNetworkInterfaceIsTrustRequired
591 @discussion Identifies if a network interface requires that the
592 associated host be trusted.
593 @param interface The network interface.
594 @result TRUE if the interface requires trust.
597 _SCNetworkInterfaceIsTrustRequired (SCNetworkInterfaceRef interface
) SPI_AVAILABLE(macos(10.14)) API_AVAILABLE(ios(12.0));
600 @function _SCNetworkInterfaceIsPhysicalEthernet
601 @discussion Indicates whether a network interface is a real ethernet interface i.e. one with an ethernet PHY.
602 @param interface The network interface.
603 @result TRUE if the interface is a real ethernet interface.
606 _SCNetworkInterfaceIsPhysicalEthernet (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.7), ios(5.0));
609 @function _SCNetworkInterfaceForceConfigurationRefresh
610 @discussion Forces a configuration refresh of the
612 @param ifName Network interface name.
613 @result TRUE if the refresh was successfully posted.
616 _SCNetworkInterfaceForceConfigurationRefresh (CFStringRef ifName
) API_AVAILABLE(macos(10.5), ios(2.0));
619 @function SCNetworkInterfaceCopyCapability
620 @discussion For the specified network interface, returns information
621 about the currently requested capabilities, the active capabilities,
622 and the capabilities which are available.
623 @param interface The desired network interface.
624 @param capability The desired capability;
625 NULL to return a CFDictionary of all capabilities.
626 @result a CFTypeRef representing the current value of requested
628 NULL if the capability is not available for this
629 interface or if an error was encountered.
630 You must release the returned value.
633 SCNetworkInterfaceCopyCapability (SCNetworkInterfaceRef interface
,
634 CFStringRef capability
) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(5.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
637 @function SCNetworkInterfaceSetCapability
638 @discussion For the specified network interface, sets the requested
640 @param interface The desired network interface.
641 @param capability The desired capability.
642 @param newValue The new requested setting for the capability;
643 NULL to restore the default setting.
644 @result TRUE if the configuration was updated; FALSE if an error was encountered.
647 SCNetworkInterfaceSetCapability (SCNetworkInterfaceRef interface
,
648 CFStringRef capability
,
649 CFTypeRef newValue
) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(5.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
652 __SCNetworkInterfaceSetDisableUntilNeededValue (SCNetworkInterfaceRef interface
,
653 CFTypeRef disable
) API_AVAILABLE(macos(10.11)) SPI_AVAILABLE(ios(9.0), tvos(9.0), watchos(2.0), bridgeos(2.0));
657 __SCNetworkInterfaceCreateCapabilities (SCNetworkInterfaceRef interface
,
659 CFDictionaryRef capability_options
) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(5.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
662 __SCNetworkInterfaceCreateMediaOptions (SCNetworkInterfaceRef interface
,
663 CFDictionaryRef media_options
) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(5.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
667 #pragma mark SCBondInterface configuration (SPIs)
670 @function _SCBondInterfaceCopyActive
671 @discussion Returns all Ethernet Bond interfaces on the system.
672 @result The list of SCBondInterface interfaces on the system.
673 You must release the returned value.
676 _SCBondInterfaceCopyActive (void) API_AVAILABLE(macos(10.5)) API_UNAVAILABLE(ios
, tvos
, watchos
, bridgeos
);
679 @function _SCBondInterfaceUpdateConfiguration
680 @discussion Updates the bond interface configuration.
681 @param prefs The "preferences" session.
682 @result TRUE if the bond interface configuration was updated.; FALSE if the
683 an error was encountered.
686 _SCBondInterfaceUpdateConfiguration (SCPreferencesRef prefs
) API_AVAILABLE(macos(10.5)) API_UNAVAILABLE(ios
, tvos
, watchos
, bridgeos
);
689 @function SCBondInterfaceGetMode
690 @discussion Return the mode for the given bond interface.
691 @param bond The bond interface to get the mode from.
692 @result A CFNumberRef containing the mode (IF_BOND_MODE_{LACP,STATIC}).
695 SCBondInterfaceGetMode (SCBondInterfaceRef bond
) API_AVAILABLE(macos(10.5)) API_UNAVAILABLE(ios
, tvos
, watchos
, bridgeos
);
698 @function SCBondInterfaceSetMode
699 @discussion Set the mode on the bond interface.
700 @param bond The bond interface on which to adjust the mode.
701 @param mode The mode value (0=IF_BOND_MODE_LACP,1=IF_BOND_MODE_STATIC)
702 @result TRUE if operation succeeded.
705 SCBondInterfaceSetMode (SCBondInterfaceRef bond
,
706 CFNumberRef mode
) API_AVAILABLE(macos(10.5)) API_UNAVAILABLE(ios
, tvos
, watchos
, bridgeos
);
709 #pragma mark SCBridgeInterface configuration (SPIs)
712 @function SCBridgeInterfaceCopyAll
713 @discussion Returns all bridge interfaces on the system.
714 @param prefs The "preferences" session.
715 @result The list of bridge interfaces on the system.
716 You must release the returned value.
718 CFArrayRef
/* of SCBridgeInterfaceRef's */
719 SCBridgeInterfaceCopyAll (SCPreferencesRef prefs
) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
722 @function SCBridgeInterfaceCopyAvailableMemberInterfaces
723 @discussion Returns all network capable devices on the system
724 that can be added to an bridge interface.
725 @param prefs The "preferences" session.
726 @result The list of interfaces.
727 You must release the returned value.
729 CFArrayRef
/* of SCNetworkInterfaceRef's */
730 SCBridgeInterfaceCopyAvailableMemberInterfaces (SCPreferencesRef prefs
) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
733 @function SCBridgeInterfaceCreate
734 @discussion Create a new SCBridgeInterface interface.
735 @param prefs The "preferences" session.
736 @result A reference to the new SCBridgeInterface.
737 You must release the returned value.
740 SCBridgeInterfaceCreate (SCPreferencesRef prefs
) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
743 @function SCBridgeInterfaceRemove
744 @discussion Removes the SCBridgeInterface from the configuration.
745 @param bridge The SCBridgeInterface interface.
746 @result TRUE if the interface was removed; FALSE if an error was encountered.
749 SCBridgeInterfaceRemove (SCBridgeInterfaceRef bridge
) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
752 @function SCBridgeInterfaceGetMemberInterfaces
753 @discussion Returns the member interfaces for the specified bridge interface.
754 @param bridge The SCBridgeInterface interface.
755 @result The list of interfaces.
757 CFArrayRef
/* of SCNetworkInterfaceRef's */
758 SCBridgeInterfaceGetMemberInterfaces (SCBridgeInterfaceRef bridge
) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
761 @function SCBridgeInterfaceGetOptions
762 @discussion Returns the configuration settings associated with a bridge interface.
763 @param bridge The SCBridgeInterface interface.
764 @result The configuration settings associated with the bridge interface;
765 NULL if no changes to the default configuration have been saved.
768 SCBridgeInterfaceGetOptions (SCBridgeInterfaceRef bridge
) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
771 @function SCBridgeInterfaceSetMemberInterfaces
772 @discussion Sets the member interfaces for the specified bridge interface.
773 @param bridge The SCBridgeInterface interface.
774 @param members The desired member interfaces.
775 @result TRUE if the configuration was stored; FALSE if an error was encountered.
778 SCBridgeInterfaceSetMemberInterfaces (SCBridgeInterfaceRef bridge
,
779 CFArrayRef members
) /* of SCNetworkInterfaceRef's */
780 API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
783 @function SCBridgeInterfaceSetLocalizedDisplayName
784 @discussion Sets the localized display name for the specified bridge interface.
785 @param bridge The SCBridgeInterface interface.
786 @param newName The new display name.
787 @result TRUE if the configuration was stored; FALSE if an error was encountered.
790 SCBridgeInterfaceSetLocalizedDisplayName (SCBridgeInterfaceRef bridge
,
791 CFStringRef newName
) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
794 @function SCBridgeInterfaceSetOptions
795 @discussion Sets the configuration settings for the specified bridge interface.
796 @param bridge The SCBridgeInterface interface.
797 @param newOptions The new configuration settings.
798 @result TRUE if the configuration was stored; FALSE if an error was encountered.
801 SCBridgeInterfaceSetOptions (SCBridgeInterfaceRef bridge
,
802 CFDictionaryRef newOptions
) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
807 @function _SCBridgeInterfaceCopyActive
808 @discussion Returns all bridge interfaces on the system.
809 @result The list of SCBridgeInterface interfaces on the system.
810 You must release the returned value.
813 _SCBridgeInterfaceCopyActive (void) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
816 @function _SCBridgeInterfaceUpdateConfiguration
817 @discussion Updates the bridge interface configuration.
818 @param prefs The "preferences" session.
819 @result TRUE if the bridge interface configuration was updated.; FALSE if the
820 an error was encountered.
823 _SCBridgeInterfaceUpdateConfiguration (SCPreferencesRef prefs
) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
827 #pragma mark SCVLANInterface configuration (SPIs)
830 @function _SCVLANInterfaceCopyActive
831 @discussion Returns all VLAN interfaces on the system.
832 @result The list of SCVLANInterface interfaces on the system.
833 You must release the returned value.
836 _SCVLANInterfaceCopyActive (void) API_AVAILABLE(macos(10.5)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
839 @function _SCVLANInterfaceUpdateConfiguration
840 @discussion Updates the VLAN interface configuration.
841 @param prefs The "preferences" session.
842 @result TRUE if the VLAN interface configuration was updated.; FALSE if the
843 an error was encountered.
846 _SCVLANInterfaceUpdateConfiguration (SCPreferencesRef prefs
) API_AVAILABLE(macos(10.5)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
850 #pragma mark SCNetworkInterface Password SPIs
854 kSCNetworkInterfacePasswordTypePPP
= 1,
855 kSCNetworkInterfacePasswordTypeIPSecSharedSecret
,
856 kSCNetworkInterfacePasswordTypeEAPOL
,
857 kSCNetworkInterfacePasswordTypeIPSecXAuth
,
858 kSCNetworkInterfacePasswordTypeVPN
,
860 typedef uint32_t SCNetworkInterfacePasswordType
;
863 SCNetworkInterfaceCheckPassword (SCNetworkInterfaceRef interface
,
864 SCNetworkInterfacePasswordType passwordType
) API_AVAILABLE(macos(10.5), ios(2.0));
867 SCNetworkInterfaceCopyPassword (SCNetworkInterfaceRef interface
,
868 SCNetworkInterfacePasswordType passwordType
) API_AVAILABLE(macos(10.5), ios(2.0));
871 SCNetworkInterfaceRemovePassword (SCNetworkInterfaceRef interface
,
872 SCNetworkInterfacePasswordType passwordType
) API_AVAILABLE(macos(10.5), ios(2.0));
875 SCNetworkInterfaceSetPassword (SCNetworkInterfaceRef interface
,
876 SCNetworkInterfacePasswordType passwordType
,
878 CFDictionaryRef options
) API_AVAILABLE(macos(10.5), ios(2.0));
882 SCNetworkInterfaceGetDisableUntilNeeded (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.11), ios(9.0));
885 SCNetworkInterfaceSetDisableUntilNeeded (SCNetworkInterfaceRef interface
,
886 Boolean disable
) API_AVAILABLE(macos(10.11), ios(9.0));
890 SCNetworkInterfaceGetQoSMarkingPolicy (SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.13), ios(10.0));
893 SCNetworkInterfaceSetQoSMarkingPolicy (SCNetworkInterfaceRef interface
,
894 CFDictionaryRef policy
) API_AVAILABLE(macos(10.13), ios(10.0));
898 #pragma mark SCNetworkProtocol configuration (SPI)
902 @group Protocol configuration
906 static __inline__ CFTypeRef
907 isA_SCNetworkProtocol(CFTypeRef obj
)
909 return (isA_CFType(obj
, SCNetworkProtocolGetTypeID()));
913 @function _SCNetworkProtocolCompare
914 @discussion Compares two SCNetworkProtocol objects.
915 @param val1 The SCNetworkProtocol object.
916 @param val2 The SCNetworkProtocol object.
917 @param context Not used.
918 @result A comparison result.
921 _SCNetworkProtocolCompare (const void *val1
,
923 void *context
) API_AVAILABLE(macos(10.13), ios(11.0));
927 #pragma mark SCNetworkService configuration (SPI)
931 @group Service configuration
935 static __inline__ CFTypeRef
936 isA_SCNetworkService(CFTypeRef obj
)
938 return (isA_CFType(obj
, SCNetworkServiceGetTypeID()));
942 @function _SCNetworkServiceCompare
943 @discussion Compares two SCNetworkService objects.
944 @param val1 The SCNetworkService object.
945 @param val2 The SCNetworkService object.
946 @param context The service order (from SCNetworkSetGetServiceOrder).
947 @result A comparison result.
950 _SCNetworkServiceCompare (const void *val1
,
952 void *context
) API_AVAILABLE(macos(10.7), ios(4.0));
955 @function _SCNetworkServiceCopyActive
956 @discussion Returns the network service with the specified identifier.
958 Note: The service returned by this SPI differs from the SCNetworkServiceCopy
959 API in that queries and operations interact with the "active" service
960 represented in the SCDynamicStore. Only a limited subset of the
961 SCNetworkService APIs are supported.
962 @param store The dynamic store session.
963 @param serviceID The unique identifier for the service.
964 @result A reference to the SCNetworkService represented in the SCDynamicStore;
965 NULL if the serviceID does not exist in the SCDynamicStore or if an
966 error was encountered.
967 You must release the returned value.
970 _SCNetworkServiceCopyActive (SCDynamicStoreRef store
,
971 CFStringRef serviceID
) API_AVAILABLE(macos(10.6), ios(2.1));
974 @function SCNetworkServiceGetPrimaryRank
975 @discussion Returns the primary service rank associated with a service.
976 @param service The network service.
977 @result The primary service rank associated with the specified application;
978 kSCNetworkServicePrimaryRankDefault if no rank is associated with the
979 application or an error was encountered.
981 SCNetworkServicePrimaryRank
982 SCNetworkServiceGetPrimaryRank (SCNetworkServiceRef service
) API_AVAILABLE(macos(10.6), ios(2.0));
985 @function SCNetworkServiceSetPrimaryRank
986 @discussion Updates the the primary service rank associated with a service.
987 @param service The network service.
988 @param newRank The new primary service rank; kSCNetworkServicePrimaryRankDefault
989 if the default service rank should be used.
990 @result TRUE if the rank was stored; FALSE if an error was encountered.
992 Notes : The kSCNetworkServicePrimaryRankFirst and kSCNetworkServicePrimaryRankLast
993 values can only valid as a transient setting.
996 SCNetworkServiceSetPrimaryRank (SCNetworkServiceRef service
,
997 SCNetworkServicePrimaryRank newRank
) API_AVAILABLE(macos(10.6), ios(2.0));
1000 @function _SCNetworkServiceIsVPN
1001 @discussion Identifies a VPN service.
1002 @param service The network service.
1003 @result TRUE if the service is a VPN.
1006 _SCNetworkServiceIsVPN (SCNetworkServiceRef service
) API_AVAILABLE(macos(10.7), ios(4.0));
1009 @function SCNetworkServiceSetExternalID
1010 @discussion Set the external identifier for a network service.
1011 @param service A reference to the network service.
1012 @param identifierDomain A service can have multiple external identifiers. This string specifies which external identifier to set.
1013 @param identifier The new external identifier to assign to the network service.
1014 @result Returns TRUE if the external identifier was set successfully, FALSE if an error occurred.
1017 SCNetworkServiceSetExternalID (SCNetworkServiceRef service
,
1018 CFStringRef identifierDomain
,
1019 CFStringRef identifier
);
1022 @function SCNetworkServiceCopyExternalID
1023 @discussion Copy the external identifier for a network service.
1024 @param service The network service.
1025 @param identifierDomain A service can have multiple external identifiers. This string specifies which external identifier to copy.
1026 @result Returns the service's external identifier, or NULL if the service does not have an external identifier in the given domain.
1029 SCNetworkServiceCopyExternalID (SCNetworkServiceRef service
,
1030 CFStringRef identifierDomain
);
1033 @function _SCNetworkServiceSetServiceID
1034 @discussion Sets serviceID of the service to a different value provided.
1035 @param service The network service
1036 @param newServiceID The new service ID
1037 @result TRUE if new service ID is set successfully.
1040 _SCNetworkServiceSetServiceID (SCNetworkServiceRef service
,
1041 CFStringRef newServiceID
) API_AVAILABLE(macos(10.10), ios(8.0));
1044 #pragma mark SCNetworkSet configuration (SPI)
1048 @group Set configuration
1052 static __inline__ CFTypeRef
1053 isA_SCNetworkSet(CFTypeRef obj
)
1055 return (isA_CFType(obj
, SCNetworkSetGetTypeID()));
1060 @function _SCNetworkSetCompare
1061 @discussion Compares two SCNetworkSet objects.
1062 @param val1 The SCNetworkSet object.
1063 @param val2 The SCNetworkSet object.
1064 @param context Not used.
1065 @result A comparison result.
1068 _SCNetworkSetCompare (const void *val1
,
1070 void *context
) API_AVAILABLE(macos(10.13), ios(11.0));
1073 @function SCNetworkSetCopyAvailableInterfaces
1074 @discussion Returns all available interfaces for the set.
1075 The interfaces excludes those of bond and bridge members.
1076 @param set The network set.
1077 @result The list of SCNetworkInterfaces.
1078 You must release the returned value.
1081 SCNetworkSetCopyAvailableInterfaces (SCNetworkSetRef set
) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1084 @function _SCNetworkSetCreateDefault
1085 @discussion Create a new [default] set in the configuration.
1086 @param prefs The "preferences" session.
1087 @result A reference to the new SCNetworkSet.
1088 You must release the returned value.
1091 _SCNetworkSetCreateDefault (SCPreferencesRef prefs
) API_AVAILABLE(macos(10.12)) SPI_AVAILABLE(ios(10.0), tvos(10.0), watchos(3.0), bridgeos(3.0));
1094 @function SCNetworkSetEstablishDefaultConfiguration
1095 @discussion Updates a network set by adding services for
1096 any network interface that is not currently
1098 If the provided set contains one (or more) services, new
1099 services will only be added for those interfaces that are
1100 not represented in *any* set.
1101 Otherwise, new services will be added for those interfaces
1102 that are not represented in the provided set.
1103 The new services are established with "default" configuration
1105 @param set The network set.
1106 @result TRUE if the configuration was updated; FALSE if no
1107 changes were required or if an error was encountered.
1110 SCNetworkSetEstablishDefaultConfiguration (SCNetworkSetRef set
) API_AVAILABLE(macos(10.5), ios(2.0));
1113 @function SCNetworkSetEstablishDefaultInterfaceConfiguration
1114 @discussion Updates a network set by adding services for
1115 the specified network interface if is not currently
1117 If the provided set contains one (or more) services, new
1118 services will only be added for interfaces that are not
1119 represented in *any* set.
1120 Otherwise, new services will be added for interfaces that
1121 are not represented in the provided set.
1122 The new services are established with "default" configuration
1124 @param set The network set.
1125 @param interface The network interface.
1126 @result TRUE if the configuration was updated; FALSE if no
1127 changes were required or if an error was encountered.
1130 SCNetworkSetEstablishDefaultInterfaceConfiguration (SCNetworkSetRef set
,
1131 SCNetworkInterfaceRef interface
) API_AVAILABLE(macos(10.5), ios(2.0));
1134 @function SCNetworkSetCopySelectedVPNService
1135 @discussion On the iPhone we only allow a single VPN network service
1136 to be selected at any given time. This API will identify
1137 the selected VPN service.
1138 @param set The network set.
1139 @result The selected VPN service; NULL if no service has been
1141 You must release the returned value.
1144 SCNetworkSetCopySelectedVPNService (SCNetworkSetRef set
) API_AVAILABLE(macos(10.7), ios(4.0));
1147 @function SCNetworkSetSetSelectedVPNService
1148 @discussion On the iPhone we only allow a single VPN network service
1149 to be selected at any given time. This API should be used to
1150 select a VPN service.
1151 @param set The network set.
1152 @param service The VPN service to be selected.
1153 @result TRUE if the name was saved; FALSE if an error was encountered.
1156 SCNetworkSetSetSelectedVPNService (SCNetworkSetRef set
,
1157 SCNetworkServiceRef service
) API_AVAILABLE(macos(10.7), ios(4.0));
1160 _SCNetworkSetSetSetID (SCNetworkSetRef set
,
1161 CFStringRef setID
) API_AVAILABLE(macos(10.10), ios(8.0));
1164 @group VPN Service configuration
1168 #pragma mark VPN Service configuration
1170 typedef SCNetworkServiceRef VPNServiceRef
;
1173 @function VPNServiceCopyAllMatchingExternalID
1174 @discussion Copy the VPN services with the given external identifier.
1175 @param prefs A reference to the prefs where the VPN services are stored.
1176 @param identifierDomain A service can have multiple external identifiers. This string specifies which one to match with the given identifier.
1177 @param identifier The external identifier of the desired services.
1178 @result A array of references to the VPN services with the given identifier, or NULL if no such service exists
1181 VPNServiceCopyAllMatchingExternalID (SCPreferencesRef prefs
,
1182 CFStringRef identifierDomain
,
1183 CFStringRef identifier
) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1186 @function VPNServiceCopyAll
1187 @discussion Copy all VPN services.
1188 @param prefs A reference to the prefs where the VPN services are stored.
1189 @result An array containing VPNServiceRefs for all the VPN services.
1192 VPNServiceCopyAll (SCPreferencesRef prefs
) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1195 @function VPNServiceCopyAppRuleIDs
1196 @discussion Copy all the app rule identifiers for a VPN service.
1197 @param service A reference to the VPN service.
1198 @result An array of CFStringRefs, each string containing the identifier of a app rule in the given service.
1201 VPNServiceCopyAppRuleIDs (VPNServiceRef service
) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1204 @function VPNServiceSetAppRule
1205 @discussion Add or modify an app rule in a VPN service. The ruleSettings dictionary must contain one of the following keys:
1206 <pre>kSCValNetVPNAppRuleExecutableMatch</pre>
1207 <pre>kSCValNetVPNAppRuleAccountIdentifierMatch</pre>
1208 The ruleSettings dictionary may also contain the following keys:
1209 <pre>kSCValNetVPNAppRuleDNSDomainMatch</pre>
1210 See SCSchemaDefinitionsPrivate.h for more details.
1211 @param service A reference to the VPN service.
1212 @param ruleIdentifier The identifier of the new app rule.
1213 @param ruleSettings The settings for the new app rule. See the dictionary keys defined above.
1214 @result TRUE if the app rule was set successfully, FALSE if an error occurred.
1217 VPNServiceSetAppRule (VPNServiceRef service
,
1218 CFStringRef ruleIdentifier
,
1219 CFDictionaryRef ruleSettings
) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1222 @function VPNServiceCopyAppRule
1223 @discussion Copy the settings for a app rule in a VPN service.
1224 @param service The app tunnel service.
1225 @param ruleIdentifier The ID of the app rule.
1226 @result The rule settings, or NULL if the app rule could not be found.
1229 VPNServiceCopyAppRule (VPNServiceRef service
,
1230 CFStringRef ruleIdentifier
) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1233 @function VPNServiceRemoveAppRule
1234 @discussion Remove an app rule from a VPN service.
1235 @param service The VPN service.
1236 @param ruleIdentifier The ID of the app rule to remove.
1237 @result Returns TRUE if the app rule was removed successfully; FALSE otherwise.
1240 VPNServiceRemoveAppRule (VPNServiceRef service
,
1241 CFStringRef ruleIdentifier
) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1244 @function VPNServiceIsManagedAppVPN
1245 @discussion Check to see if a VPN service is a managed App VPN service
1246 @param service The VPN servie.
1247 @result Returns TRUE if the service is a managed App VPN service; FALSE otherwise.
1250 VPNServiceIsManagedAppVPN (VPNServiceRef service
) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1253 @group Migration SPI
1256 #pragma mark Migration SPI
1258 extern const CFStringRef kSCNetworkConfigurationRepair
/* CFBoolean */ API_AVAILABLE(macos(10.10), ios(8.0));
1259 extern const CFStringRef kSCNetworkConfigurationRepairModel
/* CFBoolean */ API_AVAILABLE(macos(11.0), ios(14.0));
1261 extern const CFStringRef kSCNetworkConfigurationMigrationActionKey
/* CFNumber */ API_AVAILABLE(macos(10.10), ios(8.0));
1263 typedef CF_ENUM(uint32_t, SCNetworkConfigurationMigrationAction
) {
1264 kSCNetworkConfigurationMigrationAction_CleanInstall
= 0,
1265 kSCNetworkConfigurationMigrationAction_Upgrade
= 1,
1266 kSCNetworkConfigurationMigrationAction_Restore
= 2,
1270 @function _SCNetworkConfigurationCopyMigrationPaths
1271 @result Returns an array of paths that we would need from the source
1274 _SCNetworkConfigurationCopyMigrationPaths(CFDictionaryRef options
) API_AVAILABLE(macos(10.10), ios(8.0));
1277 @function _SCNetworkConfigurationPerformMigration
1278 @discussion Updates the network configuration of the target system with
1279 configurations from previous system. Both sourceDir and targetDir
1280 cannot be NULL, since NULL indicates API to look at the local system
1281 @param sourceDir A reference which points to the root of a directory populated
1282 with the list of requested directories/path from the "source" volume. Passing NULL
1283 will indicate that sourceDir should point to local system
1284 @param currentDir A reference which points to the root of a directory populated
1285 with the list of requested directories/path from the "destination" volume. Passing
1286 NULL will indicate that currentDir should point to local system.
1287 @param targetDir A reference which points to the root of a directory that we
1288 will populate (update) with new configuration. Passing NULL will mean that we want to
1289 migrate to the currentDir. If not NULL, then this path should exist.
1290 @param options Argument which will tell us what action we are supposed to take
1291 (clean-install, upgrade, migrate/restore settings from another system, ...)
1292 @result Returns array which would consist of those paths that should be moved
1293 from the "targetDir" directory to destination volume. You must release the returned value.
1298 _SCNetworkConfigurationPerformMigration (CFURLRef sourceDir
,
1299 CFURLRef currentDir
,
1301 CFDictionaryRef options
) API_AVAILABLE(macos(10.10), ios(8.0));
1305 @function _SCNetworkConfigurationCheckValidity
1306 @discussion Verifies whether the configuration files present in the specified
1307 directory have valid mappings or not
1308 @param configDir A reference which points to the directory where the configuration
1310 @result TRUE if valid configurations are found
1315 _SCNetworkConfigurationCheckValidity (CFURLRef configDir
,
1316 CFDictionaryRef options
) API_AVAILABLE(macos(10.10), ios(8.0));
1320 @function _SCNetworkConfigurationCheckValidityWithPreferences
1321 @discussion Validates the specified preferences.plist against NetworkInterfaces.plist
1322 @param prefs the preferences ref pointing to the said preferences.plist
1323 @param ni_prefs the preferences ref pointing to the said NetworkInterfaces.plist
1324 @result TRUE if the configurations are valid against each other
1329 _SCNetworkConfigurationCheckValidityWithPreferences
1330 (SCPreferencesRef prefs
,
1331 SCPreferencesRef ni_prefs
,
1332 CFDictionaryRef options
) API_AVAILABLE(macos(10.11), ios(9.0));
1336 @function _SCNetworkMigrationAreConfigurationsIdentical
1337 @discussion Compares the migration output between network configurations
1338 with the expected output.
1339 @param configurationURL A URL pointing to the top-level directory of the
1340 configuration to compare. This directory is expected to have
1341 a Library/Preferences/SystemConfiguration subdirectoy.
1342 @param expectedConfigurationURL A URL pointing to the top-level directory of
1343 the expected configuration. This directory is expected to have
1344 a Library/Preferences/SystemConfiguration subdirectoy.
1345 @result TRUE if configurations match with the expected configurations
1350 _SCNetworkMigrationAreConfigurationsIdentical (CFURLRef configurationURL
,
1351 CFURLRef expectedConfigurationURL
) API_AVAILABLE(macos(10.10), ios(8.0));
1354 @function _SCNetworkConfigurationCopyMigrationRemovePaths
1355 @discussion List of paths to files which we want to be removed from the target filesystem after migration
1356 @param targetPaths the CFArray returned by _SCNetworkConfigurationPerformMigration
1357 @param targetDir the CFURL passed to _SCNetworkConfigurationPerformMigration
1358 @result An array of CFURL's; NULL if no paths need to be removed from the target filesystem
1362 CFArrayRef
// of CFURLRef's
1363 _SCNetworkConfigurationCopyMigrationRemovePaths (CFArrayRef targetPaths
,
1364 CFURLRef targetDir
) API_AVAILABLE(macos(10.10), ios(8.0));
1368 #endif /* _SCNETWORKCONFIGURATIONPRIVATE_H */