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