objc2_system_configuration/generated/
SCNetworkReachability.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "dispatch2")]
8use dispatch2::*;
9#[cfg(feature = "objc2")]
10use objc2::__framework_prelude::*;
11use objc2_core_foundation::*;
12
13use crate::*;
14
15/// This is the handle to a network address or name.
16///
17/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scnetworkreachability?language=objc)
18#[doc(alias = "SCNetworkReachabilityRef")]
19#[repr(C)]
20pub struct SCNetworkReachability {
21    inner: [u8; 0],
22    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
23}
24
25cf_type!(
26    unsafe impl SCNetworkReachability {}
27);
28#[cfg(feature = "objc2")]
29cf_objc2_type!(
30    unsafe impl RefEncode<"__SCNetworkReachability"> for SCNetworkReachability {}
31);
32
33/// Structure containing user-specified data and callbacks for SCNetworkReachability.
34/// Field: version The version number of the structure type being passed
35/// in as a parameter to the SCDynamicStore creation function.
36/// This structure is version 0.
37/// Field: info A C pointer to a user-specified block of data.
38/// Field: retain The callback used to add a retain for the info field.
39/// If this parameter is not a pointer to a function of the correct
40/// prototype, the behavior is undefined.  The value may be NULL.
41/// Field: release The calllback used to remove a retain previously added
42/// for the info field.  If this parameter is not a pointer to a
43/// function of the correct prototype, the behavior is undefined.
44/// The value may be NULL.
45/// Field: copyDescription The callback used to provide a description of
46/// the info field.
47///
48/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scnetworkreachabilitycontext?language=objc)
49#[repr(C)]
50#[allow(unpredictable_function_pointer_comparisons)]
51#[derive(Clone, Copy, Debug, PartialEq)]
52pub struct SCNetworkReachabilityContext {
53    pub version: CFIndex,
54    pub info: *mut c_void,
55    pub retain: Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NonNull<c_void>>,
56    pub release: Option<unsafe extern "C-unwind" fn(NonNull<c_void>)>,
57    pub copyDescription: Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NonNull<CFString>>,
58}
59
60#[cfg(feature = "objc2")]
61unsafe impl Encode for SCNetworkReachabilityContext {
62    const ENCODING: Encoding = Encoding::Struct(
63        "?",
64        &[
65            <CFIndex>::ENCODING,
66            <*mut c_void>::ENCODING,
67            <Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NonNull<c_void>>>::ENCODING,
68            <Option<unsafe extern "C-unwind" fn(NonNull<c_void>)>>::ENCODING,
69            <Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NonNull<CFString>>>::ENCODING,
70        ],
71    );
72}
73
74#[cfg(feature = "objc2")]
75unsafe impl RefEncode for SCNetworkReachabilityContext {
76    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
77}
78
79/// Flags that indicate whether the specified network
80/// nodename or address is reachable, whether a connection is
81/// required, and whether some user intervention may be required
82/// when establishing a connection.
83///
84/// This flag indicates that the specified nodename or address can
85/// be reached via a transient connection, such as PPP.
86///
87/// This flag indicates that the specified nodename or address can
88/// be reached using the current network configuration.
89///
90/// This flag indicates that the specified nodename or address can
91/// be reached using the current network configuration, but a
92/// connection must first be established.
93///
94/// As an example, this status would be returned for a dialup
95/// connection that was not currently active, but could handle
96/// network traffic for the target system.
97///
98/// This flag indicates that the specified nodename or address can
99/// be reached using the current network configuration, but a
100/// connection must first be established.  Any traffic directed
101/// to the specified name or address will initiate the connection.
102///
103/// Note: this flag was previously named kSCNetworkReachabilityFlagsConnectionAutomatic
104///
105/// This flag indicates that the specified nodename or address can
106/// be reached using the current network configuration, but a
107/// connection must first be established.  In addition, some
108/// form of user intervention will be required to establish this
109/// connection, such as providing a password, an authentication
110/// token, etc.
111///
112/// Note: At the present time, this flag will only be returned
113/// in the case where you have a dial-on-traffic configuration
114/// (ConnectionOnTraffic), where an attempt to connect has
115/// already been made, and where some error (e.g. no dial tone,
116/// no answer, bad password, ...) was encountered during the
117/// automatic connection attempt.  In this case the PPP controller
118/// will stop attempting to establish a connection until the user
119/// has intervened.
120///
121/// This flag indicates that the specified nodename or address can
122/// be reached using the current network configuration, but a
123/// connection must first be established.
124/// The connection will be established "On Demand" by the
125/// CFSocketStream APIs.
126/// Other APIs will not establish the connection.
127///
128/// This flag indicates that the specified nodename or address
129/// is one associated with a network interface on the current
130/// system.
131///
132/// This flag indicates that network traffic to the specified
133/// nodename or address will not go through a gateway, but is
134/// routed directly to one of the interfaces in the system.
135///
136/// This flag indicates that the specified nodename or address can
137/// be reached via an EDGE, GPRS, or other "cell" connection.
138///
139/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scnetworkreachabilityflags?language=objc)
140// NS_OPTIONS
141#[repr(transparent)]
142#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
143pub struct SCNetworkReachabilityFlags(pub u32);
144bitflags::bitflags! {
145    impl SCNetworkReachabilityFlags: u32 {
146        #[doc(alias = "kSCNetworkReachabilityFlagsTransientConnection")]
147        const TransientConnection = 1<<0;
148        #[doc(alias = "kSCNetworkReachabilityFlagsReachable")]
149        const Reachable = 1<<1;
150        #[doc(alias = "kSCNetworkReachabilityFlagsConnectionRequired")]
151        const ConnectionRequired = 1<<2;
152        #[doc(alias = "kSCNetworkReachabilityFlagsConnectionOnTraffic")]
153        const ConnectionOnTraffic = 1<<3;
154        #[doc(alias = "kSCNetworkReachabilityFlagsInterventionRequired")]
155        const InterventionRequired = 1<<4;
156        #[doc(alias = "kSCNetworkReachabilityFlagsConnectionOnDemand")]
157        const ConnectionOnDemand = 1<<5;
158        #[doc(alias = "kSCNetworkReachabilityFlagsIsLocalAddress")]
159        const IsLocalAddress = 1<<16;
160        #[doc(alias = "kSCNetworkReachabilityFlagsIsDirect")]
161        const IsDirect = 1<<17;
162        #[doc(alias = "kSCNetworkReachabilityFlagsIsWWAN")]
163        const IsWWAN = 1<<18;
164        #[doc(alias = "kSCNetworkReachabilityFlagsConnectionAutomatic")]
165        const ConnectionAutomatic = SCNetworkReachabilityFlags::ConnectionOnTraffic.0;
166    }
167}
168
169#[cfg(feature = "objc2")]
170unsafe impl Encode for SCNetworkReachabilityFlags {
171    const ENCODING: Encoding = u32::ENCODING;
172}
173
174#[cfg(feature = "objc2")]
175unsafe impl RefEncode for SCNetworkReachabilityFlags {
176    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
177}
178
179/// Type of the callback function used when the
180/// reachability of a network address or name changes.
181///
182/// Parameter `target`: The SCNetworkReachability reference being monitored
183/// for changes.
184///
185/// Parameter `flags`: The new SCNetworkReachabilityFlags representing the
186/// reachability status of the network address/name.
187///
188/// Parameter `info`: A C pointer to a user-specified block of data.
189///
190/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scnetworkreachabilitycallback?language=objc)
191pub type SCNetworkReachabilityCallBack = Option<
192    unsafe extern "C-unwind" fn(
193        NonNull<SCNetworkReachability>,
194        SCNetworkReachabilityFlags,
195        *mut c_void,
196    ),
197>;
198
199impl SCNetworkReachability {
200    /// Creates a reference to the specified network
201    /// address.  This reference can be used later to monitor the
202    /// reachability of the target host.
203    ///
204    /// Parameter `address`: The address of the desired host.
205    ///
206    /// Returns: Returns a reference to the new immutable SCNetworkReachabilityRef.
207    ///
208    /// You must release the returned value.
209    ///
210    /// # Safety
211    ///
212    /// `address` must be a valid pointer.
213    #[doc(alias = "SCNetworkReachabilityCreateWithAddress")]
214    #[cfg(feature = "libc")]
215    #[deprecated]
216    #[inline]
217    pub unsafe fn with_address(
218        allocator: Option<&CFAllocator>,
219        address: NonNull<libc::sockaddr>,
220    ) -> Option<CFRetained<SCNetworkReachability>> {
221        extern "C-unwind" {
222            fn SCNetworkReachabilityCreateWithAddress(
223                allocator: Option<&CFAllocator>,
224                address: NonNull<libc::sockaddr>,
225            ) -> Option<NonNull<SCNetworkReachability>>;
226        }
227        let ret = unsafe { SCNetworkReachabilityCreateWithAddress(allocator, address) };
228        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
229    }
230
231    /// Creates a reference to the specified network
232    /// address.  This reference can be used later to monitor the
233    /// reachability of the target host.
234    ///
235    /// Parameter `localAddress`: The local address associated with a network
236    /// connection.  If NULL, only the remote address is of interest.
237    ///
238    /// Parameter `remoteAddress`: The remote address associated with a network
239    /// connection.  If NULL, only the local address is of interest.
240    ///
241    /// Returns: Returns a reference to the new immutable SCNetworkReachabilityRef.
242    ///
243    /// You must release the returned value.
244    ///
245    /// # Safety
246    ///
247    /// - `local_address` must be a valid pointer or null.
248    /// - `remote_address` must be a valid pointer or null.
249    #[doc(alias = "SCNetworkReachabilityCreateWithAddressPair")]
250    #[cfg(feature = "libc")]
251    #[deprecated]
252    #[inline]
253    pub unsafe fn with_address_pair(
254        allocator: Option<&CFAllocator>,
255        local_address: *const libc::sockaddr,
256        remote_address: *const libc::sockaddr,
257    ) -> Option<CFRetained<SCNetworkReachability>> {
258        extern "C-unwind" {
259            fn SCNetworkReachabilityCreateWithAddressPair(
260                allocator: Option<&CFAllocator>,
261                local_address: *const libc::sockaddr,
262                remote_address: *const libc::sockaddr,
263            ) -> Option<NonNull<SCNetworkReachability>>;
264        }
265        let ret = unsafe {
266            SCNetworkReachabilityCreateWithAddressPair(allocator, local_address, remote_address)
267        };
268        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
269    }
270
271    /// Creates a reference to the specified network host or node
272    /// name.  This reference can be used later to monitor the
273    /// reachability of the target host.
274    ///
275    /// Parameter `nodename`: The node name of the desired host.
276    /// This name would be the same as that passed to the
277    /// gethostbyname(3) or getaddrinfo(3) functions.
278    ///
279    /// Returns: Returns a reference to the new immutable SCNetworkReachabilityRef.
280    ///
281    /// You must release the returned value.
282    ///
283    /// # Safety
284    ///
285    /// `nodename` must be a valid pointer.
286    #[doc(alias = "SCNetworkReachabilityCreateWithName")]
287    #[deprecated]
288    #[inline]
289    pub unsafe fn with_name(
290        allocator: Option<&CFAllocator>,
291        nodename: NonNull<c_char>,
292    ) -> Option<CFRetained<SCNetworkReachability>> {
293        extern "C-unwind" {
294            fn SCNetworkReachabilityCreateWithName(
295                allocator: Option<&CFAllocator>,
296                nodename: NonNull<c_char>,
297            ) -> Option<NonNull<SCNetworkReachability>>;
298        }
299        let ret = unsafe { SCNetworkReachabilityCreateWithName(allocator, nodename) };
300        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
301    }
302}
303
304unsafe impl ConcreteType for SCNetworkReachability {
305    /// Returns the type identifier of all SCNetworkReachability
306    /// instances.
307    #[doc(alias = "SCNetworkReachabilityGetTypeID")]
308    #[inline]
309    fn type_id() -> CFTypeID {
310        extern "C-unwind" {
311            fn SCNetworkReachabilityGetTypeID() -> CFTypeID;
312        }
313        unsafe { SCNetworkReachabilityGetTypeID() }
314    }
315}
316
317impl SCNetworkReachability {
318    /// Determines if the given target is reachable using the
319    /// current network configuration.
320    ///
321    /// Parameter `target`: The network reference associated with the address or name
322    /// to be checked for reachability.
323    ///
324    /// Parameter `flags`: A pointer to memory that will be filled with the
325    /// SCNetworkReachabilityFlags detailing the reachability
326    /// of the specified target.
327    ///
328    /// Returns: Returns TRUE if the network connection flags are valid;
329    /// FALSE if the status could not be determined.
330    ///
331    /// # Safety
332    ///
333    /// `flags` must be a valid pointer.
334    #[doc(alias = "SCNetworkReachabilityGetFlags")]
335    #[deprecated]
336    #[inline]
337    pub unsafe fn flags(&self, flags: NonNull<SCNetworkReachabilityFlags>) -> bool {
338        extern "C-unwind" {
339            fn SCNetworkReachabilityGetFlags(
340                target: &SCNetworkReachability,
341                flags: NonNull<SCNetworkReachabilityFlags>,
342            ) -> Boolean;
343        }
344        let ret = unsafe { SCNetworkReachabilityGetFlags(self, flags) };
345        ret != 0
346    }
347
348    /// Assigns a client to a target, which receives callbacks
349    /// when the reachability of the target changes.
350    ///
351    /// Parameter `target`: The network reference associated with the address or
352    /// name to be checked for reachability.
353    ///
354    /// Parameter `callout`: The function to be called when the reachability of the
355    /// target changes.  If NULL, the current client for the target
356    /// is removed.
357    ///
358    /// Parameter `context`: The SCNetworkReachabilityContext associated with
359    /// the callout.  The value may be NULL.
360    ///
361    /// Returns: Returns TRUE if the notification client was successfully set.
362    ///
363    /// # Safety
364    ///
365    /// - `callout` must be implemented correctly.
366    /// - `context` must be a valid pointer or null.
367    #[doc(alias = "SCNetworkReachabilitySetCallback")]
368    #[deprecated]
369    #[inline]
370    pub unsafe fn set_callback(
371        &self,
372        callout: SCNetworkReachabilityCallBack,
373        context: *mut SCNetworkReachabilityContext,
374    ) -> bool {
375        extern "C-unwind" {
376            fn SCNetworkReachabilitySetCallback(
377                target: &SCNetworkReachability,
378                callout: SCNetworkReachabilityCallBack,
379                context: *mut SCNetworkReachabilityContext,
380            ) -> Boolean;
381        }
382        let ret = unsafe { SCNetworkReachabilitySetCallback(self, callout, context) };
383        ret != 0
384    }
385
386    /// Schedules the given target with the given run loop and mode.
387    ///
388    /// Parameter `target`: The address or name that is set up for asynchronous
389    /// notifications.  Must be non-NULL.
390    ///
391    /// Parameter `runLoop`: A reference to a run loop on which the target should
392    /// be scheduled.  Must be non-NULL.
393    ///
394    /// Parameter `runLoopMode`: The mode on which to schedule the target.
395    /// Must be non-NULL.
396    ///
397    /// Returns: Returns TRUE if the target is scheduled successfully;
398    /// FALSE otherwise.
399    #[doc(alias = "SCNetworkReachabilityScheduleWithRunLoop")]
400    #[deprecated]
401    #[inline]
402    pub fn schedule_with_run_loop(&self, run_loop: &CFRunLoop, run_loop_mode: &CFString) -> bool {
403        extern "C-unwind" {
404            fn SCNetworkReachabilityScheduleWithRunLoop(
405                target: &SCNetworkReachability,
406                run_loop: &CFRunLoop,
407                run_loop_mode: &CFString,
408            ) -> Boolean;
409        }
410        let ret =
411            unsafe { SCNetworkReachabilityScheduleWithRunLoop(self, run_loop, run_loop_mode) };
412        ret != 0
413    }
414
415    /// Unschedules the given target from the given run loop
416    /// and mode.
417    ///
418    /// Parameter `target`: The address or name that is set up for asynchronous
419    /// notifications.  Must be non-NULL.
420    ///
421    /// Parameter `runLoop`: A reference to a run loop from which the target
422    /// should be unscheduled.  Must be non-NULL.
423    ///
424    /// Parameter `runLoopMode`: The mode on which to unschedule the target.
425    /// Must be non-NULL.
426    ///
427    /// Returns: Returns TRUE if the target is unscheduled successfully;
428    /// FALSE otherwise.
429    #[doc(alias = "SCNetworkReachabilityUnscheduleFromRunLoop")]
430    #[deprecated]
431    #[inline]
432    pub fn unschedule_from_run_loop(&self, run_loop: &CFRunLoop, run_loop_mode: &CFString) -> bool {
433        extern "C-unwind" {
434            fn SCNetworkReachabilityUnscheduleFromRunLoop(
435                target: &SCNetworkReachability,
436                run_loop: &CFRunLoop,
437                run_loop_mode: &CFString,
438            ) -> Boolean;
439        }
440        let ret =
441            unsafe { SCNetworkReachabilityUnscheduleFromRunLoop(self, run_loop, run_loop_mode) };
442        ret != 0
443    }
444
445    /// Schedule or unschedule callbacks for the given target on the given
446    /// dispatch queue.
447    ///
448    /// Parameter `target`: The address or name that is set up for asynchronous
449    /// notifications.  Must be non-NULL.
450    ///
451    /// Parameter `queue`: A libdispatch queue to run the callback on.
452    /// Pass NULL to unschedule callbacks.
453    ///
454    /// Returns: Returns TRUE if the target is scheduled or unscheduled successfully;
455    /// FALSE otherwise.
456    ///
457    /// # Safety
458    ///
459    /// `queue` possibly has additional threading requirements.
460    #[doc(alias = "SCNetworkReachabilitySetDispatchQueue")]
461    #[cfg(feature = "dispatch2")]
462    #[deprecated]
463    #[inline]
464    pub unsafe fn set_dispatch_queue(&self, queue: Option<&DispatchQueue>) -> bool {
465        extern "C-unwind" {
466            fn SCNetworkReachabilitySetDispatchQueue(
467                target: &SCNetworkReachability,
468                queue: Option<&DispatchQueue>,
469            ) -> Boolean;
470        }
471        let ret = unsafe { SCNetworkReachabilitySetDispatchQueue(self, queue) };
472        ret != 0
473    }
474}
475
476#[cfg(feature = "libc")]
477#[deprecated = "renamed to `SCNetworkReachability::with_address`"]
478#[inline]
479pub unsafe extern "C-unwind" fn SCNetworkReachabilityCreateWithAddress(
480    allocator: Option<&CFAllocator>,
481    address: NonNull<libc::sockaddr>,
482) -> Option<CFRetained<SCNetworkReachability>> {
483    extern "C-unwind" {
484        fn SCNetworkReachabilityCreateWithAddress(
485            allocator: Option<&CFAllocator>,
486            address: NonNull<libc::sockaddr>,
487        ) -> Option<NonNull<SCNetworkReachability>>;
488    }
489    let ret = unsafe { SCNetworkReachabilityCreateWithAddress(allocator, address) };
490    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
491}
492
493#[cfg(feature = "libc")]
494#[deprecated = "renamed to `SCNetworkReachability::with_address_pair`"]
495#[inline]
496pub unsafe extern "C-unwind" fn SCNetworkReachabilityCreateWithAddressPair(
497    allocator: Option<&CFAllocator>,
498    local_address: *const libc::sockaddr,
499    remote_address: *const libc::sockaddr,
500) -> Option<CFRetained<SCNetworkReachability>> {
501    extern "C-unwind" {
502        fn SCNetworkReachabilityCreateWithAddressPair(
503            allocator: Option<&CFAllocator>,
504            local_address: *const libc::sockaddr,
505            remote_address: *const libc::sockaddr,
506        ) -> Option<NonNull<SCNetworkReachability>>;
507    }
508    let ret = unsafe {
509        SCNetworkReachabilityCreateWithAddressPair(allocator, local_address, remote_address)
510    };
511    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
512}
513
514#[deprecated = "renamed to `SCNetworkReachability::with_name`"]
515#[inline]
516pub unsafe extern "C-unwind" fn SCNetworkReachabilityCreateWithName(
517    allocator: Option<&CFAllocator>,
518    nodename: NonNull<c_char>,
519) -> Option<CFRetained<SCNetworkReachability>> {
520    extern "C-unwind" {
521        fn SCNetworkReachabilityCreateWithName(
522            allocator: Option<&CFAllocator>,
523            nodename: NonNull<c_char>,
524        ) -> Option<NonNull<SCNetworkReachability>>;
525    }
526    let ret = unsafe { SCNetworkReachabilityCreateWithName(allocator, nodename) };
527    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
528}
529
530#[deprecated = "renamed to `SCNetworkReachability::flags`"]
531#[inline]
532pub unsafe extern "C-unwind" fn SCNetworkReachabilityGetFlags(
533    target: &SCNetworkReachability,
534    flags: NonNull<SCNetworkReachabilityFlags>,
535) -> bool {
536    extern "C-unwind" {
537        fn SCNetworkReachabilityGetFlags(
538            target: &SCNetworkReachability,
539            flags: NonNull<SCNetworkReachabilityFlags>,
540        ) -> Boolean;
541    }
542    let ret = unsafe { SCNetworkReachabilityGetFlags(target, flags) };
543    ret != 0
544}
545
546#[deprecated = "renamed to `SCNetworkReachability::set_callback`"]
547#[inline]
548pub unsafe extern "C-unwind" fn SCNetworkReachabilitySetCallback(
549    target: &SCNetworkReachability,
550    callout: SCNetworkReachabilityCallBack,
551    context: *mut SCNetworkReachabilityContext,
552) -> bool {
553    extern "C-unwind" {
554        fn SCNetworkReachabilitySetCallback(
555            target: &SCNetworkReachability,
556            callout: SCNetworkReachabilityCallBack,
557            context: *mut SCNetworkReachabilityContext,
558        ) -> Boolean;
559    }
560    let ret = unsafe { SCNetworkReachabilitySetCallback(target, callout, context) };
561    ret != 0
562}
563
564#[deprecated = "renamed to `SCNetworkReachability::schedule_with_run_loop`"]
565#[inline]
566pub extern "C-unwind" fn SCNetworkReachabilityScheduleWithRunLoop(
567    target: &SCNetworkReachability,
568    run_loop: &CFRunLoop,
569    run_loop_mode: &CFString,
570) -> bool {
571    extern "C-unwind" {
572        fn SCNetworkReachabilityScheduleWithRunLoop(
573            target: &SCNetworkReachability,
574            run_loop: &CFRunLoop,
575            run_loop_mode: &CFString,
576        ) -> Boolean;
577    }
578    let ret = unsafe { SCNetworkReachabilityScheduleWithRunLoop(target, run_loop, run_loop_mode) };
579    ret != 0
580}
581
582#[deprecated = "renamed to `SCNetworkReachability::unschedule_from_run_loop`"]
583#[inline]
584pub extern "C-unwind" fn SCNetworkReachabilityUnscheduleFromRunLoop(
585    target: &SCNetworkReachability,
586    run_loop: &CFRunLoop,
587    run_loop_mode: &CFString,
588) -> bool {
589    extern "C-unwind" {
590        fn SCNetworkReachabilityUnscheduleFromRunLoop(
591            target: &SCNetworkReachability,
592            run_loop: &CFRunLoop,
593            run_loop_mode: &CFString,
594        ) -> Boolean;
595    }
596    let ret =
597        unsafe { SCNetworkReachabilityUnscheduleFromRunLoop(target, run_loop, run_loop_mode) };
598    ret != 0
599}
600
601#[cfg(feature = "dispatch2")]
602#[deprecated = "renamed to `SCNetworkReachability::set_dispatch_queue`"]
603#[inline]
604pub unsafe extern "C-unwind" fn SCNetworkReachabilitySetDispatchQueue(
605    target: &SCNetworkReachability,
606    queue: Option<&DispatchQueue>,
607) -> bool {
608    extern "C-unwind" {
609        fn SCNetworkReachabilitySetDispatchQueue(
610            target: &SCNetworkReachability,
611            queue: Option<&DispatchQueue>,
612        ) -> Boolean;
613    }
614    let ret = unsafe { SCNetworkReachabilitySetDispatchQueue(target, queue) };
615    ret != 0
616}