2 * Copyright (c) 2005-2013 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
24 #ifndef _SCNETWORKCONFIGURATIONPRIVATE_H
25 #define _SCNETWORKCONFIGURATIONPRIVATE_H
27 #include <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>
36 @header SCNetworkConfigurationPrivate
43 @group Interface configuration
47 #pragma mark SCNetworkInterface configuration (typedefs, consts, enums)
50 @const kSCNetworkInterfaceTypeBridge
52 extern const CFStringRef kSCNetworkInterfaceTypeBridge
__OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
55 @const kSCNetworkInterfaceTypeLoopback
57 extern const CFStringRef kSCNetworkInterfaceTypeLoopback
__OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
60 @const kSCNetworkInterfaceLoopback
61 @discussion A network interface representing the loopback
64 extern const SCNetworkInterfaceRef kSCNetworkInterfaceLoopback
__OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
67 @const kSCNetworkInterfaceTypeVPN
69 extern const CFStringRef kSCNetworkInterfaceTypeVPN
__OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
72 @group Interface configuration (Bridge)
76 @typedef SCBridgeInterfaceRef
77 @discussion This is the type of a reference to an object that represents
80 typedef SCNetworkInterfaceRef SCBridgeInterfaceRef
;
83 kSCNetworkServicePrimaryRankDefault
= 0,
84 kSCNetworkServicePrimaryRankFirst
= 1,
85 kSCNetworkServicePrimaryRankLast
= 2,
86 kSCNetworkServicePrimaryRankNever
= 3
88 typedef uint32_t SCNetworkServicePrimaryRank
;
91 #pragma mark SCNetworkInterface configuration (SPI)
94 @group Interface configuration
97 static __inline__ CFTypeRef
98 isA_SCNetworkInterface(CFTypeRef obj
)
100 return (isA_CFType(obj
, SCNetworkInterfaceGetTypeID()));
103 static __inline__ CFTypeRef
104 isA_SCBondInterface(CFTypeRef obj
)
106 CFStringRef interfaceType
;
108 if (!isA_SCNetworkInterface(obj
)) {
109 // if not an SCNetworkInterface
113 interfaceType
= SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef
)obj
);
114 if (!CFEqual(interfaceType
, kSCNetworkInterfaceTypeBond
)) {
122 static __inline__ CFTypeRef
123 isA_SCBridgeInterface(CFTypeRef obj
)
125 CFStringRef interfaceType
;
127 if (!isA_SCNetworkInterface(obj
)) {
128 // if not an SCNetworkInterface
132 interfaceType
= SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef
)obj
);
133 if (!CFEqual(interfaceType
, kSCNetworkInterfaceTypeBridge
)) {
141 static __inline__ CFTypeRef
142 isA_SCVLANInterface(CFTypeRef obj
)
144 CFStringRef interfaceType
;
146 if (!isA_SCNetworkInterface(obj
)) {
147 // if not an SCNetworkInterface
151 interfaceType
= SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef
)obj
);
152 if (!CFEqual(interfaceType
, kSCNetworkInterfaceTypeVLAN
)) {
161 @function _SCNetworkInterfaceCompare
162 @discussion Compares two SCNetworkInterface objects.
163 @param val1 The SCNetworkInterface object.
164 @param val2 The SCNetworkInterface object.
165 @param context Not used.
166 @result A comparison result.
169 _SCNetworkInterfaceCompare (const void *val1
,
171 void *context
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
174 @function _SCNetworkInterfaceCopyActive
175 @discussion Creates an SCNetworkInterface and associated with interface name
176 and SCDynamicStoreRef
177 @param the interface name
178 @param the SCDynamicStoreRef
179 @result the SCNetworkInterface
181 SCNetworkInterfaceRef
182 _SCNetworkInterfaceCopyActive (SCDynamicStoreRef store
,
183 CFStringRef bsdName
) __OSX_AVAILABLE_STARTING(__MAC_10_8
,__IPHONE_5_0
);
186 @function _SCNetworkInterfaceCopyAllWithPreferences
187 Returns all network capable interfaces on the system.
188 @param prefs The "preferences" session.
189 @result The list of interfaces on the system.
190 You must release the returned value.
192 CFArrayRef
/* of SCNetworkInterfaceRef's */
193 _SCNetworkInterfaceCopyAllWithPreferences (SCPreferencesRef prefs
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_5_0
/*SPI*/);
196 @function _SCNetworkInterfaceCopyBTPANInterface
197 @discussion Returns the SCNetworkInterface associated with the BT-PAN interface
198 @result The BT-PAN interface; NULL if the interface is not (yet) known.
200 SCNetworkInterfaceRef
201 _SCNetworkInterfaceCopyBTPANInterface (void) __OSX_AVAILABLE_STARTING(__MAC_10_8
/*FIXME*/,__IPHONE_NA
);
204 @function _SCNetworkInterfaceCopySlashDevPath
205 @discussion Returns the /dev pathname for the interface.
206 @param interface The network interface.
207 @result The /dev pathname associated with the interface (e.g. "/dev/modem");
208 NULL if no path is available.
211 _SCNetworkInterfaceCopySlashDevPath (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_3_0
);
213 #define kIncludeNoVirtualInterfaces 0x0
214 #define kIncludeVLANInterfaces 0x1
215 #define kIncludeBondInterfaces 0x2
216 #define kIncludeBridgeInterfaces 0x4
217 #define kIncludeAllVirtualInterfaces 0xffffffff
220 @function _SCNetworkInterfaceCreateWithBSDName
221 @discussion Create a new network interface associated with the provided
222 BSD interface name. This API supports Ethernet, FireWire, and
223 IEEE 802.11 interfaces.
224 @param bsdName The BSD interface name.
225 @param flags Indicates whether virtual (Bond, Bridge, VLAN)
226 network interfaces should be included.
227 @result A reference to the new SCNetworkInterface.
228 You must release the returned value.
230 SCNetworkInterfaceRef
231 _SCNetworkInterfaceCreateWithBSDName (CFAllocatorRef allocator
,
233 UInt32 flags
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
236 @function _SCNetworkInterfaceCreateWithEntity
237 @discussion Create a new network interface associated with the provided
238 SCDynamicStore service entity dictionary.
239 @param interface_entity The entity dictionary.
240 @param service The network service.
241 @result A reference to the new SCNetworkInterface.
242 You must release the returned value.
244 SCNetworkInterfaceRef
245 _SCNetworkInterfaceCreateWithEntity (CFAllocatorRef allocator
,
246 CFDictionaryRef interface_entity
,
247 SCNetworkServiceRef service
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
250 @function _SCNetworkInterfaceCreateWithIONetworkInterfaceObject
251 @discussion Create a new network interface associated with the provided
252 IORegistry "IONetworkInterface" object.
253 @param if_obj The IONetworkInterface object.
254 @result A reference to the new SCNetworkInterface.
255 You must release the returned value.
257 SCNetworkInterfaceRef
258 _SCNetworkInterfaceCreateWithIONetworkInterfaceObject (io_object_t if_obj
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
261 @function SCNetworkInterfaceGetPrimaryRank
262 @discussion We allow caller to retrieve the rank on an interface.
263 The key is stored in State:/Network/Interface/<ifname>/Service
264 @param the interface to get the rank
265 @result SCNetworkServicePrimaryRank
267 SCNetworkServicePrimaryRank
268 SCNetworkInterfaceGetPrimaryRank (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_8
,__IPHONE_5_0
);
271 @function SCNetworkInterfaceSetPrimaryRank
272 @discussion We allow caller to set an assertion on an interface.
273 @param the interface to set the rank assertion
274 @param the new rank to be set
275 @result TRUE if operation is successful; FALSE if an error was encountered.
278 SCNetworkInterfaceSetPrimaryRank (SCNetworkInterfaceRef interface
,
279 SCNetworkServicePrimaryRank newRank
) __OSX_AVAILABLE_STARTING(__MAC_10_8
,__IPHONE_5_0
);
281 #define kSCNetworkInterfaceConfigurationActionKey CFSTR("New Interface Detected Action")
282 #define kSCNetworkInterfaceConfigurationActionValueNone CFSTR("None")
283 #define kSCNetworkInterfaceConfigurationActionValuePrompt CFSTR("Prompt")
284 #define kSCNetworkInterfaceConfigurationActionValueConfigure CFSTR("Configure")
286 #define kSCNetworkInterfaceNetworkConfigurationOverridesKey CFSTR("NetworkConfigurationOverrides")
287 #define kSCNetworkInterfaceHiddenConfigurationKey CFSTR("HiddenConfiguration")
288 #define kSCNetworkInterfaceHiddenPortKey CFSTR("HiddenPort")
290 // IORegistry property to indicate that a [WWAN] interface is not yet ready
291 #define kSCNetworkInterfaceInitializingKey CFSTR("Initializing")
294 @function _SCNetworkInterfaceCopyInterfaceInfo
295 @discussion Returns interface details
296 @param interface The network interface.
297 @result A dictionary with details about the network interface.
300 _SCNetworkInterfaceCopyInterfaceInfo (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_3_0
);
303 @function _SCNetworkInterfaceGetConfigurationAction
304 @discussion Returns a user-notification / auto-configuration action for the interface.
305 @param interface The network interface.
306 @result The user-notification / auto-configuration action;
307 NULL if the default action should be used.
310 _SCNetworkInterfaceGetConfigurationAction (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_2_0
);
313 @function _SCNetworkInterfaceGetHardwareAddress
314 @discussion Returns a link layer address for the interface.
315 @param interface The network interface.
316 @result The hardware (MAC) address for the interface.
317 NULL if no hardware address is available.
320 _SCNetworkInterfaceGetHardwareAddress (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
323 @function _SCNetworkInterfaceGetIOInterfaceNamePrefix
324 @discussion Returns the IOInterfaceNamePrefix for the interface.
325 @param interface The network interface.
326 @result The IOInterfaceNamePrefix associated with the interface;
327 NULL if no IOInterfaceNamePrefix is available.
330 _SCNetworkInterfaceGetIOInterfaceNamePrefix (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_8
,__IPHONE_6_0
);
333 @function _SCNetworkInterfaceGetIOInterfaceType
334 @discussion Returns the IOInterfaceType for the interface.
335 @param interface The network interface.
336 @result The IOInterfaceType associated with the interface
339 _SCNetworkInterfaceGetIOInterfaceType (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
342 @function _SCNetworkInterfaceGetIOInterfaceUnit
343 @discussion Returns the IOInterfaceUnit for the interface.
344 @param interface The network interface.
345 @result The IOInterfaceUnit associated with the interface;
346 NULL if no IOInterfaceUnit is available.
349 _SCNetworkInterfaceGetIOInterfaceUnit (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
352 @function _SCNetworkInterfaceGetIOPath
353 @discussion Returns the IOPath for the interface.
354 @param interface The network interface.
355 @result The IOPath associated with the interface;
356 NULL if no IOPath is available.
359 _SCNetworkInterfaceGetIOPath (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
362 @function _SCNetworkInterfaceGetIORegistryEntryID
363 @discussion Returns the IORegistry entry ID for the interface.
364 @param interface The network interface.
365 @result The IORegistry entry ID associated with the interface;
366 Zero if no entry ID is available.
369 _SCNetworkInterfaceGetIORegistryEntryID (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_8
,__IPHONE_5_0
);
372 @function _SCNetworkInterfaceIsBluetoothPAN
373 @discussion Identifies if a network interface is a Bluetooth PAN (GN) device.
374 @param interface The network interface.
375 @result TRUE if the interface is a Bluetooth PAN device.
378 _SCNetworkInterfaceIsBluetoothPAN (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_3_0
);
381 @function _SCNetworkInterfaceIsBluetoothPAN_NAP
382 @discussion Identifies if a network interface is a Bluetooth PAN-NAP device.
383 @param interface The network interface.
384 @result TRUE if the interface is a Bluetooth PAN-NAP device.
387 _SCNetworkInterfaceIsBluetoothPAN_NAP (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_5_0
);
390 @function _SCNetworkInterfaceIsBluetoothP2P
391 @discussion Identifies if a network interface is a Bluetooth P2P (PAN-U) device.
392 @param interface The network interface.
393 @result TRUE if the interface is a Bluetooth P2P device.
396 _SCNetworkInterfaceIsBluetoothP2P (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_5_0
);
399 @function _SCNetworkInterfaceIsBuiltin
400 @discussion Identifies if a network interface is "built-in".
401 @param interface The network interface.
402 @result TRUE if the interface is "built-in".
405 _SCNetworkInterfaceIsBuiltin (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
408 @function _SCNetworkInterfaceIsHiddenConfiguration
409 @discussion Identifies if the configuration of a network interface should be
410 hidden from any user interface (e.g. the "Network" pref pane).
411 @param interface The network interface.
412 @result TRUE if the interface configuration should be hidden.
415 _SCNetworkInterfaceIsHiddenConfiguration (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
);
418 @function _SCNetworkInterfaceIsModemV92
419 @discussion Identifies if a modem network interface supports
421 @param interface The network interface.
422 @result TRUE if the interface is "v.92" modem.
425 _SCNetworkInterfaceIsModemV92 (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
428 @function _SCNetworkInterfaceIsTethered
429 @discussion Identifies if a network interface is an Apple tethered device (e.g. an iPhone).
430 @param interface The network interface.
431 @result TRUE if the interface is a tethered device.
434 _SCNetworkInterfaceIsTethered (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_3_0
);
437 @function _SCNetworkInterfaceIsThunderbolt
438 @discussion Identifies if a network interface is a Thunderbolt device
439 @param interface The network interface.
440 @result TRUE if the interface is a Thunderbolt device.
443 _SCNetworkInterfaceIsThunderbolt (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_9
,__IPHONE_7_0
);
446 @function _SCNetworkInterfaceIsPhysicalEthernet
447 @discussion Indicates whether a network interface is a real ethernet interface i.e. one with an ethernet PHY.
448 @param interface The network interface.
449 @result TRUE if the interface is a real ethernet interface.
452 _SCNetworkInterfaceIsPhysicalEthernet (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_5_0
);
455 @function _SCNetworkInterfaceForceConfigurationRefresh
456 @discussion Forces a configuration refresh of the
458 @param ifName Network interface name.
459 @result TRUE if the refresh was successfully posted.
462 _SCNetworkInterfaceForceConfigurationRefresh (CFStringRef ifName
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
465 @function SCNetworkInterfaceCopyCapability
466 @discussion For the specified network interface, returns information
467 about the currently requested capabilities, the active capabilities,
468 and the capabilities which are available.
469 @param interface The desired network interface.
470 @param capability The desired capability.
471 @result a CFTypeRef representing the current value of requested
473 NULL if the capability is not available for this
474 interface or if an error was encountered.
475 You must release the returned value.
478 SCNetworkInterfaceCopyCapability (SCNetworkInterfaceRef interface
,
479 CFStringRef capability
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_5_0
/*SPI*/);
482 @function SCNetworkInterfaceSetCapability
483 @discussion For the specified network interface, sets the requested
485 @param interface The desired network interface.
486 @param capability The desired capability.
487 @param newValue The new requested setting for the capability;
488 NULL to restore the default setting.
489 @result TRUE if the configuration was updated; FALSE if an error was encountered.
492 SCNetworkInterfaceSetCapability (SCNetworkInterfaceRef interface
,
493 CFStringRef capability
,
494 CFTypeRef newValue
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_5_0
/*SPI*/);
497 #pragma mark SCBondInterface configuration (SPIs)
500 @function _SCBondInterfaceCopyActive
501 @discussion Returns all Ethernet Bond interfaces on the system.
502 @result The list of SCBondInterface interfaces on the system.
503 You must release the returned value.
506 _SCBondInterfaceCopyActive (void) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_4_0
/*SPI*/);
509 @function _SCBondInterfaceUpdateConfiguration
510 @discussion Updates the bond interface configuration.
511 @param prefs The "preferences" session.
512 @result TRUE if the bond interface configuration was updated.; FALSE if the
513 an error was encountered.
516 _SCBondInterfaceUpdateConfiguration (SCPreferencesRef prefs
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_4_0
/*SPI*/);
519 @function SCBondInterfaceGetMode
520 @discussion Return the mode for the given bond interface.
521 @param bond The bond interface to get the mode from.
522 @result A CFNumberRef containing the mode (IF_BOND_MODE_{LACP,STATIC}).
525 SCBondInterfaceGetMode (SCBondInterfaceRef bond
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_4_0
/*SPI*/);
528 @function SCBondInterfaceSetMode
529 @discussion Set the mode on the bond interface.
530 @param bond The bond interface on which to adjust the mode.
531 @param mode The mode value (0=IF_BOND_MODE_LACP,1=IF_BOND_MODE_STATIC)
532 @result TRUE if operation succeeded.
535 SCBondInterfaceSetMode (SCBondInterfaceRef bond
,
536 CFNumberRef mode
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_4_0
/*SPI*/);
539 #pragma mark SCBridgeInterface configuration (SPIs)
542 @function SCBridgeInterfaceCopyAll
543 @discussion Returns all bridge interfaces on the system.
544 @param prefs The "preferences" session.
545 @result The list of bridge interfaces on the system.
546 You must release the returned value.
548 CFArrayRef
/* of SCBridgeInterfaceRef's */
549 SCBridgeInterfaceCopyAll (SCPreferencesRef prefs
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
552 @function SCBridgeInterfaceCopyAvailableMemberInterfaces
553 @discussion Returns all network capable devices on the system
554 that can be added to an bridge interface.
555 @param prefs The "preferences" session.
556 @result The list of interfaces.
557 You must release the returned value.
559 CFArrayRef
/* of SCNetworkInterfaceRef's */
560 SCBridgeInterfaceCopyAvailableMemberInterfaces (SCPreferencesRef prefs
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
563 @function SCBridgeInterfaceCreate
564 @discussion Create a new SCBridgeInterface interface.
565 @param prefs The "preferences" session.
566 @result A reference to the new SCBridgeInterface.
567 You must release the returned value.
570 SCBridgeInterfaceCreate (SCPreferencesRef prefs
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
573 @function SCBridgeInterfaceRemove
574 @discussion Removes the SCBridgeInterface from the configuration.
575 @param bridge The SCBridgeInterface interface.
576 @result TRUE if the interface was removed; FALSE if an error was encountered.
579 SCBridgeInterfaceRemove (SCBridgeInterfaceRef bridge
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
582 @function SCBridgeInterfaceGetMemberInterfaces
583 @discussion Returns the member interfaces for the specified bridge interface.
584 @param bridge The SCBridgeInterface interface.
585 @result The list of interfaces.
587 CFArrayRef
/* of SCNetworkInterfaceRef's */
588 SCBridgeInterfaceGetMemberInterfaces (SCBridgeInterfaceRef bridge
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
591 @function SCBridgeInterfaceGetOptions
592 @discussion Returns the configuration settings associated with a bridge interface.
593 @param bridge The SCBridgeInterface interface.
594 @result The configuration settings associated with the bridge interface;
595 NULL if no changes to the default configuration have been saved.
598 SCBridgeInterfaceGetOptions (SCBridgeInterfaceRef bridge
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
601 @function SCBridgeInterfaceSetMemberInterfaces
602 @discussion Sets the member interfaces for the specified bridge interface.
603 @param bridge The SCBridgeInterface interface.
604 @param members The desired member interfaces.
605 @result TRUE if the configuration was stored; FALSE if an error was encountered.
608 SCBridgeInterfaceSetMemberInterfaces (SCBridgeInterfaceRef bridge
,
609 CFArrayRef members
) /* of SCNetworkInterfaceRef's */
610 __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
613 @function SCBridgeInterfaceSetLocalizedDisplayName
614 @discussion Sets the localized display name for the specified bridge interface.
615 @param bridge The SCBridgeInterface interface.
616 @param newName The new display name.
617 @result TRUE if the configuration was stored; FALSE if an error was encountered.
620 SCBridgeInterfaceSetLocalizedDisplayName (SCBridgeInterfaceRef bridge
,
621 CFStringRef newName
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
624 @function SCBridgeInterfaceSetOptions
625 @discussion Sets the configuration settings for the specified bridge interface.
626 @param bridge The SCBridgeInterface interface.
627 @param newOptions The new configuration settings.
628 @result TRUE if the configuration was stored; FALSE if an error was encountered.
631 SCBridgeInterfaceSetOptions (SCBridgeInterfaceRef bridge
,
632 CFDictionaryRef newOptions
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
637 @function _SCBridgeInterfaceCopyActive
638 @discussion Returns all bridge interfaces on the system.
639 @result The list of SCBridgeInterface interfaces on the system.
640 You must release the returned value.
643 _SCBridgeInterfaceCopyActive (void) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
646 @function _SCBridgeInterfaceUpdateConfiguration
647 @discussion Updates the bridge interface configuration.
648 @param prefs The "preferences" session.
649 @result TRUE if the bridge interface configuration was updated.; FALSE if the
650 an error was encountered.
653 _SCBridgeInterfaceUpdateConfiguration (SCPreferencesRef prefs
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
657 #pragma mark SCVLANInterface configuration (SPIs)
660 @function _SCVLANInterfaceCopyActive
661 @discussion Returns all VLAN interfaces on the system.
662 @result The list of SCVLANInterface interfaces on the system.
663 You must release the returned value.
666 _SCVLANInterfaceCopyActive (void) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_4_0
/*SPI*/);
669 @function _SCVLANInterfaceUpdateConfiguration
670 @discussion Updates the VLAN interface configuration.
671 @param prefs The "preferences" session.
672 @result TRUE if the VLAN interface configuration was updated.; FALSE if the
673 an error was encountered.
676 _SCVLANInterfaceUpdateConfiguration (SCPreferencesRef prefs
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_4_0
/*SPI*/);
680 #pragma mark SCNetworkInterface Password SPIs
684 kSCNetworkInterfacePasswordTypePPP
= 1,
685 kSCNetworkInterfacePasswordTypeIPSecSharedSecret
,
686 kSCNetworkInterfacePasswordTypeEAPOL
,
687 kSCNetworkInterfacePasswordTypeIPSecXAuth
,
688 kSCNetworkInterfacePasswordTypeVPN
,
690 typedef uint32_t SCNetworkInterfacePasswordType
;
693 SCNetworkInterfaceCheckPassword (SCNetworkInterfaceRef interface
,
694 SCNetworkInterfacePasswordType passwordType
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
697 SCNetworkInterfaceCopyPassword (SCNetworkInterfaceRef interface
,
698 SCNetworkInterfacePasswordType passwordType
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
701 SCNetworkInterfaceRemovePassword (SCNetworkInterfaceRef interface
,
702 SCNetworkInterfacePasswordType passwordType
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
705 SCNetworkInterfaceSetPassword (SCNetworkInterfaceRef interface
,
706 SCNetworkInterfacePasswordType passwordType
,
708 CFDictionaryRef options
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
712 #pragma mark SCNetworkProtocol configuration (SPI)
716 @group Protocol configuration
720 static __inline__ CFTypeRef
721 isA_SCNetworkProtocol(CFTypeRef obj
)
723 return (isA_CFType(obj
, SCNetworkProtocolGetTypeID()));
728 #pragma mark SCNetworkService configuration (SPI)
732 @group Service configuration
736 static __inline__ CFTypeRef
737 isA_SCNetworkService(CFTypeRef obj
)
739 return (isA_CFType(obj
, SCNetworkServiceGetTypeID()));
743 @function _SCNetworkServiceCompare
744 @discussion Compares two SCNetworkService objects.
745 @param val1 The SCNetworkService object.
746 @param val2 The SCNetworkService object.
747 @param context The service order (from SCNetworkSetGetServiceOrder).
748 @result A comparison result.
751 _SCNetworkServiceCompare (const void *val1
,
753 void *context
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
);
756 @function _SCNetworkServiceCopyActive
757 @discussion Returns the network service with the specified identifier.
759 Note: The service returned by this SPI differs from the SCNetworkServiceCopy
760 API in that queries and operations interact with the "active" service
761 represented in the SCDynamicStore. Only a limited subset of the
762 SCNetworkService APIs are supported.
763 @param prefs The dynamic store session.
764 @param serviceID The unique identifier for the service.
765 @result A reference to the SCNetworkService represented in the SCDynamicStore;
766 NULL if the serviceID does not exist in the SCDynamicStore or if an
767 error was encountered.
768 You must release the returned value.
771 _SCNetworkServiceCopyActive (SCDynamicStoreRef store
,
772 CFStringRef serviceID
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_2_1
);
775 @function SCNetworkServiceGetPrimaryRank
776 @discussion Returns the primary service rank associated with a service.
777 @param service The network service.
778 @result The primary service rank associated with the specified application;
779 kSCNetworkServicePrimaryRankDefault if no rank is associated with the
780 application or an error was encountered.
782 SCNetworkServicePrimaryRank
783 SCNetworkServiceGetPrimaryRank (SCNetworkServiceRef service
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_2_0
);
786 @function SCNetworkServiceSetPrimaryRank
787 @discussion Updates the the primary service rank associated with a service.
788 @param service The network service.
789 @param newRank The new primary service rank; kSCNetworkServicePrimaryRankDefault
790 if the default service rank should be used.
791 @result TRUE if the rank was stored; FALSE if an error was encountered.
793 Notes : The kSCNetworkServicePrimaryRankFirst and kSCNetworkServicePrimaryRankLast
794 values can only valid as a transient setting.
797 SCNetworkServiceSetPrimaryRank (SCNetworkServiceRef service
,
798 SCNetworkServicePrimaryRank newRank
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_2_0
);
801 @function _SCNetworkServiceIsVPN
802 @discussion Identifies a VPN service.
803 @param service The network service.
804 @result TRUE if the service is a VPN.
807 _SCNetworkServiceIsVPN (SCNetworkServiceRef service
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
);
810 @function SCNetworkServiceSetExternalID
811 @discussion Set the external identifier for a network service.
812 @param service A reference to the network service.
813 @param identifierDomain A service can have multiple external identifiers. This string specifies which external identifier to set.
814 @param identifier The new external identifier to assign to the network service.
815 @result Returns TRUE if the external identifier was set successfully, FALSE if an error occurred.
818 SCNetworkServiceSetExternalID (SCNetworkServiceRef service
,
819 CFStringRef identifierDomain
,
820 CFStringRef identifier
);
823 @function SCNetworkServiceCopyExternalID
824 @discussion Copy the external identifier for a network service.
825 @param service The network service.
826 @param identifierDomain A service can have multiple external identifiers. This string specifies which external identifier to copy.
827 @result Returns the service's external identifier, or NULL if the service does not have an external identifier in the given domain.
830 SCNetworkServiceCopyExternalID (SCNetworkServiceRef service
,
831 CFStringRef identifierDomain
);
834 #pragma mark SCNetworkSet configuration (SPI)
838 @group Set configuration
842 static __inline__ CFTypeRef
843 isA_SCNetworkSet(CFTypeRef obj
)
845 return (isA_CFType(obj
, SCNetworkSetGetTypeID()));
850 @function SCNetworkSetCopyAvailableInterfaces
851 @discussion Returns all available interfaces for the set.
852 The interfaces excludes those of bond and bridge members.
853 @param set The network set.
854 @result The list of SCNetworkInterfaces.
855 You must release the returned value.
858 SCNetworkSetCopyAvailableInterfaces (SCNetworkSetRef set
) __OSX_AVAILABLE_STARTING(__MAC_10_9
,__IPHONE_7_0
/*SPI*/);
861 @function SCNetworkSetEstablishDefaultConfiguration
862 @discussion Updates a network set by adding services for
863 any network interface that is not currently
865 If the provided set contains one (or more) services, new
866 services will only be added for those interfaces that are
867 not represented in *any* set.
868 Otherwise, new services will be added for those interfaces
869 that are not represented in the provided set.
870 The new services are established with "default" configuration
872 @param set The network set.
873 @result TRUE if the configuration was updated; FALSE if no
874 changes were required or if an error was encountered.
877 SCNetworkSetEstablishDefaultConfiguration (SCNetworkSetRef set
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
880 @function SCNetworkSetEstablishDefaultInterfaceConfiguration
881 @discussion Updates a network set by adding services for
882 the specified network interface if is not currently
884 If the provided set contains one (or more) services, new
885 services will only be added for interfaces that are not
886 represented in *any* set.
887 Otherwise, new services will be added for interfaces that
888 are not represented in the provided set.
889 The new services are established with "default" configuration
891 @param set The network set.
892 @param interface The network interface.
893 @result TRUE if the configuration was updated; FALSE if no
894 changes were required or if an error was encountered.
897 SCNetworkSetEstablishDefaultInterfaceConfiguration (SCNetworkSetRef set
,
898 SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
901 @function SCNetworkSetCopySelectedVPNService
902 @discussion On the iPhone we only allow a single VPN network service
903 to be selected at any given time. This API will identify
904 the selected VPN service.
905 @param set The network set.
906 @result The selected VPN service; NULL if no service has been
908 You must release the returned value.
911 SCNetworkSetCopySelectedVPNService (SCNetworkSetRef set
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
);
914 @function SCNetworkSetSetSelectedVPNService
915 @discussion On the iPhone we only allow a single VPN network service
916 to be selected at any given time. This API should be used to
917 select a VPN service.
918 @param set The network set.
919 @param service The VPN service to be selected.
920 @result TRUE if the name was saved; FALSE if an error was encountered.
923 SCNetworkSetSetSelectedVPNService (SCNetworkSetRef set
,
924 SCNetworkServiceRef service
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
);
927 @group VPN Service configuration
931 #pragma mark VPN Service configuration
933 typedef SCNetworkServiceRef VPNServiceRef
;
936 @function VPNServiceCopyAllMatchingExternalID
937 @discussion Copy the VPN services with the given external identifier.
938 @param prefs A reference to the prefs where the VPN services are stored.
939 @param identifierDomain A service can have multiple external identifiers. This string specifies which one to match with the given identifier.
940 @param identifier The external identifier of the desired services.
941 @result A array of references to the VPN services with the given identifier, or NULL if no such service exists
944 VPNServiceCopyAllMatchingExternalID (SCPreferencesRef prefs
,
945 CFStringRef identifierDomain
,
946 CFStringRef identifier
) __OSX_AVAILABLE_STARTING(__MAC_10_9
,__IPHONE_7_0
/*SPI*/);
949 @function VPNServiceCopyAll
950 @discussion Copy all VPN services.
951 @param prefs A reference to the prefs where the VPN services are stored.
952 @result An array containing VPNServiceRefs for all the VPN services.
955 VPNServiceCopyAll (SCPreferencesRef prefs
) __OSX_AVAILABLE_STARTING(__MAC_10_9
,__IPHONE_7_0
/*SPI*/);
958 @function VPNServiceCopyAppRuleIDs
959 @discussion Copy all the app rule identifiers for a VPN service.
960 @param service A reference to the VPN service.
961 @result An array of CFStringRefs, each string containing the identifier of a app rule in the given service.
964 VPNServiceCopyAppRuleIDs (VPNServiceRef service
) __OSX_AVAILABLE_STARTING(__MAC_10_9
,__IPHONE_7_0
/*SPI*/);
967 @function VPNServiceSetAppRule
968 @discussion Add or modify an app rule in a VPN service. The ruleSettings dictionary must contain one of the following keys:
969 <pre>kSCValNetVPNAppRuleExecutableMatch</pre>
970 <pre>kSCValNetVPNAppRuleAccountIdentifierMatch</pre>
971 The ruleSettings dictionary may also contain the following keys:
972 <pre>kSCValNetVPNAppRuleDNSDomainMatch</pre>
973 See SCSchemaDefinitionsPrivate.h for more details.
974 @param service A reference to the VPN service.
975 @param ruleIdentifier The identifier of the new app rule.
976 @param ruleSettings The settings for the new app rule. See the dictionary keys defined above.
977 @result TRUE if the app rule was set successfully, FALSE if an error occurred.
980 VPNServiceSetAppRule (VPNServiceRef service
,
981 CFStringRef ruleIdentifier
,
982 CFDictionaryRef ruleSettings
) __OSX_AVAILABLE_STARTING(__MAC_10_9
,__IPHONE_7_0
/*SPI*/);
985 @function VPNServiceCopyAppRule
986 @discussion Copy the settings for a app rule in a VPN service.
987 @param service The app tunnel service.
988 @param ruleIdentifier The ID of the app rule.
989 @result The rule settings, or NULL if the app rule could not be found.
992 VPNServiceCopyAppRule (VPNServiceRef service
,
993 CFStringRef ruleIdentifier
) __OSX_AVAILABLE_STARTING(__MAC_10_9
,__IPHONE_7_0
/*SPI*/);
996 @function VPNServiceRemoveAppRule
997 @discussion Remove an app rule from a VPN service.
998 @param service The VPN service.
999 @param ruleIdentifier The ID of the app rule to remove.
1000 @result Returns TRUE if the app rule was removed successfully; FALSE otherwise.
1003 VPNServiceRemoveAppRule (VPNServiceRef service
,
1004 CFStringRef ruleIdentifier
) __OSX_AVAILABLE_STARTING(__MAC_10_9
,__IPHONE_7_0
/*SPI*/);
1007 #endif /* _SCNETWORKCONFIGURATIONPRIVATE_H */