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