Mac Developer Library

Developer

System Configuration Framework Reference SCNetworkConfiguration Reference

Options
Deployment Target:

On This Page
Language:

SCNetworkConfiguration Reference

The SCNetworkConfiguration programming interface provides access to the stored network configuration. The functions include providing access to the network-capable devices on the system, the network sets, network services, and network protocols. Note that these functions follow Core Foundation function-name conventions. A function that has "Create" or "Copy" in its name returns a reference you must release with the CFRelease function.

Note that when using the functions in this programming interface, you must call the SCPreferencesCommitChanges function to ensure that your changes are committed to permanent storage.

Functions

  • Returns all network-capable interfaces on the system.

    Declaration

    Swift

    func SCNetworkInterfaceCopyAll() -> CFArray

    Objective-C

    CFArrayRef SCNetworkInterfaceCopyAll ( void );

    Return Value

    The list of interfaces on the system. You must release the returned value.

    Availability

    Available in OS X v10.4 and later.

  • Returns the current MTU setting and the range of allowable values for the specified network interface.

    Declaration

    Swift

    func SCNetworkInterfaceCopyMTU(_ interface: SCNetworkInterface, _ mtu_cur: UnsafeMutablePointer<Int32>, _ mtu_min: UnsafeMutablePointer<Int32>, _ mtu_max: UnsafeMutablePointer<Int32>) -> Bool

    Objective-C

    Boolean SCNetworkInterfaceCopyMTU ( SCNetworkInterfaceRef interface, int *mtu_cur, int *mtu_min, int *mtu_max );

    Parameters

    interface

    The network interface.

    mtu_cur

    On output, the current MTU setting for the interface.

    mtu_min

    On output, the minimum MTU setting for the interface. If negative, the minimum setting could not be determined.

    mtu_max

    On output, the maximum MTU setting for the interface. If negative, the maximum setting could not be determined.

    Return Value

    TRUE if the requested information has been returned.

    Availability

    Available in OS X v10.5 and later.

  • Returns information media options for the specified network interface.

    Declaration

    Swift

    func SCNetworkInterfaceCopyMediaOptions(_ interface: SCNetworkInterface, _ current: UnsafeMutablePointer<Unmanaged<CFDictionary>?>, _ active: UnsafeMutablePointer<Unmanaged<CFDictionary>?>, _ available: UnsafeMutablePointer<Unmanaged<CFArray>?>, _ filter: Bool) -> Bool

    Objective-C

    Boolean SCNetworkInterfaceCopyMediaOptions ( SCNetworkInterfaceRef interface, CFDictionaryRef _Nullable *current, CFDictionaryRef _Nullable *active, CFArrayRef _Nullable *available, Boolean filter );

    Parameters

    interface

    The network interface.

    current

    On output, a dictionary representing the currently requested media options (subtype, options). If NULL, the current options are not returned.

    active

    On output, a dictionary representing the active media options (subtype, options). If NULL, the active options are not returned.

    available

    On output, an array representing the possible media options (subtype, options). If NULL, the current options are not returned.

    filter

    A Boolean value indicating whether the available options should be filtered to exclude those options which would not normally be requested by a user/admin (for example, hw-loopback).

    Return Value

    TRUE if requested information has been returned.

    Availability

    Available in OS X v10.5 and later.

  • Returns a list of available media options for the specified interface configuration options and subtype.

    Declaration

    Swift

    func SCNetworkInterfaceCopyMediaSubTypeOptions(_ available: CFArray, _ subType: CFString) -> CFArray?

    Objective-C

    CFArrayRef SCNetworkInterfaceCopyMediaSubTypeOptions ( CFArrayRef available, CFStringRef subType );

    Parameters

    available

    The available options as returned by the SCNetworkInterfaceCopyMediaOptions function.

    subType

    The subtype.

    Return Value

    An array of available media options, or NULL if no options are available. Each of the available options is returned as an array of strings.

    Availability

    Available in OS X v10.5 and later.

  • Returns a list of available media subtypes for the specified interface configuration options.

    Declaration

    Swift

    func SCNetworkInterfaceCopyMediaSubTypes(_ available: CFArray) -> CFArray?

    Objective-C

    CFArrayRef SCNetworkInterfaceCopyMediaSubTypes ( CFArrayRef available );

    Parameters

    available

    The available options as returned by the SCNetworkInterfaceCopyMediaOptions function.

    Return Value

    An array of available media subtypes (for example, 10BaseT/UTP, 100baseTX, etc), or NULL if no subtypes are available

    Availability

    Available in OS X v10.5 and later.

  • Creates a new network interface layered on top of the specified interface.

    Declaration

    Swift

    func SCNetworkInterfaceCreateWithInterface(_ interface: SCNetworkInterface, _ interfaceType: CFString) -> SCNetworkInterface?

    Objective-C

    SCNetworkInterfaceRef SCNetworkInterfaceCreateWithInterface ( SCNetworkInterfaceRef interface, CFStringRef interfaceType );

    Parameters

    interface

    The network interface.

    interfaceType

    The type of interface to layer on top of the network interface specified in interface.

    Return Value

    A reference to the new network interface. You must release the returned value.

    Discussion

    You can use this function to create a "PPP" interface on top of a "modem."

    Availability

    Available in OS X v10.4 and later.

  • Sends a notification to interested network configuration agents to immediately retry their configuration.

    Declaration

    Swift

    func SCNetworkInterfaceForceConfigurationRefresh(_ interface: SCNetworkInterface) -> Bool

    Objective-C

    Boolean SCNetworkInterfaceForceConfigurationRefresh ( SCNetworkInterfaceRef interface );

    Parameters

    interface

    The desired network interface.

    Return Value

    TRUE if the notification was sent; otherwise, FALSE.

    Discussion

    Calling this function causes the DHCP client to contact the DHCP server immediately rather than waiting until its timeout has expired. The caller uses this function to inform the system that the network infrastructure or configuration has changed.

    Note that this function requires root privilege; alternatively, you can pass in an interface that is derived from a sequence of calls to:

    Availability

    Available in OS X v10.5 and later.

  • Returns the BSD interface or device name for the specified interface.

    Declaration

    Swift

    func SCNetworkInterfaceGetBSDName(_ interface: SCNetworkInterface) -> CFString?

    Objective-C

    CFStringRef SCNetworkInterfaceGetBSDName ( SCNetworkInterfaceRef interface );

    Parameters

    interface

    The network interface.

    Return Value

    The BSD name associated with the interface (for example, en0), or NULL if no BSD name is available.

    Availability

    Available in OS X v10.4 and later.

  • Returns the configuration settings associated with the specified interface.

    Declaration

    Swift

    func SCNetworkInterfaceGetConfiguration(_ interface: SCNetworkInterface) -> CFDictionary?

    Objective-C

    CFDictionaryRef SCNetworkInterfaceGetConfiguration ( SCNetworkInterfaceRef interface );

    Parameters

    interface

    The network interface.

    Return Value

    The configuration settings associated with the interface, or NULL if no configuration settings are associated with the interface or an error occurred.

    Availability

    Available in OS X v10.4 and later.

  • Returns the extended configuration settings associated with the specified interface.

    Declaration

    Swift

    func SCNetworkInterfaceGetExtendedConfiguration(_ interface: SCNetworkInterface, _ extendedType: CFString) -> CFDictionary?

    Objective-C

    CFDictionaryRef SCNetworkInterfaceGetExtendedConfiguration ( SCNetworkInterfaceRef interface, CFStringRef extendedType );

    Parameters

    interface

    The network interface.

    extendedType

    The type of extended information (for example, EAPOL).

    Return Value

    The configuration settings associated with the interface, or NULL if no configuration settings are associated with the interface or an error occurred.

    Availability

    Available in OS X v10.5 and later.

  • Returns a displayable link layer address for the specified interface.

    Declaration

    Swift

    func SCNetworkInterfaceGetHardwareAddressString(_ interface: SCNetworkInterface) -> CFString?

    Objective-C

    CFStringRef SCNetworkInterfaceGetHardwareAddressString ( SCNetworkInterfaceRef interface );

    Parameters

    interface

    The network interface.

    Return Value

    The hardware MAC (Media Access Control) address for the interface.

    Availability

    Available in OS X v10.4 and later.

  • Returns the underlying interface, for layered network interfaces.

    Declaration

    Swift

    func SCNetworkInterfaceGetInterface(_ interface: SCNetworkInterface) -> SCNetworkInterface?

    Objective-C

    SCNetworkInterfaceRef SCNetworkInterfaceGetInterface ( SCNetworkInterfaceRef interface );

    Parameters

    interface

    The network interface.

    Return Value

    The underlying network interface, or NULL if the specified interface is a leaf interface.

    Availability

    Available in OS X v10.4 and later.

  • Returns the network interface type of the specified interface.

    Declaration

    Swift

    func SCNetworkInterfaceGetInterfaceType(_ interface: SCNetworkInterface) -> CFString?

    Objective-C

    CFStringRef SCNetworkInterfaceGetInterfaceType ( SCNetworkInterfaceRef interface );

    Parameters

    interface

    The network interface.

    Return Value

    The interface type.

    Availability

    Available in OS X v10.4 and later.

  • Returns the localized display name, such as "Ethernet" or "FireWire," for the specified interface.

    Declaration

    Swift

    func SCNetworkInterfaceGetLocalizedDisplayName(_ interface: SCNetworkInterface) -> CFString?

    Objective-C

    CFStringRef SCNetworkInterfaceGetLocalizedDisplayName ( SCNetworkInterfaceRef interface );

    Parameters

    interface

    The network interface.

    Return Value

    The localized display name for the interface, or NULL if no name is available.

    Availability

    Available in OS X v10.4 and later.

  • Identifies all of the network interface types, such as PPP, that can be layered on top of the specified interface.

    Declaration

    Swift

    func SCNetworkInterfaceGetSupportedInterfaceTypes(_ interface: SCNetworkInterface) -> CFArray?

    Objective-C

    CFArrayRef SCNetworkInterfaceGetSupportedInterfaceTypes ( SCNetworkInterfaceRef interface );

    Parameters

    interface

    The network interface.

    Return Value

    The list of network interface types supported by the specified interface, or NULL if no interface types are supported.

    Availability

    Available in OS X v10.4 and later.

  • Identifies all of the network protocol types, such as IPv4 and IPv6, that can be layered on top of the specified interface.

    Declaration

    Swift

    func SCNetworkInterfaceGetSupportedProtocolTypes(_ interface: SCNetworkInterface) -> CFArray?

    Objective-C

    CFArrayRef SCNetworkInterfaceGetSupportedProtocolTypes ( SCNetworkInterfaceRef interface );

    Parameters

    interface

    The network interface.

    Return Value

    The list of network protocol types supported by the specified interface, or NULL if no protocol types are supported.

    Availability

    Available in OS X v10.4 and later.

  • Returns the type identifier of all SCNetworkInterface instances.

    Declaration

    Swift

    func SCNetworkInterfaceGetTypeID() -> CFTypeID

    Objective-C

    CFTypeID SCNetworkInterfaceGetTypeID ( void );

    Return Value

    The type identifier of all SCNetworkInterface instances.

    Availability

    Available in OS X v10.4 and later.

  • Stores the configuration settings for the specified interface.

    Declaration

    Swift

    func SCNetworkInterfaceSetConfiguration(_ interface: SCNetworkInterface, _ config: CFDictionary) -> Bool

    Objective-C

    Boolean SCNetworkInterfaceSetConfiguration ( SCNetworkInterfaceRef interface, CFDictionaryRef config );

    Parameters

    interface

    The network interface.

    config

    The configuration settings to store.

    Return Value

    TRUE if the configuration was stored; FALSE if an error occurred.

    Availability

    Available in OS X v10.4 and later.

  • Stores the extended configuration settings for the specified interface.

    Declaration

    Swift

    func SCNetworkInterfaceSetExtendedConfiguration(_ interface: SCNetworkInterface, _ extendedType: CFString, _ config: CFDictionary) -> Bool

    Objective-C

    Boolean SCNetworkInterfaceSetExtendedConfiguration ( SCNetworkInterfaceRef interface, CFStringRef extendedType, CFDictionaryRef config );

    Parameters

    interface

    The network interface.

    extendedType

    The type of extended information.

    config

    The extended configuration settings to store.

    Return Value

    TRUE if the configuration was stored; FALSE if an error occurred.

    Availability

    Available in OS X v10.5 and later.

  • Sets the requested MTU setting for the specified network interface.

    Declaration

    Swift

    func SCNetworkInterfaceSetMTU(_ interface: SCNetworkInterface, _ mtu: Int32) -> Bool

    Objective-C

    Boolean SCNetworkInterfaceSetMTU ( SCNetworkInterfaceRef interface, int mtu );

    Parameters

    interface

    The network interface.

    mtu

    The MTU setting.

    Return Value

    TRUE if the configuration was updated; FALSE if an error occurred.

    Availability

    Available in OS X v10.5 and later.

  • Sets the requested media subtype and options for the specified network interface.

    Declaration

    Swift

    func SCNetworkInterfaceSetMediaOptions(_ interface: SCNetworkInterface, _ subtype: CFString, _ options: CFArray) -> Bool

    Objective-C

    Boolean SCNetworkInterfaceSetMediaOptions ( SCNetworkInterfaceRef interface, CFStringRef subtype, CFArrayRef options );

    Parameters

    interface

    The network interface.

    subtype

    The media subtype to set (for example, "autoselect" or "100baseTX").

    options

    The media options to set (for example, "half-duplex" or "full-duplex"). If NULL, the active options are not returned.

    Return Value

    TRUE if the configuration was updated; FALSE if an error occurred.

    Availability

    Available in OS X v10.5 and later.

  • Returns the configuration settings associated with the specified protocol.

    Declaration

    Swift

    func SCNetworkProtocolGetConfiguration(_ `protocol`: SCNetworkProtocol) -> CFDictionary?

    Objective-C

    CFDictionaryRef SCNetworkProtocolGetConfiguration ( SCNetworkProtocolRef protocol );

    Parameters

    protocol

    The network protocol.

    Return Value

    The configuration settings associated with the protocol, or NULL if no configuration settings are associated with the protocol or an error occurred.

    Availability

    Available in OS X v10.4 and later.

  • Returns a Boolean value indicating whether the specified protocol is enabled.

    Declaration

    Swift

    func SCNetworkProtocolGetEnabled(_ `protocol`: SCNetworkProtocol) -> Bool

    Objective-C

    Boolean SCNetworkProtocolGetEnabled ( SCNetworkProtocolRef protocol );

    Parameters

    protocol

    The network protocol.

    Return Value

    TRUE if the protocol is enabled; otherwise, FALSE.

    Availability

    Available in OS X v10.4 and later.

  • Returns the type of the specified network protocol.

    Declaration

    Swift

    func SCNetworkProtocolGetProtocolType(_ `protocol`: SCNetworkProtocol) -> CFString?

    Objective-C

    CFStringRef SCNetworkProtocolGetProtocolType ( SCNetworkProtocolRef protocol );

    Parameters

    protocol

    The network protocol.

    Return Value

    The protocol type.

    Availability

    Available in OS X v10.4 and later.

  • Returns the type identifier of all SCNetworkProtocol instances.

    Declaration

    Swift

    func SCNetworkProtocolGetTypeID() -> CFTypeID

    Objective-C

    CFTypeID SCNetworkProtocolGetTypeID ( void );

    Return Value

    The type identifier of all SCNetworkProtocol instances.

    Availability

    Available in OS X v10.4 and later.

  • Stores the configuration settings for the specified network protocol.

    Declaration

    Swift

    func SCNetworkProtocolSetConfiguration(_ `protocol`: SCNetworkProtocol, _ config: CFDictionary) -> Bool

    Objective-C

    Boolean SCNetworkProtocolSetConfiguration ( SCNetworkProtocolRef protocol, CFDictionaryRef config );

    Parameters

    protocol

    The network protocol.

    config

    The configuration settings to store.

    Return Value

    TRUE if the configuration was stored; FALSE if an error occurred.

    Availability

    Available in OS X v10.4 and later.

  • Enables or disables the specified protocol.

    Declaration

    Swift

    func SCNetworkProtocolSetEnabled(_ `protocol`: SCNetworkProtocol, _ enabled: Bool) -> Bool

    Objective-C

    Boolean SCNetworkProtocolSetEnabled ( SCNetworkProtocolRef protocol, Boolean enabled );

    Parameters

    protocol

    The network protocol to enable or disable.

    enabled

    TRUE if the protocol should be enabled.

    Return Value

    TRUE if the enabled status was saved; FALSE if an error occurred.

    Availability

    Available in OS X v10.4 and later.

  • Adds the network protocol of the specified type to the specified service.

    Declaration

    Swift

    func SCNetworkServiceAddProtocolType(_ service: SCNetworkService, _ protocolType: CFString) -> Bool

    Objective-C

    Boolean SCNetworkServiceAddProtocolType ( SCNetworkServiceRef service, CFStringRef protocolType );

    Parameters

    service

    The network service.

    protocolType

    The type of network protocol to add to the service.

    Return Value

    TRUE if the protocol was added to the service; FALSE if the protocol was already present or an error occurred.

    Discussion

    The protocol configuration is set to default values that are appropriate for the interface associated with the service.

    Availability

    Available in OS X v10.4 and later.

  • Returns the network service with the specified identifier.

    Declaration

    Swift

    func SCNetworkServiceCopy(_ prefs: SCPreferences, _ serviceID: CFString) -> SCNetworkService?

    Objective-C

    SCNetworkServiceRef SCNetworkServiceCopy ( SCPreferencesRef prefs, CFStringRef serviceID );

    Parameters

    prefs

    The preferences session.

    serviceID

    The unique identifier of the network service.

    Return Value

    The network service from the associated preferences, or NULL if the service ID does not exist in the preferences or if an error occurred. You must release the returned value.

    Availability

    Available in OS X v10.4 and later.

  • Returns all available network services for the specified preferences.

    Declaration

    Swift

    func SCNetworkServiceCopyAll(_ prefs: SCPreferences) -> CFArray?

    Objective-C

    CFArrayRef SCNetworkServiceCopyAll ( SCPreferencesRef prefs );

    Parameters

    prefs

    The preferences session.

    Return Value

    The list of network services associated with the preferences. You must release the returned value.

    Availability

    Available in OS X v10.4 and later.

  • Returns the network protocol of the specified type for the specified service.

    Declaration

    Swift

    func SCNetworkServiceCopyProtocol(_ service: SCNetworkService, _ protocolType: CFString) -> SCNetworkProtocol?

    Objective-C

    SCNetworkProtocolRef SCNetworkServiceCopyProtocol ( SCNetworkServiceRef service, CFStringRef protocolType );

    Parameters

    service

    The network service.

    protocolType

    The type of network protocol.

    Return Value

    The network protocol associated with the service, or NULL if this protocol has not been added or if an error occurred. You must release the returned value.

    Availability

    Available in OS X v10.4 and later.

  • Returns all network protocols associated with the specified service.

    Declaration

    Swift

    func SCNetworkServiceCopyProtocols(_ service: SCNetworkService) -> CFArray?

    Objective-C

    CFArrayRef SCNetworkServiceCopyProtocols ( SCNetworkServiceRef service );

    Parameters

    service

    The network service.

    Return Value

    The network protocols associated with the service. You must release the returned value.

    Availability

    Available in OS X v10.4 and later.

  • Creates a new network service for the specified interface in the configuration.

    Declaration

    Swift

    func SCNetworkServiceCreate(_ prefs: SCPreferences, _ interface: SCNetworkInterface) -> SCNetworkService?

    Objective-C

    SCNetworkServiceRef SCNetworkServiceCreate ( SCPreferencesRef prefs, SCNetworkInterfaceRef interface );

    Parameters

    prefs

    The preferences session.

    interface

    The network interface for which to create the new service.

    Return Value

    The new network service. You must release the returned value.

    Availability

    Available in OS X v10.4 and later.

  • Establishes the default configuration for the specified network service.

    Declaration

    Swift

    func SCNetworkServiceEstablishDefaultConfiguration(_ service: SCNetworkService) -> Bool

    Objective-C

    Boolean SCNetworkServiceEstablishDefaultConfiguration ( SCNetworkServiceRef service );

    Parameters

    service

    The network service.

    Return Value

    TRUE if the configuration was updated; FALSE if an error occurred.

    Discussion

    The default configuration includes the addition of network protocols for the service (with default configuration options).

    Availability

    Available in OS X v10.5 and later.

  • Returns a Boolean value indicating whether the specified service is enabled.

    Declaration

    Swift

    func SCNetworkServiceGetEnabled(_ service: SCNetworkService) -> Bool

    Objective-C

    Boolean SCNetworkServiceGetEnabled ( SCNetworkServiceRef service );

    Parameters

    service

    The network service.

    Return Value

    TRUE if the service is enabled; otherwise, FALSE.

    Availability

    Available in OS X v10.4 and later.

  • Returns the network interface associated with the specified service.

    Declaration

    Swift

    func SCNetworkServiceGetInterface(_ service: SCNetworkService) -> SCNetworkInterface?

    Objective-C

    SCNetworkInterfaceRef SCNetworkServiceGetInterface ( SCNetworkServiceRef service );

    Parameters

    service

    The network service.

    Return Value

    The network interface associated with the service, or NULL if an error occurred.

    Availability

    Available in OS X v10.4 and later.

  • Returns the user-specified name associated with the specified service.

    Declaration

    Swift

    func SCNetworkServiceGetName(_ service: SCNetworkService) -> CFString?

    Objective-C

    CFStringRef SCNetworkServiceGetName ( SCNetworkServiceRef service );

    Parameters

    service

    The network service.

    Return Value

    The user-specified name associated with the service.

    Availability

    Available in OS X v10.4 and later.

  • Returns the identifier for the specified service.

    Declaration

    Swift

    func SCNetworkServiceGetServiceID(_ service: SCNetworkService) -> CFString?

    Objective-C

    CFStringRef SCNetworkServiceGetServiceID ( SCNetworkServiceRef service );

    Parameters

    service

    The network service.

    Return Value

    The service identifier.

    Availability

    Available in OS X v10.4 and later.

  • Returns the type identifier of all SCNetworkService instances.

    Declaration

    Swift

    func SCNetworkServiceGetTypeID() -> CFTypeID

    Objective-C

    CFTypeID SCNetworkServiceGetTypeID ( void );

    Return Value

    The type identifier of all SCNetworkService instances.

    Availability

    Available in OS X v10.4 and later.

  • Removes the specified network service from the configuration.

    Declaration

    Swift

    func SCNetworkServiceRemove(_ service: SCNetworkService) -> Bool

    Objective-C

    Boolean SCNetworkServiceRemove ( SCNetworkServiceRef service );

    Parameters

    service

    The network service to remove.

    Return Value

    TRUE if the service was removed; FALSE if an error occurred.

    Availability

    Available in OS X v10.4 and later.

  • Removes the network protocol of the specified type from the specified service.

    Declaration

    Swift

    func SCNetworkServiceRemoveProtocolType(_ service: SCNetworkService, _ protocolType: CFString) -> Bool

    Objective-C

    Boolean SCNetworkServiceRemoveProtocolType ( SCNetworkServiceRef service, CFStringRef protocolType );

    Parameters

    service

    The network service.

    protocolType

    The type of network protocol to remove from the service.

    Return Value

    TRUE if the protocol was removed to the service; FALSE if the protocol was not configured or an error occurred.

    Availability

    Available in OS X v10.4 and later.

  • Enables or disables the specified service.

    Declaration

    Swift

    func SCNetworkServiceSetEnabled(_ service: SCNetworkService, _ enabled: Bool) -> Bool

    Objective-C

    Boolean SCNetworkServiceSetEnabled ( SCNetworkServiceRef service, Boolean enabled );

    Parameters

    service

    The network service to enable or disable.

    enabled

    Pass TRUE if the service should be enabled; FALSE otherwise.

    Return Value

    TRUE if the enabled status was saved; FALSE if an error occurred.

    Availability

    Available in OS X v10.4 and later.

  • Stores the user-specified name for the specified service.

    Declaration

    Swift

    func SCNetworkServiceSetName(_ service: SCNetworkService, _ name: CFString) -> Bool

    Objective-C

    Boolean SCNetworkServiceSetName ( SCNetworkServiceRef service, CFStringRef name );

    Parameters

    service

    The network service.

    name

    The user-defined name to associate with the service.

    Return Value

    TRUE if the name was saved; FALSE if an error occurred.

    Discussion

    Although it is not technically required, the user-specified names for all services within any given set should be unique. For this reason, an error will be returned if you attempt to name two services with the same string.

    Availability

    Available in OS X v10.4 and later.

  • Adds the specified network service to the specified set.

    Declaration

    Swift

    func SCNetworkSetAddService(_ set: SCNetworkSet, _ service: SCNetworkService) -> Bool

    Objective-C

    Boolean SCNetworkSetAddService ( SCNetworkSetRef set, SCNetworkServiceRef service );

    Parameters

    set

    The set (the complete configuration for a single location).

    service

    The service to add to the set.

    Return Value

    TRUE if the service was added to the set; FALSE if the service was already present or an error occurred.

    Discussion

    Prior to OS X v10.5, the Network Preferences pane did not support having a single service being a member of more than one set. Therefore, an error is returned if you attempt to add a service to more than one set on a pre-10.5 system.

    Availability

    Available in OS X v10.4 and later.

  • Returns a Boolean value indicating whether the specified interface is represented by at least one network service in the specified set.

    Declaration

    Swift

    func SCNetworkSetContainsInterface(_ set: SCNetworkSet, _ interface: SCNetworkInterface) -> Bool

    Objective-C

    Boolean SCNetworkSetContainsInterface ( SCNetworkSetRef set, SCNetworkInterfaceRef interface );

    Parameters

    set

    The set (the complete configuration for a single location).

    interface

    The network interface.

    Return Value

    TRUE if the interface is represented in the set; otherwise, FALSE.

    Availability

    Available in OS X v10.5 and later.

  • Returns the set with the specified identifier.

    Declaration

    Swift

    func SCNetworkSetCopy(_ prefs: SCPreferences, _ setID: CFString) -> SCNetworkSet?

    Objective-C

    SCNetworkSetRef SCNetworkSetCopy ( SCPreferencesRef prefs, CFStringRef setID );

    Parameters

    prefs

    The preferences session.

    setID

    The unique identifier for the set.

    Return Value

    The network set from the associated preferences, or NULL if the identifier does not exist in the preferences or if an error occurred. You must release the returned value.

    Availability

    Available in OS X v10.4 and later.

  • Returns all available sets for the specified preferences session.

    Declaration

    Swift

    func SCNetworkSetCopyAll(_ prefs: SCPreferences) -> CFArray?

    Objective-C

    CFArrayRef SCNetworkSetCopyAll ( SCPreferencesRef prefs );

    Parameters

    prefs

    The preferences session.

    Return Value

    The list of network sets associated with the preferences. You must release the returned value.

    Availability

    Available in OS X v10.4 and later.

  • Returns the current set.

    Declaration

    Swift

    func SCNetworkSetCopyCurrent(_ prefs: SCPreferences) -> SCNetworkSet?

    Objective-C

    SCNetworkSetRef SCNetworkSetCopyCurrent ( SCPreferencesRef prefs );

    Parameters

    prefs

    The preferences session.

    Return Value

    The current set, or NULL if no current set has been defined.

    Availability

    Available in OS X v10.4 and later.

  • Returns all network services associated with the specified set.

    Declaration

    Swift

    func SCNetworkSetCopyServices(_ set: SCNetworkSet) -> CFArray?

    Objective-C

    CFArrayRef SCNetworkSetCopyServices ( SCNetworkSetRef set );

    Parameters

    set

    The set (the complete configuration for a single location).

    Return Value

    The list of network services associated with the set. You must release the returned value.

    Availability

    Available in OS X v10.4 and later.

  • Creates a new set in the configuration.

    Declaration

    Swift

    func SCNetworkSetCreate(_ prefs: SCPreferences) -> SCNetworkSet?

    Objective-C

    SCNetworkSetRef SCNetworkSetCreate ( SCPreferencesRef prefs );

    Parameters

    prefs

    The preferences session.

    Return Value

    The new network set. You must release the returned value.

    Availability

    Available in OS X v10.4 and later.

  • Returns the user-specified name associated with the specified set.

    Declaration

    Swift

    func SCNetworkSetGetName(_ set: SCNetworkSet) -> CFString?

    Objective-C

    CFStringRef SCNetworkSetGetName ( SCNetworkSetRef set );

    Parameters

    set

    The set (the complete configuration for a single location).

    Return Value

    The user-specified name associated with the set.

    Availability

    Available in OS X v10.4 and later.

  • Returns the user-specified ordering of network services within the specified set.

    Declaration

    Swift

    func SCNetworkSetGetServiceOrder(_ set: SCNetworkSet) -> CFArray?

    Objective-C

    CFArrayRef SCNetworkSetGetServiceOrder ( SCNetworkSetRef set );

    Parameters

    set

    The set (the complete configuration for a single location).

    Return Value

    The ordered list of service identifiers associated with the set, or NULL if no service order has been specified or if an error occurred.

    Availability

    Available in OS X v10.4 and later.

  • Returns the identifier for the specified set.

    Declaration

    Swift

    func SCNetworkSetGetSetID(_ set: SCNetworkSet) -> CFString?

    Objective-C

    CFStringRef SCNetworkSetGetSetID ( SCNetworkSetRef set );

    Parameters

    set

    The set (the complete configuration for a single location).

    Return Value

    The set identifier.

    Availability

    Available in OS X v10.4 and later.

  • Returns the type identifier of all SCNetworkSet instances.

    Declaration

    Swift

    func SCNetworkSetGetTypeID() -> CFTypeID

    Objective-C

    CFTypeID SCNetworkSetGetTypeID ( void );

    Return Value

    The type identifier of all SCNetworkSet instances.

    Availability

    Available in OS X v10.4 and later.

  • Removes the specified set from the configuration.

    Declaration

    Swift

    func SCNetworkSetRemove(_ set: SCNetworkSet) -> Bool

    Objective-C

    Boolean SCNetworkSetRemove ( SCNetworkSetRef set );

    Parameters

    set

    The set (the complete configuration for a single location).

    Return Value

    TRUE if the set was removed; FALSE if an error occurred.

    Availability

    Available in OS X v10.4 and later.

  • Removes the specified network service from the specified set.

    Declaration

    Swift

    func SCNetworkSetRemoveService(_ set: SCNetworkSet, _ service: SCNetworkService) -> Bool

    Objective-C

    Boolean SCNetworkSetRemoveService ( SCNetworkSetRef set, SCNetworkServiceRef service );

    Parameters

    set

    The set (the complete configuration for a single location).

    service

    The service to remove.

    Return Value

    TRUE if the service was removed from the set; FALSE if the service was not already present or an error occurred.

    Availability

    Available in OS X v10.4 and later.

  • Specifies the set that should be the current set.

    Declaration

    Swift

    func SCNetworkSetSetCurrent(_ set: SCNetworkSet) -> Bool

    Objective-C

    Boolean SCNetworkSetSetCurrent ( SCNetworkSetRef set );

    Parameters

    set

    The set (the complete configuration for a single location).

    Return Value

    TRUE if the current set was updated; FALSE if an error occurred.

    Availability

    Available in OS X v10.4 and later.

  • Stores the user-specified name for the specified set.

    Declaration

    Swift

    func SCNetworkSetSetName(_ set: SCNetworkSet, _ name: CFString) -> Bool

    Objective-C

    Boolean SCNetworkSetSetName ( SCNetworkSetRef set, CFStringRef name );

    Parameters

    set

    The set (the complete configuration for a single location).

    name

    The user-defined name to associate with the set.

    Return Value

    TRUE if the name was saved; FALSE if an error occurred.

    Discussion

    Although it is not technically required, the user-specified names for all sets should be unique. For this reason, an error is returned if you attempt to name two sets with the same string.

    Availability

    Available in OS X v10.4 and later.

  • Stores the user-specified ordering of network services for the specified set.

    Declaration

    Swift

    func SCNetworkSetSetServiceOrder(_ set: SCNetworkSet, _ newOrder: CFArray) -> Bool

    Objective-C

    Boolean SCNetworkSetSetServiceOrder ( SCNetworkSetRef set, CFArrayRef newOrder );

    Parameters

    set

    The set (the complete configuration for a single location).

    newOrder

    The ordered list of service identifiers for the set.

    Return Value

    TRUE if the new service order was saved; FALSE if an error occurred.

    Availability

    Available in OS X v10.4 and later.

