#[repr(C)]pub struct SCNetworkInterface { /* private fields */ }
SCNetworkConfiguration
only.Expand description
This is the type of a reference to an object that represents a network interface.
See also Apple’s documentation
Implementations§
Source§impl SCNetworkInterface
impl SCNetworkInterface
Sourcepub fn all() -> CFRetained<CFArray>
pub fn all() -> CFRetained<CFArray>
Returns all network capable interfaces on the system.
Returns: The list of interfaces on the system. You must release the returned value.
Sourcepub fn supported_interface_types(
self: &SCNetworkInterface,
) -> Option<CFRetained<CFArray>>
pub fn supported_interface_types( self: &SCNetworkInterface, ) -> Option<CFRetained<CFArray>>
Identify all of the network interface types (e.g. PPP) that can be layered on top of this interface.
Parameter interface
: The network interface.
Returns: The list of SCNetworkInterface types supported by the interface; NULL if no interface types are supported.
Sourcepub fn supported_protocol_types(
self: &SCNetworkInterface,
) -> Option<CFRetained<CFArray>>
pub fn supported_protocol_types( self: &SCNetworkInterface, ) -> Option<CFRetained<CFArray>>
Identify all of the network protocol types (e.g. IPv4, IPv6) that can be layered on top of this interface.
Parameter interface
: The network interface.
Returns: The list of SCNetworkProtocol types supported by the interface; NULL if no protocol types are supported.
Sourcepub fn with_interface(
self: &SCNetworkInterface,
interface_type: &CFString,
) -> Option<CFRetained<SCNetworkInterface>>
pub fn with_interface( self: &SCNetworkInterface, interface_type: &CFString, ) -> Option<CFRetained<SCNetworkInterface>>
Create a new network interface layered on top of another. For example, this function would be used to create a “PPP” interface on top of a “modem”.
Parameter interface
: The network interface.
Parameter interfaceType
: The type of SCNetworkInterface to be layered on
top of the provided interface.
Returns: A reference to the new SCNetworkInterface. You must release the returned value.
Sourcepub fn bsd_name(self: &SCNetworkInterface) -> Option<CFRetained<CFString>>
pub fn bsd_name(self: &SCNetworkInterface) -> Option<CFRetained<CFString>>
Returns the BSD interface (en0) or device name (modem) for the interface.
Parameter interface
: The network interface.
Returns: The BSD name associated with the interface (e.g. “en0”); NULL if no BSD name is available.
Sourcepub fn configuration(
self: &SCNetworkInterface,
) -> Option<CFRetained<CFDictionary>>
pub fn configuration( self: &SCNetworkInterface, ) -> Option<CFRetained<CFDictionary>>
Returns the configuration settings associated with a interface.
Parameter interface
: The network interface.
Returns: The configuration settings associated with the interface; NULL if no configuration settings are associated with the interface or an error was encountered.
Sourcepub fn extended_configuration(
self: &SCNetworkInterface,
extended_type: &CFString,
) -> Option<CFRetained<CFDictionary>>
pub fn extended_configuration( self: &SCNetworkInterface, extended_type: &CFString, ) -> Option<CFRetained<CFDictionary>>
Returns the configuration settings associated with a interface.
Parameter interface
: The network interface.
Parameter extendedType
: A string representing the type of extended information (e.g. EAPOL).
Returns: The configuration settings associated with the interface; NULL if no configuration settings are associated with the interface or an error was encountered.
Sourcepub fn hardware_address_string(
self: &SCNetworkInterface,
) -> Option<CFRetained<CFString>>
pub fn hardware_address_string( self: &SCNetworkInterface, ) -> Option<CFRetained<CFString>>
Returns a displayable link layer address for the interface.
Parameter interface
: The network interface.
Returns: A string representing the hardware (MAC) address for the interface.
Sourcepub fn interface(
self: &SCNetworkInterface,
) -> Option<CFRetained<SCNetworkInterface>>
pub fn interface( self: &SCNetworkInterface, ) -> Option<CFRetained<SCNetworkInterface>>
For layered network interfaces, return the underlying interface.
Parameter interface
: The network interface.
Returns: The underlying network interface; NULL if this is a leaf interface.
Sourcepub fn interface_type(self: &SCNetworkInterface) -> Option<CFRetained<CFString>>
pub fn interface_type(self: &SCNetworkInterface) -> Option<CFRetained<CFString>>
Returns the associated network interface type.
Parameter interface
: The network interface.
Returns: The interface type.
Sourcepub fn localized_display_name(
self: &SCNetworkInterface,
) -> Option<CFRetained<CFString>>
pub fn localized_display_name( self: &SCNetworkInterface, ) -> Option<CFRetained<CFString>>
Returns the localized name (e.g. “Ethernet”, “FireWire”) for the interface.
Parameter interface
: The network interface.
Returns: A localized, display name for the interface; NULL if no name is available.
Sourcepub unsafe fn set_configuration(
self: &SCNetworkInterface,
config: Option<&CFDictionary>,
) -> bool
pub unsafe fn set_configuration( self: &SCNetworkInterface, config: Option<&CFDictionary>, ) -> bool
Stores the configuration settings for the interface.
Parameter interface
: The network interface.
Parameter config
: The configuration settings to associate with this interface.
Returns: TRUE if the configuration was stored; FALSE if an error was encountered.
Sourcepub unsafe fn set_extended_configuration(
self: &SCNetworkInterface,
extended_type: &CFString,
config: Option<&CFDictionary>,
) -> bool
pub unsafe fn set_extended_configuration( self: &SCNetworkInterface, extended_type: &CFString, config: Option<&CFDictionary>, ) -> bool
Stores the configuration settings for the interface.
Parameter interface
: The network interface.
Parameter config
: The configuration settings to associate with this interface.
Returns: TRUE if the configuration was stored; FALSE if an error was encountered.
Sourcepub unsafe fn media_options(
self: &SCNetworkInterface,
current: *mut *const CFDictionary,
active: *mut *const CFDictionary,
available: *mut *const CFArray,
filter: bool,
) -> bool
pub unsafe fn media_options( self: &SCNetworkInterface, current: *mut *const CFDictionary, active: *mut *const CFDictionary, available: *mut *const CFArray, filter: bool, ) -> bool
For the specified network interface, returns information about the currently requested media options, the active media options, and the media options which are available.
Parameter interface
: The desired network interface.
Parameter current
: A pointer to memory that will be filled with a CFDictionaryRef
representing the currently requested media options (subtype, options).
If NULL, the current options will not be returned.
Parameter active
: A pointer to memory that will be filled with a CFDictionaryRef
representing the active media options (subtype, options).
If NULL, the active options will not be returned.
Parameter available
: A pointer to memory that will be filled with a CFArrayRef
representing the possible media options (subtype, options).
If NULL, the available options will not be returned.
Parameter filter
: A boolean indicating whether the available options should be
filtered to exclude those options which would not normally be
requested by a user/admin (e.g. hw-loopback).
Returns: TRUE if requested information has been returned.
Sourcepub fn media_sub_types(available: &CFArray) -> Option<CFRetained<CFArray>>
pub fn media_sub_types(available: &CFArray) -> Option<CFRetained<CFArray>>
For the provided interface configuration options, return a list of available media subtypes.
Parameter available
: The available options as returned by the
SCNetworkInterfaceCopyMediaOptions function.
Returns: An array of available media subtypes CFString’s (e.g. 10BaseT/UTP, 100baseTX, etc). NULL if no subtypes are available.
Sourcepub fn media_sub_type_options(
available: &CFArray,
sub_type: &CFString,
) -> Option<CFRetained<CFArray>>
pub fn media_sub_type_options( available: &CFArray, sub_type: &CFString, ) -> Option<CFRetained<CFArray>>
For the provided interface configuration options and specific subtype, return a list of available media options.
Parameter available
: The available options as returned by the
SCNetworkInterfaceCopyMediaOptions function.
Parameter subType
: The subtype
Returns: An array of available media options. Each of the available options is returned as an array of CFString’s (e.g. <half -duplex>, <full -duplex,flow-control>). NULL if no options are available.
Sourcepub unsafe fn mtu(
self: &SCNetworkInterface,
mtu_cur: *mut c_int,
mtu_min: *mut c_int,
mtu_max: *mut c_int,
) -> bool
pub unsafe fn mtu( self: &SCNetworkInterface, mtu_cur: *mut c_int, mtu_min: *mut c_int, mtu_max: *mut c_int, ) -> bool
For the specified network interface, returns information about the currently MTU setting and the range of allowable values.
Parameter interface
: The desired network interface.
Parameter mtu_cur
: A pointer to memory that will be filled with the current
MTU setting for the interface.
Parameter mtu_min
: A pointer to memory that will be filled with the minimum
MTU setting for the interface. If negative, the minimum setting
could not be determined.
Parameter mtu_max
: A pointer to memory that will be filled with the maximum
MTU setting for the interface. If negative, the maximum setting
could not be determined.
Returns: TRUE if requested information has been returned.
Sourcepub fn set_media_options(
self: &SCNetworkInterface,
subtype: Option<&CFString>,
options: Option<&CFArray>,
) -> bool
pub fn set_media_options( self: &SCNetworkInterface, subtype: Option<&CFString>, options: Option<&CFArray>, ) -> bool
For the specified network interface, sets the requested media subtype and options.
Parameter interface
: The desired network interface.
Parameter subtype
: The desired media subtype (e.g. “autoselect”, “100baseTX”, …).
If NULL, no specific media subtype will be requested.
Parameter options
: The desired media options (e.g. “half-duplex”, “full-duplex”, …).
If NULL, no specific media options will be requested.
Returns: TRUE if the configuration was updated; FALSE if an error was encountered.
Sourcepub fn set_mtu(self: &SCNetworkInterface, mtu: c_int) -> bool
pub fn set_mtu(self: &SCNetworkInterface, mtu: c_int) -> bool
For the specified network interface, sets the requested MTU setting.
Parameter interface
: The desired network interface.
Parameter mtu
: The desired MTU setting for the interface.
If zero, the interface will use the default MTU setting.
Returns: TRUE if the configuration was updated; FALSE if an error was encountered.
Sourcepub fn force_configuration_refresh(self: &SCNetworkInterface) -> bool
pub fn force_configuration_refresh(self: &SCNetworkInterface) -> bool
Sends a notification to interested network configuration agents to immediately retry their configuration. For example, calling this function will cause the DHCP client to contact the DHCP server immediately rather than waiting until its timeout has expired. The utility of this function is to allow the caller to give a hint to the system that the network infrastructure or configuration has changed.
Note: This function requires root (euid==0) privilege or, alternatively, you may pass an SCNetworkInterface which is derived from a sequence of calls to :
SCPreferencesCreateWithAuthorization SCNetworkSetCopy… SCNetworkServiceGetInterface
Parameter interface
: The desired network interface.
Returns: Returns TRUE if the notification was sent; FALSE otherwise.
Methods from Deref<Target = CFType>§
Sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: ConcreteType,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: ConcreteType,
Attempt to downcast the type to that of type T
.
This is the reference-variant. Use CFRetained::downcast
if you
want to convert a retained type. See also ConcreteType
for more
details on which types support being converted to.
Sourcepub fn retain_count(&self) -> usize
pub fn retain_count(&self) -> usize
Get the reference count of the object.
This function may be useful for debugging. You normally do not use this function otherwise.
Beware that some things (like CFNumber
s, small CFString
s etc.) may
not have a normal retain count for optimization purposes, and can
return usize::MAX
in that case.
Trait Implementations§
Source§impl AsRef<AnyObject> for SCNetworkInterface
impl AsRef<AnyObject> for SCNetworkInterface
Source§impl AsRef<CFType> for SCNetworkInterface
impl AsRef<CFType> for SCNetworkInterface
Source§impl AsRef<SCNetworkInterface> for SCNetworkInterface
impl AsRef<SCNetworkInterface> for SCNetworkInterface
Source§impl Borrow<AnyObject> for SCNetworkInterface
impl Borrow<AnyObject> for SCNetworkInterface
Source§impl Borrow<CFType> for SCNetworkInterface
impl Borrow<CFType> for SCNetworkInterface
Source§impl ConcreteType for SCNetworkInterface
impl ConcreteType for SCNetworkInterface
Source§impl Debug for SCNetworkInterface
impl Debug for SCNetworkInterface
Source§impl Deref for SCNetworkInterface
impl Deref for SCNetworkInterface
Source§impl Hash for SCNetworkInterface
impl Hash for SCNetworkInterface
Source§impl Message for SCNetworkInterface
impl Message for SCNetworkInterface
Source§impl PartialEq for SCNetworkInterface
impl PartialEq for SCNetworkInterface
Source§impl RefEncode for SCNetworkInterface
impl RefEncode for SCNetworkInterface
Source§const ENCODING_REF: Encoding
const ENCODING_REF: Encoding
Source§impl Type for SCNetworkInterface
impl Type for SCNetworkInterface
Source§fn retain(&self) -> CFRetained<Self>where
Self: Sized,
fn retain(&self) -> CFRetained<Self>where
Self: Sized,
Source§fn as_concrete_TypeRef(&self) -> &Self
fn as_concrete_TypeRef(&self) -> &Self
core-foundation
crate.Source§unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self>where
Self: Sized,
unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self>where
Self: Sized,
core-foundation
crate. Read moreSource§fn as_CFTypeRef(&self) -> &CFType
fn as_CFTypeRef(&self) -> &CFType
core-foundation
crate.Source§unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self>where
Self: Sized,
unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self>where
Self: Sized,
core-foundation
crate. Read more