objc2_system_configuration/generated/
SCNetworkConnection.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 = "objc2")]
8use objc2::__framework_prelude::*;
9use objc2_core_foundation::*;
10
11use crate::*;
12
13/// This is the handle to manage a connection-oriented service.
14///
15/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scnetworkconnection?language=objc)
16#[repr(C)]
17pub struct SCNetworkConnection {
18    inner: [u8; 0],
19    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
20}
21
22cf_type!(
23    #[encoding_name = "__SCNetworkConnection"]
24    unsafe impl SCNetworkConnection {}
25);
26
27/// Structure containing user-specified data and callbacks
28/// for a SCNetworkConnection.
29/// Field: version The version number of the structure type being passed
30/// in as a parameter to the SCNetworkConnectionCreateWithServiceID
31/// function.  This structure is version 0.
32/// Field: info A C pointer to a user-specified block of data.
33/// Field: retain The callback used to add a retain for the info field.
34/// If this parameter is not a pointer to a function of the correct
35/// prototype, the behavior is undefined.  The value may be NULL.
36/// Field: release The calllback used to remove a retain previously added
37/// for the info field.  If this parameter is not a pointer to a
38/// function of the correct prototype, the behavior is undefined.
39/// The value may be NULL.
40/// Field: copyDescription The callback used to provide a description of
41/// the info field.
42///
43/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scnetworkconnectioncontext?language=objc)
44#[repr(C)]
45#[derive(Clone, Copy, Debug, PartialEq)]
46pub struct SCNetworkConnectionContext {
47    pub version: CFIndex,
48    pub info: *mut c_void,
49    pub retain: Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NonNull<c_void>>,
50    pub release: Option<unsafe extern "C-unwind" fn(NonNull<c_void>)>,
51    pub copyDescription: Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NonNull<CFString>>,
52}
53
54#[cfg(feature = "objc2")]
55unsafe impl Encode for SCNetworkConnectionContext {
56    const ENCODING: Encoding = Encoding::Struct(
57        "?",
58        &[
59            <CFIndex>::ENCODING,
60            <*mut c_void>::ENCODING,
61            <Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NonNull<c_void>>>::ENCODING,
62            <Option<unsafe extern "C-unwind" fn(NonNull<c_void>)>>::ENCODING,
63            <Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NonNull<CFString>>>::ENCODING,
64        ],
65    );
66}
67
68#[cfg(feature = "objc2")]
69unsafe impl RefEncode for SCNetworkConnectionContext {
70    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
71}
72
73/// Status of the network connection.
74/// This status is intended to be generic and high level.
75/// An extended status, specific to the type of network
76/// connection is also available for applications that
77/// need additonal information.
78///
79/// The network connection refers to an invalid service.
80///
81/// The network connection is disconnected.
82///
83/// The network connection is connecting.
84///
85/// The network connection is connected.
86///
87/// The network connection is disconnecting.
88///
89/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scnetworkconnectionstatus?language=objc)
90// NS_ENUM
91#[repr(transparent)]
92#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
93pub struct SCNetworkConnectionStatus(pub i32);
94impl SCNetworkConnectionStatus {
95    #[doc(alias = "kSCNetworkConnectionInvalid")]
96    pub const Invalid: Self = Self(-1);
97    #[doc(alias = "kSCNetworkConnectionDisconnected")]
98    pub const Disconnected: Self = Self(0);
99    #[doc(alias = "kSCNetworkConnectionConnecting")]
100    pub const Connecting: Self = Self(1);
101    #[doc(alias = "kSCNetworkConnectionConnected")]
102    pub const Connected: Self = Self(2);
103    #[doc(alias = "kSCNetworkConnectionDisconnecting")]
104    pub const Disconnecting: Self = Self(3);
105}
106
107#[cfg(feature = "objc2")]
108unsafe impl Encode for SCNetworkConnectionStatus {
109    const ENCODING: Encoding = i32::ENCODING;
110}
111
112#[cfg(feature = "objc2")]
113unsafe impl RefEncode for SCNetworkConnectionStatus {
114    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
115}
116
117/// PPP-specific status of the network connection.
118/// This status is returned as part of the extended information
119/// for a PPP service.
120/// Note: additional status might be returned in the future.
121/// Your application should be prepared to receive an unknown value.
122///
123/// PPP is disconnected.
124///
125/// PPP is initializing.
126///
127/// PPP is connecting the lower connection layer (for example,
128/// the modem is dialing out).
129///
130/// PPP is waiting for networking traffic to automatically
131/// establish the connection.
132///
133/// The PPP lower layer is connected and PPP is negotiating the
134/// link layer (LCP protocol).
135///
136/// PPP is authenticating to the server (PAP, CHAP, MS-CHAP or
137/// EAP protocols).
138///
139/// PPP is waiting for the server to call back.
140///
141/// PPP is now authenticated and negotiating the networking
142/// layer (IPCP or IPv6CP protocols)
143///
144/// PPP is now fully connected for at least one networking layer.
145/// Additional networking protocol might still be negotiating.
146///
147/// PPP networking and link protocols are terminating.
148///
149/// PPP is disconnecting the lower level (for example, the modem
150/// is hanging up).
151///
152/// PPP is disconnected and maintaining the link temporarily off.
153///
154/// PPP is suspended as a result of the suspend command (for
155/// example, when a V.92 Modem is On Hold).
156///
157/// PPP has found a busy server and is waiting for redial.
158///
159/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scnetworkconnectionpppstatus?language=objc)
160// NS_ENUM
161#[repr(transparent)]
162#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
163pub struct SCNetworkConnectionPPPStatus(pub i32);
164impl SCNetworkConnectionPPPStatus {
165    #[doc(alias = "kSCNetworkConnectionPPPDisconnected")]
166    pub const Disconnected: Self = Self(0);
167    #[doc(alias = "kSCNetworkConnectionPPPInitializing")]
168    pub const Initializing: Self = Self(1);
169    #[doc(alias = "kSCNetworkConnectionPPPConnectingLink")]
170    pub const ConnectingLink: Self = Self(2);
171    #[doc(alias = "kSCNetworkConnectionPPPDialOnTraffic")]
172    pub const DialOnTraffic: Self = Self(3);
173    #[doc(alias = "kSCNetworkConnectionPPPNegotiatingLink")]
174    pub const NegotiatingLink: Self = Self(4);
175    #[doc(alias = "kSCNetworkConnectionPPPAuthenticating")]
176    pub const Authenticating: Self = Self(5);
177    #[doc(alias = "kSCNetworkConnectionPPPWaitingForCallBack")]
178    pub const WaitingForCallBack: Self = Self(6);
179    #[doc(alias = "kSCNetworkConnectionPPPNegotiatingNetwork")]
180    pub const NegotiatingNetwork: Self = Self(7);
181    #[doc(alias = "kSCNetworkConnectionPPPConnected")]
182    pub const Connected: Self = Self(8);
183    #[doc(alias = "kSCNetworkConnectionPPPTerminating")]
184    pub const Terminating: Self = Self(9);
185    #[doc(alias = "kSCNetworkConnectionPPPDisconnectingLink")]
186    pub const DisconnectingLink: Self = Self(10);
187    #[doc(alias = "kSCNetworkConnectionPPPHoldingLinkOff")]
188    pub const HoldingLinkOff: Self = Self(11);
189    #[doc(alias = "kSCNetworkConnectionPPPSuspended")]
190    pub const Suspended: Self = Self(12);
191    #[doc(alias = "kSCNetworkConnectionPPPWaitingForRedial")]
192    pub const WaitingForRedial: Self = Self(13);
193}
194
195#[cfg(feature = "objc2")]
196unsafe impl Encode for SCNetworkConnectionPPPStatus {
197    const ENCODING: Encoding = i32::ENCODING;
198}
199
200#[cfg(feature = "objc2")]
201unsafe impl RefEncode for SCNetworkConnectionPPPStatus {
202    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
203}
204
205/// Type of the callback function used when a
206/// status event is delivered.
207///
208/// Parameter `status`: The connection status.
209///
210/// Parameter `connection`: The connection reference.
211///
212/// Parameter `info`: Application-specific information.
213///
214/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scnetworkconnectioncallback?language=objc)
215pub type SCNetworkConnectionCallBack = Option<
216    unsafe extern "C-unwind" fn(
217        NonNull<SCNetworkConnection>,
218        SCNetworkConnectionStatus,
219        *mut c_void,
220    ),
221>;
222
223unsafe impl ConcreteType for SCNetworkConnection {
224    /// Returns the type identifier of all SCNetworkConnection
225    /// instances.
226    #[doc(alias = "SCNetworkConnectionGetTypeID")]
227    #[inline]
228    fn type_id() -> CFTypeID {
229        extern "C-unwind" {
230            fn SCNetworkConnectionGetTypeID() -> CFTypeID;
231        }
232        unsafe { SCNetworkConnectionGetTypeID() }
233    }
234}
235
236/// Provides the default service ID and a dictionary of user
237/// options for the connection.  Applications can use the
238/// returned serviceID and userOptions values to open a
239/// connection on the fly.
240///
241/// Parameter `selectionOptions`: Currently unimplemented. Pass NULL for this
242/// version.
243///
244/// Parameter `serviceID`: Reference to the default serviceID for starting
245/// connections, this value will be returned by the function.
246///
247/// Parameter `userOptions`: Reference to default userOptions for starting
248/// connections, this will be returned by the function.
249///
250/// Returns: Returns TRUE if there is a valid service to dial;
251/// FALSE if the function was unable to retrieve a service to dial.
252#[inline]
253pub unsafe extern "C-unwind" fn SCNetworkConnectionCopyUserPreferences(
254    selection_options: Option<&CFDictionary>,
255    service_id: NonNull<*const CFString>,
256    user_options: NonNull<*const CFDictionary>,
257) -> bool {
258    extern "C-unwind" {
259        fn SCNetworkConnectionCopyUserPreferences(
260            selection_options: Option<&CFDictionary>,
261            service_id: NonNull<*const CFString>,
262            user_options: NonNull<*const CFDictionary>,
263        ) -> Boolean;
264    }
265    let ret = unsafe {
266        SCNetworkConnectionCopyUserPreferences(selection_options, service_id, user_options)
267    };
268    ret != 0
269}
270
271/// Creates a new connection reference to use for getting
272/// the status or for connecting or disconnecting the associated
273/// service.
274///
275/// Parameter `allocator`: The CFAllocator that should be used to allocate
276/// memory for the connection structure.  This parameter may be
277/// NULL in which case the current default CFAllocator is used.
278/// If this reference is not a valid CFAllocator, the behavior
279/// is undefined.
280///
281/// Parameter `serviceID`: A string that defines the service identifier
282/// of the connection.  Service identifiers uniquely identify
283/// services in the system configuration database.
284///
285/// Parameter `callout`: The function to be called when the status
286/// of the connection changes.  If this parameter is NULL, the
287/// application will not receive notifications of status change
288/// and will need to poll for updates.
289///
290/// Parameter `context`: The SCNetworkConnectionContext associated with the
291/// callout.
292///
293/// Returns: Returns a reference to the new SCNetworkConnection.
294#[inline]
295pub unsafe extern "C-unwind" fn SCNetworkConnectionCreateWithServiceID(
296    allocator: Option<&CFAllocator>,
297    service_id: &CFString,
298    callout: SCNetworkConnectionCallBack,
299    context: *mut SCNetworkConnectionContext,
300) -> Option<CFRetained<SCNetworkConnection>> {
301    extern "C-unwind" {
302        fn SCNetworkConnectionCreateWithServiceID(
303            allocator: Option<&CFAllocator>,
304            service_id: &CFString,
305            callout: SCNetworkConnectionCallBack,
306            context: *mut SCNetworkConnectionContext,
307        ) -> Option<NonNull<SCNetworkConnection>>;
308    }
309    let ret =
310        unsafe { SCNetworkConnectionCreateWithServiceID(allocator, service_id, callout, context) };
311    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
312}
313
314/// Returns the service ID associated with the SCNetworkConnection.
315///
316/// Parameter `connection`: The SCNetworkConnection to obtain status from.
317///
318/// Returns: Returns the service ID associated with the SCNetworkConnection.
319#[inline]
320pub unsafe extern "C-unwind" fn SCNetworkConnectionCopyServiceID(
321    connection: &SCNetworkConnection,
322) -> Option<CFRetained<CFString>> {
323    extern "C-unwind" {
324        fn SCNetworkConnectionCopyServiceID(
325            connection: &SCNetworkConnection,
326        ) -> Option<NonNull<CFString>>;
327    }
328    let ret = unsafe { SCNetworkConnectionCopyServiceID(connection) };
329    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
330}
331
332extern "C-unwind" {
333    /// Returns the status of the SCNetworkConnection.
334    /// A status is one of the following values:
335    /// <pre>
336    ///
337    /// ```text
338    /// &#32
339    ///     kSCNetworkConnectionInvalid
340    ///     kSCNetworkConnectionDisconnected
341    ///     kSCNetworkConnectionConnecting
342    ///     kSCNetworkConnectionDisconnecting
343    ///     kSCNetworkConnectionConnected
344    /// ```
345    ///
346    /// </pre>
347    ///
348    /// Parameter `connection`: The SCNetworkConnection to obtain status from.
349    ///
350    /// Returns: Returns the status value.
351    pub fn SCNetworkConnectionGetStatus(
352        connection: &SCNetworkConnection,
353    ) -> SCNetworkConnectionStatus;
354}
355
356/// Returns the extended status of the connection.
357/// An extended status dictionary contains specific dictionaries
358/// describing the status for each subcomponent of the service.
359///
360/// For example, a status dictionary will contain the following
361/// sub-dictionaries, keys, and values:
362/// <pre>
363///
364/// ```text
365/// &#32
366///     IPv4  : Addresses      : the assigned IP address.
367/// &#32
368///     PPP   : Status         : the PPP-specific status of type
369///                  SCNetworkConnectionPPPStatus.
370/// &#32
371///         LastCause      : Available when the status is "Disconnected"
372///                  and contains the last error associated with
373///                  connecting or disconnecting.
374/// &#32
375///         ConnectTime    : the time when the connection was
376///                  established.
377/// &#32
378///     Modem : ConnectSpeed   : the speed of the modem connection
379///                  in bits/second.
380/// &#32
381///     IPSec : Status         : the IPSec-specific status of type
382///                  SCNetworkConnectionIPSecStatus
383/// &#32
384///         ConnectTime    : the time when the connection was
385///                  established.
386///
387/// ```
388///
389/// </pre>
390/// Other dictionaries could be present for PPPoE, PPTP, and L2TP.
391///
392/// The status dictionary may be extended in the future to contain
393/// additional information.
394///
395/// Parameter `connection`: The SCNetworkConnection to obtain status from.
396///
397/// Returns: Returns the status dictionary.
398/// If NULL is returned, the error can be retrieved using the SCError function.
399#[inline]
400pub unsafe extern "C-unwind" fn SCNetworkConnectionCopyExtendedStatus(
401    connection: &SCNetworkConnection,
402) -> Option<CFRetained<CFDictionary>> {
403    extern "C-unwind" {
404        fn SCNetworkConnectionCopyExtendedStatus(
405            connection: &SCNetworkConnection,
406        ) -> Option<NonNull<CFDictionary>>;
407    }
408    let ret = unsafe { SCNetworkConnectionCopyExtendedStatus(connection) };
409    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
410}
411
412/// Returns the statistics of the SCNetworkConnection.
413/// A statistic dictionary contains specific dictionaries
414/// with statistics for each subcomponent of the service.
415///
416/// For example, a statistics dictionary will contain the following
417/// sub-dictionaries, keys, and values:
418/// <pre>
419///
420/// ```text
421/// &#32
422///     PPP : BytesIn    :
423///     PPP : BytesOut   : Contains the number of bytes going up into
424///                (or coming out of) the network stack for
425///                any networking protocol without the PPP
426///                headers and trailers.
427/// &#32
428///     PPP : PacketsIn  :
429///     PPP : PacketsOut : Contains the number of packets going up into
430///                (or coming out of) the network stack for
431///                any networking protocol without the PPP
432///                headers and trailers.
433/// &#32
434///     PPP : ErrorsIn   :
435///     PPP : ErrorsOut  : Contains the number of errors going up into
436///                (or coming out of) the network stack for
437///                any networking protocol without the PPP
438///                headers and trailers.
439/// ```
440///
441/// </pre>
442/// The statistics dictionary may be extended in the future to
443/// contain additional information.
444///
445/// Parameter `connection`: The SCNetworkConnection to obtained statistics from.
446///
447/// Returns: Returns the statistics dictionary.
448/// If NULL is returned, the error can be retrieved using the SCError function.
449#[inline]
450pub unsafe extern "C-unwind" fn SCNetworkConnectionCopyStatistics(
451    connection: &SCNetworkConnection,
452) -> Option<CFRetained<CFDictionary>> {
453    extern "C-unwind" {
454        fn SCNetworkConnectionCopyStatistics(
455            connection: &SCNetworkConnection,
456        ) -> Option<NonNull<CFDictionary>>;
457    }
458    let ret = unsafe { SCNetworkConnectionCopyStatistics(connection) };
459    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
460}
461
462/// Starts the connection for the SCNetworkConnection.
463/// The connection process is asynchronous and the function will
464/// return immediately.  The connection status can be obtained
465/// by polling or by callback.  The connection is made with the
466/// default settings from the administrator.  Some of the settings
467/// can be overridden for the duration of the connection.  These
468/// are specified in an options dictionary.  The options dictionary
469/// uses the same format as a network service defined in the system
470/// configuration preferences schema.
471///
472/// Note: Starting and stopping of connections is implicitly
473/// arbitrated.  Calling SCNetworkConnectionStart on a connection
474/// already started will indicate that the application has
475/// interest in the connection and it shouldn't be stopped by
476/// anyone else.
477///
478/// Parameter `connection`: The SCNetworkConnection to start.
479///
480/// Parameter `userOptions`: The options dictionary to start the connection with.
481/// If userOptions is NULL, the default settings will be used.
482/// If userOptions are specified, they must be in the same format
483/// as network services stored in the system configuration
484/// preferences schema.  The options will override the default
485/// settings defined for the service.
486///
487/// For security reasons, not all options can be overridden; the
488/// appropriate merging of all settings will be done before the
489/// connection is established, and inappropriate options will be
490/// ignored.
491///
492/// Parameter `linger`: This parameter indicates whether or not the connection
493/// can stay around when the application no longer has interest
494/// in it.  A typical application should pass FALSE, and the
495/// connection will be automatically stopped when the reference
496/// is released or if the application quits.  If the application
497/// passes TRUE, the application can release the reference or
498/// exit and the connection will be maintained until a timeout
499/// event, until a specific stop request occurs, or until an
500/// error is encountered.
501///
502/// Returns: Returns TRUE if the connection was correctly started (the
503/// actual connection is not established yet, and the connection
504/// status needs to be periodically checked); FALSE if the
505/// connection request was not started.  The error must be
506/// retrieved from the SCError function.
507#[inline]
508pub unsafe extern "C-unwind" fn SCNetworkConnectionStart(
509    connection: &SCNetworkConnection,
510    user_options: Option<&CFDictionary>,
511    linger: bool,
512) -> bool {
513    extern "C-unwind" {
514        fn SCNetworkConnectionStart(
515            connection: &SCNetworkConnection,
516            user_options: Option<&CFDictionary>,
517            linger: Boolean,
518        ) -> Boolean;
519    }
520    let ret = unsafe { SCNetworkConnectionStart(connection, user_options, linger as _) };
521    ret != 0
522}
523
524/// Stops the connection for the SCNetworkConnection.
525/// The disconnection process is asynchronous and the function
526/// will return immediately.  The connection status can be
527/// obtained by polling or by callback.  This function performs
528/// an arbitrated stop of the connection.  If several applications
529/// have marked their interest in the connection, by calling
530/// SCNetworkConnectionStart, the call will succeed but the
531/// actual connection will be maintained until the last interested
532/// application calls SCNetworkConnectionStop.
533///
534/// In certain cases, you might want to stop the connection anyway.
535/// In these cases, you set the forceDisconnect argument to TRUE.
536///
537/// Parameter `connection`: The SCNetworkConnection to stop.
538///
539/// Returns: Returns TRUE if the disconnection request succeeded;
540/// FALSE if the disconnection request failed.
541/// The error must be retrieved from the SCError function.
542#[inline]
543pub unsafe extern "C-unwind" fn SCNetworkConnectionStop(
544    connection: &SCNetworkConnection,
545    force_disconnect: bool,
546) -> bool {
547    extern "C-unwind" {
548        fn SCNetworkConnectionStop(
549            connection: &SCNetworkConnection,
550            force_disconnect: Boolean,
551        ) -> Boolean;
552    }
553    let ret = unsafe { SCNetworkConnectionStop(connection, force_disconnect as _) };
554    ret != 0
555}
556
557/// Copies the user options used to start the connection.
558/// This is a mechanism a client can use to retrieve the user options
559/// previously passed to the SCNetworkConnectionStart function.
560///
561/// Parameter `connection`: The SCNetworkConnection to obtain options from.
562///
563/// Returns: Returns the service dictionary containing the connection options.
564/// The dictionary can be empty if no user options were used.
565/// If NULL is returned, the error can be retrieved using the SCError function.
566#[inline]
567pub unsafe extern "C-unwind" fn SCNetworkConnectionCopyUserOptions(
568    connection: &SCNetworkConnection,
569) -> Option<CFRetained<CFDictionary>> {
570    extern "C-unwind" {
571        fn SCNetworkConnectionCopyUserOptions(
572            connection: &SCNetworkConnection,
573        ) -> Option<NonNull<CFDictionary>>;
574    }
575    let ret = unsafe { SCNetworkConnectionCopyUserOptions(connection) };
576    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
577}
578
579/// Schedules a connection with the run loop.
580///
581/// Parameter `connection`: The SCNetworkConnection to schedule.
582///
583/// Parameter `runLoop`: The run loop to schedule with.
584///
585/// Parameter `runLoopMode`: The run loop mode.
586///
587/// Returns: Returns TRUE if the connection is scheduled successfully;
588/// FALSE if the scheduling failed.
589/// The error can be retrieved using the SCError function.
590#[inline]
591pub unsafe extern "C-unwind" fn SCNetworkConnectionScheduleWithRunLoop(
592    connection: &SCNetworkConnection,
593    run_loop: &CFRunLoop,
594    run_loop_mode: &CFString,
595) -> bool {
596    extern "C-unwind" {
597        fn SCNetworkConnectionScheduleWithRunLoop(
598            connection: &SCNetworkConnection,
599            run_loop: &CFRunLoop,
600            run_loop_mode: &CFString,
601        ) -> Boolean;
602    }
603    let ret =
604        unsafe { SCNetworkConnectionScheduleWithRunLoop(connection, run_loop, run_loop_mode) };
605    ret != 0
606}
607
608/// Unschedules a connection from the run loop.
609///
610/// Parameter `connection`: The SCNetworkConnection to unschedule.
611///
612/// Parameter `runLoop`: The run loop to unschedule from.
613///
614/// Parameter `runLoopMode`: The run loop mode.
615///
616/// Returns: Returns TRUE if the connection is unscheduled successfully;
617/// FALSE if the unscheduling failed.
618/// The error can be retrieved using the SCError function.
619#[inline]
620pub unsafe extern "C-unwind" fn SCNetworkConnectionUnscheduleFromRunLoop(
621    connection: &SCNetworkConnection,
622    run_loop: &CFRunLoop,
623    run_loop_mode: &CFString,
624) -> bool {
625    extern "C-unwind" {
626        fn SCNetworkConnectionUnscheduleFromRunLoop(
627            connection: &SCNetworkConnection,
628            run_loop: &CFRunLoop,
629            run_loop_mode: &CFString,
630        ) -> Boolean;
631    }
632    let ret =
633        unsafe { SCNetworkConnectionUnscheduleFromRunLoop(connection, run_loop, run_loop_mode) };
634    ret != 0
635}