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