this repo has no description
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 */
52extern 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 */
58extern 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 */
65extern 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 */
70extern 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 */
81typedef SCNetworkInterfaceRef SCBridgeInterfaceRef;
82
83typedef 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
98static __inline__ CFTypeRef
99isA_SCNetworkInterface(CFTypeRef obj)
100{
101 return (isA_CFType(obj, SCNetworkInterfaceGetTypeID()));
102}
103
104static __inline__ CFTypeRef
105isA_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
123static __inline__ CFTypeRef
124isA_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
142static __inline__ CFTypeRef
143isA_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 */
169CFComparisonResult
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 */
182SCNetworkInterfaceRef
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 */
193CFArrayRef /* 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 */
201SCNetworkInterfaceRef
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 */
211CFStringRef
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 */
231SCNetworkInterfaceRef
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 */
245SCNetworkInterfaceRef
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 */
258SCNetworkInterfaceRef
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 */
267SCNetworkServicePrimaryRank
268SCNetworkInterfaceGetPrimaryRank (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 */
279Boolean
280SCNetworkInterfaceSetPrimaryRank (SCNetworkInterfaceRef interface,
281 SCNetworkServicePrimaryRank newRank) API_AVAILABLE(macos(10.8), ios(5.0));
282
283/**
284 ** SCNetworkInterfaceAdvisory
285 **/
286
287typedef 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*/
307Boolean
308SCNetworkInterfaceSetAdvisory(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*/
319Boolean
320SCNetworkInterfaceAdvisoryIsSet(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*/
331CFStringRef
332SCNetworkInterfaceCopyAdvisoryNotificationKey(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 */
358CFDictionaryRef
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 */
368CFStringRef
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 */
378CFNumberRef
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 */
388CFNumberRef
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 */
398CFDataRef
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 */
408CFStringRef
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 */
417CFNumberRef
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 */
427CFNumberRef
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 */
437CFStringRef
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 */
447uint64_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 */
456Boolean
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 */
465Boolean
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 */
474Boolean
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 */
483Boolean
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 */
492Boolean
493_SCNetworkInterfaceIsBuiltin (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.5), ios(2.0));
494
495/*!
496 @function _SCNetworkInterfaceIsCarPlay
497 @discussion Identifies if a network interface is a CarPlay device.
498 @param interface The network interface.
499 @result TRUE if the interface is a CarPlay device.
500 */
501Boolean
502_SCNetworkInterfaceIsCarPlay (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.15), ios(13.0));
503
504/*!
505 @function _SCNetworkInterfaceIsHiddenConfiguration
506 @discussion Identifies if the configuration of a network interface should be
507 hidden from any user interface (e.g. the "Network" pref pane).
508 @param interface The network interface.
509 @result TRUE if the interface configuration should be hidden.
510 */
511Boolean
512_SCNetworkInterfaceIsHiddenConfiguration (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.7), ios(4.0));
513
514/*!
515 @function _SCNetworkInterfaceIsTethered
516 @discussion Identifies if a network interface is an Apple tethered device (e.g. an iPhone).
517 @param interface The network interface.
518 @result TRUE if the interface is a tethered device.
519 */
520Boolean
521_SCNetworkInterfaceIsTethered (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.6), ios(3.0));
522
523/*!
524 @function _SCNetworkInterfaceIsThunderbolt
525 @discussion Identifies if a network interface is a Thunderbolt device
526 @param interface The network interface.
527 @result TRUE if the interface is a Thunderbolt device.
528 */
529Boolean
530_SCNetworkInterfaceIsThunderbolt (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.9), ios(7.0));
531
532/*!
533 @function _SCNetworkInterfaceIsTrustRequired
534 @discussion Identifies if a network interface requires that the
535 associated host be trusted.
536 @param interface The network interface.
537 @result TRUE if the interface requires trust.
538 */
539Boolean
540_SCNetworkInterfaceIsTrustRequired (SCNetworkInterfaceRef interface) SPI_AVAILABLE(macos(10.14)) API_AVAILABLE(ios(12.0));
541
542/*!
543 @function _SCNetworkInterfaceIsPhysicalEthernet
544 @discussion Indicates whether a network interface is a real ethernet interface i.e. one with an ethernet PHY.
545 @param interface The network interface.
546 @result TRUE if the interface is a real ethernet interface.
547 */
548Boolean
549_SCNetworkInterfaceIsPhysicalEthernet (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.7), ios(5.0));
550
551/*!
552 @function _SCNetworkInterfaceForceConfigurationRefresh
553 @discussion Forces a configuration refresh of the
554 specified interface.
555 @param ifName Network interface name.
556 @result TRUE if the refresh was successfully posted.
557 */
558Boolean
559_SCNetworkInterfaceForceConfigurationRefresh (CFStringRef ifName) API_AVAILABLE(macos(10.5), ios(2.0));
560
561/*!
562 @function SCNetworkInterfaceCopyCapability
563 @discussion For the specified network interface, returns information
564 about the currently requested capabilities, the active capabilities,
565 and the capabilities which are available.
566 @param interface The desired network interface.
567 @param capability The desired capability;
568 NULL to return a CFDictionary of all capabilities.
569 @result a CFTypeRef representing the current value of requested
570 capability;
571 NULL if the capability is not available for this
572 interface or if an error was encountered.
573 You must release the returned value.
574 */
575CFTypeRef
576SCNetworkInterfaceCopyCapability (SCNetworkInterfaceRef interface,
577 CFStringRef capability) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(5.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
578
579/*!
580 @function SCNetworkInterfaceSetCapability
581 @discussion For the specified network interface, sets the requested
582 capabilities.
583 @param interface The desired network interface.
584 @param capability The desired capability.
585 @param newValue The new requested setting for the capability;
586 NULL to restore the default setting.
587 @result TRUE if the configuration was updated; FALSE if an error was encountered.
588 */
589Boolean
590SCNetworkInterfaceSetCapability (SCNetworkInterfaceRef interface,
591 CFStringRef capability,
592 CFTypeRef newValue) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(5.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
593
594Boolean
595__SCNetworkInterfaceSetDisableUntilNeededValue (SCNetworkInterfaceRef interface,
596 CFTypeRef disable) API_AVAILABLE(macos(10.11)) SPI_AVAILABLE(ios(9.0), tvos(9.0), watchos(2.0), bridgeos(2.0));
597
598
599int
600__SCNetworkInterfaceCreateCapabilities (SCNetworkInterfaceRef interface,
601 int capability_base,
602 CFDictionaryRef capability_options) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(5.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
603
604int
605__SCNetworkInterfaceCreateMediaOptions (SCNetworkInterfaceRef interface,
606 CFDictionaryRef media_options) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(5.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
607
608
609#pragma mark -
610#pragma mark SCBondInterface configuration (SPIs)
611
612/*!
613 @function _SCBondInterfaceCopyActive
614 @discussion Returns all Ethernet Bond interfaces on the system.
615 @result The list of SCBondInterface interfaces on the system.
616 You must release the returned value.
617 */
618CFArrayRef
619_SCBondInterfaceCopyActive (void) API_AVAILABLE(macos(10.5)) API_UNAVAILABLE(ios, tvos, watchos, bridgeos);
620
621/*!
622 @function _SCBondInterfaceUpdateConfiguration
623 @discussion Updates the bond interface configuration.
624 @param prefs The "preferences" session.
625 @result TRUE if the bond interface configuration was updated.; FALSE if the
626 an error was encountered.
627 */
628Boolean
629_SCBondInterfaceUpdateConfiguration (SCPreferencesRef prefs) API_AVAILABLE(macos(10.5)) API_UNAVAILABLE(ios, tvos, watchos, bridgeos);
630
631/*!
632 @function SCBondInterfaceGetMode
633 @discussion Return the mode for the given bond interface.
634 @param bond The bond interface to get the mode from.
635 @result A CFNumberRef containing the mode (IF_BOND_MODE_{LACP,STATIC}).
636 */
637CFNumberRef
638SCBondInterfaceGetMode (SCBondInterfaceRef bond) API_AVAILABLE(macos(10.5)) API_UNAVAILABLE(ios, tvos, watchos, bridgeos);
639
640/*!
641 @function SCBondInterfaceSetMode
642 @discussion Set the mode on the bond interface.
643 @param bond The bond interface on which to adjust the mode.
644 @param mode The mode value (0=IF_BOND_MODE_LACP,1=IF_BOND_MODE_STATIC)
645 @result TRUE if operation succeeded.
646 */
647Boolean
648SCBondInterfaceSetMode (SCBondInterfaceRef bond,
649 CFNumberRef mode) API_AVAILABLE(macos(10.5)) API_UNAVAILABLE(ios, tvos, watchos, bridgeos);
650
651#pragma mark -
652#pragma mark SCBridgeInterface configuration (SPIs)
653
654/*!
655 @function SCBridgeInterfaceCopyAll
656 @discussion Returns all bridge interfaces on the system.
657 @param prefs The "preferences" session.
658 @result The list of bridge interfaces on the system.
659 You must release the returned value.
660 */
661CFArrayRef /* of SCBridgeInterfaceRef's */
662SCBridgeInterfaceCopyAll (SCPreferencesRef prefs) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
663
664/*!
665 @function SCBridgeInterfaceCopyAvailableMemberInterfaces
666 @discussion Returns all network capable devices on the system
667 that can be added to an bridge interface.
668 @param prefs The "preferences" session.
669 @result The list of interfaces.
670 You must release the returned value.
671 */
672CFArrayRef /* of SCNetworkInterfaceRef's */
673SCBridgeInterfaceCopyAvailableMemberInterfaces (SCPreferencesRef prefs) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
674
675/*!
676 @function SCBridgeInterfaceCreate
677 @discussion Create a new SCBridgeInterface interface.
678 @param prefs The "preferences" session.
679 @result A reference to the new SCBridgeInterface.
680 You must release the returned value.
681 */
682SCBridgeInterfaceRef
683SCBridgeInterfaceCreate (SCPreferencesRef prefs) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
684
685/*!
686 @function SCBridgeInterfaceRemove
687 @discussion Removes the SCBridgeInterface from the configuration.
688 @param bridge The SCBridgeInterface interface.
689 @result TRUE if the interface was removed; FALSE if an error was encountered.
690 */
691Boolean
692SCBridgeInterfaceRemove (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 SCBridgeInterfaceGetMemberInterfaces
696 @discussion Returns the member interfaces for the specified bridge interface.
697 @param bridge The SCBridgeInterface interface.
698 @result The list of interfaces.
699 */
700CFArrayRef /* of SCNetworkInterfaceRef's */
701SCBridgeInterfaceGetMemberInterfaces (SCBridgeInterfaceRef bridge) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
702
703/*!
704 @function SCBridgeInterfaceGetOptions
705 @discussion Returns the configuration settings associated with a bridge interface.
706 @param bridge The SCBridgeInterface interface.
707 @result The configuration settings associated with the bridge interface;
708 NULL if no changes to the default configuration have been saved.
709 */
710CFDictionaryRef
711SCBridgeInterfaceGetOptions (SCBridgeInterfaceRef bridge) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
712
713/*!
714 @function SCBridgeInterfaceSetMemberInterfaces
715 @discussion Sets the member interfaces for the specified bridge interface.
716 @param bridge The SCBridgeInterface interface.
717 @param members The desired member interfaces.
718 @result TRUE if the configuration was stored; FALSE if an error was encountered.
719 */
720Boolean
721SCBridgeInterfaceSetMemberInterfaces (SCBridgeInterfaceRef bridge,
722 CFArrayRef members) /* of SCNetworkInterfaceRef's */
723 API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
724
725/*!
726 @function SCBridgeInterfaceSetLocalizedDisplayName
727 @discussion Sets the localized display name for the specified bridge interface.
728 @param bridge The SCBridgeInterface interface.
729 @param newName The new display name.
730 @result TRUE if the configuration was stored; FALSE if an error was encountered.
731 */
732Boolean
733SCBridgeInterfaceSetLocalizedDisplayName (SCBridgeInterfaceRef bridge,
734 CFStringRef newName) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
735
736/*!
737 @function SCBridgeInterfaceSetOptions
738 @discussion Sets the configuration settings for the specified bridge interface.
739 @param bridge The SCBridgeInterface interface.
740 @param newOptions The new configuration settings.
741 @result TRUE if the configuration was stored; FALSE if an error was encountered.
742 */
743Boolean
744SCBridgeInterfaceSetOptions (SCBridgeInterfaceRef bridge,
745 CFDictionaryRef newOptions) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
746
747#pragma mark -
748
749/*!
750 @function _SCBridgeInterfaceCopyActive
751 @discussion Returns all bridge interfaces on the system.
752 @result The list of SCBridgeInterface interfaces on the system.
753 You must release the returned value.
754 */
755CFArrayRef
756_SCBridgeInterfaceCopyActive (void) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
757
758/*!
759 @function _SCBridgeInterfaceUpdateConfiguration
760 @discussion Updates the bridge interface configuration.
761 @param prefs The "preferences" session.
762 @result TRUE if the bridge interface configuration was updated.; FALSE if the
763 an error was encountered.
764 */
765Boolean
766_SCBridgeInterfaceUpdateConfiguration (SCPreferencesRef prefs) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
767
768
769#pragma mark -
770#pragma mark SCVLANInterface configuration (SPIs)
771
772/*!
773 @function _SCVLANInterfaceCopyActive
774 @discussion Returns all VLAN interfaces on the system.
775 @result The list of SCVLANInterface interfaces on the system.
776 You must release the returned value.
777 */
778CFArrayRef
779_SCVLANInterfaceCopyActive (void) API_AVAILABLE(macos(10.5)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
780
781/*!
782 @function _SCVLANInterfaceUpdateConfiguration
783 @discussion Updates the VLAN interface configuration.
784 @param prefs The "preferences" session.
785 @result TRUE if the VLAN interface configuration was updated.; FALSE if the
786 an error was encountered.
787 */
788Boolean
789_SCVLANInterfaceUpdateConfiguration (SCPreferencesRef prefs) API_AVAILABLE(macos(10.5)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
790
791
792#pragma mark -
793#pragma mark SCNetworkInterface Password SPIs
794
795
796enum {
797 kSCNetworkInterfacePasswordTypePPP = 1,
798 kSCNetworkInterfacePasswordTypeIPSecSharedSecret,
799 kSCNetworkInterfacePasswordTypeEAPOL,
800 kSCNetworkInterfacePasswordTypeIPSecXAuth,
801 kSCNetworkInterfacePasswordTypeVPN,
802};
803typedef uint32_t SCNetworkInterfacePasswordType;
804
805Boolean
806SCNetworkInterfaceCheckPassword (SCNetworkInterfaceRef interface,
807 SCNetworkInterfacePasswordType passwordType) API_AVAILABLE(macos(10.5), ios(2.0));
808
809CFDataRef
810SCNetworkInterfaceCopyPassword (SCNetworkInterfaceRef interface,
811 SCNetworkInterfacePasswordType passwordType) API_AVAILABLE(macos(10.5), ios(2.0));
812
813Boolean
814SCNetworkInterfaceRemovePassword (SCNetworkInterfaceRef interface,
815 SCNetworkInterfacePasswordType passwordType) API_AVAILABLE(macos(10.5), ios(2.0));
816
817Boolean
818SCNetworkInterfaceSetPassword (SCNetworkInterfaceRef interface,
819 SCNetworkInterfacePasswordType passwordType,
820 CFDataRef password,
821 CFDictionaryRef options) API_AVAILABLE(macos(10.5), ios(2.0));
822
823
824Boolean
825SCNetworkInterfaceGetDisableUntilNeeded (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.11), ios(9.0));
826
827Boolean
828SCNetworkInterfaceSetDisableUntilNeeded (SCNetworkInterfaceRef interface,
829 Boolean disable) API_AVAILABLE(macos(10.11), ios(9.0));
830
831
832CFDictionaryRef
833SCNetworkInterfaceGetQoSMarkingPolicy (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.13), ios(10.0));
834
835Boolean
836SCNetworkInterfaceSetQoSMarkingPolicy (SCNetworkInterfaceRef interface,
837 CFDictionaryRef policy) API_AVAILABLE(macos(10.13), ios(10.0));
838
839
840#pragma mark -
841#pragma mark SCNetworkProtocol configuration (SPI)
842
843
844/*!
845 @group Protocol configuration
846 */
847
848
849static __inline__ CFTypeRef
850isA_SCNetworkProtocol(CFTypeRef obj)
851{
852 return (isA_CFType(obj, SCNetworkProtocolGetTypeID()));
853}
854
855/*!
856 @function _SCNetworkProtocolCompare
857 @discussion Compares two SCNetworkProtocol objects.
858 @param val1 The SCNetworkProtocol object.
859 @param val2 The SCNetworkProtocol object.
860 @param context Not used.
861 @result A comparison result.
862 */
863CFComparisonResult
864_SCNetworkProtocolCompare (const void *val1,
865 const void *val2,
866 void *context) API_AVAILABLE(macos(10.13), ios(11.0));
867
868
869#pragma mark -
870#pragma mark SCNetworkService configuration (SPI)
871
872
873/*!
874 @group Service configuration
875 */
876
877
878static __inline__ CFTypeRef
879isA_SCNetworkService(CFTypeRef obj)
880{
881 return (isA_CFType(obj, SCNetworkServiceGetTypeID()));
882}
883
884/*!
885 @function _SCNetworkServiceCompare
886 @discussion Compares two SCNetworkService objects.
887 @param val1 The SCNetworkService object.
888 @param val2 The SCNetworkService object.
889 @param context The service order (from SCNetworkSetGetServiceOrder).
890 @result A comparison result.
891 */
892CFComparisonResult
893_SCNetworkServiceCompare (const void *val1,
894 const void *val2,
895 void *context) API_AVAILABLE(macos(10.7), ios(4.0));
896
897/*!
898 @function _SCNetworkServiceCopyActive
899 @discussion Returns the network service with the specified identifier.
900
901 Note: The service returned by this SPI differs from the SCNetworkServiceCopy
902 API in that queries and operations interact with the "active" service
903 represented in the SCDynamicStore. Only a limited subset of the
904 SCNetworkService APIs are supported.
905 @param store The dynamic store session.
906 @param serviceID The unique identifier for the service.
907 @result A reference to the SCNetworkService represented in the SCDynamicStore;
908 NULL if the serviceID does not exist in the SCDynamicStore or if an
909 error was encountered.
910 You must release the returned value.
911 */
912SCNetworkServiceRef
913_SCNetworkServiceCopyActive (SCDynamicStoreRef store,
914 CFStringRef serviceID) API_AVAILABLE(macos(10.6), ios(2.1));
915
916/*!
917 @function SCNetworkServiceGetPrimaryRank
918 @discussion Returns the primary service rank associated with a service.
919 @param service The network service.
920 @result The primary service rank associated with the specified application;
921 kSCNetworkServicePrimaryRankDefault if no rank is associated with the
922 application or an error was encountered.
923 */
924SCNetworkServicePrimaryRank
925SCNetworkServiceGetPrimaryRank (SCNetworkServiceRef service) API_AVAILABLE(macos(10.6), ios(2.0));
926
927/*!
928 @function SCNetworkServiceSetPrimaryRank
929 @discussion Updates the the primary service rank associated with a service.
930 @param service The network service.
931 @param newRank The new primary service rank; kSCNetworkServicePrimaryRankDefault
932 if the default service rank should be used.
933 @result TRUE if the rank was stored; FALSE if an error was encountered.
934
935 Notes : The kSCNetworkServicePrimaryRankFirst and kSCNetworkServicePrimaryRankLast
936 values can only valid as a transient setting.
937 */
938Boolean
939SCNetworkServiceSetPrimaryRank (SCNetworkServiceRef service,
940 SCNetworkServicePrimaryRank newRank) API_AVAILABLE(macos(10.6), ios(2.0));
941
942/*!
943 @function _SCNetworkServiceIsVPN
944 @discussion Identifies a VPN service.
945 @param service The network service.
946 @result TRUE if the service is a VPN.
947 */
948Boolean
949_SCNetworkServiceIsVPN (SCNetworkServiceRef service) API_AVAILABLE(macos(10.7), ios(4.0));
950
951/*!
952 @function SCNetworkServiceSetExternalID
953 @discussion Set the external identifier for a network service.
954 @param service A reference to the network service.
955 @param identifierDomain A service can have multiple external identifiers. This string specifies which external identifier to set.
956 @param identifier The new external identifier to assign to the network service.
957 @result Returns TRUE if the external identifier was set successfully, FALSE if an error occurred.
958 */
959Boolean
960SCNetworkServiceSetExternalID (SCNetworkServiceRef service,
961 CFStringRef identifierDomain,
962 CFStringRef identifier);
963
964/*!
965 @function SCNetworkServiceCopyExternalID
966 @discussion Copy the external identifier for a network service.
967 @param service The network service.
968 @param identifierDomain A service can have multiple external identifiers. This string specifies which external identifier to copy.
969 @result Returns the service's external identifier, or NULL if the service does not have an external identifier in the given domain.
970*/
971CFStringRef
972SCNetworkServiceCopyExternalID (SCNetworkServiceRef service,
973 CFStringRef identifierDomain);
974
975/*!
976 @function _SCNetworkServiceSetServiceID
977 @discussion Sets serviceID of the service to a different value provided.
978 @param service The network service
979 @param newServiceID The new service ID
980 @result TRUE if new service ID is set successfully.
981 */
982Boolean
983_SCNetworkServiceSetServiceID (SCNetworkServiceRef service,
984 CFStringRef newServiceID) API_AVAILABLE(macos(10.10), ios(8.0));
985
986#pragma mark -
987#pragma mark SCNetworkSet configuration (SPI)
988
989
990/*!
991 @group Set configuration
992 */
993
994
995static __inline__ CFTypeRef
996isA_SCNetworkSet(CFTypeRef obj)
997{
998 return (isA_CFType(obj, SCNetworkSetGetTypeID()));
999}
1000
1001
1002/*!
1003 @function _SCNetworkSetCompare
1004 @discussion Compares two SCNetworkSet objects.
1005 @param val1 The SCNetworkSet object.
1006 @param val2 The SCNetworkSet object.
1007 @param context Not used.
1008 @result A comparison result.
1009 */
1010CFComparisonResult
1011_SCNetworkSetCompare (const void *val1,
1012 const void *val2,
1013 void *context) API_AVAILABLE(macos(10.13), ios(11.0));
1014
1015/*!
1016 @function SCNetworkSetCopyAvailableInterfaces
1017 @discussion Returns all available interfaces for the set.
1018 The interfaces excludes those of bond and bridge members.
1019 @param set The network set.
1020 @result The list of SCNetworkInterfaces.
1021 You must release the returned value.
1022 */
1023CFArrayRef
1024SCNetworkSetCopyAvailableInterfaces (SCNetworkSetRef set) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1025
1026/*!
1027 @function _SCNetworkSetCreateDefault
1028 @discussion Create a new [default] set in the configuration.
1029 @param prefs The "preferences" session.
1030 @result A reference to the new SCNetworkSet.
1031 You must release the returned value.
1032 */
1033SCNetworkSetRef
1034_SCNetworkSetCreateDefault (SCPreferencesRef prefs) API_AVAILABLE(macos(10.12)) SPI_AVAILABLE(ios(10.0), tvos(10.0), watchos(3.0), bridgeos(3.0));
1035
1036/*!
1037 @function SCNetworkSetEstablishDefaultConfiguration
1038 @discussion Updates a network set by adding services for
1039 any network interface that is not currently
1040 represented.
1041 If the provided set contains one (or more) services, new
1042 services will only be added for those interfaces that are
1043 not represented in *any* set.
1044 Otherwise, new services will be added for those interfaces
1045 that are not represented in the provided set.
1046 The new services are established with "default" configuration
1047 options.
1048 @param set The network set.
1049 @result TRUE if the configuration was updated; FALSE if no
1050 changes were required or if an error was encountered.
1051*/
1052Boolean
1053SCNetworkSetEstablishDefaultConfiguration (SCNetworkSetRef set) API_AVAILABLE(macos(10.5), ios(2.0));
1054
1055/*!
1056 @function SCNetworkSetEstablishDefaultInterfaceConfiguration
1057 @discussion Updates a network set by adding services for
1058 the specified network interface if is not currently
1059 represented.
1060 If the provided set contains one (or more) services, new
1061 services will only be added for interfaces that are not
1062 represented in *any* set.
1063 Otherwise, new services will be added for interfaces that
1064 are not represented in the provided set.
1065 The new services are established with "default" configuration
1066 options.
1067 @param set The network set.
1068 @param interface The network interface.
1069 @result TRUE if the configuration was updated; FALSE if no
1070 changes were required or if an error was encountered.
1071 */
1072Boolean
1073SCNetworkSetEstablishDefaultInterfaceConfiguration (SCNetworkSetRef set,
1074 SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.5), ios(2.0));
1075
1076/*!
1077 @function SCNetworkSetCopySelectedVPNService
1078 @discussion On the iPhone we only allow a single VPN network service
1079 to be selected at any given time. This API will identify
1080 the selected VPN service.
1081 @param set The network set.
1082 @result The selected VPN service; NULL if no service has been
1083 selected.
1084 You must release the returned value.
1085 */
1086SCNetworkServiceRef
1087SCNetworkSetCopySelectedVPNService (SCNetworkSetRef set) API_AVAILABLE(macos(10.7), ios(4.0));
1088
1089/*!
1090 @function SCNetworkSetSetSelectedVPNService
1091 @discussion On the iPhone we only allow a single VPN network service
1092 to be selected at any given time. This API should be used to
1093 select a VPN service.
1094 @param set The network set.
1095 @param service The VPN service to be selected.
1096 @result TRUE if the name was saved; FALSE if an error was encountered.
1097 */
1098Boolean
1099SCNetworkSetSetSelectedVPNService (SCNetworkSetRef set,
1100 SCNetworkServiceRef service) API_AVAILABLE(macos(10.7), ios(4.0));
1101
1102Boolean
1103_SCNetworkSetSetSetID (SCNetworkSetRef set,
1104 CFStringRef setID) API_AVAILABLE(macos(10.10), ios(8.0));
1105
1106/*!
1107 @group VPN Service configuration
1108 */
1109
1110#pragma mark -
1111#pragma mark VPN Service configuration
1112
1113typedef SCNetworkServiceRef VPNServiceRef;
1114
1115/*!
1116 @function VPNServiceCopyAllMatchingExternalID
1117 @discussion Copy the VPN services with the given external identifier.
1118 @param prefs A reference to the prefs where the VPN services are stored.
1119 @param identifierDomain A service can have multiple external identifiers. This string specifies which one to match with the given identifier.
1120 @param identifier The external identifier of the desired services.
1121 @result A array of references to the VPN services with the given identifier, or NULL if no such service exists
1122 */
1123CFArrayRef
1124VPNServiceCopyAllMatchingExternalID (SCPreferencesRef prefs,
1125 CFStringRef identifierDomain,
1126 CFStringRef identifier) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1127
1128/*!
1129 @function VPNServiceCopyAll
1130 @discussion Copy all VPN services.
1131 @param prefs A reference to the prefs where the VPN services are stored.
1132 @result An array containing VPNServiceRefs for all the VPN services.
1133 */
1134CFArrayRef
1135VPNServiceCopyAll (SCPreferencesRef prefs) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1136
1137/*!
1138 @function VPNServiceCopyAppRuleIDs
1139 @discussion Copy all the app rule identifiers for a VPN service.
1140 @param service A reference to the VPN service.
1141 @result An array of CFStringRefs, each string containing the identifier of a app rule in the given service.
1142 */
1143CFArrayRef
1144VPNServiceCopyAppRuleIDs (VPNServiceRef service) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1145
1146/*!
1147 @function VPNServiceSetAppRule
1148 @discussion Add or modify an app rule in a VPN service. The ruleSettings dictionary must contain one of the following keys:
1149 <pre>kSCValNetVPNAppRuleExecutableMatch</pre>
1150 <pre>kSCValNetVPNAppRuleAccountIdentifierMatch</pre>
1151 The ruleSettings dictionary may also contain the following keys:
1152 <pre>kSCValNetVPNAppRuleDNSDomainMatch</pre>
1153 See SCSchemaDefinitionsPrivate.h for more details.
1154 @param service A reference to the VPN service.
1155 @param ruleIdentifier The identifier of the new app rule.
1156 @param ruleSettings The settings for the new app rule. See the dictionary keys defined above.
1157 @result TRUE if the app rule was set successfully, FALSE if an error occurred.
1158 */
1159Boolean
1160VPNServiceSetAppRule (VPNServiceRef service,
1161 CFStringRef ruleIdentifier,
1162 CFDictionaryRef ruleSettings) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1163
1164/*!
1165 @function VPNServiceCopyAppRule
1166 @discussion Copy the settings for a app rule in a VPN service.
1167 @param service The app tunnel service.
1168 @param ruleIdentifier The ID of the app rule.
1169 @result The rule settings, or NULL if the app rule could not be found.
1170 */
1171CFDictionaryRef
1172VPNServiceCopyAppRule (VPNServiceRef service,
1173 CFStringRef ruleIdentifier) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1174
1175/*!
1176 @function VPNServiceRemoveAppRule
1177 @discussion Remove an app rule from a VPN service.
1178 @param service The VPN service.
1179 @param ruleIdentifier The ID of the app rule to remove.
1180 @result Returns TRUE if the app rule was removed successfully; FALSE otherwise.
1181 */
1182Boolean
1183VPNServiceRemoveAppRule (VPNServiceRef service,
1184 CFStringRef ruleIdentifier) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1185
1186/*!
1187 @function VPNServiceIsManagedAppVPN
1188 @discussion Check to see if a VPN service is a managed App VPN service
1189 @param service The VPN servie.
1190 @result Returns TRUE if the service is a managed App VPN service; FALSE otherwise.
1191*/
1192Boolean
1193VPNServiceIsManagedAppVPN (VPNServiceRef service) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1194
1195/*!
1196 @group Migration SPI
1197 */
1198#pragma mark -
1199#pragma mark Migration SPI
1200
1201extern const CFStringRef kSCNetworkConfigurationRepair /* CFBoolean */ API_AVAILABLE(macos(10.10), ios(8.0));
1202
1203extern const CFStringRef kSCNetworkConfigurationMigrationActionKey /* CFNumber */ API_AVAILABLE(macos(10.10), ios(8.0));
1204
1205typedef CF_ENUM(uint32_t, SCNetworkConfigurationMigrationAction) {
1206 kSCNetworkConfigurationMigrationAction_CleanInstall = 0,
1207 kSCNetworkConfigurationMigrationAction_Upgrade = 1,
1208 kSCNetworkConfigurationMigrationAction_Restore = 2,
1209};
1210
1211/*!
1212 @function _SCNetworkConfigurationCopyMigrationPaths
1213 @result Returns an array of paths that we would need from the source
1214 */
1215CFArrayRef
1216_SCNetworkConfigurationCopyMigrationPaths(CFDictionaryRef options) API_AVAILABLE(macos(10.10), ios(8.0));
1217
1218/*!
1219 @function _SCNetworkConfigurationPerformMigration
1220 @discussion Updates the network configuration of the target system with
1221 configurations from previous system. Both sourceDir and targetDir
1222 cannot be NULL, since NULL indicates API to look at the local system
1223 @param sourceDir A reference which points to the root of a directory populated
1224 with the list of requested directories/path from the "source" volume. Passing NULL
1225 will indicate that sourceDir should point to local system
1226 @param currentDir A reference which points to the root of a directory populated
1227 with the list of requested directories/path from the "destination" volume. Passing
1228 NULL will indicate that currentDir should point to local system.
1229 @param targetDir A reference which points to the root of a directory that we
1230 will populate (update) with new configuration. Passing NULL will mean that we want to
1231 migrate to the currentDir. If not NULL, then this path should exist.
1232 @param options Argument which will tell us what action we are supposed to take
1233 (clean-install, upgrade, migrate/restore settings from another system, ...)
1234 @result Returns array which would consist of those paths that should be moved
1235 from the "targetDir" directory to destination volume. You must release the returned value.
1236 */
1237
1238CF_RETURNS_RETAINED
1239CFArrayRef
1240_SCNetworkConfigurationPerformMigration (CFURLRef sourceDir,
1241 CFURLRef currentDir,
1242 CFURLRef targetDir,
1243 CFDictionaryRef options) API_AVAILABLE(macos(10.10), ios(8.0));
1244
1245
1246/*!
1247 @function _SCNetworkConfigurationCheckValidity
1248 @discussion Verifies whether the configuration files present in the specified
1249 directory have valid mappings or not
1250 @param configDir A reference which points to the directory where the configuration
1251 files are present
1252 @result TRUE if valid configurations are found
1253
1254 */
1255
1256Boolean
1257_SCNetworkConfigurationCheckValidity (CFURLRef configDir,
1258 CFDictionaryRef options) API_AVAILABLE(macos(10.10), ios(8.0));
1259
1260
1261/*!
1262 @function _SCNetworkConfigurationCheckValidityWithPreferences
1263 @discussion Validates the specified preferences.plist against NetworkInterfaces.plist
1264 @param prefs the preferences ref pointing to the said preferences.plist
1265 @param ni_prefs the preferences ref pointing to the said NetworkInterfaces.plist
1266 @result TRUE if the configurations are valid against each other
1267
1268 */
1269
1270Boolean
1271_SCNetworkConfigurationCheckValidityWithPreferences
1272 (SCPreferencesRef prefs,
1273 SCPreferencesRef ni_prefs,
1274 CFDictionaryRef options) API_AVAILABLE(macos(10.11), ios(9.0));
1275
1276
1277/*!
1278 @function _SCNetworkMigrationAreConfigurationsIdentical
1279 @discussion Compares the migration output between network configurations
1280 with the expected output.
1281 @param configurationURL A URL pointing to the top-level directory of the
1282 configuration to compare. This directory is expected to have
1283 a Library/Preferences/SystemConfiguration subdirectoy.
1284 @param expectedConfigurationURL A URL pointing to the top-level directory of
1285 the expected configuration. This directory is expected to have
1286 a Library/Preferences/SystemConfiguration subdirectoy.
1287 @result TRUE if configurations match with the expected configurations
1288
1289 */
1290
1291Boolean
1292_SCNetworkMigrationAreConfigurationsIdentical (CFURLRef configurationURL,
1293 CFURLRef expectedConfigurationURL) API_AVAILABLE(macos(10.10), ios(8.0));
1294
1295/*!
1296 @function _SCNetworkConfigurationCopyMigrationRemovePaths
1297 @discussion List of paths to files which we want to be removed from the target filesystem after migration
1298 @param targetPaths the CFArray returned by _SCNetworkConfigurationPerformMigration
1299 @param targetDir the CFURL passed to _SCNetworkConfigurationPerformMigration
1300 @result An array of CFURL's; NULL if no paths need to be removed from the target filesystem
1301
1302*/
1303
1304CFArrayRef // of CFURLRef's
1305_SCNetworkConfigurationCopyMigrationRemovePaths (CFArrayRef targetPaths,
1306 CFURLRef targetDir) API_AVAILABLE(macos(10.10), ios(8.0));
1307
1308__END_DECLS
1309
1310#endif /* _SCNETWORKCONFIGURATIONPRIVATE_H */