#[repr(C)]pub struct SCNetworkService { /* private fields */ }
SCNetworkConfiguration
only.Expand description
This is the type of a reference to an object that represents a network service.
See also Apple’s documentation
Implementations§
Source§impl SCNetworkService
impl SCNetworkService
Sourcepub fn add_protocol_type(
self: &SCNetworkService,
protocol_type: &CFString,
) -> bool
pub fn add_protocol_type( self: &SCNetworkService, protocol_type: &CFString, ) -> bool
Adds a network protocol of the specified type to the service. The protocol configuration is set to default values that are appropriate for the interface associated with the service.
Parameter service
: The network service.
Parameter protocolType
: The type of SCNetworkProtocol to be added to the service.
Returns: TRUE if the protocol was added to the service; FALSE if the protocol was already present or an error was encountered.
Sourcepub fn all(prefs: &SCPreferences) -> Option<CFRetained<CFArray>>
Available on crate feature SCPreferences
only.
pub fn all(prefs: &SCPreferences) -> Option<CFRetained<CFArray>>
SCPreferences
only.Returns all available network services for the specified preferences.
Parameter prefs
: The “preferences” session.
Returns: The list of SCNetworkService services associated with the preferences. You must release the returned value.
Sourcepub fn protocols(self: &SCNetworkService) -> Option<CFRetained<CFArray>>
pub fn protocols(self: &SCNetworkService) -> Option<CFRetained<CFArray>>
Returns all network protocols associated with the service.
Parameter service
: The network service.
Returns: The list of SCNetworkProtocol protocols associated with the service. You must release the returned value.
Sourcepub fn new(
prefs: &SCPreferences,
interface: &SCNetworkInterface,
) -> Option<CFRetained<SCNetworkService>>
Available on crate feature SCPreferences
only.
pub fn new( prefs: &SCPreferences, interface: &SCNetworkInterface, ) -> Option<CFRetained<SCNetworkService>>
SCPreferences
only.Create a new network service for the specified interface in the configuration.
Parameter prefs
: The “preferences” session.
Returns: A reference to the new SCNetworkService. You must release the returned value.
Sourcepub fn copy(
prefs: &SCPreferences,
service_id: &CFString,
) -> Option<CFRetained<SCNetworkService>>
Available on crate feature SCPreferences
only.
pub fn copy( prefs: &SCPreferences, service_id: &CFString, ) -> Option<CFRetained<SCNetworkService>>
SCPreferences
only.Returns the network service with the specified identifier.
Parameter prefs
: The “preferences” session.
Parameter serviceID
: The unique identifier for the service.
Returns: A reference to the SCNetworkService from the associated preferences; NULL if the serviceID does not exist in the preferences or if an error was encountered. You must release the returned value.
Sourcepub fn establish_default_configuration(self: &SCNetworkService) -> bool
pub fn establish_default_configuration(self: &SCNetworkService) -> bool
Establishes the “default” configuration for a network service. This configuration includes the addition of network protocols for the service (with “default” configuration options).
Parameter service
: The network service.
Returns: TRUE if the configuration was updated; FALSE if an error was encountered.
Sourcepub fn enabled(self: &SCNetworkService) -> bool
pub fn enabled(self: &SCNetworkService) -> bool
Returns whether this service has been enabled.
Parameter service
: The network service.
Returns: TRUE if the service is enabled.
Sourcepub fn interface(
self: &SCNetworkService,
) -> Option<CFRetained<SCNetworkInterface>>
pub fn interface( self: &SCNetworkService, ) -> Option<CFRetained<SCNetworkInterface>>
Returns the network interface associated with the service.
Parameter service
: The network service.
Returns: A reference to the SCNetworkInterface associated with the service; NULL if an error was encountered.
Sourcepub fn name(self: &SCNetworkService) -> Option<CFRetained<CFString>>
pub fn name(self: &SCNetworkService) -> Option<CFRetained<CFString>>
Returns the [user specified] name associated with the service.
Parameter service
: The network service.
Returns: The [user specified] name.
Sourcepub fn protocol(
self: &SCNetworkService,
protocol_type: &CFString,
) -> Option<CFRetained<SCNetworkProtocol>>
pub fn protocol( self: &SCNetworkService, protocol_type: &CFString, ) -> Option<CFRetained<SCNetworkProtocol>>
Returns the network protocol of the specified type for the service.
Parameter service
: The network service.
Returns: A reference to the SCNetworkProtocol associated with the service; NULL if this protocol has not been added or if an error was encountered. You must release the returned value.
Sourcepub fn service_id(self: &SCNetworkService) -> Option<CFRetained<CFString>>
pub fn service_id(self: &SCNetworkService) -> Option<CFRetained<CFString>>
Returns the identifier for the service.
Parameter service
: The network service.
Returns: The service identifier.
Sourcepub fn remove(self: &SCNetworkService) -> bool
pub fn remove(self: &SCNetworkService) -> bool
Removes the network service from the configuration.
Parameter service
: The network service.
Returns: TRUE if the service was removed; FALSE if an error was encountered.
Sourcepub fn remove_protocol_type(
self: &SCNetworkService,
protocol_type: &CFString,
) -> bool
pub fn remove_protocol_type( self: &SCNetworkService, protocol_type: &CFString, ) -> bool
Removes the network protocol of the specified type from the service.
Parameter service
: The network service.
Parameter protocolType
: The type of SCNetworkProtocol to be removed from the service.
Returns: TRUE if the protocol was removed to the service; FALSE if the protocol was not configured or an error was encountered.
Sourcepub fn set_enabled(self: &SCNetworkService, enabled: bool) -> bool
pub fn set_enabled(self: &SCNetworkService, enabled: bool) -> bool
Enables or disables the service.
Parameter service
: The network service.
Parameter enabled
: TRUE if the service should be enabled.
Returns: TRUE if the enabled status was saved; FALSE if an error was encountered.
Sourcepub fn set_name(self: &SCNetworkService, name: Option<&CFString>) -> bool
pub fn set_name(self: &SCNetworkService, name: Option<&CFString>) -> bool
Stores the [user specified] name for the service.
Parameter service
: The network service.
Parameter name
: The [user defined] name to associate with the service.
Returns: TRUE if the name was saved; FALSE if an error was encountered.
Note: although not technically required, the [user specified] names for all services within any given set should be unique. As such, an error will be returned if you attemp to name two services with the same string.
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 SCNetworkService
impl AsRef<AnyObject> for SCNetworkService
Source§impl AsRef<CFType> for SCNetworkService
impl AsRef<CFType> for SCNetworkService
Source§impl AsRef<SCNetworkService> for SCNetworkService
impl AsRef<SCNetworkService> for SCNetworkService
Source§impl Borrow<AnyObject> for SCNetworkService
impl Borrow<AnyObject> for SCNetworkService
Source§impl Borrow<CFType> for SCNetworkService
impl Borrow<CFType> for SCNetworkService
Source§impl ConcreteType for SCNetworkService
impl ConcreteType for SCNetworkService
Source§impl Debug for SCNetworkService
impl Debug for SCNetworkService
Source§impl Deref for SCNetworkService
impl Deref for SCNetworkService
Source§impl Hash for SCNetworkService
impl Hash for SCNetworkService
Source§impl Message for SCNetworkService
impl Message for SCNetworkService
Source§impl PartialEq for SCNetworkService
impl PartialEq for SCNetworkService
Source§impl RefEncode for SCNetworkService
impl RefEncode for SCNetworkService
Source§const ENCODING_REF: Encoding
const ENCODING_REF: Encoding
Source§impl Type for SCNetworkService
impl Type for SCNetworkService
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