Data Types

  • The reference to an object that represents a network interface.

    Declaration

    Swift

    typealias SCNetworkInterfaceRef = SCNetworkInterface

    Objective-C

    typedef const struct __SCNetworkInterface * SCNetworkInterfaceRef;

    Import Statement

    Objective-C

    @import SystemConfiguration;

    Swift

    import SystemConfiguration

    Availability

    Available in OS X v10.4 and later.

  • The reference to an object that represents an Ethernet bond interface.

    Declaration

    Swift

    typealias SCBondInterfaceRef = SCBondInterface

    Objective-C

    typedef SCNetworkInterfaceRef SCBondInterfaceRef;

    Import Statement

    Objective-C

    @import SystemConfiguration;

    Swift

    import SystemConfiguration

    Availability

    Available in OS X v10.5 and later.

  • The reference to an object that represents the status of an Ethernet bond interface.

    Declaration

    Swift

    typealias SCBondStatusRef = SCBondStatus

    Objective-C

    typedef const struct __SCBondStatus * SCBondStatusRef;

    Import Statement

    Objective-C

    @import SystemConfiguration;

    Swift

    import SystemConfiguration

    Availability

    Available in OS X v10.5 and later.

  • The reference to an object that represents a virtual LAN (VLAN) interface.

    Declaration

    Swift

    typealias SCVLANInterfaceRef = SCVLANInterface

    Objective-C

    typedef SCNetworkInterfaceRef SCVLANInterfaceRef;

    Import Statement

    Objective-C

    @import SystemConfiguration;

    Swift

    import SystemConfiguration

    Availability

    Available in OS X v10.5 and later.

  • The reference to an object that represents a network protocol.

    Declaration

    Swift

    typealias SCNetworkProtocolRef = SCNetworkProtocol

    Objective-C

    typedef const struct __SCNetworkProtocol * SCNetworkProtocolRef;

    Import Statement

    Objective-C

    @import SystemConfiguration;

    Swift

    import SystemConfiguration

    Availability

    Available in OS X v10.4 and later.

  • The reference to an object that represents a network service.

    Declaration

    Swift

    typealias SCNetworkServiceRef = SCNetworkService

    Objective-C

    typedef const struct __SCNetworkService * SCNetworkServiceRef;

    Import Statement

    Objective-C

    @import SystemConfiguration;

    Swift

    import SystemConfiguration

    Availability

    Available in OS X v10.4 and later.

  • The reference to an object that represents a network set.

    Declaration

    Swift

    typealias SCNetworkSetRef = SCNetworkSet

    Objective-C

    typedef const struct __SCNetworkSet * SCNetworkSetRef;

    Import Statement

    Objective-C

    @import SystemConfiguration;

    Swift

    import SystemConfiguration

    Availability

    Available in OS X v10.4 and later.

