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 _SCNetworkInterfaceIsBluetoothPAN
304 @discussion Identifies if a network interface is a Bluetooth PAN (GN) device.
305 @param interface The network interface.
306 @result TRUE if the interface is a Bluetooth PAN device.
309 _SCNetworkInterfaceIsBluetoothPAN (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_3_0
);
312 @function _SCNetworkInterfaceIsBluetoothPAN_NAP
313 @discussion Identifies if a network interface is a Bluetooth PAN-NAP device.
314 @param interface The network interface.
315 @result TRUE if the interface is a Bluetooth PAN-NAP device.
318 _SCNetworkInterfaceIsBluetoothPAN_NAP (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_5_0
);
321 @function _SCNetworkInterfaceIsBluetoothP2P
322 @discussion Identifies if a network interface is a Bluetooth P2P (PAN-U) device.
323 @param interface The network interface.
324 @result TRUE if the interface is a Bluetooth P2P device.
327 _SCNetworkInterfaceIsBluetoothP2P (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_5_0
);
330 @function _SCNetworkInterfaceIsBuiltin
331 @discussion Identifies if a network interface is "built-in".
332 @param interface The network interface.
333 @result TRUE if the interface is "built-in".
336 _SCNetworkInterfaceIsBuiltin (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
339 @function _SCNetworkInterfaceIsHiddenConfiguration
340 @discussion Identifies if the configuration of a network interface should be
341 hidden from any user interface (e.g. the "Network" pref pane).
342 @param interface The network interface.
343 @result TRUE if the interface configuration should be hidden.
346 _SCNetworkInterfaceIsHiddenConfiguration (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
);
349 @function _SCNetworkInterfaceIsModemV92
350 @discussion Identifies if a modem network interface supports
352 @param interface The network interface.
353 @result TRUE if the interface is "v.92" modem.
356 _SCNetworkInterfaceIsModemV92 (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
359 @function _SCNetworkInterfaceIsTethered
360 @discussion Identifies if a network interface is an Apple tethered device (e.g. an iPhone).
361 @param interface The network interface.
362 @result TRUE if the interface is a tethered device.
365 _SCNetworkInterfaceIsTethered (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_3_0
);
368 @function _SCNetworkInterfaceIsPhysicalEthernet
369 @discussion Indicates whether a network interface is a real ethernet interface i.e. one with an ethernet PHY.
370 @param interface The network interface.
371 @result TRUE if the interface is a real ethernet interface.
374 _SCNetworkInterfaceIsPhysicalEthernet (SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_5_0
);
377 @function _SCNetworkInterfaceForceConfigurationRefresh
378 @discussion Forces a configuration refresh of the
380 @param ifName Network interface name.
381 @result TRUE if the refresh was successfully posted.
384 _SCNetworkInterfaceForceConfigurationRefresh (CFStringRef ifName
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
387 @function SCNetworkInterfaceCopyCapability
388 @discussion For the specified network interface, returns information
389 about the currently requested capabilities, the active capabilities,
390 and the capabilities which are available.
391 @param interface The desired network interface.
392 @param capability The desired capability.
393 @result a CFTypeRef representing the current value of requested
395 NULL if the capability is not available for this
396 interface or if an error was encountered.
397 You must release the returned value.
400 SCNetworkInterfaceCopyCapability (SCNetworkInterfaceRef interface
,
401 CFStringRef capability
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_5_0
/*SPI*/);
404 @function SCNetworkInterfaceSetCapability
405 @discussion For the specified network interface, sets the requested
407 @param interface The desired network interface.
408 @param capability The desired capability.
409 @param newValue The new requested setting for the capability;
410 NULL to restore the default setting.
411 @result TRUE if the configuration was updated; FALSE if an error was encountered.
414 SCNetworkInterfaceSetCapability (SCNetworkInterfaceRef interface
,
415 CFStringRef capability
,
416 CFTypeRef newValue
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_5_0
/*SPI*/);
419 #pragma mark SCBondInterface configuration (SPIs)
422 @function _SCBondInterfaceCopyActive
423 @discussion Returns all Ethernet Bond interfaces on the system.
424 @result The list of SCBondInterface interfaces on the system.
425 You must release the returned value.
428 _SCBondInterfaceCopyActive (void) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_4_0
/*SPI*/);
431 @function _SCBondInterfaceUpdateConfiguration
432 @discussion Updates the bond interface configuration.
433 @param prefs The "preferences" session.
434 @result TRUE if the bond interface configuration was updated.; FALSE if the
435 an error was encountered.
438 _SCBondInterfaceUpdateConfiguration (SCPreferencesRef prefs
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_4_0
/*SPI*/);
441 @function SCBondInterfaceGetMode
442 @discussion Return the mode for the given bond interface.
443 @param bond The bond interface to get the mode from.
444 @result A CFNumberRef containing the mode (IF_BOND_MODE_{LACP,STATIC}).
447 SCBondInterfaceGetMode (SCBondInterfaceRef bond
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_4_0
/*SPI*/);
450 @function SCBondInterfaceSetMode
451 @discussion Set the mode on the bond interface.
452 @param bond The bond interface on which to adjust the mode.
453 @param mode The mode value (0=IF_BOND_MODE_LACP,1=IF_BOND_MODE_STATIC)
454 @result TRUE if operation succeeded.
457 SCBondInterfaceSetMode (SCBondInterfaceRef bond
,
458 CFNumberRef mode
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_4_0
/*SPI*/);
461 #pragma mark SCBridgeInterface configuration (SPIs)
464 @function SCBridgeInterfaceCopyAll
465 @discussion Returns all bridge interfaces on the system.
466 @param prefs The "preferences" session.
467 @result The list of bridge interfaces on the system.
468 You must release the returned value.
470 CFArrayRef
/* of SCBridgeInterfaceRef's */
471 SCBridgeInterfaceCopyAll (SCPreferencesRef prefs
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
474 @function SCBridgeInterfaceCopyAvailableMemberInterfaces
475 @discussion Returns all network capable devices on the system
476 that can be added to an bridge interface.
477 @param prefs The "preferences" session.
478 @result The list of interfaces.
479 You must release the returned value.
481 CFArrayRef
/* of SCNetworkInterfaceRef's */
482 SCBridgeInterfaceCopyAvailableMemberInterfaces (SCPreferencesRef prefs
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
485 @function SCBridgeInterfaceCreate
486 @discussion Create a new SCBridgeInterface interface.
487 @param prefs The "preferences" session.
488 @result A reference to the new SCBridgeInterface.
489 You must release the returned value.
492 SCBridgeInterfaceCreate (SCPreferencesRef prefs
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
495 @function SCBridgeInterfaceRemove
496 @discussion Removes the SCBridgeInterface from the configuration.
497 @param bridge The SCBridgeInterface interface.
498 @result TRUE if the interface was removed; FALSE if an error was encountered.
501 SCBridgeInterfaceRemove (SCBridgeInterfaceRef bridge
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
504 @function SCBridgeInterfaceGetMemberInterfaces
505 @discussion Returns the member interfaces for the specified bridge interface.
506 @param bridge The SCBridgeInterface interface.
507 @result The list of interfaces.
509 CFArrayRef
/* of SCNetworkInterfaceRef's */
510 SCBridgeInterfaceGetMemberInterfaces (SCBridgeInterfaceRef bridge
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
513 @function SCBridgeInterfaceGetOptions
514 @discussion Returns the configuration settings associated with a bridge interface.
515 @param bridge The SCBridgeInterface interface.
516 @result The configuration settings associated with the bridge interface;
517 NULL if no changes to the default configuration have been saved.
520 SCBridgeInterfaceGetOptions (SCBridgeInterfaceRef bridge
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
523 @function SCBridgeInterfaceSetMemberInterfaces
524 @discussion Sets the member interfaces for the specified bridge interface.
525 @param bridge The SCBridgeInterface interface.
526 @param members The desired member interfaces.
527 @result TRUE if the configuration was stored; FALSE if an error was encountered.
530 SCBridgeInterfaceSetMemberInterfaces (SCBridgeInterfaceRef bridge
,
531 CFArrayRef members
) /* of SCNetworkInterfaceRef's */
532 __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
535 @function SCBridgeInterfaceSetLocalizedDisplayName
536 @discussion Sets the localized display name for the specified bridge interface.
537 @param bridge The SCBridgeInterface interface.
538 @param newName The new display name.
539 @result TRUE if the configuration was stored; FALSE if an error was encountered.
542 SCBridgeInterfaceSetLocalizedDisplayName (SCBridgeInterfaceRef bridge
,
543 CFStringRef newName
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
546 @function SCBridgeInterfaceSetOptions
547 @discussion Sets the configuration settings for the specified bridge interface.
548 @param bridge The SCBridgeInterface interface.
549 @param newOptions The new configuration settings.
550 @result TRUE if the configuration was stored; FALSE if an error was encountered.
553 SCBridgeInterfaceSetOptions (SCBridgeInterfaceRef bridge
,
554 CFDictionaryRef newOptions
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
559 @function _SCBridgeInterfaceCopyActive
560 @discussion Returns all bridge interfaces on the system.
561 @result The list of SCBridgeInterface interfaces on the system.
562 You must release the returned value.
565 _SCBridgeInterfaceCopyActive (void) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
568 @function _SCBridgeInterfaceUpdateConfiguration
569 @discussion Updates the bridge interface configuration.
570 @param prefs The "preferences" session.
571 @result TRUE if the bridge interface configuration was updated.; FALSE if the
572 an error was encountered.
575 _SCBridgeInterfaceUpdateConfiguration (SCPreferencesRef prefs
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
/*SPI*/);
579 #pragma mark SCVLANInterface configuration (SPIs)
582 @function _SCVLANInterfaceCopyActive
583 @discussion Returns all VLAN interfaces on the system.
584 @result The list of SCVLANInterface interfaces on the system.
585 You must release the returned value.
588 _SCVLANInterfaceCopyActive (void) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_4_0
/*SPI*/);
591 @function _SCVLANInterfaceUpdateConfiguration
592 @discussion Updates the VLAN interface configuration.
593 @param prefs The "preferences" session.
594 @result TRUE if the VLAN interface configuration was updated.; FALSE if the
595 an error was encountered.
598 _SCVLANInterfaceUpdateConfiguration (SCPreferencesRef prefs
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_4_0
/*SPI*/);
602 #pragma mark SCNetworkInterface Password SPIs
606 kSCNetworkInterfacePasswordTypePPP
= 1,
607 kSCNetworkInterfacePasswordTypeIPSecSharedSecret
,
608 kSCNetworkInterfacePasswordTypeEAPOL
,
609 kSCNetworkInterfacePasswordTypeIPSecXAuth
,
610 kSCNetworkInterfacePasswordTypeVPN
,
612 typedef uint32_t SCNetworkInterfacePasswordType
;
615 SCNetworkInterfaceCheckPassword (SCNetworkInterfaceRef interface
,
616 SCNetworkInterfacePasswordType passwordType
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
619 SCNetworkInterfaceCopyPassword (SCNetworkInterfaceRef interface
,
620 SCNetworkInterfacePasswordType passwordType
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
623 SCNetworkInterfaceRemovePassword (SCNetworkInterfaceRef interface
,
624 SCNetworkInterfacePasswordType passwordType
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
627 SCNetworkInterfaceSetPassword (SCNetworkInterfaceRef interface
,
628 SCNetworkInterfacePasswordType passwordType
,
630 CFDictionaryRef options
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
634 #pragma mark SCNetworkProtocol configuration (SPI)
638 @group Protocol configuration
642 static __inline__ CFTypeRef
643 isA_SCNetworkProtocol(CFTypeRef obj
)
645 return (isA_CFType(obj
, SCNetworkProtocolGetTypeID()));
650 #pragma mark SCNetworkService configuration (SPI)
654 @group Service configuration
658 static __inline__ CFTypeRef
659 isA_SCNetworkService(CFTypeRef obj
)
661 return (isA_CFType(obj
, SCNetworkServiceGetTypeID()));
665 kSCNetworkServicePrimaryRankDefault
= 0,
666 kSCNetworkServicePrimaryRankFirst
= 1,
667 kSCNetworkServicePrimaryRankLast
= 2,
668 kSCNetworkServicePrimaryRankNever
= 3
670 typedef uint32_t SCNetworkServicePrimaryRank
;
673 @function _SCNetworkServiceCompare
674 @discussion Compares two SCNetworkService objects.
675 @param val1 The SCNetworkService object.
676 @param val2 The SCNetworkService object.
677 @param context The service order (from SCNetworkSetGetServiceOrder).
678 @result A comparison result.
681 _SCNetworkServiceCompare (const void *val1
,
683 void *context
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
);
686 @function _SCNetworkServiceCopyActive
687 @discussion Returns the network service with the specified identifier.
689 Note: The service returned by this SPI differs from the SCNetworkServiceCopy
690 API in that queries and operations interact with the "active" service
691 represented in the SCDynamicStore. Only a limited subset of the
692 SCNetworkService APIs are supported.
693 @param prefs The dynamic store session.
694 @param serviceID The unique identifier for the service.
695 @result A reference to the SCNetworkService represented in the SCDynamicStore;
696 NULL if the serviceID does not exist in the SCDynamicStore or if an
697 error was encountered.
698 You must release the returned value.
701 _SCNetworkServiceCopyActive (SCDynamicStoreRef store
,
702 CFStringRef serviceID
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_2_1
);
705 @function SCNetworkServiceGetPrimaryRank
706 @discussion Returns the primary service rank associated with a service.
707 @param service The network service.
708 @result The primary service rank associated with the specified application;
709 kSCNetworkServicePrimaryRankDefault if no rank is associated with the
710 application or an error was encountered.
712 SCNetworkServicePrimaryRank
713 SCNetworkServiceGetPrimaryRank (SCNetworkServiceRef service
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_2_0
);
716 @function SCNetworkServiceSetPrimaryRank
717 @discussion Updates the the primary service rank associated with a service.
718 @param service The network service.
719 @param newRank The new primary service rank; kSCNetworkServicePrimaryRankDefault
720 if the default service rank should be used.
721 @result TRUE if the rank was stored; FALSE if an error was encountered.
723 Notes : The kSCNetworkServicePrimaryRankFirst and kSCNetworkServicePrimaryRankLast
724 values can only valid as a transient setting.
727 SCNetworkServiceSetPrimaryRank (SCNetworkServiceRef service
,
728 SCNetworkServicePrimaryRank newRank
) __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_2_0
);
731 @function _SCNetworkServiceIsVPN
732 @discussion Identifies a VPN service.
733 @param service The network service.
734 @result TRUE if the service is a VPN.
737 _SCNetworkServiceIsVPN (SCNetworkServiceRef service
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
);
740 #pragma mark SCNetworkSet configuration (SPI)
744 @group Set configuration
748 static __inline__ CFTypeRef
749 isA_SCNetworkSet(CFTypeRef obj
)
751 return (isA_CFType(obj
, SCNetworkSetGetTypeID()));
756 @function SCNetworkSetEstablishDefaultConfiguration
757 @discussion Updates a network set by adding services for
758 any network interface that is not currently
760 If the provided set contains one (or more) services, new
761 services will only be added for those interfaces that are
762 not represented in *any* set.
763 Otherwise, new services will be added for those interfaces
764 that are not represented in the provided set.
765 The new services are established with "default" configuration
767 @param set The network set.
768 @result TRUE if the configuration was updated; FALSE if no
769 changes were required or if an error was encountered.
772 SCNetworkSetEstablishDefaultConfiguration (SCNetworkSetRef set
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
775 @function SCNetworkSetEstablishDefaultInterfaceConfiguration
776 @discussion Updates a network set by adding services for
777 the specified network interface if is not currently
779 If the provided set contains one (or more) services, new
780 services will only be added for interfaces that are not
781 represented in *any* set.
782 Otherwise, new services will be added for interfaces that
783 are not represented in the provided set.
784 The new services are established with "default" configuration
786 @param set The network set.
787 @param interface The network interface.
788 @result TRUE if the configuration was updated; FALSE if no
789 changes were required or if an error was encountered.
792 SCNetworkSetEstablishDefaultInterfaceConfiguration (SCNetworkSetRef set
,
793 SCNetworkInterfaceRef interface
) __OSX_AVAILABLE_STARTING(__MAC_10_5
,__IPHONE_2_0
);
796 @function SCNetworkSetCopySelectedVPNService
797 @discussion On the iPhone we only allow a single VPN network service
798 to be selected at any given time. This API will identify
799 the selected VPN service.
800 @param set The network set.
801 @result The selected VPN service; NULL if no service has been
803 You must release the returned value.
806 SCNetworkSetCopySelectedVPNService (SCNetworkSetRef set
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
);
809 @function SCNetworkSetSetSelectedVPNService
810 @discussion On the iPhone we only allow a single VPN network service
811 to be selected at any given time. This API should be used to
812 select a VPN service.
813 @param set The network set.
814 @param service The VPN service to be selected.
815 @result TRUE if the name was saved; FALSE if an error was encountered.
818 SCNetworkSetSetSelectedVPNService (SCNetworkSetRef set
,
819 SCNetworkServiceRef service
) __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_0
);
823 #endif /* _SCNETWORKCONFIGURATIONPRIVATE_H */