]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/SCNetworkConfigurationPrivate.h
configd-1109.101.1.tar.gz
[apple/configd.git] / SystemConfiguration.fproj / SCNetworkConfigurationPrivate.h
1 /*
2 * Copyright (c) 2005-2020 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #ifndef _SCNETWORKCONFIGURATIONPRIVATE_H
25 #define _SCNETWORKCONFIGURATIONPRIVATE_H
26
27 #include <os/availability.h>
28 #include <TargetConditionals.h>
29 #include <sys/cdefs.h>
30 #include <CoreFoundation/CoreFoundation.h>
31 #include <SystemConfiguration/SystemConfiguration.h>
32 #include <SystemConfiguration/SCValidation.h>
33 #include <IOKit/IOKitLib.h>
34
35 /*!
36 @header SCNetworkConfigurationPrivate
37 */
38
39 __BEGIN_DECLS
40
41
42 /*!
43 @group Interface configuration
44 */
45
46 #pragma mark -
47 #pragma mark SCNetworkInterface configuration (typedefs, consts, enums)
48
49 /*!
50 @const kSCNetworkInterfaceTypeBridge
51 */
52 extern const CFStringRef kSCNetworkInterfaceTypeBridge API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
53
54
55 /*!
56 @const kSCNetworkInterfaceTypeLoopback
57 */
58 extern const CFStringRef kSCNetworkInterfaceTypeLoopback API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
59
60 /*!
61 @const kSCNetworkInterfaceLoopback
62 @discussion A network interface representing the loopback
63 interface (lo0).
64 */
65 extern const SCNetworkInterfaceRef kSCNetworkInterfaceLoopback API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
66
67 /*!
68 @const kSCNetworkInterfaceTypeVPN
69 */
70 extern const CFStringRef kSCNetworkInterfaceTypeVPN API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
71
72 /*!
73 @group Interface configuration (Bridge)
74 */
75
76 /*!
77 @typedef SCBridgeInterfaceRef
78 @discussion This is the type of a reference to an object that represents
79 a bridge interface.
80 */
81 typedef SCNetworkInterfaceRef SCBridgeInterfaceRef;
82
83 typedef CF_ENUM(uint32_t, SCNetworkServicePrimaryRank) {
84 kSCNetworkServicePrimaryRankDefault = 0,
85 kSCNetworkServicePrimaryRankFirst = 1,
86 kSCNetworkServicePrimaryRankLast = 2,
87 kSCNetworkServicePrimaryRankNever = 3,
88 kSCNetworkServicePrimaryRankScoped = 4
89 };
90
91 #pragma mark -
92 #pragma mark SCNetworkConfiguration (SPI)
93
94 /*!
95 @group Configuration
96 */
97
98 void
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));
103
104 Boolean
105 _SCNetworkConfigurationBypassSystemInterfaces (SCPreferencesRef prefs) SPI_AVAILABLE(macos(10.15.4), ios(13.4), tvos(13.4), watchos(6.2), bridgeos(4.0));
106
107 void
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));
110
111 Boolean
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));
114
115 Boolean
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));
118
119 Boolean
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));
123
124
125 #pragma mark -
126 #pragma mark SCNetworkInterface configuration (SPI)
127
128 /*!
129 @group Interface configuration
130 */
131
132 static __inline__ CFTypeRef
133 isA_SCNetworkInterface(CFTypeRef obj)
134 {
135 return (isA_CFType(obj, SCNetworkInterfaceGetTypeID()));
136 }
137
138 static __inline__ CFTypeRef
139 isA_SCBondInterface(CFTypeRef obj)
140 {
141 CFStringRef interfaceType;
142
143 if (!isA_SCNetworkInterface(obj)) {
144 // if not an SCNetworkInterface
145 return NULL;
146 }
147
148 interfaceType = SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef)obj);
149 if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeBond)) {
150 // if not a Bond
151 return NULL;
152 }
153
154 return obj;
155 }
156
157 static __inline__ CFTypeRef
158 isA_SCBridgeInterface(CFTypeRef obj)
159 {
160 CFStringRef interfaceType;
161
162 if (!isA_SCNetworkInterface(obj)) {
163 // if not an SCNetworkInterface
164 return NULL;
165 }
166
167 interfaceType = SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef)obj);
168 if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeBridge)) {
169 // if not a bridge
170 return NULL;
171 }
172
173 return obj;
174 }
175
176 static __inline__ CFTypeRef
177 isA_SCVLANInterface(CFTypeRef obj)
178 {
179 CFStringRef interfaceType;
180
181 if (!isA_SCNetworkInterface(obj)) {
182 // if not an SCNetworkInterface
183 return NULL;
184 }
185
186 interfaceType = SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef)obj);
187 if (!CFEqual(interfaceType, kSCNetworkInterfaceTypeVLAN)) {
188 // if not a VLAN
189 return NULL;
190 }
191
192 return obj;
193 }
194
195 /*!
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.
202 */
203 CFComparisonResult
204 _SCNetworkInterfaceCompare (const void *val1,
205 const void *val2,
206 void *context) API_AVAILABLE(macos(10.5), ios(2.0));
207
208 /*!
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
215 */
216 SCNetworkInterfaceRef
217 _SCNetworkInterfaceCopyActive (SCDynamicStoreRef store,
218 CFStringRef bsdName) API_AVAILABLE(macos(10.8), ios(5.0));
219
220 /*!
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.
226 */
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));
229
230 /*!
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.
234 */
235 SCNetworkInterfaceRef
236 _SCNetworkInterfaceCopyBTPANInterface (void) API_AVAILABLE(macos(10.9)) API_UNAVAILABLE(ios, tvos, watchos, bridgeos);
237
238 /*!
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.
244 */
245 CFStringRef
246 _SCNetworkInterfaceCopySlashDevPath (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.6), ios(3.0));
247
248 SCNetworkServiceRef
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));
251
252 #define kIncludeNoVirtualInterfaces 0x0
253 #define kIncludeVLANInterfaces 0x1
254 #define kIncludeBondInterfaces 0x2
255 #define kIncludeBridgeInterfaces 0x4
256 #define kIncludeAllVirtualInterfaces 0xffffffff
257
258 /*!
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.
268 */
269 SCNetworkInterfaceRef
270 _SCNetworkInterfaceCreateWithBSDName (CFAllocatorRef allocator,
271 CFStringRef bsdName,
272 UInt32 flags) API_AVAILABLE(macos(10.5), ios(2.0));
273
274 /*!
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.
282 */
283 SCNetworkInterfaceRef
284 _SCNetworkInterfaceCreateWithEntity (CFAllocatorRef allocator,
285 CFDictionaryRef interface_entity,
286 SCNetworkServiceRef service) API_AVAILABLE(macos(10.5), ios(2.0));
287
288 /*!
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.
295 */
296 SCNetworkInterfaceRef
297 _SCNetworkInterfaceCreateWithIONetworkInterfaceObject (io_object_t if_obj) API_AVAILABLE(macos(10.5), ios(2.0));
298
299 /*!
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
304 */
305 SCNetworkServicePrimaryRank
306 SCNetworkInterfaceGetPrimaryRank (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.8), ios(5.0));
307
308 /*!
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
312 remains valid.
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.
316 */
317 Boolean
318 SCNetworkInterfaceSetPrimaryRank (SCNetworkInterfaceRef interface,
319 SCNetworkServicePrimaryRank newRank) API_AVAILABLE(macos(10.8), ios(5.0));
320
321 /**
322 ** SCNetworkInterfaceAdvisory
323 **/
324
325 typedef CF_ENUM(uint32_t, SCNetworkInterfaceAdvisory) {
326 kSCNetworkInterfaceAdvisoryNone = 0,
327 kSCNetworkInterfaceAdvisoryLinkLayerIssue = 1,
328 kSCNetworkInterfaceAdvisoryUplinkIssue = 2,
329 };
330
331 /*!
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.
344 */
345 Boolean
346 SCNetworkInterfaceSetAdvisory(SCNetworkInterfaceRef interface,
347 SCNetworkInterfaceAdvisory advisory,
348 CFStringRef reason)
349 API_AVAILABLE(macos(10.14), ios(12.0));
350
351 /*!
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.
356 */
357 Boolean
358 SCNetworkInterfaceAdvisoryIsSet(SCNetworkInterfaceRef interface)
359 API_AVAILABLE(macos(10.14), ios(12.0));
360
361 /*!
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
367 interface.
368 */
369 CFStringRef
370 SCNetworkInterfaceCopyAdvisoryNotificationKey(SCNetworkInterfaceRef interface)
371 API_AVAILABLE(macos(10.14), ios(12.0));
372
373
374 #define kSCNetworkInterfaceConfigurationActionKey CFSTR("New Interface Detected Action")
375 #define kSCNetworkInterfaceConfigurationActionValueNone CFSTR("None")
376 #define kSCNetworkInterfaceConfigurationActionValuePrompt CFSTR("Prompt")
377 #define kSCNetworkInterfaceConfigurationActionValueConfigure CFSTR("Configure")
378
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 */
383
384 // IORegistry property to indicate that a [WWAN] interface is not yet ready
385 #define kSCNetworkInterfaceInitializingKey CFSTR("Initializing")
386
387 // IORegistry property to indicate that the attached host should be trusted before use
388 #define kSCNetworkInterfaceTrustRequiredKey CFSTR("TrustRequired")
389
390 /*!
391 @function _SCNetworkInterfaceCopyInterfaceInfo
392 @discussion Returns interface details
393 @param interface The network interface.
394 @result A dictionary with details about the network interface.
395 */
396 CFDictionaryRef
397 _SCNetworkInterfaceCopyInterfaceInfo (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.6), ios(3.0));
398
399 /*!
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.
405 */
406 CFStringRef
407 _SCNetworkInterfaceGetConfigurationAction (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.6), ios(2.0));
408
409 /*!
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.
415 */
416 CFNumberRef
417 _SCNetworkInterfaceGetFamilyType (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.12), ios(10.0));
418
419 /*!
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.
425 */
426 CFNumberRef
427 _SCNetworkInterfaceGetFamilySubType (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.12), ios(10.0));
428
429 /*!
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.
435 */
436 CFDataRef
437 _SCNetworkInterfaceGetHardwareAddress (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.5), ios(2.0));
438
439 /*!
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.
445 */
446 CFStringRef
447 _SCNetworkInterfaceGetIOInterfaceNamePrefix (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.8), ios(6.0));
448
449 /*!
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
454 */
455 CFNumberRef
456 _SCNetworkInterfaceGetIOInterfaceType (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.5), ios(2.0));
457
458 /*!
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.
464 */
465 CFNumberRef
466 _SCNetworkInterfaceGetIOInterfaceUnit (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.5), ios(2.0));
467
468 /*!
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.
474 */
475 CFStringRef
476 _SCNetworkInterfaceGetIOPath (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.5), ios(2.0));
477
478 /*!
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.
484 */
485 uint64_t
486 _SCNetworkInterfaceGetIORegistryEntryID (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.8), ios(5.0));
487
488 /*!
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.
493 */
494 Boolean
495 _SCNetworkInterfaceIsApplePreconfigured (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.12), ios(10.0));
496
497 /*!
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.
502 */
503 Boolean
504 _SCNetworkInterfaceIsBluetoothPAN (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.6), ios(3.0));
505
506 /*!
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.
511 */
512 Boolean
513 _SCNetworkInterfaceIsBluetoothPAN_NAP (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.7), ios(5.0));
514
515 /*!
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.
520 */
521 Boolean
522 _SCNetworkInterfaceIsBluetoothP2P (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.7), ios(5.0));
523
524 /*!
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".
529 */
530 Boolean
531 _SCNetworkInterfaceIsBuiltin (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.5), ios(2.0));
532
533 /*!
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.
538 */
539 Boolean
540 _SCNetworkInterfaceIsCarPlay (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.15), ios(13.0));
541
542 /*!
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.
548 */
549 Boolean
550 _SCNetworkInterfaceIsHiddenConfiguration (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.7), ios(4.0));
551
552 /*!
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.
557 */
558 Boolean
559 _SCNetworkInterfaceIsHiddenInterface (SCNetworkInterfaceRef interface) SPI_AVAILABLE(macos(10.16), ios(14.0), tvos(14.0), watchos(7.0));
560
561
562 /*!
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.
567 */
568 Boolean
569 _SCNetworkInterfaceIsQoSMarkingProfileInstalled (SCNetworkInterfaceRef interface) SPI_AVAILABLE(macos(10.16), ios(14.0), tvos(14.0), watchos(7.0));
570
571 /*!
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.
576 */
577 Boolean
578 _SCNetworkInterfaceIsTethered (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.6), ios(3.0));
579
580 /*!
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.
585 */
586 Boolean
587 _SCNetworkInterfaceIsThunderbolt (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.9), ios(7.0));
588
589 /*!
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.
595 */
596 Boolean
597 _SCNetworkInterfaceIsTrustRequired (SCNetworkInterfaceRef interface) SPI_AVAILABLE(macos(10.14)) API_AVAILABLE(ios(12.0));
598
599 /*!
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.
604 */
605 Boolean
606 _SCNetworkInterfaceIsPhysicalEthernet (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.7), ios(5.0));
607
608 /*!
609 @function _SCNetworkInterfaceForceConfigurationRefresh
610 @discussion Forces a configuration refresh of the
611 specified interface.
612 @param ifName Network interface name.
613 @result TRUE if the refresh was successfully posted.
614 */
615 Boolean
616 _SCNetworkInterfaceForceConfigurationRefresh (CFStringRef ifName) API_AVAILABLE(macos(10.5), ios(2.0));
617
618 /*!
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
627 capability;
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.
631 */
632 CFTypeRef
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));
635
636 /*!
637 @function SCNetworkInterfaceSetCapability
638 @discussion For the specified network interface, sets the requested
639 capabilities.
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.
645 */
646 Boolean
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));
650
651 Boolean
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));
654
655
656 int
657 __SCNetworkInterfaceCreateCapabilities (SCNetworkInterfaceRef interface,
658 int capability_base,
659 CFDictionaryRef capability_options) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(5.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
660
661 int
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));
664
665
666 #pragma mark -
667 #pragma mark SCBondInterface configuration (SPIs)
668
669 /*!
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.
674 */
675 CFArrayRef
676 _SCBondInterfaceCopyActive (void) API_AVAILABLE(macos(10.5)) API_UNAVAILABLE(ios, tvos, watchos, bridgeos);
677
678 /*!
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.
684 */
685 Boolean
686 _SCBondInterfaceUpdateConfiguration (SCPreferencesRef prefs) API_AVAILABLE(macos(10.5)) API_UNAVAILABLE(ios, tvos, watchos, bridgeos);
687
688 /*!
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}).
693 */
694 CFNumberRef
695 SCBondInterfaceGetMode (SCBondInterfaceRef bond) API_AVAILABLE(macos(10.5)) API_UNAVAILABLE(ios, tvos, watchos, bridgeos);
696
697 /*!
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.
703 */
704 Boolean
705 SCBondInterfaceSetMode (SCBondInterfaceRef bond,
706 CFNumberRef mode) API_AVAILABLE(macos(10.5)) API_UNAVAILABLE(ios, tvos, watchos, bridgeos);
707
708 #pragma mark -
709 #pragma mark SCBridgeInterface configuration (SPIs)
710
711 /*!
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.
717 */
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));
720
721 /*!
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.
728 */
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));
731
732 /*!
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.
738 */
739 SCBridgeInterfaceRef
740 SCBridgeInterfaceCreate (SCPreferencesRef prefs) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
741
742 /*!
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.
747 */
748 Boolean
749 SCBridgeInterfaceRemove (SCBridgeInterfaceRef bridge) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
750
751 /*!
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.
756 */
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));
759
760 /*!
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.
766 */
767 CFDictionaryRef
768 SCBridgeInterfaceGetOptions (SCBridgeInterfaceRef bridge) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
769
770 /*!
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.
776 */
777 Boolean
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));
781
782 /*!
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.
788 */
789 Boolean
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));
792
793 /*!
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.
799 */
800 Boolean
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));
803
804 #pragma mark -
805
806 /*!
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.
811 */
812 CFArrayRef
813 _SCBridgeInterfaceCopyActive (void) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
814
815 /*!
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.
821 */
822 Boolean
823 _SCBridgeInterfaceUpdateConfiguration (SCPreferencesRef prefs) API_AVAILABLE(macos(10.7)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
824
825
826 #pragma mark -
827 #pragma mark SCVLANInterface configuration (SPIs)
828
829 /*!
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.
834 */
835 CFArrayRef
836 _SCVLANInterfaceCopyActive (void) API_AVAILABLE(macos(10.5)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
837
838 /*!
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.
844 */
845 Boolean
846 _SCVLANInterfaceUpdateConfiguration (SCPreferencesRef prefs) API_AVAILABLE(macos(10.5)) SPI_AVAILABLE(ios(4.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
847
848
849 #pragma mark -
850 #pragma mark SCNetworkInterface Password SPIs
851
852
853 enum {
854 kSCNetworkInterfacePasswordTypePPP = 1,
855 kSCNetworkInterfacePasswordTypeIPSecSharedSecret,
856 kSCNetworkInterfacePasswordTypeEAPOL,
857 kSCNetworkInterfacePasswordTypeIPSecXAuth,
858 kSCNetworkInterfacePasswordTypeVPN,
859 };
860 typedef uint32_t SCNetworkInterfacePasswordType;
861
862 Boolean
863 SCNetworkInterfaceCheckPassword (SCNetworkInterfaceRef interface,
864 SCNetworkInterfacePasswordType passwordType) API_AVAILABLE(macos(10.5), ios(2.0));
865
866 CFDataRef
867 SCNetworkInterfaceCopyPassword (SCNetworkInterfaceRef interface,
868 SCNetworkInterfacePasswordType passwordType) API_AVAILABLE(macos(10.5), ios(2.0));
869
870 Boolean
871 SCNetworkInterfaceRemovePassword (SCNetworkInterfaceRef interface,
872 SCNetworkInterfacePasswordType passwordType) API_AVAILABLE(macos(10.5), ios(2.0));
873
874 Boolean
875 SCNetworkInterfaceSetPassword (SCNetworkInterfaceRef interface,
876 SCNetworkInterfacePasswordType passwordType,
877 CFDataRef password,
878 CFDictionaryRef options) API_AVAILABLE(macos(10.5), ios(2.0));
879
880
881 Boolean
882 SCNetworkInterfaceGetDisableUntilNeeded (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.11), ios(9.0));
883
884 Boolean
885 SCNetworkInterfaceSetDisableUntilNeeded (SCNetworkInterfaceRef interface,
886 Boolean disable) API_AVAILABLE(macos(10.11), ios(9.0));
887
888
889 CFDictionaryRef
890 SCNetworkInterfaceGetQoSMarkingPolicy (SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.13), ios(10.0));
891
892 Boolean
893 SCNetworkInterfaceSetQoSMarkingPolicy (SCNetworkInterfaceRef interface,
894 CFDictionaryRef policy) API_AVAILABLE(macos(10.13), ios(10.0));
895
896
897 #pragma mark -
898 #pragma mark SCNetworkProtocol configuration (SPI)
899
900
901 /*!
902 @group Protocol configuration
903 */
904
905
906 static __inline__ CFTypeRef
907 isA_SCNetworkProtocol(CFTypeRef obj)
908 {
909 return (isA_CFType(obj, SCNetworkProtocolGetTypeID()));
910 }
911
912 /*!
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.
919 */
920 CFComparisonResult
921 _SCNetworkProtocolCompare (const void *val1,
922 const void *val2,
923 void *context) API_AVAILABLE(macos(10.13), ios(11.0));
924
925
926 #pragma mark -
927 #pragma mark SCNetworkService configuration (SPI)
928
929
930 /*!
931 @group Service configuration
932 */
933
934
935 static __inline__ CFTypeRef
936 isA_SCNetworkService(CFTypeRef obj)
937 {
938 return (isA_CFType(obj, SCNetworkServiceGetTypeID()));
939 }
940
941 /*!
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.
948 */
949 CFComparisonResult
950 _SCNetworkServiceCompare (const void *val1,
951 const void *val2,
952 void *context) API_AVAILABLE(macos(10.7), ios(4.0));
953
954 /*!
955 @function _SCNetworkServiceCopyActive
956 @discussion Returns the network service with the specified identifier.
957
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.
968 */
969 SCNetworkServiceRef
970 _SCNetworkServiceCopyActive (SCDynamicStoreRef store,
971 CFStringRef serviceID) API_AVAILABLE(macos(10.6), ios(2.1));
972
973 /*!
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.
980 */
981 SCNetworkServicePrimaryRank
982 SCNetworkServiceGetPrimaryRank (SCNetworkServiceRef service) API_AVAILABLE(macos(10.6), ios(2.0));
983
984 /*!
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.
991
992 Notes : The kSCNetworkServicePrimaryRankFirst and kSCNetworkServicePrimaryRankLast
993 values can only valid as a transient setting.
994 */
995 Boolean
996 SCNetworkServiceSetPrimaryRank (SCNetworkServiceRef service,
997 SCNetworkServicePrimaryRank newRank) API_AVAILABLE(macos(10.6), ios(2.0));
998
999 /*!
1000 @function _SCNetworkServiceIsVPN
1001 @discussion Identifies a VPN service.
1002 @param service The network service.
1003 @result TRUE if the service is a VPN.
1004 */
1005 Boolean
1006 _SCNetworkServiceIsVPN (SCNetworkServiceRef service) API_AVAILABLE(macos(10.7), ios(4.0));
1007
1008 /*!
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.
1015 */
1016 Boolean
1017 SCNetworkServiceSetExternalID (SCNetworkServiceRef service,
1018 CFStringRef identifierDomain,
1019 CFStringRef identifier);
1020
1021 /*!
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.
1027 */
1028 CFStringRef
1029 SCNetworkServiceCopyExternalID (SCNetworkServiceRef service,
1030 CFStringRef identifierDomain);
1031
1032 /*!
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.
1038 */
1039 Boolean
1040 _SCNetworkServiceSetServiceID (SCNetworkServiceRef service,
1041 CFStringRef newServiceID) API_AVAILABLE(macos(10.10), ios(8.0));
1042
1043 #pragma mark -
1044 #pragma mark SCNetworkSet configuration (SPI)
1045
1046
1047 /*!
1048 @group Set configuration
1049 */
1050
1051
1052 static __inline__ CFTypeRef
1053 isA_SCNetworkSet(CFTypeRef obj)
1054 {
1055 return (isA_CFType(obj, SCNetworkSetGetTypeID()));
1056 }
1057
1058
1059 /*!
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.
1066 */
1067 CFComparisonResult
1068 _SCNetworkSetCompare (const void *val1,
1069 const void *val2,
1070 void *context) API_AVAILABLE(macos(10.13), ios(11.0));
1071
1072 /*!
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.
1079 */
1080 CFArrayRef
1081 SCNetworkSetCopyAvailableInterfaces (SCNetworkSetRef set) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1082
1083 /*!
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.
1089 */
1090 SCNetworkSetRef
1091 _SCNetworkSetCreateDefault (SCPreferencesRef prefs) API_AVAILABLE(macos(10.12)) SPI_AVAILABLE(ios(10.0), tvos(10.0), watchos(3.0), bridgeos(3.0));
1092
1093 /*!
1094 @function SCNetworkSetEstablishDefaultConfiguration
1095 @discussion Updates a network set by adding services for
1096 any network interface that is not currently
1097 represented.
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
1104 options.
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.
1108 */
1109 Boolean
1110 SCNetworkSetEstablishDefaultConfiguration (SCNetworkSetRef set) API_AVAILABLE(macos(10.5), ios(2.0));
1111
1112 /*!
1113 @function SCNetworkSetEstablishDefaultInterfaceConfiguration
1114 @discussion Updates a network set by adding services for
1115 the specified network interface if is not currently
1116 represented.
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
1123 options.
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.
1128 */
1129 Boolean
1130 SCNetworkSetEstablishDefaultInterfaceConfiguration (SCNetworkSetRef set,
1131 SCNetworkInterfaceRef interface) API_AVAILABLE(macos(10.5), ios(2.0));
1132
1133 /*!
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
1140 selected.
1141 You must release the returned value.
1142 */
1143 SCNetworkServiceRef
1144 SCNetworkSetCopySelectedVPNService (SCNetworkSetRef set) API_AVAILABLE(macos(10.7), ios(4.0));
1145
1146 /*!
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.
1154 */
1155 Boolean
1156 SCNetworkSetSetSelectedVPNService (SCNetworkSetRef set,
1157 SCNetworkServiceRef service) API_AVAILABLE(macos(10.7), ios(4.0));
1158
1159 Boolean
1160 _SCNetworkSetSetSetID (SCNetworkSetRef set,
1161 CFStringRef setID) API_AVAILABLE(macos(10.10), ios(8.0));
1162
1163 /*!
1164 @group VPN Service configuration
1165 */
1166
1167 #pragma mark -
1168 #pragma mark VPN Service configuration
1169
1170 typedef SCNetworkServiceRef VPNServiceRef;
1171
1172 /*!
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
1179 */
1180 CFArrayRef
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));
1184
1185 /*!
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.
1190 */
1191 CFArrayRef
1192 VPNServiceCopyAll (SCPreferencesRef prefs) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1193
1194 /*!
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.
1199 */
1200 CFArrayRef
1201 VPNServiceCopyAppRuleIDs (VPNServiceRef service) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1202
1203 /*!
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.
1215 */
1216 Boolean
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));
1220
1221 /*!
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.
1227 */
1228 CFDictionaryRef
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));
1231
1232 /*!
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.
1238 */
1239 Boolean
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));
1242
1243 /*!
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.
1248 */
1249 Boolean
1250 VPNServiceIsManagedAppVPN (VPNServiceRef service) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(7.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
1251
1252 /*!
1253 @group Migration SPI
1254 */
1255 #pragma mark -
1256 #pragma mark Migration SPI
1257
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));
1260
1261 extern const CFStringRef kSCNetworkConfigurationMigrationActionKey /* CFNumber */ API_AVAILABLE(macos(10.10), ios(8.0));
1262
1263 typedef CF_ENUM(uint32_t, SCNetworkConfigurationMigrationAction) {
1264 kSCNetworkConfigurationMigrationAction_CleanInstall = 0,
1265 kSCNetworkConfigurationMigrationAction_Upgrade = 1,
1266 kSCNetworkConfigurationMigrationAction_Restore = 2,
1267 };
1268
1269 /*!
1270 @function _SCNetworkConfigurationCopyMigrationPaths
1271 @result Returns an array of paths that we would need from the source
1272 */
1273 CFArrayRef
1274 _SCNetworkConfigurationCopyMigrationPaths(CFDictionaryRef options) API_AVAILABLE(macos(10.10), ios(8.0));
1275
1276 /*!
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.
1294 */
1295
1296 CF_RETURNS_RETAINED
1297 CFArrayRef
1298 _SCNetworkConfigurationPerformMigration (CFURLRef sourceDir,
1299 CFURLRef currentDir,
1300 CFURLRef targetDir,
1301 CFDictionaryRef options) API_AVAILABLE(macos(10.10), ios(8.0));
1302
1303
1304 /*!
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
1309 files are present
1310 @result TRUE if valid configurations are found
1311
1312 */
1313
1314 Boolean
1315 _SCNetworkConfigurationCheckValidity (CFURLRef configDir,
1316 CFDictionaryRef options) API_AVAILABLE(macos(10.10), ios(8.0));
1317
1318
1319 /*!
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
1325
1326 */
1327
1328 Boolean
1329 _SCNetworkConfigurationCheckValidityWithPreferences
1330 (SCPreferencesRef prefs,
1331 SCPreferencesRef ni_prefs,
1332 CFDictionaryRef options) API_AVAILABLE(macos(10.11), ios(9.0));
1333
1334
1335 /*!
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
1346
1347 */
1348
1349 Boolean
1350 _SCNetworkMigrationAreConfigurationsIdentical (CFURLRef configurationURL,
1351 CFURLRef expectedConfigurationURL) API_AVAILABLE(macos(10.10), ios(8.0));
1352
1353 /*!
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
1359
1360 */
1361
1362 CFArrayRef // of CFURLRef's
1363 _SCNetworkConfigurationCopyMigrationRemovePaths (CFArrayRef targetPaths,
1364 CFURLRef targetDir) API_AVAILABLE(macos(10.10), ios(8.0));
1365
1366 __END_DECLS
1367
1368 #endif /* _SCNETWORKCONFIGURATIONPRIVATE_H */