Constants

  • Ethernet bond aggregation status codes.

    Declaration

    Swift

    var kSCBondStatusOK: Int { get } var kSCBondStatusLinkInvalid: Int { get } var kSCBondStatusNoPartner: Int { get } var kSCBondStatusNotInActiveGroup: Int { get } var kSCBondStatusUnknown: Int { get }

    Objective-C

    enum { kSCBondStatusOK = 0, kSCBondStatusLinkInvalid = 1, kSCBondStatusNoPartner = 2, kSCBondStatusNotInActiveGroup = 3, kSCBondStatusUnknown = 999 };

    Constants

    • kSCBondStatusOK

      kSCBondStatusOK

      The status is valid (for example, enabled, active, running, and so forth.)

      Available in OS X v10.5 and later.

    • kSCBondStatusLinkInvalid

      kSCBondStatusLinkInvalid

      The link state is not valid (such as down, half-duplex, or wrong speed).

      Available in OS X v10.5 and later.

    • kSCBondStatusNoPartner

      kSCBondStatusNoPartner

      The port on the switch to which the device is connected doesn't seem to have 802.3ad Link Aggregation enabled.

      Available in OS X v10.5 and later.

    • kSCBondStatusNotInActiveGroup

      kSCBondStatusNotInActiveGroup

      Communication with a partner is occurring, but the link aggregation group is different from the one that is active.

      Available in OS X v10.5 and later.

    • kSCBondStatusUnknown

      kSCBondStatusUnknown

      Nonspecific failure.

      Available in OS X v10.5 and later.

  • Ethernet bond status codes.

    Declaration

    Swift

    let kSCBondStatusDeviceAggregationStatus: CFString let kSCBondStatusDeviceCollecting: CFString let kSCBondStatusDeviceDistributing: CFString

    Objective-C

    const CFStringRef kSCBondStatusDeviceAggregationStatus; const CFStringRef kSCBondStatusDeviceCollecting; const CFStringRef kSCBondStatusDeviceDistributing;

    Constants

    • kSCBondStatusDeviceAggregationStatus

      kSCBondStatusDeviceAggregationStatus

      Device is aggregating. See Ethernet Bond Aggregation Status for a list of possible values.

      Available in OS X v10.4 and later.

    • kSCBondStatusDeviceCollecting

      kSCBondStatusDeviceCollecting

      Can be 0 or 1.

      Available in OS X v10.4 and later.

    • kSCBondStatusDeviceDistributing

      kSCBondStatusDeviceDistributing

      Can be 0 or 1.

      Available in OS X v10.4 and later.

  • Keys that identify network interface types.

    Declaration

    Swift

    let kSCNetworkInterfaceType6to4: CFString let kSCNetworkInterfaceTypeBluetooth: CFString let kSCNetworkInterfaceTypeBond: CFString let kSCNetworkInterfaceTypeEthernet: CFString let kSCNetworkInterfaceTypeFireWire: CFString let kSCNetworkInterfaceTypeIEEE80211: CFString let kSCNetworkInterfaceTypeIPSec: CFString let kSCNetworkInterfaceTypeIrDA: CFString let kSCNetworkInterfaceTypeL2TP: CFString let kSCNetworkInterfaceTypeModem: CFString let kSCNetworkInterfaceTypePPP: CFString let kSCNetworkInterfaceTypePPTP: CFString let kSCNetworkInterfaceTypeSerial: CFString let kSCNetworkInterfaceTypeVLAN: CFString let kSCNetworkInterfaceTypeWWAN: CFString let kSCNetworkInterfaceTypeIPv4: CFString let kSCNetworkInterfaceIPv4: SCNetworkInterface

    Objective-C

    const CFStringRef kSCNetworkInterfaceType6to4; const CFStringRef kSCNetworkInterfaceTypeBluetooth; const CFStringRef kSCNetworkInterfaceTypeBond; const CFStringRef kSCNetworkInterfaceTypeEthernet; const CFStringRef kSCNetworkInterfaceTypeFireWire; const CFStringRef kSCNetworkInterfaceTypeIEEE80211; const CFStringRef kSCNetworkInterfaceTypeIPSec; const CFStringRef kSCNetworkInterfaceTypeIrDA; const CFStringRef kSCNetworkInterfaceTypeL2TP; const CFStringRef kSCNetworkInterfaceTypeModem; const CFStringRef kSCNetworkInterfaceTypePPP; const CFStringRef kSCNetworkInterfaceTypePPTP; const CFStringRef kSCNetworkInterfaceTypeSerial; const CFStringRef kSCNetworkInterfaceTypeVLAN; const CFStringRef kSCNetworkInterfaceTypeWWAN; const CFStringRef kSCNetworkInterfaceTypeIPv4; const SCNetworkInterfaceRef kSCNetworkInterfaceIPv4;

    Constants

    • kSCNetworkInterfaceType6to4

      kSCNetworkInterfaceType6to4

      The 6to4 interface.

      Available in OS X v10.4 and later.

    • kSCNetworkInterfaceTypeBluetooth

      kSCNetworkInterfaceTypeBluetooth

      The Bluetooth interface.

      Available in OS X v10.4 and later.

    • kSCNetworkInterfaceTypeBond

      kSCNetworkInterfaceTypeBond

      The Ethernet bond interface.

      Available in OS X v10.4 and later.

    • kSCNetworkInterfaceTypeEthernet

      kSCNetworkInterfaceTypeEthernet

      The Ethernet interface.

      Available in OS X v10.4 and later.

    • kSCNetworkInterfaceTypeFireWire

      kSCNetworkInterfaceTypeFireWire

      The FireWire interface.

      Available in OS X v10.4 and later.

    • kSCNetworkInterfaceTypeIEEE80211

      kSCNetworkInterfaceTypeIEEE80211

      The IEEE 802.11 interface.

      Available in OS X v10.4 and later.

    • kSCNetworkInterfaceTypeIPSec

      kSCNetworkInterfaceTypeIPSec

      The IPSec interface.

      Available in OS X v10.5 and later.

    • kSCNetworkInterfaceTypeIrDA

      kSCNetworkInterfaceTypeIrDA

      The IrDA interface.

      Available in OS X v10.4 and later.

    • kSCNetworkInterfaceTypeL2TP

      kSCNetworkInterfaceTypeL2TP

      The L2TP interface.

      Available in OS X v10.4 and later.

    • kSCNetworkInterfaceTypeModem

      kSCNetworkInterfaceTypeModem

      The modem interface.

      Available in OS X v10.4 and later.

    • kSCNetworkInterfaceTypePPP

      kSCNetworkInterfaceTypePPP

      The PPP interface.

      Available in OS X v10.4 and later.

    • kSCNetworkInterfaceTypePPTP

      kSCNetworkInterfaceTypePPTP

      The PPTP interface.

      Available in OS X v10.4 and later.

    • kSCNetworkInterfaceTypeSerial

      kSCNetworkInterfaceTypeSerial

      The serial interface.

      Available in OS X v10.4 and later.

    • kSCNetworkInterfaceTypeVLAN

      kSCNetworkInterfaceTypeVLAN

      The VLAN interface.

      Available in OS X v10.4 and later.

    • kSCNetworkInterfaceTypeWWAN

      kSCNetworkInterfaceTypeWWAN

      The WWAN interface.

      Available in OS X v10.5 and later.

    • kSCNetworkInterfaceTypeIPv4

      kSCNetworkInterfaceTypeIPv4

      The IPv4 interface.

      Available in OS X v10.4 and later.

    • kSCNetworkInterfaceIPv4

      kSCNetworkInterfaceIPv4

      A network interface that can used for layering other interfaces (for example, 6to4, PPTP, or L2TP) over an existing IPv4 network.

      Available in OS X v10.4 and later.

  • Keys that identify network protocol types.

    Declaration

    Swift

    let kSCNetworkProtocolTypeDNS: CFString let kSCNetworkProtocolTypeIPv4: CFString let kSCNetworkProtocolTypeIPv6: CFString let kSCNetworkProtocolTypeProxies: CFString let kSCNetworkProtocolTypeSMB: CFString

    Objective-C

    const CFStringRef kSCNetworkProtocolTypeAppleTalk; const CFStringRef kSCNetworkProtocolTypeDNS; const CFStringRef kSCNetworkProtocolTypeIPv4; const CFStringRef kSCNetworkProtocolTypeIPv6; const CFStringRef kSCNetworkProtocolTypeProxies; const CFStringRef kSCNetworkProtocolTypeSMB;

    Constants

    • kSCNetworkProtocolTypeAppleTalk

      The AppleTalk protocol.

      Available in OS X v10.4 and later.

      Deprecated in OS X v10.6.

    • kSCNetworkProtocolTypeDNS

      kSCNetworkProtocolTypeDNS

      The DNS protocol.

      Available in OS X v10.4 and later.

    • kSCNetworkProtocolTypeIPv4

      kSCNetworkProtocolTypeIPv4

      The IPv4 protocol.

      Available in OS X v10.4 and later.

    • kSCNetworkProtocolTypeIPv6

      kSCNetworkProtocolTypeIPv6

      The IPv6 protocol.

      Available in OS X v10.4 and later.

    • kSCNetworkProtocolTypeProxies

      kSCNetworkProtocolTypeProxies

      Protocol proxies.

      Available in OS X v10.4 and later.

    • kSCNetworkProtocolTypeSMB

      kSCNetworkProtocolTypeSMB

      The SMB procotol.

      Available in OS X v10.5 and later.