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