pub struct SCNetworkReachability { /* private fields */ }SCNetworkReachability only.Expand description
This is the handle to a network address or name.
See also Apple’s documentation
Implementations§
Source§impl SCNetworkReachability
impl SCNetworkReachability
Sourcepub unsafe fn with_address(
allocator: Option<&CFAllocator>,
address: NonNull<sockaddr>,
) -> Option<CFRetained<SCNetworkReachability>>
👎DeprecatedAvailable on crate feature libc only.
pub unsafe fn with_address( allocator: Option<&CFAllocator>, address: NonNull<sockaddr>, ) -> Option<CFRetained<SCNetworkReachability>>
libc only.Creates a reference to the specified network address. This reference can be used later to monitor the reachability of the target host.
Parameter address: The address of the desired host.
Returns: Returns a reference to the new immutable SCNetworkReachabilityRef.
You must release the returned value.
§Safety
address must be a valid pointer.
Sourcepub unsafe fn with_address_pair(
allocator: Option<&CFAllocator>,
local_address: *const sockaddr,
remote_address: *const sockaddr,
) -> Option<CFRetained<SCNetworkReachability>>
👎DeprecatedAvailable on crate feature libc only.
pub unsafe fn with_address_pair( allocator: Option<&CFAllocator>, local_address: *const sockaddr, remote_address: *const sockaddr, ) -> Option<CFRetained<SCNetworkReachability>>
libc only.Creates a reference to the specified network address. This reference can be used later to monitor the reachability of the target host.
Parameter localAddress: The local address associated with a network
connection. If NULL, only the remote address is of interest.
Parameter remoteAddress: The remote address associated with a network
connection. If NULL, only the local address is of interest.
Returns: Returns a reference to the new immutable SCNetworkReachabilityRef.
You must release the returned value.
§Safety
local_addressmust be a valid pointer or null.remote_addressmust be a valid pointer or null.
Sourcepub unsafe fn with_name(
allocator: Option<&CFAllocator>,
nodename: NonNull<c_char>,
) -> Option<CFRetained<SCNetworkReachability>>
👎Deprecated
pub unsafe fn with_name( allocator: Option<&CFAllocator>, nodename: NonNull<c_char>, ) -> Option<CFRetained<SCNetworkReachability>>
Creates a reference to the specified network host or node name. This reference can be used later to monitor the reachability of the target host.
Parameter nodename: The node name of the desired host.
This name would be the same as that passed to the
gethostbyname(3) or getaddrinfo(3) functions.
Returns: Returns a reference to the new immutable SCNetworkReachabilityRef.
You must release the returned value.
§Safety
nodename must be a valid pointer.
Source§impl SCNetworkReachability
impl SCNetworkReachability
Sourcepub unsafe fn flags(&self, flags: NonNull<SCNetworkReachabilityFlags>) -> bool
👎Deprecated
pub unsafe fn flags(&self, flags: NonNull<SCNetworkReachabilityFlags>) -> bool
Determines if the given target is reachable using the current network configuration.
Parameter target: The network reference associated with the address or name
to be checked for reachability.
Parameter flags: A pointer to memory that will be filled with the
SCNetworkReachabilityFlags detailing the reachability
of the specified target.
Returns: Returns TRUE if the network connection flags are valid; FALSE if the status could not be determined.
§Safety
flags must be a valid pointer.
Sourcepub unsafe fn set_callback(
&self,
callout: SCNetworkReachabilityCallBack,
context: *mut SCNetworkReachabilityContext,
) -> bool
👎Deprecated
pub unsafe fn set_callback( &self, callout: SCNetworkReachabilityCallBack, context: *mut SCNetworkReachabilityContext, ) -> bool
Assigns a client to a target, which receives callbacks when the reachability of the target changes.
Parameter target: The network reference associated with the address or
name to be checked for reachability.
Parameter callout: The function to be called when the reachability of the
target changes. If NULL, the current client for the target
is removed.
Parameter context: The SCNetworkReachabilityContext associated with
the callout. The value may be NULL.
Returns: Returns TRUE if the notification client was successfully set.
§Safety
calloutmust be implemented correctly.contextmust be a valid pointer or null.
Sourcepub fn schedule_with_run_loop(
&self,
run_loop: &CFRunLoop,
run_loop_mode: &CFString,
) -> bool
👎Deprecated
pub fn schedule_with_run_loop( &self, run_loop: &CFRunLoop, run_loop_mode: &CFString, ) -> bool
Schedules the given target with the given run loop and mode.
Parameter target: The address or name that is set up for asynchronous
notifications. Must be non-NULL.
Parameter runLoop: A reference to a run loop on which the target should
be scheduled. Must be non-NULL.
Parameter runLoopMode: The mode on which to schedule the target.
Must be non-NULL.
Returns: Returns TRUE if the target is scheduled successfully; FALSE otherwise.
Sourcepub fn unschedule_from_run_loop(
&self,
run_loop: &CFRunLoop,
run_loop_mode: &CFString,
) -> bool
👎Deprecated
pub fn unschedule_from_run_loop( &self, run_loop: &CFRunLoop, run_loop_mode: &CFString, ) -> bool
Unschedules the given target from the given run loop and mode.
Parameter target: The address or name that is set up for asynchronous
notifications. Must be non-NULL.
Parameter runLoop: A reference to a run loop from which the target
should be unscheduled. Must be non-NULL.
Parameter runLoopMode: The mode on which to unschedule the target.
Must be non-NULL.
Returns: Returns TRUE if the target is unscheduled successfully; FALSE otherwise.
Sourcepub unsafe fn set_dispatch_queue(&self, queue: Option<&DispatchQueue>) -> bool
👎DeprecatedAvailable on crate feature dispatch2 only.
pub unsafe fn set_dispatch_queue(&self, queue: Option<&DispatchQueue>) -> bool
dispatch2 only.Schedule or unschedule callbacks for the given target on the given dispatch queue.
Parameter target: The address or name that is set up for asynchronous
notifications. Must be non-NULL.
Parameter queue: A libdispatch queue to run the callback on.
Pass NULL to unschedule callbacks.
Returns: Returns TRUE if the target is scheduled or unscheduled successfully; FALSE otherwise.
§Safety
queue possibly has additional threading requirements.
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 CFNumbers, small CFStrings 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 SCNetworkReachability
impl AsRef<AnyObject> for SCNetworkReachability
Source§impl AsRef<CFType> for SCNetworkReachability
impl AsRef<CFType> for SCNetworkReachability
Source§impl Borrow<AnyObject> for SCNetworkReachability
impl Borrow<AnyObject> for SCNetworkReachability
Source§impl Borrow<CFType> for SCNetworkReachability
impl Borrow<CFType> for SCNetworkReachability
Source§impl ConcreteType for SCNetworkReachability
impl ConcreteType for SCNetworkReachability
Source§impl Debug for SCNetworkReachability
impl Debug for SCNetworkReachability
Source§impl Deref for SCNetworkReachability
impl Deref for SCNetworkReachability
Source§impl Hash for SCNetworkReachability
impl Hash for SCNetworkReachability
Source§impl Message for SCNetworkReachability
impl Message for SCNetworkReachability
Source§impl PartialEq for SCNetworkReachability
impl PartialEq for SCNetworkReachability
Source§impl RefEncode for SCNetworkReachability
impl RefEncode for SCNetworkReachability
Source§const ENCODING_REF: Encoding
const ENCODING_REF: Encoding
Source§impl Type for SCNetworkReachability
impl Type for SCNetworkReachability
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