2 * Copyright (c) 2005-2011 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)
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 #pragma mark SCNetworkInterface configuration (SPI)
86 @group Interface configuration
89 static __inline__ CFTypeRef
90 isA_SCNetworkInterface(CFTypeRef obj
)
92 return (isA_CFType(obj
, SCNetworkInterfaceGetTypeID()));
95 static __inline__ CFTypeRef
96 isA_SCBondInterface(CFTypeRef obj
)
98 CFStringRef interfaceType
;
100 if (!isA_SCNetworkInterface(obj
)) {
101 // if not an SCNetworkInterface
105 interfaceType
= SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef
)obj
);
106 if (!CFEqual(interfaceType
, kSCNetworkInterfaceTypeBond
)) {
114 static __inline__ CFTypeRef
115 isA_SCBridgeInterface(CFTypeRef obj
)
117 CFStringRef interfaceType
;
119 if (!isA_SCNetworkInterface(obj
)) {
120 // if not an SCNetworkInterface
124 interfaceType
= SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef
)obj
);
125 if (!CFEqual(interfaceType
, kSCNetworkInterfaceTypeBridge
)) {
133 static __inline__ CFTypeRef
134 isA_SCVLANInterface(CFTypeRef obj
)
136 CFStringRef interfaceType
;
138 if (!isA_SCNetworkInterface(obj
)) {
139 // if not an SCNetworkInterface
143 interfaceType
= SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef
)obj
);
144 if (!CFEqual(interfaceType
, kSCNetworkInterfaceTypeVLAN
)) {
153 @function _SCNetworkInterfaceCompare
154 @discussion Compares two SCNetworkInterface objects.
155 @param val1 The SCNetworkInterface object.
156 @param val2 The SCNetworkInterface object.
157 @param context Not used.
158 @result A comparison result.
161 _SCNetworkInterfaceCompare (const void *val1
,
163 void *context
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
166 @function _SCNetworkInterfaceCopyAllWithPreferences
167 Returns all network capable interfaces on the system.
168 @param prefs The "preferences" session.
169 @result The list of interfaces on the system.
170 You must release the returned value.
172 CFArrayRef
/* of SCNetworkInterfaceRef's */
173 _SCNetworkInterfaceCopyAllWithPreferences (SCPreferencesRef prefs
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_5_0
/*SPI*/);
176 @function _SCNetworkInterfaceCopySlashDevPath
177 @discussion Returns the /dev pathname for the interface.
178 @param interface The network interface.
179 @result The /dev pathname associated with the interface (e.g. "/dev/modem");
180 NULL if no path is available.
183 _SCNetworkInterfaceCopySlashDevPath (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_3_0
);
185 #define kIncludeNoVirtualInterfaces 0x0
186 #define kIncludeVLANInterfaces 0x1
187 #define kIncludeBondInterfaces 0x2
188 #define kIncludeBridgeInterfaces 0x4
189 #define kIncludeAllVirtualInterfaces 0xffffffff
192 @function _SCNetworkInterfaceCreateWithBSDName
193 @discussion Create a new network interface associated with the provided
194 BSD interface name. This API supports Ethernet, FireWire, and
195 IEEE 802.11 interfaces.
196 @param bsdName The BSD interface name.
197 @param flags Indicates whether virtual (Bond, Bridge, VLAN)
198 network interfaces should be included.
199 @result A reference to the new SCNetworkInterface.
200 You must release the returned value.
202 SCNetworkInterfaceRef
203 _SCNetworkInterfaceCreateWithBSDName (CFAllocatorRef allocator
,
205 UInt32 flags
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
208 @function _SCNetworkInterfaceCreateWithEntity
209 @discussion Create a new network interface associated with the provided
210 SCDynamicStore service entity dictionary.
211 @param interface_entity The entity dictionary.
212 @param service The network service.
213 @result A reference to the new SCNetworkInterface.
214 You must release the returned value.
216 SCNetworkInterfaceRef
217 _SCNetworkInterfaceCreateWithEntity (CFAllocatorRef allocator
,
218 CFDictionaryRef interface_entity
,
219 SCNetworkServiceRef service
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
222 @function _SCNetworkInterfaceCreateWithIONetworkInterfaceObject
223 @discussion Create a new network interface associated with the provided
224 IORegistry "IONetworkInterface" object.
225 @param if_obj The IONetworkInterface object.
226 @result A reference to the new SCNetworkInterface.
227 You must release the returned value.
229 SCNetworkInterfaceRef
230 _SCNetworkInterfaceCreateWithIONetworkInterfaceObject (io_object_t if_obj
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
232 #define kSCNetworkInterfaceConfigurationActionKey CFSTR("New Interface Detected Action")
233 #define kSCNetworkInterfaceConfigurationActionValueNone CFSTR("None")
234 #define kSCNetworkInterfaceConfigurationActionValuePrompt CFSTR("Prompt")
235 #define kSCNetworkInterfaceConfigurationActionValueConfigure CFSTR("Configure")
237 #define kSCNetworkInterfaceNetworkConfigurationOverridesKey CFSTR("NetworkConfigurationOverrides")
238 #define kSCNetworkInterfaceHiddenConfigurationKey CFSTR("HiddenConfiguration")
239 #define kSCNetworkInterfaceHiddenPortKey CFSTR("HiddenPort")
241 // IORegistry property to indicate that a [WWAN] interface is not yet ready
242 #define kSCNetworkInterfaceInitializingKey CFSTR("Initializing")
245 @function _SCNetworkInterfaceCopyInterfaceInfo
246 @discussion Returns interface details
247 @param interface The network interface.
248 @result A dictionary with details about the network interface.
251 _SCNetworkInterfaceCopyInterfaceInfo (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_3_0
);
254 @function _SCNetworkInterfaceGetConfigurationAction
255 @discussion Returns a user-notification / auto-configuration action for the interface.
256 @param interface The network interface.
257 @result The user-notification / auto-configuration action;
258 NULL if the default action should be used.
261 _SCNetworkInterfaceGetConfigurationAction (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_2_0
);
264 @function _SCNetworkInterfaceGetHardwareAddress
265 @discussion Returns a link layer address for the interface.
266 @param interface The network interface.
267 @result The hardware (MAC) address for the interface.
268 NULL if no hardware address is available.
271 _SCNetworkInterfaceGetHardwareAddress (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
274 @function _SCNetworkInterfaceGetIOInterfaceType
275 @discussion Returns the IOInterfaceType for the interface.
276 @param interface The network interface.
277 @result The IOInterfaceType associated with the interface
280 _SCNetworkInterfaceGetIOInterfaceType (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
283 @function _SCNetworkInterfaceGetIOInterfaceUnit
284 @discussion Returns the IOInterfaceUnit for the interface.
285 @param interface The network interface.
286 @result The IOInterfaceUnit associated with the interface;
287 NULL if no IOLocation is available.
290 _SCNetworkInterfaceGetIOInterfaceUnit (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
293 @function _SCNetworkInterfaceGetIOPath
294 @discussion Returns the IOPath for the interface.
295 @param interface The network interface.
296 @result The IOPath associated with the interface;
297 NULL if no IOPath is available.
300 _SCNetworkInterfaceGetIOPath (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
303 @function _SCNetworkInterfaceGetIORegistryEntryID
304 @discussion Returns the IORegistry entry ID for the interface.
305 @param interface The network interface.
306 @result The IORegistry entry ID associated with the interface;
307 Zero if no entry ID is available.
310 _SCNetworkInterfaceGetIORegistryEntryID (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_7
/*FIXME*/,__IPHONE_5_0
);
313 @function _SCNetworkInterfaceIsBluetoothPAN
314 @discussion Identifies if a network interface is a Bluetooth PAN (GN) device.
315 @param interface The network interface.
316 @result TRUE if the interface is a Bluetooth PAN device.
319 _SCNetworkInterfaceIsBluetoothPAN (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_3_0
);
322 @function _SCNetworkInterfaceIsBluetoothPAN_NAP
323 @discussion Identifies if a network interface is a Bluetooth PAN-NAP device.
324 @param interface The network interface.
325 @result TRUE if the interface is a Bluetooth PAN-NAP device.
328 _SCNetworkInterfaceIsBluetoothPAN_NAP (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_5_0
);
331 @function _SCNetworkInterfaceIsBluetoothP2P
332 @discussion Identifies if a network interface is a Bluetooth P2P (PAN-U) device.
333 @param interface The network interface.
334 @result TRUE if the interface is a Bluetooth P2P device.
337 _SCNetworkInterfaceIsBluetoothP2P (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_5_0
);
340 @function _SCNetworkInterfaceIsBuiltin
341 @discussion Identifies if a network interface is "built-in".
342 @param interface The network interface.
343 @result TRUE if the interface is "built-in".
346 _SCNetworkInterfaceIsBuiltin (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
349 @function _SCNetworkInterfaceIsHiddenConfiguration
350 @discussion Identifies if the configuration of a network interface should be
351 hidden from any user interface (e.g. the "Network" pref pane).
352 @param interface The network interface.
353 @result TRUE if the interface configuration should be hidden.
356 _SCNetworkInterfaceIsHiddenConfiguration (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
);
359 @function _SCNetworkInterfaceIsModemV92
360 @discussion Identifies if a modem network interface supports
362 @param interface The network interface.
363 @result TRUE if the interface is "v.92" modem.
366 _SCNetworkInterfaceIsModemV92 (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
369 @function _SCNetworkInterfaceIsTethered
370 @discussion Identifies if a network interface is an Apple tethered device (e.g. an iPhone).
371 @param interface The network interface.
372 @result TRUE if the interface is a tethered device.
375 _SCNetworkInterfaceIsTethered (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_3_0
);
378 @function _SCNetworkInterfaceIsPhysicalEthernet
379 @discussion Indicates whether a network interface is a real ethernet interface i.e. one with an ethernet PHY.
380 @param interface The network interface.
381 @result TRUE if the interface is a real ethernet interface.
384 _SCNetworkInterfaceIsPhysicalEthernet (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_5_0
);
387 @function _SCNetworkInterfaceForceConfigurationRefresh
388 @discussion Forces a configuration refresh of the
390 @param ifName Network interface name.
391 @result TRUE if the refresh was successfully posted.
394 _SCNetworkInterfaceForceConfigurationRefresh (CFStringRef ifName
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
397 @function SCNetworkInterfaceCopyCapability
398 @discussion For the specified network interface, returns information
399 about the currently requested capabilities, the active capabilities,
400 and the capabilities which are available.
401 @param interface The desired network interface.
402 @param capability The desired capability.
403 @result a CFTypeRef representing the current value of requested
405 NULL if the capability is not available for this
406 interface or if an error was encountered.
407 You must release the returned value.
410 SCNetworkInterfaceCopyCapability (SCNetworkInterfaceRef interface
,
411 CFStringRef capability
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_5_0
/*SPI*/);
414 @function SCNetworkInterfaceSetCapability
415 @discussion For the specified network interface, sets the requested
417 @param interface The desired network interface.
418 @param capability The desired capability.
419 @param newValue The new requested setting for the capability;
420 NULL to restore the default setting.
421 @result TRUE if the configuration was updated; FALSE if an error was encountered.
424 SCNetworkInterfaceSetCapability (SCNetworkInterfaceRef interface
,
425 CFStringRef capability
,
426 CFTypeRef newValue
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_5_0
/*SPI*/);
429 #pragma mark SCBondInterface configuration (SPIs)
432 @function _SCBondInterfaceCopyActive
433 @discussion Returns all Ethernet Bond interfaces on the system.
434 @result The list of SCBondInterface interfaces on the system.
435 You must release the returned value.
438 _SCBondInterfaceCopyActive (void) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_4_0
/*SPI*/);
441 @function _SCBondInterfaceUpdateConfiguration
442 @discussion Updates the bond interface configuration.
443 @param prefs The "preferences" session.
444 @result TRUE if the bond interface configuration was updated.; FALSE if the
445 an error was encountered.
448 _SCBondInterfaceUpdateConfiguration (SCPreferencesRef prefs
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_4_0
/*SPI*/);
451 @function SCBondInterfaceGetMode
452 @discussion Return the mode for the given bond interface.
453 @param bond The bond interface to get the mode from.
454 @result A CFNumberRef containing the mode (IF_BOND_MODE_{LACP,STATIC}).
457 SCBondInterfaceGetMode (SCBondInterfaceRef bond
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_4_0
/*SPI*/);
460 @function SCBondInterfaceSetMode
461 @discussion Set the mode on the bond interface.
462 @param bond The bond interface on which to adjust the mode.
463 @param mode The mode value (0=IF_BOND_MODE_LACP,1=IF_BOND_MODE_STATIC)
464 @result TRUE if operation succeeded.
467 SCBondInterfaceSetMode (SCBondInterfaceRef bond
,
468 CFNumberRef mode
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_4_0
/*SPI*/);
471 #pragma mark SCBridgeInterface configuration (SPIs)
474 @function SCBridgeInterfaceCopyAll
475 @discussion Returns all bridge interfaces on the system.
476 @param prefs The "preferences" session.
477 @result The list of bridge interfaces on the system.
478 You must release the returned value.
480 CFArrayRef
/* of SCBridgeInterfaceRef's */
481 SCBridgeInterfaceCopyAll (SCPreferencesRef prefs
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
484 @function SCBridgeInterfaceCopyAvailableMemberInterfaces
485 @discussion Returns all network capable devices on the system
486 that can be added to an bridge interface.
487 @param prefs The "preferences" session.
488 @result The list of interfaces.
489 You must release the returned value.
491 CFArrayRef
/* of SCNetworkInterfaceRef's */
492 SCBridgeInterfaceCopyAvailableMemberInterfaces (SCPreferencesRef prefs
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
495 @function SCBridgeInterfaceCreate
496 @discussion Create a new SCBridgeInterface interface.
497 @param prefs The "preferences" session.
498 @result A reference to the new SCBridgeInterface.
499 You must release the returned value.
502 SCBridgeInterfaceCreate (SCPreferencesRef prefs
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
505 @function SCBridgeInterfaceRemove
506 @discussion Removes the SCBridgeInterface from the configuration.
507 @param bridge The SCBridgeInterface interface.
508 @result TRUE if the interface was removed; FALSE if an error was encountered.
511 SCBridgeInterfaceRemove (SCBridgeInterfaceRef bridge
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
514 @function SCBridgeInterfaceGetMemberInterfaces
515 @discussion Returns the member interfaces for the specified bridge interface.
516 @param bridge The SCBridgeInterface interface.
517 @result The list of interfaces.
519 CFArrayRef
/* of SCNetworkInterfaceRef's */
520 SCBridgeInterfaceGetMemberInterfaces (SCBridgeInterfaceRef bridge
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
523 @function SCBridgeInterfaceGetOptions
524 @discussion Returns the configuration settings associated with a bridge interface.
525 @param bridge The SCBridgeInterface interface.
526 @result The configuration settings associated with the bridge interface;
527 NULL if no changes to the default configuration have been saved.
530 SCBridgeInterfaceGetOptions (SCBridgeInterfaceRef bridge
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
533 @function SCBridgeInterfaceSetMemberInterfaces
534 @discussion Sets the member interfaces for the specified bridge interface.
535 @param bridge The SCBridgeInterface interface.
536 @param members The desired member interfaces.
537 @result TRUE if the configuration was stored; FALSE if an error was encountered.
540 SCBridgeInterfaceSetMemberInterfaces (SCBridgeInterfaceRef bridge
,
541 CFArrayRef members
) /* of SCNetworkInterfaceRef's */
542 __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
545 @function SCBridgeInterfaceSetLocalizedDisplayName
546 @discussion Sets the localized display name for the specified bridge interface.
547 @param bridge The SCBridgeInterface interface.
548 @param newName The new display name.
549 @result TRUE if the configuration was stored; FALSE if an error was encountered.
552 SCBridgeInterfaceSetLocalizedDisplayName (SCBridgeInterfaceRef bridge
,
553 CFStringRef newName
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
556 @function SCBridgeInterfaceSetOptions
557 @discussion Sets the configuration settings for the specified bridge interface.
558 @param bridge The SCBridgeInterface interface.
559 @param newOptions The new configuration settings.
560 @result TRUE if the configuration was stored; FALSE if an error was encountered.
563 SCBridgeInterfaceSetOptions (SCBridgeInterfaceRef bridge
,
564 CFDictionaryRef newOptions
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
569 @function _SCBridgeInterfaceCopyActive
570 @discussion Returns all bridge interfaces on the system.
571 @result The list of SCBridgeInterface interfaces on the system.
572 You must release the returned value.
575 _SCBridgeInterfaceCopyActive (void) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
578 @function _SCBridgeInterfaceUpdateConfiguration
579 @discussion Updates the bridge interface configuration.
580 @param prefs The "preferences" session.
581 @result TRUE if the bridge interface configuration was updated.; FALSE if the
582 an error was encountered.
585 _SCBridgeInterfaceUpdateConfiguration (SCPreferencesRef prefs
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
589 #pragma mark SCVLANInterface configuration (SPIs)
592 @function _SCVLANInterfaceCopyActive
593 @discussion Returns all VLAN interfaces on the system.
594 @result The list of SCVLANInterface interfaces on the system.
595 You must release the returned value.
598 _SCVLANInterfaceCopyActive (void) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_4_0
/*SPI*/);
601 @function _SCVLANInterfaceUpdateConfiguration
602 @discussion Updates the VLAN interface configuration.
603 @param prefs The "preferences" session.
604 @result TRUE if the VLAN interface configuration was updated.; FALSE if the
605 an error was encountered.
608 _SCVLANInterfaceUpdateConfiguration (SCPreferencesRef prefs
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_4_0
/*SPI*/);
612 #pragma mark SCNetworkInterface Password SPIs
616 kSCNetworkInterfacePasswordTypePPP
= 1,
617 kSCNetworkInterfacePasswordTypeIPSecSharedSecret
,
618 kSCNetworkInterfacePasswordTypeEAPOL
,
619 kSCNetworkInterfacePasswordTypeIPSecXAuth
,
620 kSCNetworkInterfacePasswordTypeVPN
,
622 typedef uint32_t SCNetworkInterfacePasswordType
;
625 SCNetworkInterfaceCheckPassword (SCNetworkInterfaceRef interface
,
626 SCNetworkInterfacePasswordType passwordType
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
629 SCNetworkInterfaceCopyPassword (SCNetworkInterfaceRef interface
,
630 SCNetworkInterfacePasswordType passwordType
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
633 SCNetworkInterfaceRemovePassword (SCNetworkInterfaceRef interface
,
634 SCNetworkInterfacePasswordType passwordType
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
637 SCNetworkInterfaceSetPassword (SCNetworkInterfaceRef interface
,
638 SCNetworkInterfacePasswordType passwordType
,
640 CFDictionaryRef options
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
644 #pragma mark SCNetworkProtocol configuration (SPI)
648 @group Protocol configuration
652 static __inline__ CFTypeRef
653 isA_SCNetworkProtocol(CFTypeRef obj
)
655 return (isA_CFType(obj
, SCNetworkProtocolGetTypeID()));
660 #pragma mark SCNetworkService configuration (SPI)
664 @group Service configuration
668 static __inline__ CFTypeRef
669 isA_SCNetworkService(CFTypeRef obj
)
671 return (isA_CFType(obj
, SCNetworkServiceGetTypeID()));
675 kSCNetworkServicePrimaryRankDefault
= 0,
676 kSCNetworkServicePrimaryRankFirst
= 1,
677 kSCNetworkServicePrimaryRankLast
= 2,
678 kSCNetworkServicePrimaryRankNever
= 3
680 typedef uint32_t SCNetworkServicePrimaryRank
;
683 @function _SCNetworkServiceCompare
684 @discussion Compares two SCNetworkService objects.
685 @param val1 The SCNetworkService object.
686 @param val2 The SCNetworkService object.
687 @param context The service order (from SCNetworkSetGetServiceOrder).
688 @result A comparison result.
691 _SCNetworkServiceCompare (const void *val1
,
693 void *context
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
);
696 @function _SCNetworkServiceCopyActive
697 @discussion Returns the network service with the specified identifier.
699 Note: The service returned by this SPI differs from the SCNetworkServiceCopy
700 API in that queries and operations interact with the "active" service
701 represented in the SCDynamicStore. Only a limited subset of the
702 SCNetworkService APIs are supported.
703 @param prefs The dynamic store session.
704 @param serviceID The unique identifier for the service.
705 @result A reference to the SCNetworkService represented in the SCDynamicStore;
706 NULL if the serviceID does not exist in the SCDynamicStore or if an
707 error was encountered.
708 You must release the returned value.
711 _SCNetworkServiceCopyActive (SCDynamicStoreRef store
,
712 CFStringRef serviceID
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_2_1
);
715 @function SCNetworkServiceGetPrimaryRank
716 @discussion Returns the primary service rank associated with a service.
717 @param service The network service.
718 @result The primary service rank associated with the specified application;
719 kSCNetworkServicePrimaryRankDefault if no rank is associated with the
720 application or an error was encountered.
722 SCNetworkServicePrimaryRank
723 SCNetworkServiceGetPrimaryRank (SCNetworkServiceRef service
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_2_0
);
726 @function SCNetworkServiceSetPrimaryRank
727 @discussion Updates the the primary service rank associated with a service.
728 @param service The network service.
729 @param newRank The new primary service rank; kSCNetworkServicePrimaryRankDefault
730 if the default service rank should be used.
731 @result TRUE if the rank was stored; FALSE if an error was encountered.
733 Notes : The kSCNetworkServicePrimaryRankFirst and kSCNetworkServicePrimaryRankLast
734 values can only valid as a transient setting.
737 SCNetworkServiceSetPrimaryRank (SCNetworkServiceRef service
,
738 SCNetworkServicePrimaryRank newRank
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_2_0
);
741 @function _SCNetworkServiceIsVPN
742 @discussion Identifies a VPN service.
743 @param service The network service.
744 @result TRUE if the service is a VPN.
747 _SCNetworkServiceIsVPN (SCNetworkServiceRef service
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
);
750 #pragma mark SCNetworkSet configuration (SPI)
754 @group Set configuration
758 static __inline__ CFTypeRef
759 isA_SCNetworkSet(CFTypeRef obj
)
761 return (isA_CFType(obj
, SCNetworkSetGetTypeID()));
766 @function SCNetworkSetEstablishDefaultConfiguration
767 @discussion Updates a network set by adding services for
768 any network interface that is not currently
770 If the provided set contains one (or more) services, new
771 services will only be added for those interfaces that are
772 not represented in *any* set.
773 Otherwise, new services will be added for those interfaces
774 that are not represented in the provided set.
775 The new services are established with "default" configuration
777 @param set The network set.
778 @result TRUE if the configuration was updated; FALSE if no
779 changes were required or if an error was encountered.
782 SCNetworkSetEstablishDefaultConfiguration (SCNetworkSetRef set
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
785 @function SCNetworkSetEstablishDefaultInterfaceConfiguration
786 @discussion Updates a network set by adding services for
787 the specified network interface if is not currently
789 If the provided set contains one (or more) services, new
790 services will only be added for interfaces that are not
791 represented in *any* set.
792 Otherwise, new services will be added for interfaces that
793 are not represented in the provided set.
794 The new services are established with "default" configuration
796 @param set The network set.
797 @param interface The network interface.
798 @result TRUE if the configuration was updated; FALSE if no
799 changes were required or if an error was encountered.
802 SCNetworkSetEstablishDefaultInterfaceConfiguration (SCNetworkSetRef set
,
803 SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
806 @function SCNetworkSetCopySelectedVPNService
807 @discussion On the iPhone we only allow a single VPN network service
808 to be selected at any given time. This API will identify
809 the selected VPN service.
810 @param set The network set.
811 @result The selected VPN service; NULL if no service has been
813 You must release the returned value.
816 SCNetworkSetCopySelectedVPNService (SCNetworkSetRef set
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
);
819 @function SCNetworkSetSetSelectedVPNService
820 @discussion On the iPhone we only allow a single VPN network service
821 to be selected at any given time. This API should be used to
822 select a VPN service.
823 @param set The network set.
824 @param service The VPN service to be selected.
825 @result TRUE if the name was saved; FALSE if an error was encountered.
828 SCNetworkSetSetSelectedVPNService (SCNetworkSetRef set
,
829 SCNetworkServiceRef service
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
);
833 #endif /* _SCNETWORKCONFIGURATIONPRIVATE_H */