objc2_system_configuration/generated/
SCNetworkConfiguration.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;
7use objc2_core_foundation::*;
8
9use crate::*;
10
11/// This is the type of a reference to an object that represents
12/// a network interface.
13///
14/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scnetworkinterface?language=objc)
15#[repr(C)]
16pub struct SCNetworkInterface {
17    inner: [u8; 0],
18    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
19}
20
21cf_type!(
22    #[encoding_name = "__SCNetworkInterface"]
23    unsafe impl SCNetworkInterface {}
24);
25
26extern "C" {
27    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetype6to4?language=objc)
28    pub static kSCNetworkInterfaceType6to4: &'static CFString;
29}
30
31extern "C" {
32    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypebluetooth?language=objc)
33    pub static kSCNetworkInterfaceTypeBluetooth: &'static CFString;
34}
35
36extern "C" {
37    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypebond?language=objc)
38    pub static kSCNetworkInterfaceTypeBond: &'static CFString;
39}
40
41extern "C" {
42    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypeethernet?language=objc)
43    pub static kSCNetworkInterfaceTypeEthernet: &'static CFString;
44}
45
46extern "C" {
47    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypefirewire?language=objc)
48    pub static kSCNetworkInterfaceTypeFireWire: &'static CFString;
49}
50
51extern "C" {
52    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypeieee80211?language=objc)
53    pub static kSCNetworkInterfaceTypeIEEE80211: &'static CFString;
54}
55
56extern "C" {
57    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypeipsec?language=objc)
58    pub static kSCNetworkInterfaceTypeIPSec: &'static CFString;
59}
60
61extern "C" {
62    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypeirda?language=objc)
63    pub static kSCNetworkInterfaceTypeIrDA: &'static CFString;
64}
65
66extern "C" {
67    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypel2tp?language=objc)
68    pub static kSCNetworkInterfaceTypeL2TP: &'static CFString;
69}
70
71extern "C" {
72    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypemodem?language=objc)
73    pub static kSCNetworkInterfaceTypeModem: &'static CFString;
74}
75
76extern "C" {
77    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypeppp?language=objc)
78    pub static kSCNetworkInterfaceTypePPP: &'static CFString;
79}
80
81extern "C" {
82    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypepptp?language=objc)
83    pub static kSCNetworkInterfaceTypePPTP: &'static CFString;
84}
85
86extern "C" {
87    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypeserial?language=objc)
88    pub static kSCNetworkInterfaceTypeSerial: &'static CFString;
89}
90
91extern "C" {
92    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypevlan?language=objc)
93    pub static kSCNetworkInterfaceTypeVLAN: &'static CFString;
94}
95
96extern "C" {
97    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypewwan?language=objc)
98    pub static kSCNetworkInterfaceTypeWWAN: &'static CFString;
99}
100
101extern "C" {
102    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypeipv4?language=objc)
103    pub static kSCNetworkInterfaceTypeIPv4: &'static CFString;
104}
105
106extern "C" {
107    /// A network interface that can used for layering other
108    /// interfaces (e.g. 6to4, IPSec, PPTP, L2TP) over an existing
109    /// IPv4 network.
110    ///
111    /// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfaceipv4?language=objc)
112    pub static kSCNetworkInterfaceIPv4: &'static SCNetworkInterface;
113}
114
115/// This is the type of a reference to an object that represents
116/// an Ethernet Bond interface.
117///
118/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scbondinterface?language=objc)
119pub type SCBondInterface = SCNetworkInterface;
120
121/// This is the type of a reference to an object that represents
122/// the status of an Ethernet Bond interface.
123///
124/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scbondstatus?language=objc)
125#[repr(C)]
126pub struct SCBondStatus {
127    inner: [u8; 0],
128    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
129}
130
131cf_type!(
132    #[encoding_name = "__SCBondStatus"]
133    unsafe impl SCBondStatus {}
134);
135
136/// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscbondstatusok?language=objc)
137pub const kSCBondStatusOK: c_uint = 0;
138/// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscbondstatuslinkinvalid?language=objc)
139pub const kSCBondStatusLinkInvalid: c_uint = 1;
140/// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscbondstatusnopartner?language=objc)
141pub const kSCBondStatusNoPartner: c_uint = 2;
142/// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscbondstatusnotinactivegroup?language=objc)
143pub const kSCBondStatusNotInActiveGroup: c_uint = 3;
144/// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscbondstatusunknown?language=objc)
145pub const kSCBondStatusUnknown: c_uint = 999;
146
147extern "C" {
148    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscbondstatusdeviceaggregationstatus?language=objc)
149    pub static kSCBondStatusDeviceAggregationStatus: &'static CFString;
150}
151
152extern "C" {
153    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscbondstatusdevicecollecting?language=objc)
154    pub static kSCBondStatusDeviceCollecting: &'static CFString;
155}
156
157extern "C" {
158    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscbondstatusdevicedistributing?language=objc)
159    pub static kSCBondStatusDeviceDistributing: &'static CFString;
160}
161
162/// This is the type of a reference to an object that represents
163/// a Virtual LAN (VLAN) interface.
164///
165/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scvlaninterface?language=objc)
166pub type SCVLANInterface = SCNetworkInterface;
167
168/// This is the type of a reference to an object that represents
169/// a network protocol.
170///
171/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scnetworkprotocol?language=objc)
172#[repr(C)]
173pub struct SCNetworkProtocol {
174    inner: [u8; 0],
175    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
176}
177
178cf_type!(
179    #[encoding_name = "__SCNetworkProtocol"]
180    unsafe impl SCNetworkProtocol {}
181);
182
183extern "C" {
184    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkprotocoltypedns?language=objc)
185    pub static kSCNetworkProtocolTypeDNS: &'static CFString;
186}
187
188extern "C" {
189    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkprotocoltypeipv4?language=objc)
190    pub static kSCNetworkProtocolTypeIPv4: &'static CFString;
191}
192
193extern "C" {
194    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkprotocoltypeipv6?language=objc)
195    pub static kSCNetworkProtocolTypeIPv6: &'static CFString;
196}
197
198extern "C" {
199    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkprotocoltypeproxies?language=objc)
200    pub static kSCNetworkProtocolTypeProxies: &'static CFString;
201}
202
203extern "C" {
204    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkprotocoltypesmb?language=objc)
205    pub static kSCNetworkProtocolTypeSMB: &'static CFString;
206}
207
208/// This is the type of a reference to an object that represents
209/// a network service.
210///
211/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scnetworkservice?language=objc)
212#[repr(C)]
213pub struct SCNetworkService {
214    inner: [u8; 0],
215    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
216}
217
218cf_type!(
219    #[encoding_name = "__SCNetworkService"]
220    unsafe impl SCNetworkService {}
221);
222
223/// This is the type of a reference to an object that represents
224/// a network set.
225///
226/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scnetworkset?language=objc)
227#[repr(C)]
228pub struct SCNetworkSet {
229    inner: [u8; 0],
230    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
231}
232
233cf_type!(
234    #[encoding_name = "__SCNetworkSet"]
235    unsafe impl SCNetworkSet {}
236);
237
238unsafe impl ConcreteType for SCNetworkInterface {
239    /// Returns the type identifier of all SCNetworkInterface instances.
240    #[doc(alias = "SCNetworkInterfaceGetTypeID")]
241    #[inline]
242    fn type_id() -> CFTypeID {
243        extern "C-unwind" {
244            fn SCNetworkInterfaceGetTypeID() -> CFTypeID;
245        }
246        unsafe { SCNetworkInterfaceGetTypeID() }
247    }
248}
249
250/// Returns all network capable interfaces on the system.
251///
252/// Returns: The list of interfaces on the system.
253/// You must release the returned value.
254#[inline]
255pub unsafe extern "C-unwind" fn SCNetworkInterfaceCopyAll() -> CFRetained<CFArray> {
256    extern "C-unwind" {
257        fn SCNetworkInterfaceCopyAll() -> Option<NonNull<CFArray>>;
258    }
259    let ret = unsafe { SCNetworkInterfaceCopyAll() };
260    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
261    unsafe { CFRetained::from_raw(ret) }
262}
263
264/// Identify all of the network interface types (e.g. PPP) that
265/// can be layered on top of this interface.
266///
267/// Parameter `interface`: The network interface.
268///
269/// Returns: The list of SCNetworkInterface types supported by the interface;
270/// NULL if no interface types are supported.
271#[inline]
272pub unsafe extern "C-unwind" fn SCNetworkInterfaceGetSupportedInterfaceTypes(
273    interface: &SCNetworkInterface,
274) -> Option<CFRetained<CFArray>> {
275    extern "C-unwind" {
276        fn SCNetworkInterfaceGetSupportedInterfaceTypes(
277            interface: &SCNetworkInterface,
278        ) -> Option<NonNull<CFArray>>;
279    }
280    let ret = unsafe { SCNetworkInterfaceGetSupportedInterfaceTypes(interface) };
281    ret.map(|ret| unsafe { CFRetained::retain(ret) })
282}
283
284/// Identify all of the network protocol types (e.g. IPv4, IPv6) that
285/// can be layered on top of this interface.
286///
287/// Parameter `interface`: The network interface.
288///
289/// Returns: The list of SCNetworkProtocol types supported by the interface;
290/// NULL if no protocol types are supported.
291#[inline]
292pub unsafe extern "C-unwind" fn SCNetworkInterfaceGetSupportedProtocolTypes(
293    interface: &SCNetworkInterface,
294) -> Option<CFRetained<CFArray>> {
295    extern "C-unwind" {
296        fn SCNetworkInterfaceGetSupportedProtocolTypes(
297            interface: &SCNetworkInterface,
298        ) -> Option<NonNull<CFArray>>;
299    }
300    let ret = unsafe { SCNetworkInterfaceGetSupportedProtocolTypes(interface) };
301    ret.map(|ret| unsafe { CFRetained::retain(ret) })
302}
303
304/// Create a new network interface layered on top of another.  For
305/// example, this function would be used to create a "PPP" interface
306/// on top of a "modem".
307///
308/// Parameter `interface`: The network interface.
309///
310/// Parameter `interfaceType`: The type of SCNetworkInterface to be layered on
311/// top of the provided interface.
312///
313/// Returns: A reference to the new SCNetworkInterface.
314/// You must release the returned value.
315#[inline]
316pub unsafe extern "C-unwind" fn SCNetworkInterfaceCreateWithInterface(
317    interface: &SCNetworkInterface,
318    interface_type: &CFString,
319) -> Option<CFRetained<SCNetworkInterface>> {
320    extern "C-unwind" {
321        fn SCNetworkInterfaceCreateWithInterface(
322            interface: &SCNetworkInterface,
323            interface_type: &CFString,
324        ) -> Option<NonNull<SCNetworkInterface>>;
325    }
326    let ret = unsafe { SCNetworkInterfaceCreateWithInterface(interface, interface_type) };
327    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
328}
329
330/// Returns the BSD interface (en0) or device name (modem)
331/// for the interface.
332///
333/// Parameter `interface`: The network interface.
334///
335/// Returns: The BSD name associated with the interface (e.g. "en0");
336/// NULL if no BSD name is available.
337#[inline]
338pub unsafe extern "C-unwind" fn SCNetworkInterfaceGetBSDName(
339    interface: &SCNetworkInterface,
340) -> Option<CFRetained<CFString>> {
341    extern "C-unwind" {
342        fn SCNetworkInterfaceGetBSDName(
343            interface: &SCNetworkInterface,
344        ) -> Option<NonNull<CFString>>;
345    }
346    let ret = unsafe { SCNetworkInterfaceGetBSDName(interface) };
347    ret.map(|ret| unsafe { CFRetained::retain(ret) })
348}
349
350/// Returns the configuration settings associated with a interface.
351///
352/// Parameter `interface`: The network interface.
353///
354/// Returns: The configuration settings associated with the interface;
355/// NULL if no configuration settings are associated with the interface
356/// or an error was encountered.
357#[inline]
358pub unsafe extern "C-unwind" fn SCNetworkInterfaceGetConfiguration(
359    interface: &SCNetworkInterface,
360) -> Option<CFRetained<CFDictionary>> {
361    extern "C-unwind" {
362        fn SCNetworkInterfaceGetConfiguration(
363            interface: &SCNetworkInterface,
364        ) -> Option<NonNull<CFDictionary>>;
365    }
366    let ret = unsafe { SCNetworkInterfaceGetConfiguration(interface) };
367    ret.map(|ret| unsafe { CFRetained::retain(ret) })
368}
369
370/// Returns the configuration settings associated with a interface.
371///
372/// Parameter `interface`: The network interface.
373///
374/// Parameter `extendedType`: A string representing the type of extended information (e.g. EAPOL).
375///
376/// Returns: The configuration settings associated with the interface;
377/// NULL if no configuration settings are associated with the interface
378/// or an error was encountered.
379#[inline]
380pub unsafe extern "C-unwind" fn SCNetworkInterfaceGetExtendedConfiguration(
381    interface: &SCNetworkInterface,
382    extended_type: &CFString,
383) -> Option<CFRetained<CFDictionary>> {
384    extern "C-unwind" {
385        fn SCNetworkInterfaceGetExtendedConfiguration(
386            interface: &SCNetworkInterface,
387            extended_type: &CFString,
388        ) -> Option<NonNull<CFDictionary>>;
389    }
390    let ret = unsafe { SCNetworkInterfaceGetExtendedConfiguration(interface, extended_type) };
391    ret.map(|ret| unsafe { CFRetained::retain(ret) })
392}
393
394/// Returns a displayable link layer address for the interface.
395///
396/// Parameter `interface`: The network interface.
397///
398/// Returns: A string representing the hardware (MAC) address for the interface.
399#[inline]
400pub unsafe extern "C-unwind" fn SCNetworkInterfaceGetHardwareAddressString(
401    interface: &SCNetworkInterface,
402) -> Option<CFRetained<CFString>> {
403    extern "C-unwind" {
404        fn SCNetworkInterfaceGetHardwareAddressString(
405            interface: &SCNetworkInterface,
406        ) -> Option<NonNull<CFString>>;
407    }
408    let ret = unsafe { SCNetworkInterfaceGetHardwareAddressString(interface) };
409    ret.map(|ret| unsafe { CFRetained::retain(ret) })
410}
411
412/// For layered network interfaces, return the underlying interface.
413///
414/// Parameter `interface`: The network interface.
415///
416/// Returns: The underlying network interface;
417/// NULL if this is a leaf interface.
418#[inline]
419pub unsafe extern "C-unwind" fn SCNetworkInterfaceGetInterface(
420    interface: &SCNetworkInterface,
421) -> Option<CFRetained<SCNetworkInterface>> {
422    extern "C-unwind" {
423        fn SCNetworkInterfaceGetInterface(
424            interface: &SCNetworkInterface,
425        ) -> Option<NonNull<SCNetworkInterface>>;
426    }
427    let ret = unsafe { SCNetworkInterfaceGetInterface(interface) };
428    ret.map(|ret| unsafe { CFRetained::retain(ret) })
429}
430
431/// Returns the associated network interface type.
432///
433/// Parameter `interface`: The network interface.
434///
435/// Returns: The interface type.
436#[inline]
437pub unsafe extern "C-unwind" fn SCNetworkInterfaceGetInterfaceType(
438    interface: &SCNetworkInterface,
439) -> Option<CFRetained<CFString>> {
440    extern "C-unwind" {
441        fn SCNetworkInterfaceGetInterfaceType(
442            interface: &SCNetworkInterface,
443        ) -> Option<NonNull<CFString>>;
444    }
445    let ret = unsafe { SCNetworkInterfaceGetInterfaceType(interface) };
446    ret.map(|ret| unsafe { CFRetained::retain(ret) })
447}
448
449/// Returns the localized name (e.g. "Ethernet", "FireWire") for
450/// the interface.
451///
452/// Parameter `interface`: The network interface.
453///
454/// Returns: A localized, display name for the interface;
455/// NULL if no name is available.
456#[inline]
457pub unsafe extern "C-unwind" fn SCNetworkInterfaceGetLocalizedDisplayName(
458    interface: &SCNetworkInterface,
459) -> Option<CFRetained<CFString>> {
460    extern "C-unwind" {
461        fn SCNetworkInterfaceGetLocalizedDisplayName(
462            interface: &SCNetworkInterface,
463        ) -> Option<NonNull<CFString>>;
464    }
465    let ret = unsafe { SCNetworkInterfaceGetLocalizedDisplayName(interface) };
466    ret.map(|ret| unsafe { CFRetained::retain(ret) })
467}
468
469/// Stores the configuration settings for the interface.
470///
471/// Parameter `interface`: The network interface.
472///
473/// Parameter `config`: The configuration settings to associate with this interface.
474///
475/// Returns: TRUE if the configuration was stored; FALSE if an error was encountered.
476#[inline]
477pub unsafe extern "C-unwind" fn SCNetworkInterfaceSetConfiguration(
478    interface: &SCNetworkInterface,
479    config: Option<&CFDictionary>,
480) -> bool {
481    extern "C-unwind" {
482        fn SCNetworkInterfaceSetConfiguration(
483            interface: &SCNetworkInterface,
484            config: Option<&CFDictionary>,
485        ) -> Boolean;
486    }
487    let ret = unsafe { SCNetworkInterfaceSetConfiguration(interface, config) };
488    ret != 0
489}
490
491/// Stores the configuration settings for the interface.
492///
493/// Parameter `interface`: The network interface.
494///
495/// Parameter `config`: The configuration settings to associate with this interface.
496///
497/// Returns: TRUE if the configuration was stored; FALSE if an error was encountered.
498#[inline]
499pub unsafe extern "C-unwind" fn SCNetworkInterfaceSetExtendedConfiguration(
500    interface: &SCNetworkInterface,
501    extended_type: &CFString,
502    config: Option<&CFDictionary>,
503) -> bool {
504    extern "C-unwind" {
505        fn SCNetworkInterfaceSetExtendedConfiguration(
506            interface: &SCNetworkInterface,
507            extended_type: &CFString,
508            config: Option<&CFDictionary>,
509        ) -> Boolean;
510    }
511    let ret =
512        unsafe { SCNetworkInterfaceSetExtendedConfiguration(interface, extended_type, config) };
513    ret != 0
514}
515
516/// For the specified network interface, returns information
517/// about the currently requested media options, the active media
518/// options, and the media options which are available.
519///
520/// Parameter `interface`: The desired network interface.
521///
522/// Parameter `current`: A pointer to memory that will be filled with a CFDictionaryRef
523/// representing the currently requested media options (subtype, options).
524/// If NULL, the current options will not be returned.
525///
526/// Parameter `active`: A pointer to memory that will be filled with a CFDictionaryRef
527/// representing the active media options (subtype, options).
528/// If NULL, the active options will not be returned.
529///
530/// Parameter `available`: A pointer to memory that will be filled with a CFArrayRef
531/// representing the possible media options (subtype, options).
532/// If NULL, the available options will not be returned.
533///
534/// Parameter `filter`: A boolean indicating whether the available options should be
535/// filtered to exclude those options which would not normally be
536/// requested by a user/admin (e.g. hw-loopback).
537///
538/// Returns: TRUE if requested information has been returned.
539#[inline]
540pub unsafe extern "C-unwind" fn SCNetworkInterfaceCopyMediaOptions(
541    interface: &SCNetworkInterface,
542    current: *mut *const CFDictionary,
543    active: *mut *const CFDictionary,
544    available: *mut *const CFArray,
545    filter: bool,
546) -> bool {
547    extern "C-unwind" {
548        fn SCNetworkInterfaceCopyMediaOptions(
549            interface: &SCNetworkInterface,
550            current: *mut *const CFDictionary,
551            active: *mut *const CFDictionary,
552            available: *mut *const CFArray,
553            filter: Boolean,
554        ) -> Boolean;
555    }
556    let ret = unsafe {
557        SCNetworkInterfaceCopyMediaOptions(interface, current, active, available, filter as _)
558    };
559    ret != 0
560}
561
562/// For the provided interface configuration options, return a list
563/// of available media subtypes.
564///
565/// Parameter `available`: The available options as returned by the
566/// SCNetworkInterfaceCopyMediaOptions function.
567///
568/// Returns: An array of available media subtypes CFString's (e.g. 10BaseT/UTP,
569/// 100baseTX, etc).  NULL if no subtypes are available.
570#[inline]
571pub unsafe extern "C-unwind" fn SCNetworkInterfaceCopyMediaSubTypes(
572    available: &CFArray,
573) -> Option<CFRetained<CFArray>> {
574    extern "C-unwind" {
575        fn SCNetworkInterfaceCopyMediaSubTypes(available: &CFArray) -> Option<NonNull<CFArray>>;
576    }
577    let ret = unsafe { SCNetworkInterfaceCopyMediaSubTypes(available) };
578    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
579}
580
581/// For the provided interface configuration options and specific
582/// subtype, return a list of available media options.
583///
584/// Parameter `available`: The available options as returned by the
585/// SCNetworkInterfaceCopyMediaOptions function.
586///
587/// Parameter `subType`: The subtype
588///
589/// Returns: An array of available media options.  Each of the available options
590/// is returned as an array of CFString's (e.g.
591/// <half
592/// -duplex>,
593/// <full
594/// -duplex,flow-control>).  NULL if no options are available.
595#[inline]
596pub unsafe extern "C-unwind" fn SCNetworkInterfaceCopyMediaSubTypeOptions(
597    available: &CFArray,
598    sub_type: &CFString,
599) -> Option<CFRetained<CFArray>> {
600    extern "C-unwind" {
601        fn SCNetworkInterfaceCopyMediaSubTypeOptions(
602            available: &CFArray,
603            sub_type: &CFString,
604        ) -> Option<NonNull<CFArray>>;
605    }
606    let ret = unsafe { SCNetworkInterfaceCopyMediaSubTypeOptions(available, sub_type) };
607    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
608}
609
610/// For the specified network interface, returns information
611/// about the currently MTU setting and the range of allowable
612/// values.
613///
614/// Parameter `interface`: The desired network interface.
615///
616/// Parameter `mtu_cur`: A pointer to memory that will be filled with the current
617/// MTU setting for the interface.
618///
619/// Parameter `mtu_min`: A pointer to memory that will be filled with the minimum
620/// MTU setting for the interface.  If negative, the minimum setting
621/// could not be determined.
622///
623/// Parameter `mtu_max`: A pointer to memory that will be filled with the maximum
624/// MTU setting for the interface.  If negative, the maximum setting
625/// could not be determined.
626///
627/// Returns: TRUE if requested information has been returned.
628#[inline]
629pub unsafe extern "C-unwind" fn SCNetworkInterfaceCopyMTU(
630    interface: &SCNetworkInterface,
631    mtu_cur: *mut c_int,
632    mtu_min: *mut c_int,
633    mtu_max: *mut c_int,
634) -> bool {
635    extern "C-unwind" {
636        fn SCNetworkInterfaceCopyMTU(
637            interface: &SCNetworkInterface,
638            mtu_cur: *mut c_int,
639            mtu_min: *mut c_int,
640            mtu_max: *mut c_int,
641        ) -> Boolean;
642    }
643    let ret = unsafe { SCNetworkInterfaceCopyMTU(interface, mtu_cur, mtu_min, mtu_max) };
644    ret != 0
645}
646
647/// For the specified network interface, sets the requested
648/// media subtype and options.
649///
650/// Parameter `interface`: The desired network interface.
651///
652/// Parameter `subtype`: The desired media subtype (e.g. "autoselect", "100baseTX", ...).
653/// If NULL, no specific media subtype will be requested.
654///
655/// Parameter `options`: The desired media options (e.g. "half-duplex", "full-duplex", ...).
656/// If NULL, no specific media options will be requested.
657///
658/// Returns: TRUE if the configuration was updated; FALSE if an error was encountered.
659#[inline]
660pub unsafe extern "C-unwind" fn SCNetworkInterfaceSetMediaOptions(
661    interface: &SCNetworkInterface,
662    subtype: Option<&CFString>,
663    options: Option<&CFArray>,
664) -> bool {
665    extern "C-unwind" {
666        fn SCNetworkInterfaceSetMediaOptions(
667            interface: &SCNetworkInterface,
668            subtype: Option<&CFString>,
669            options: Option<&CFArray>,
670        ) -> Boolean;
671    }
672    let ret = unsafe { SCNetworkInterfaceSetMediaOptions(interface, subtype, options) };
673    ret != 0
674}
675
676/// For the specified network interface, sets the
677/// requested MTU setting.
678///
679/// Parameter `interface`: The desired network interface.
680///
681/// Parameter `mtu`: The desired MTU setting for the interface.
682/// If zero, the interface will use the default MTU setting.
683///
684/// Returns: TRUE if the configuration was updated; FALSE if an error was encountered.
685#[inline]
686pub unsafe extern "C-unwind" fn SCNetworkInterfaceSetMTU(
687    interface: &SCNetworkInterface,
688    mtu: c_int,
689) -> bool {
690    extern "C-unwind" {
691        fn SCNetworkInterfaceSetMTU(interface: &SCNetworkInterface, mtu: c_int) -> Boolean;
692    }
693    let ret = unsafe { SCNetworkInterfaceSetMTU(interface, mtu) };
694    ret != 0
695}
696
697/// Sends a notification to interested network configuration
698/// agents to immediately retry their configuration. For example,
699/// calling this function will cause the DHCP client to contact
700/// the DHCP server immediately rather than waiting until its
701/// timeout has expired.  The utility of this function is to
702/// allow the caller to give a hint to the system that the
703/// network infrastructure or configuration has changed.
704///
705/// Note: This function requires root (euid==0) privilege or,
706/// alternatively, you may pass an SCNetworkInterface which
707/// is derived from a sequence of calls to :
708///
709/// SCPreferencesCreateWithAuthorization
710/// SCNetworkSetCopy...
711/// SCNetworkServiceGetInterface
712///
713/// Parameter `interface`: The desired network interface.
714///
715/// Returns: Returns TRUE if the notification was sent; FALSE otherwise.
716#[inline]
717pub unsafe extern "C-unwind" fn SCNetworkInterfaceForceConfigurationRefresh(
718    interface: &SCNetworkInterface,
719) -> bool {
720    extern "C-unwind" {
721        fn SCNetworkInterfaceForceConfigurationRefresh(interface: &SCNetworkInterface) -> Boolean;
722    }
723    let ret = unsafe { SCNetworkInterfaceForceConfigurationRefresh(interface) };
724    ret != 0
725}
726
727/// Returns all Ethernet Bond interfaces on the system.
728///
729/// Parameter `prefs`: The "preferences" session.
730///
731/// Returns: The list of Ethernet Bond interfaces on the system.
732/// You must release the returned value.
733#[cfg(feature = "SCPreferences")]
734#[inline]
735pub unsafe extern "C-unwind" fn SCBondInterfaceCopyAll(
736    prefs: &SCPreferences,
737) -> CFRetained<CFArray> {
738    extern "C-unwind" {
739        fn SCBondInterfaceCopyAll(prefs: &SCPreferences) -> Option<NonNull<CFArray>>;
740    }
741    let ret = unsafe { SCBondInterfaceCopyAll(prefs) };
742    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
743    unsafe { CFRetained::from_raw(ret) }
744}
745
746/// Returns all network capable devices on the system
747/// that can be added to an Ethernet Bond interface.
748///
749/// Parameter `prefs`: The "preferences" session.
750///
751/// Returns: The list of interfaces.
752/// You must release the returned value.
753#[cfg(feature = "SCPreferences")]
754#[inline]
755pub unsafe extern "C-unwind" fn SCBondInterfaceCopyAvailableMemberInterfaces(
756    prefs: &SCPreferences,
757) -> CFRetained<CFArray> {
758    extern "C-unwind" {
759        fn SCBondInterfaceCopyAvailableMemberInterfaces(
760            prefs: &SCPreferences,
761        ) -> Option<NonNull<CFArray>>;
762    }
763    let ret = unsafe { SCBondInterfaceCopyAvailableMemberInterfaces(prefs) };
764    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
765    unsafe { CFRetained::from_raw(ret) }
766}
767
768/// Create a new SCBondInterface interface.
769///
770/// Parameter `prefs`: The "preferences" session.
771///
772/// Returns: A reference to the new SCBondInterface.
773/// You must release the returned value.
774#[cfg(feature = "SCPreferences")]
775#[inline]
776pub unsafe extern "C-unwind" fn SCBondInterfaceCreate(
777    prefs: &SCPreferences,
778) -> Option<CFRetained<SCBondInterface>> {
779    extern "C-unwind" {
780        fn SCBondInterfaceCreate(prefs: &SCPreferences) -> Option<NonNull<SCBondInterface>>;
781    }
782    let ret = unsafe { SCBondInterfaceCreate(prefs) };
783    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
784}
785
786/// Removes the SCBondInterface from the configuration.
787///
788/// Parameter `bond`: The SCBondInterface interface.
789///
790/// Returns: TRUE if the interface was removed; FALSE if an error was encountered.
791#[inline]
792pub unsafe extern "C-unwind" fn SCBondInterfaceRemove(bond: &SCBondInterface) -> bool {
793    extern "C-unwind" {
794        fn SCBondInterfaceRemove(bond: &SCBondInterface) -> Boolean;
795    }
796    let ret = unsafe { SCBondInterfaceRemove(bond) };
797    ret != 0
798}
799
800/// Returns the member interfaces for the specified Ethernet Bond interface.
801///
802/// Parameter `bond`: The SCBondInterface interface.
803///
804/// Returns: The list of interfaces.
805#[inline]
806pub unsafe extern "C-unwind" fn SCBondInterfaceGetMemberInterfaces(
807    bond: &SCBondInterface,
808) -> Option<CFRetained<CFArray>> {
809    extern "C-unwind" {
810        fn SCBondInterfaceGetMemberInterfaces(bond: &SCBondInterface) -> Option<NonNull<CFArray>>;
811    }
812    let ret = unsafe { SCBondInterfaceGetMemberInterfaces(bond) };
813    ret.map(|ret| unsafe { CFRetained::retain(ret) })
814}
815
816/// Returns the configuration settings associated with a Ethernet Bond interface.
817///
818/// Parameter `bond`: The SCBondInterface interface.
819///
820/// Returns: The configuration settings associated with the Ethernet Bond interface;
821/// NULL if no changes to the default configuration have been saved.
822#[inline]
823pub unsafe extern "C-unwind" fn SCBondInterfaceGetOptions(
824    bond: &SCBondInterface,
825) -> Option<CFRetained<CFDictionary>> {
826    extern "C-unwind" {
827        fn SCBondInterfaceGetOptions(bond: &SCBondInterface) -> Option<NonNull<CFDictionary>>;
828    }
829    let ret = unsafe { SCBondInterfaceGetOptions(bond) };
830    ret.map(|ret| unsafe { CFRetained::retain(ret) })
831}
832
833/// Sets the member interfaces for the specified Ethernet Bond interface.
834///
835/// Parameter `bond`: The SCBondInterface interface.
836///
837/// Parameter `members`: The desired member interfaces.
838///
839/// Returns: TRUE if the configuration was stored; FALSE if an error was encountered.
840#[inline]
841pub unsafe extern "C-unwind" fn SCBondInterfaceSetMemberInterfaces(
842    bond: &SCBondInterface,
843    members: &CFArray,
844) -> bool {
845    extern "C-unwind" {
846        fn SCBondInterfaceSetMemberInterfaces(bond: &SCBondInterface, members: &CFArray)
847            -> Boolean;
848    }
849    let ret = unsafe { SCBondInterfaceSetMemberInterfaces(bond, members) };
850    ret != 0
851}
852
853/// Sets the localized display name for the specified Ethernet Bond interface.
854///
855/// Parameter `bond`: The SCBondInterface interface.
856///
857/// Parameter `newName`: The new display name.
858///
859/// Returns: TRUE if the configuration was stored; FALSE if an error was encountered.
860#[inline]
861pub unsafe extern "C-unwind" fn SCBondInterfaceSetLocalizedDisplayName(
862    bond: &SCBondInterface,
863    new_name: &CFString,
864) -> bool {
865    extern "C-unwind" {
866        fn SCBondInterfaceSetLocalizedDisplayName(
867            bond: &SCBondInterface,
868            new_name: &CFString,
869        ) -> Boolean;
870    }
871    let ret = unsafe { SCBondInterfaceSetLocalizedDisplayName(bond, new_name) };
872    ret != 0
873}
874
875/// Sets the configuration settings for the specified Ethernet Bond interface.
876///
877/// Parameter `bond`: The SCBondInterface interface.
878///
879/// Parameter `newOptions`: The new configuration settings.
880///
881/// Returns: TRUE if the configuration was stored; FALSE if an error was encountered.
882#[inline]
883pub unsafe extern "C-unwind" fn SCBondInterfaceSetOptions(
884    bond: &SCBondInterface,
885    new_options: &CFDictionary,
886) -> bool {
887    extern "C-unwind" {
888        fn SCBondInterfaceSetOptions(bond: &SCBondInterface, new_options: &CFDictionary)
889            -> Boolean;
890    }
891    let ret = unsafe { SCBondInterfaceSetOptions(bond, new_options) };
892    ret != 0
893}
894
895/// Returns the status of the specified Ethernet Bond interface.
896///
897/// Parameter `bond`: The SCBondInterface interface.
898///
899/// Returns: The status associated with the interface.
900/// You must release the returned value.
901#[inline]
902pub unsafe extern "C-unwind" fn SCBondInterfaceCopyStatus(
903    bond: &SCBondInterface,
904) -> Option<CFRetained<SCBondStatus>> {
905    extern "C-unwind" {
906        fn SCBondInterfaceCopyStatus(bond: &SCBondInterface) -> Option<NonNull<SCBondStatus>>;
907    }
908    let ret = unsafe { SCBondInterfaceCopyStatus(bond) };
909    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
910}
911
912unsafe impl ConcreteType for SCBondStatus {
913    /// Returns the type identifier of all SCBondStatus instances.
914    #[doc(alias = "SCBondStatusGetTypeID")]
915    #[inline]
916    fn type_id() -> CFTypeID {
917        extern "C-unwind" {
918            fn SCBondStatusGetTypeID() -> CFTypeID;
919        }
920        unsafe { SCBondStatusGetTypeID() }
921    }
922}
923
924/// Returns the member interfaces that are represented with the
925/// Ethernet Bond interface.
926///
927/// Parameter `bondStatus`: The Ethernet Bond status.
928///
929/// Returns: The list of interfaces.
930#[inline]
931pub unsafe extern "C-unwind" fn SCBondStatusGetMemberInterfaces(
932    bond_status: &SCBondStatus,
933) -> Option<CFRetained<CFArray>> {
934    extern "C-unwind" {
935        fn SCBondStatusGetMemberInterfaces(bond_status: &SCBondStatus) -> Option<NonNull<CFArray>>;
936    }
937    let ret = unsafe { SCBondStatusGetMemberInterfaces(bond_status) };
938    ret.map(|ret| unsafe { CFRetained::retain(ret) })
939}
940
941/// Returns the status of a specific member interface of an
942/// Ethernet Bond or the status of the bond as a whole.
943///
944/// Parameter `bondStatus`: The Ethernet Bond status.
945///
946/// Parameter `interface`: The specific member interface; NULL if you want the
947/// status of the Ethernet Bond.
948///
949/// Returns: The interface status.
950///
951/// Note: at present, no information about the status of the Ethernet
952/// Bond is returned.  As long as one member interface is active
953/// then the bond should be operational.
954#[inline]
955pub unsafe extern "C-unwind" fn SCBondStatusGetInterfaceStatus(
956    bond_status: &SCBondStatus,
957    interface: Option<&SCNetworkInterface>,
958) -> Option<CFRetained<CFDictionary>> {
959    extern "C-unwind" {
960        fn SCBondStatusGetInterfaceStatus(
961            bond_status: &SCBondStatus,
962            interface: Option<&SCNetworkInterface>,
963        ) -> Option<NonNull<CFDictionary>>;
964    }
965    let ret = unsafe { SCBondStatusGetInterfaceStatus(bond_status, interface) };
966    ret.map(|ret| unsafe { CFRetained::retain(ret) })
967}
968
969/// Returns all VLAN interfaces on the system.
970///
971/// Returns: The list of VLAN interfaces on the system.
972/// You must release the returned value.
973#[cfg(feature = "SCPreferences")]
974#[inline]
975pub unsafe extern "C-unwind" fn SCVLANInterfaceCopyAll(
976    prefs: &SCPreferences,
977) -> CFRetained<CFArray> {
978    extern "C-unwind" {
979        fn SCVLANInterfaceCopyAll(prefs: &SCPreferences) -> Option<NonNull<CFArray>>;
980    }
981    let ret = unsafe { SCVLANInterfaceCopyAll(prefs) };
982    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
983    unsafe { CFRetained::from_raw(ret) }
984}
985
986/// Returns the network capable devices on the system
987/// that can be associated with a VLAN interface.
988///
989/// Returns: The list of interfaces.
990/// You must release the returned value.
991#[inline]
992pub unsafe extern "C-unwind" fn SCVLANInterfaceCopyAvailablePhysicalInterfaces(
993) -> CFRetained<CFArray> {
994    extern "C-unwind" {
995        fn SCVLANInterfaceCopyAvailablePhysicalInterfaces() -> Option<NonNull<CFArray>>;
996    }
997    let ret = unsafe { SCVLANInterfaceCopyAvailablePhysicalInterfaces() };
998    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
999    unsafe { CFRetained::from_raw(ret) }
1000}
1001
1002/// Create a new SCVLANInterface interface.
1003///
1004/// Parameter `prefs`: The "preferences" session.
1005///
1006/// Parameter `physical`: The physical interface to associate with the VLAN.
1007///
1008/// Parameter `tag`: The tag to associate with the VLAN.
1009///
1010/// Returns: A reference to the new SCVLANInterface.
1011/// You must release the returned value.
1012///
1013/// Note: the tag must be in the range (1
1014/// <
1015/// = tag
1016/// <
1017/// = 4094)
1018#[cfg(feature = "SCPreferences")]
1019#[inline]
1020pub unsafe extern "C-unwind" fn SCVLANInterfaceCreate(
1021    prefs: &SCPreferences,
1022    physical: &SCNetworkInterface,
1023    tag: &CFNumber,
1024) -> Option<CFRetained<SCVLANInterface>> {
1025    extern "C-unwind" {
1026        fn SCVLANInterfaceCreate(
1027            prefs: &SCPreferences,
1028            physical: &SCNetworkInterface,
1029            tag: &CFNumber,
1030        ) -> Option<NonNull<SCVLANInterface>>;
1031    }
1032    let ret = unsafe { SCVLANInterfaceCreate(prefs, physical, tag) };
1033    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1034}
1035
1036/// Removes the SCVLANInterface from the configuration.
1037///
1038/// Parameter `vlan`: The SCVLANInterface interface.
1039///
1040/// Returns: TRUE if the interface was removed; FALSE if an error was encountered.
1041#[inline]
1042pub unsafe extern "C-unwind" fn SCVLANInterfaceRemove(vlan: &SCVLANInterface) -> bool {
1043    extern "C-unwind" {
1044        fn SCVLANInterfaceRemove(vlan: &SCVLANInterface) -> Boolean;
1045    }
1046    let ret = unsafe { SCVLANInterfaceRemove(vlan) };
1047    ret != 0
1048}
1049
1050/// Returns the physical interface for the specified VLAN interface.
1051///
1052/// Parameter `vlan`: The SCVLANInterface interface.
1053///
1054/// Returns: The list of interfaces.
1055#[inline]
1056pub unsafe extern "C-unwind" fn SCVLANInterfaceGetPhysicalInterface(
1057    vlan: &SCVLANInterface,
1058) -> Option<CFRetained<SCNetworkInterface>> {
1059    extern "C-unwind" {
1060        fn SCVLANInterfaceGetPhysicalInterface(
1061            vlan: &SCVLANInterface,
1062        ) -> Option<NonNull<SCNetworkInterface>>;
1063    }
1064    let ret = unsafe { SCVLANInterfaceGetPhysicalInterface(vlan) };
1065    ret.map(|ret| unsafe { CFRetained::retain(ret) })
1066}
1067
1068/// Returns the tag for the specified VLAN interface.
1069///
1070/// Parameter `vlan`: The SCVLANInterface interface.
1071///
1072/// Returns: The tag.
1073#[inline]
1074pub unsafe extern "C-unwind" fn SCVLANInterfaceGetTag(
1075    vlan: &SCVLANInterface,
1076) -> Option<CFRetained<CFNumber>> {
1077    extern "C-unwind" {
1078        fn SCVLANInterfaceGetTag(vlan: &SCVLANInterface) -> Option<NonNull<CFNumber>>;
1079    }
1080    let ret = unsafe { SCVLANInterfaceGetTag(vlan) };
1081    ret.map(|ret| unsafe { CFRetained::retain(ret) })
1082}
1083
1084/// Returns the configuration settings associated with the VLAN interface.
1085///
1086/// Parameter `vlan`: The SCVLANInterface interface.
1087///
1088/// Returns: The configuration settings associated with the VLAN interface;
1089/// NULL if no changes to the default configuration have been saved.
1090#[inline]
1091pub unsafe extern "C-unwind" fn SCVLANInterfaceGetOptions(
1092    vlan: &SCVLANInterface,
1093) -> Option<CFRetained<CFDictionary>> {
1094    extern "C-unwind" {
1095        fn SCVLANInterfaceGetOptions(vlan: &SCVLANInterface) -> Option<NonNull<CFDictionary>>;
1096    }
1097    let ret = unsafe { SCVLANInterfaceGetOptions(vlan) };
1098    ret.map(|ret| unsafe { CFRetained::retain(ret) })
1099}
1100
1101/// Updates the specified VLAN interface.
1102///
1103/// Parameter `vlan`: The SCVLANInterface interface.
1104///
1105/// Parameter `physical`: The physical interface to associate with the VLAN.
1106///
1107/// Parameter `tag`: The tag to associate with the VLAN.
1108///
1109/// Returns: TRUE if the configuration was stored; FALSE if an error was encountered.
1110///
1111/// Note: the tag must be in the range (1
1112/// <
1113/// = tag
1114/// <
1115/// = 4094)
1116#[inline]
1117pub unsafe extern "C-unwind" fn SCVLANInterfaceSetPhysicalInterfaceAndTag(
1118    vlan: &SCVLANInterface,
1119    physical: &SCNetworkInterface,
1120    tag: &CFNumber,
1121) -> bool {
1122    extern "C-unwind" {
1123        fn SCVLANInterfaceSetPhysicalInterfaceAndTag(
1124            vlan: &SCVLANInterface,
1125            physical: &SCNetworkInterface,
1126            tag: &CFNumber,
1127        ) -> Boolean;
1128    }
1129    let ret = unsafe { SCVLANInterfaceSetPhysicalInterfaceAndTag(vlan, physical, tag) };
1130    ret != 0
1131}
1132
1133/// Sets the localized display name for the specified VLAN interface.
1134///
1135/// Parameter `vlan`: The SCVLANInterface interface.
1136///
1137/// Parameter `newName`: The new display name.
1138///
1139/// Returns: TRUE if the configuration was stored; FALSE if an error was encountered.
1140#[inline]
1141pub unsafe extern "C-unwind" fn SCVLANInterfaceSetLocalizedDisplayName(
1142    vlan: &SCVLANInterface,
1143    new_name: &CFString,
1144) -> bool {
1145    extern "C-unwind" {
1146        fn SCVLANInterfaceSetLocalizedDisplayName(
1147            vlan: &SCVLANInterface,
1148            new_name: &CFString,
1149        ) -> Boolean;
1150    }
1151    let ret = unsafe { SCVLANInterfaceSetLocalizedDisplayName(vlan, new_name) };
1152    ret != 0
1153}
1154
1155/// Sets the configuration settings for the specified VLAN interface.
1156///
1157/// Parameter `vlan`: The SCVLANInterface interface.
1158///
1159/// Parameter `newOptions`: The new configuration settings.
1160///
1161/// Returns: TRUE if the configuration was stored; FALSE if an error was encountered.
1162#[inline]
1163pub unsafe extern "C-unwind" fn SCVLANInterfaceSetOptions(
1164    vlan: &SCVLANInterface,
1165    new_options: &CFDictionary,
1166) -> bool {
1167    extern "C-unwind" {
1168        fn SCVLANInterfaceSetOptions(vlan: &SCVLANInterface, new_options: &CFDictionary)
1169            -> Boolean;
1170    }
1171    let ret = unsafe { SCVLANInterfaceSetOptions(vlan, new_options) };
1172    ret != 0
1173}
1174
1175unsafe impl ConcreteType for SCNetworkProtocol {
1176    /// Returns the type identifier of all SCNetworkProtocol instances.
1177    #[doc(alias = "SCNetworkProtocolGetTypeID")]
1178    #[inline]
1179    fn type_id() -> CFTypeID {
1180        extern "C-unwind" {
1181            fn SCNetworkProtocolGetTypeID() -> CFTypeID;
1182        }
1183        unsafe { SCNetworkProtocolGetTypeID() }
1184    }
1185}
1186
1187/// Returns the configuration settings associated with the protocol.
1188///
1189/// Parameter `protocol`: The network protocol.
1190///
1191/// Returns: The configuration settings associated with the protocol;
1192/// NULL if no configuration settings are associated with the protocol
1193/// or an error was encountered.
1194#[inline]
1195pub unsafe extern "C-unwind" fn SCNetworkProtocolGetConfiguration(
1196    protocol: &SCNetworkProtocol,
1197) -> Option<CFRetained<CFDictionary>> {
1198    extern "C-unwind" {
1199        fn SCNetworkProtocolGetConfiguration(
1200            protocol: &SCNetworkProtocol,
1201        ) -> Option<NonNull<CFDictionary>>;
1202    }
1203    let ret = unsafe { SCNetworkProtocolGetConfiguration(protocol) };
1204    ret.map(|ret| unsafe { CFRetained::retain(ret) })
1205}
1206
1207/// Returns whether this protocol has been enabled.
1208///
1209/// Parameter `protocol`: The network protocol.
1210///
1211/// Returns: TRUE if the protocol is enabled.
1212#[inline]
1213pub unsafe extern "C-unwind" fn SCNetworkProtocolGetEnabled(protocol: &SCNetworkProtocol) -> bool {
1214    extern "C-unwind" {
1215        fn SCNetworkProtocolGetEnabled(protocol: &SCNetworkProtocol) -> Boolean;
1216    }
1217    let ret = unsafe { SCNetworkProtocolGetEnabled(protocol) };
1218    ret != 0
1219}
1220
1221/// Returns the associated network protocol type.
1222///
1223/// Parameter `protocol`: The network protocol.
1224///
1225/// Returns: The protocol type.
1226#[inline]
1227pub unsafe extern "C-unwind" fn SCNetworkProtocolGetProtocolType(
1228    protocol: &SCNetworkProtocol,
1229) -> Option<CFRetained<CFString>> {
1230    extern "C-unwind" {
1231        fn SCNetworkProtocolGetProtocolType(
1232            protocol: &SCNetworkProtocol,
1233        ) -> Option<NonNull<CFString>>;
1234    }
1235    let ret = unsafe { SCNetworkProtocolGetProtocolType(protocol) };
1236    ret.map(|ret| unsafe { CFRetained::retain(ret) })
1237}
1238
1239/// Stores the configuration settings for the protocol.
1240///
1241/// Parameter `protocol`: The network protocol.
1242///
1243/// Parameter `config`: The configuration settings to associate with this protocol.
1244///
1245/// Returns: TRUE if the configuration was stored; FALSE if an error was encountered.
1246#[inline]
1247pub unsafe extern "C-unwind" fn SCNetworkProtocolSetConfiguration(
1248    protocol: &SCNetworkProtocol,
1249    config: Option<&CFDictionary>,
1250) -> bool {
1251    extern "C-unwind" {
1252        fn SCNetworkProtocolSetConfiguration(
1253            protocol: &SCNetworkProtocol,
1254            config: Option<&CFDictionary>,
1255        ) -> Boolean;
1256    }
1257    let ret = unsafe { SCNetworkProtocolSetConfiguration(protocol, config) };
1258    ret != 0
1259}
1260
1261/// Enables or disables the protocol.
1262///
1263/// Parameter `protocol`: The network protocol.
1264///
1265/// Parameter `enabled`: TRUE if the protocol should be enabled.
1266///
1267/// Returns: TRUE if the enabled status was saved; FALSE if an error was encountered.
1268#[inline]
1269pub unsafe extern "C-unwind" fn SCNetworkProtocolSetEnabled(
1270    protocol: &SCNetworkProtocol,
1271    enabled: bool,
1272) -> bool {
1273    extern "C-unwind" {
1274        fn SCNetworkProtocolSetEnabled(protocol: &SCNetworkProtocol, enabled: Boolean) -> Boolean;
1275    }
1276    let ret = unsafe { SCNetworkProtocolSetEnabled(protocol, enabled as _) };
1277    ret != 0
1278}
1279
1280unsafe impl ConcreteType for SCNetworkService {
1281    /// Returns the type identifier of all SCNetworkService instances.
1282    #[doc(alias = "SCNetworkServiceGetTypeID")]
1283    #[inline]
1284    fn type_id() -> CFTypeID {
1285        extern "C-unwind" {
1286            fn SCNetworkServiceGetTypeID() -> CFTypeID;
1287        }
1288        unsafe { SCNetworkServiceGetTypeID() }
1289    }
1290}
1291
1292/// Adds a network protocol of the specified type to the
1293/// service.  The protocol configuration is set to default values
1294/// that are appropriate for the interface associated with the
1295/// service.
1296///
1297/// Parameter `service`: The network service.
1298///
1299/// Parameter `protocolType`: The type of SCNetworkProtocol to be added to the service.
1300///
1301/// Returns: TRUE if the protocol was added to the service; FALSE if the
1302/// protocol was already present or an error was encountered.
1303#[inline]
1304pub unsafe extern "C-unwind" fn SCNetworkServiceAddProtocolType(
1305    service: &SCNetworkService,
1306    protocol_type: &CFString,
1307) -> bool {
1308    extern "C-unwind" {
1309        fn SCNetworkServiceAddProtocolType(
1310            service: &SCNetworkService,
1311            protocol_type: &CFString,
1312        ) -> Boolean;
1313    }
1314    let ret = unsafe { SCNetworkServiceAddProtocolType(service, protocol_type) };
1315    ret != 0
1316}
1317
1318/// Returns all available network services for the specified preferences.
1319///
1320/// Parameter `prefs`: The "preferences" session.
1321///
1322/// Returns: The list of SCNetworkService services associated with the preferences.
1323/// You must release the returned value.
1324#[cfg(feature = "SCPreferences")]
1325#[inline]
1326pub unsafe extern "C-unwind" fn SCNetworkServiceCopyAll(
1327    prefs: &SCPreferences,
1328) -> Option<CFRetained<CFArray>> {
1329    extern "C-unwind" {
1330        fn SCNetworkServiceCopyAll(prefs: &SCPreferences) -> Option<NonNull<CFArray>>;
1331    }
1332    let ret = unsafe { SCNetworkServiceCopyAll(prefs) };
1333    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1334}
1335
1336/// Returns all network protocols associated with the service.
1337///
1338/// Parameter `service`: The network service.
1339///
1340/// Returns: The list of SCNetworkProtocol protocols associated with the service.
1341/// You must release the returned value.
1342#[inline]
1343pub unsafe extern "C-unwind" fn SCNetworkServiceCopyProtocols(
1344    service: &SCNetworkService,
1345) -> Option<CFRetained<CFArray>> {
1346    extern "C-unwind" {
1347        fn SCNetworkServiceCopyProtocols(service: &SCNetworkService) -> Option<NonNull<CFArray>>;
1348    }
1349    let ret = unsafe { SCNetworkServiceCopyProtocols(service) };
1350    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1351}
1352
1353/// Create a new network service for the specified interface in the
1354/// configuration.
1355///
1356/// Parameter `prefs`: The "preferences" session.
1357///
1358/// Returns: A reference to the new SCNetworkService.
1359/// You must release the returned value.
1360#[cfg(feature = "SCPreferences")]
1361#[inline]
1362pub unsafe extern "C-unwind" fn SCNetworkServiceCreate(
1363    prefs: &SCPreferences,
1364    interface: &SCNetworkInterface,
1365) -> Option<CFRetained<SCNetworkService>> {
1366    extern "C-unwind" {
1367        fn SCNetworkServiceCreate(
1368            prefs: &SCPreferences,
1369            interface: &SCNetworkInterface,
1370        ) -> Option<NonNull<SCNetworkService>>;
1371    }
1372    let ret = unsafe { SCNetworkServiceCreate(prefs, interface) };
1373    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1374}
1375
1376/// Returns the network service with the specified identifier.
1377///
1378/// Parameter `prefs`: The "preferences" session.
1379///
1380/// Parameter `serviceID`: The unique identifier for the service.
1381///
1382/// Returns: A reference to the SCNetworkService from the associated preferences;
1383/// NULL if the serviceID does not exist in the preferences or if an
1384/// error was encountered.
1385/// You must release the returned value.
1386#[cfg(feature = "SCPreferences")]
1387#[inline]
1388pub unsafe extern "C-unwind" fn SCNetworkServiceCopy(
1389    prefs: &SCPreferences,
1390    service_id: &CFString,
1391) -> Option<CFRetained<SCNetworkService>> {
1392    extern "C-unwind" {
1393        fn SCNetworkServiceCopy(
1394            prefs: &SCPreferences,
1395            service_id: &CFString,
1396        ) -> Option<NonNull<SCNetworkService>>;
1397    }
1398    let ret = unsafe { SCNetworkServiceCopy(prefs, service_id) };
1399    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1400}
1401
1402/// Establishes the "default" configuration for a network
1403/// service.  This configuration includes the addition of
1404/// network protocols for the service (with "default"
1405/// configuration options).
1406///
1407/// Parameter `service`: The network service.
1408///
1409/// Returns: TRUE if the configuration was updated; FALSE if an error was encountered.
1410#[inline]
1411pub unsafe extern "C-unwind" fn SCNetworkServiceEstablishDefaultConfiguration(
1412    service: &SCNetworkService,
1413) -> bool {
1414    extern "C-unwind" {
1415        fn SCNetworkServiceEstablishDefaultConfiguration(service: &SCNetworkService) -> Boolean;
1416    }
1417    let ret = unsafe { SCNetworkServiceEstablishDefaultConfiguration(service) };
1418    ret != 0
1419}
1420
1421/// Returns whether this service has been enabled.
1422///
1423/// Parameter `service`: The network service.
1424///
1425/// Returns: TRUE if the service is enabled.
1426#[inline]
1427pub unsafe extern "C-unwind" fn SCNetworkServiceGetEnabled(service: &SCNetworkService) -> bool {
1428    extern "C-unwind" {
1429        fn SCNetworkServiceGetEnabled(service: &SCNetworkService) -> Boolean;
1430    }
1431    let ret = unsafe { SCNetworkServiceGetEnabled(service) };
1432    ret != 0
1433}
1434
1435/// Returns the network interface associated with the service.
1436///
1437/// Parameter `service`: The network service.
1438///
1439/// Returns: A reference to the SCNetworkInterface associated with the service;
1440/// NULL if an error was encountered.
1441#[inline]
1442pub unsafe extern "C-unwind" fn SCNetworkServiceGetInterface(
1443    service: &SCNetworkService,
1444) -> Option<CFRetained<SCNetworkInterface>> {
1445    extern "C-unwind" {
1446        fn SCNetworkServiceGetInterface(
1447            service: &SCNetworkService,
1448        ) -> Option<NonNull<SCNetworkInterface>>;
1449    }
1450    let ret = unsafe { SCNetworkServiceGetInterface(service) };
1451    ret.map(|ret| unsafe { CFRetained::retain(ret) })
1452}
1453
1454/// Returns the [user specified] name associated with the service.
1455///
1456/// Parameter `service`: The network service.
1457///
1458/// Returns: The [user specified] name.
1459#[inline]
1460pub unsafe extern "C-unwind" fn SCNetworkServiceGetName(
1461    service: &SCNetworkService,
1462) -> Option<CFRetained<CFString>> {
1463    extern "C-unwind" {
1464        fn SCNetworkServiceGetName(service: &SCNetworkService) -> Option<NonNull<CFString>>;
1465    }
1466    let ret = unsafe { SCNetworkServiceGetName(service) };
1467    ret.map(|ret| unsafe { CFRetained::retain(ret) })
1468}
1469
1470/// Returns the network protocol of the specified type for
1471/// the service.
1472///
1473/// Parameter `service`: The network service.
1474///
1475/// Returns: A reference to the SCNetworkProtocol associated with the service;
1476/// NULL if this protocol has not been added or if an error was encountered.
1477/// You must release the returned value.
1478#[inline]
1479pub unsafe extern "C-unwind" fn SCNetworkServiceCopyProtocol(
1480    service: &SCNetworkService,
1481    protocol_type: &CFString,
1482) -> Option<CFRetained<SCNetworkProtocol>> {
1483    extern "C-unwind" {
1484        fn SCNetworkServiceCopyProtocol(
1485            service: &SCNetworkService,
1486            protocol_type: &CFString,
1487        ) -> Option<NonNull<SCNetworkProtocol>>;
1488    }
1489    let ret = unsafe { SCNetworkServiceCopyProtocol(service, protocol_type) };
1490    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1491}
1492
1493/// Returns the identifier for the service.
1494///
1495/// Parameter `service`: The network service.
1496///
1497/// Returns: The service identifier.
1498#[inline]
1499pub unsafe extern "C-unwind" fn SCNetworkServiceGetServiceID(
1500    service: &SCNetworkService,
1501) -> Option<CFRetained<CFString>> {
1502    extern "C-unwind" {
1503        fn SCNetworkServiceGetServiceID(service: &SCNetworkService) -> Option<NonNull<CFString>>;
1504    }
1505    let ret = unsafe { SCNetworkServiceGetServiceID(service) };
1506    ret.map(|ret| unsafe { CFRetained::retain(ret) })
1507}
1508
1509/// Removes the network service from the configuration.
1510///
1511/// Parameter `service`: The network service.
1512///
1513/// Returns: TRUE if the service was removed; FALSE if an error was encountered.
1514#[inline]
1515pub unsafe extern "C-unwind" fn SCNetworkServiceRemove(service: &SCNetworkService) -> bool {
1516    extern "C-unwind" {
1517        fn SCNetworkServiceRemove(service: &SCNetworkService) -> Boolean;
1518    }
1519    let ret = unsafe { SCNetworkServiceRemove(service) };
1520    ret != 0
1521}
1522
1523/// Removes the network protocol of the specified type from the service.
1524///
1525/// Parameter `service`: The network service.
1526///
1527/// Parameter `protocolType`: The type of SCNetworkProtocol to be removed from the service.
1528///
1529/// Returns: TRUE if the protocol was removed to the service; FALSE if the
1530/// protocol was not configured or an error was encountered.
1531#[inline]
1532pub unsafe extern "C-unwind" fn SCNetworkServiceRemoveProtocolType(
1533    service: &SCNetworkService,
1534    protocol_type: &CFString,
1535) -> bool {
1536    extern "C-unwind" {
1537        fn SCNetworkServiceRemoveProtocolType(
1538            service: &SCNetworkService,
1539            protocol_type: &CFString,
1540        ) -> Boolean;
1541    }
1542    let ret = unsafe { SCNetworkServiceRemoveProtocolType(service, protocol_type) };
1543    ret != 0
1544}
1545
1546/// Enables or disables the service.
1547///
1548/// Parameter `service`: The network service.
1549///
1550/// Parameter `enabled`: TRUE if the service should be enabled.
1551///
1552/// Returns: TRUE if the enabled status was saved; FALSE if an error was encountered.
1553#[inline]
1554pub unsafe extern "C-unwind" fn SCNetworkServiceSetEnabled(
1555    service: &SCNetworkService,
1556    enabled: bool,
1557) -> bool {
1558    extern "C-unwind" {
1559        fn SCNetworkServiceSetEnabled(service: &SCNetworkService, enabled: Boolean) -> Boolean;
1560    }
1561    let ret = unsafe { SCNetworkServiceSetEnabled(service, enabled as _) };
1562    ret != 0
1563}
1564
1565/// Stores the [user specified] name for the service.
1566///
1567/// Parameter `service`: The network service.
1568///
1569/// Parameter `name`: The [user defined] name to associate with the service.
1570///
1571/// Returns: TRUE if the name was saved; FALSE if an error was encountered.
1572///
1573/// Note: although not technically required, the [user specified] names
1574/// for all services within any given set should be unique.  As such, an
1575/// error will be returned if you attemp to name two services with the
1576/// same string.
1577#[inline]
1578pub unsafe extern "C-unwind" fn SCNetworkServiceSetName(
1579    service: &SCNetworkService,
1580    name: Option<&CFString>,
1581) -> bool {
1582    extern "C-unwind" {
1583        fn SCNetworkServiceSetName(service: &SCNetworkService, name: Option<&CFString>) -> Boolean;
1584    }
1585    let ret = unsafe { SCNetworkServiceSetName(service, name) };
1586    ret != 0
1587}
1588
1589unsafe impl ConcreteType for SCNetworkSet {
1590    /// Returns the type identifier of all SCNetworkSet instances.
1591    #[doc(alias = "SCNetworkSetGetTypeID")]
1592    #[inline]
1593    fn type_id() -> CFTypeID {
1594        extern "C-unwind" {
1595            fn SCNetworkSetGetTypeID() -> CFTypeID;
1596        }
1597        unsafe { SCNetworkSetGetTypeID() }
1598    }
1599}
1600
1601/// Adds the network service to the set.
1602///
1603/// Parameter `set`: The network set.
1604///
1605/// Parameter `service`: The service to be added.
1606///
1607/// Returns: TRUE if the service was added to the set; FALSE if the
1608/// service was already present or an error was encountered.
1609///
1610/// Note: prior to Mac OS X 10.5, the Network Preferences UI
1611/// did not support having a single service being a member of
1612/// more than one set.  An error will be returned if you attempt
1613/// to add a service to more than one set on a pre-10.5 system.
1614#[inline]
1615pub unsafe extern "C-unwind" fn SCNetworkSetAddService(
1616    set: &SCNetworkSet,
1617    service: &SCNetworkService,
1618) -> bool {
1619    extern "C-unwind" {
1620        fn SCNetworkSetAddService(set: &SCNetworkSet, service: &SCNetworkService) -> Boolean;
1621    }
1622    let ret = unsafe { SCNetworkSetAddService(set, service) };
1623    ret != 0
1624}
1625
1626/// Checks if an interface is represented by at least one
1627/// network service in the specified set.
1628///
1629/// Parameter `set`: The network set.
1630///
1631/// Parameter `interface`: The network interface.
1632///
1633/// Returns: TRUE if the interface is represented in the set; FALSE if not.
1634#[inline]
1635pub unsafe extern "C-unwind" fn SCNetworkSetContainsInterface(
1636    set: &SCNetworkSet,
1637    interface: &SCNetworkInterface,
1638) -> bool {
1639    extern "C-unwind" {
1640        fn SCNetworkSetContainsInterface(
1641            set: &SCNetworkSet,
1642            interface: &SCNetworkInterface,
1643        ) -> Boolean;
1644    }
1645    let ret = unsafe { SCNetworkSetContainsInterface(set, interface) };
1646    ret != 0
1647}
1648
1649/// Returns all available sets for the specified preferences.
1650///
1651/// Parameter `prefs`: The "preferences" session.
1652///
1653/// Returns: The list of SCNetworkSet sets associated with the preferences.
1654/// You must release the returned value.
1655#[cfg(feature = "SCPreferences")]
1656#[inline]
1657pub unsafe extern "C-unwind" fn SCNetworkSetCopyAll(
1658    prefs: &SCPreferences,
1659) -> Option<CFRetained<CFArray>> {
1660    extern "C-unwind" {
1661        fn SCNetworkSetCopyAll(prefs: &SCPreferences) -> Option<NonNull<CFArray>>;
1662    }
1663    let ret = unsafe { SCNetworkSetCopyAll(prefs) };
1664    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1665}
1666
1667/// Returns the "current" set.
1668///
1669/// Parameter `prefs`: The "preferences" session.
1670///
1671/// Returns: The current set; NULL if no current set has been defined.
1672#[cfg(feature = "SCPreferences")]
1673#[inline]
1674pub unsafe extern "C-unwind" fn SCNetworkSetCopyCurrent(
1675    prefs: &SCPreferences,
1676) -> Option<CFRetained<SCNetworkSet>> {
1677    extern "C-unwind" {
1678        fn SCNetworkSetCopyCurrent(prefs: &SCPreferences) -> Option<NonNull<SCNetworkSet>>;
1679    }
1680    let ret = unsafe { SCNetworkSetCopyCurrent(prefs) };
1681    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1682}
1683
1684/// Returns all network services associated with the set.
1685///
1686/// Parameter `set`: The network set.
1687///
1688/// Returns: The list of SCNetworkService services associated with the set.
1689/// You must release the returned value.
1690#[inline]
1691pub unsafe extern "C-unwind" fn SCNetworkSetCopyServices(
1692    set: &SCNetworkSet,
1693) -> Option<CFRetained<CFArray>> {
1694    extern "C-unwind" {
1695        fn SCNetworkSetCopyServices(set: &SCNetworkSet) -> Option<NonNull<CFArray>>;
1696    }
1697    let ret = unsafe { SCNetworkSetCopyServices(set) };
1698    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1699}
1700
1701/// Create a new set in the configuration.
1702///
1703/// Parameter `prefs`: The "preferences" session.
1704///
1705/// Returns: A reference to the new SCNetworkSet.
1706/// You must release the returned value.
1707#[cfg(feature = "SCPreferences")]
1708#[inline]
1709pub unsafe extern "C-unwind" fn SCNetworkSetCreate(
1710    prefs: &SCPreferences,
1711) -> Option<CFRetained<SCNetworkSet>> {
1712    extern "C-unwind" {
1713        fn SCNetworkSetCreate(prefs: &SCPreferences) -> Option<NonNull<SCNetworkSet>>;
1714    }
1715    let ret = unsafe { SCNetworkSetCreate(prefs) };
1716    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1717}
1718
1719/// Returns the set with the specified identifier.
1720///
1721/// Parameter `prefs`: The "preferences" session.
1722///
1723/// Parameter `setID`: The unique identifier for the set.
1724///
1725/// Returns: A reference to the SCNetworkSet from the associated preferences;
1726/// NULL if the setID does not exist in the preferences or if an
1727/// error was encountered.
1728/// You must release the returned value.
1729#[cfg(feature = "SCPreferences")]
1730#[inline]
1731pub unsafe extern "C-unwind" fn SCNetworkSetCopy(
1732    prefs: &SCPreferences,
1733    set_id: &CFString,
1734) -> Option<CFRetained<SCNetworkSet>> {
1735    extern "C-unwind" {
1736        fn SCNetworkSetCopy(
1737            prefs: &SCPreferences,
1738            set_id: &CFString,
1739        ) -> Option<NonNull<SCNetworkSet>>;
1740    }
1741    let ret = unsafe { SCNetworkSetCopy(prefs, set_id) };
1742    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1743}
1744
1745/// Returns the [user specified] name associated with the set.
1746///
1747/// Parameter `set`: The network set.
1748///
1749/// Returns: The [user specified] name.
1750#[inline]
1751pub unsafe extern "C-unwind" fn SCNetworkSetGetName(
1752    set: &SCNetworkSet,
1753) -> Option<CFRetained<CFString>> {
1754    extern "C-unwind" {
1755        fn SCNetworkSetGetName(set: &SCNetworkSet) -> Option<NonNull<CFString>>;
1756    }
1757    let ret = unsafe { SCNetworkSetGetName(set) };
1758    ret.map(|ret| unsafe { CFRetained::retain(ret) })
1759}
1760
1761/// Returns the identifier for the set.
1762///
1763/// Parameter `set`: The network set.
1764///
1765/// Returns: The set identifier.
1766#[inline]
1767pub unsafe extern "C-unwind" fn SCNetworkSetGetSetID(
1768    set: &SCNetworkSet,
1769) -> Option<CFRetained<CFString>> {
1770    extern "C-unwind" {
1771        fn SCNetworkSetGetSetID(set: &SCNetworkSet) -> Option<NonNull<CFString>>;
1772    }
1773    let ret = unsafe { SCNetworkSetGetSetID(set) };
1774    ret.map(|ret| unsafe { CFRetained::retain(ret) })
1775}
1776
1777/// Returns the [user specified] ordering of network services
1778/// within the set.
1779///
1780/// Parameter `set`: The network set.
1781///
1782/// Returns: The ordered list of CFStringRef service identifiers associated
1783/// with the set;
1784/// NULL if no service order has been specified or if an error
1785/// was encountered.
1786#[inline]
1787pub unsafe extern "C-unwind" fn SCNetworkSetGetServiceOrder(
1788    set: &SCNetworkSet,
1789) -> Option<CFRetained<CFArray>> {
1790    extern "C-unwind" {
1791        fn SCNetworkSetGetServiceOrder(set: &SCNetworkSet) -> Option<NonNull<CFArray>>;
1792    }
1793    let ret = unsafe { SCNetworkSetGetServiceOrder(set) };
1794    ret.map(|ret| unsafe { CFRetained::retain(ret) })
1795}
1796
1797/// Removes the set from the configuration.
1798///
1799/// Parameter `set`: The network set.
1800///
1801/// Returns: TRUE if the set was removed; FALSE if an error was encountered.
1802#[inline]
1803pub unsafe extern "C-unwind" fn SCNetworkSetRemove(set: &SCNetworkSet) -> bool {
1804    extern "C-unwind" {
1805        fn SCNetworkSetRemove(set: &SCNetworkSet) -> Boolean;
1806    }
1807    let ret = unsafe { SCNetworkSetRemove(set) };
1808    ret != 0
1809}
1810
1811/// Removes the network service from the set.
1812///
1813/// Parameter `set`: The network set.
1814///
1815/// Parameter `service`: The service to be removed.
1816///
1817/// Returns: TRUE if the service was removed from the set; FALSE if the
1818/// service was not already present or an error was encountered.
1819#[inline]
1820pub unsafe extern "C-unwind" fn SCNetworkSetRemoveService(
1821    set: &SCNetworkSet,
1822    service: &SCNetworkService,
1823) -> bool {
1824    extern "C-unwind" {
1825        fn SCNetworkSetRemoveService(set: &SCNetworkSet, service: &SCNetworkService) -> Boolean;
1826    }
1827    let ret = unsafe { SCNetworkSetRemoveService(set, service) };
1828    ret != 0
1829}
1830
1831/// Specifies the set that should be the "current" set.
1832///
1833/// Parameter `set`: The network set.
1834///
1835/// Returns: TRUE if the current set was updated;
1836/// FALSE if an error was encountered.
1837#[inline]
1838pub unsafe extern "C-unwind" fn SCNetworkSetSetCurrent(set: &SCNetworkSet) -> bool {
1839    extern "C-unwind" {
1840        fn SCNetworkSetSetCurrent(set: &SCNetworkSet) -> Boolean;
1841    }
1842    let ret = unsafe { SCNetworkSetSetCurrent(set) };
1843    ret != 0
1844}
1845
1846/// Stores the [user specified] name for the set.
1847///
1848/// Parameter `set`: The network set.
1849///
1850/// Parameter `name`: The [user defined] name to associate with the set.
1851///
1852/// Returns: TRUE if the name was saved; FALSE if an error was encountered.
1853///
1854/// Note: although not technically required, the [user specified] names
1855/// for all set should be unique.  As such, an error will be returned if
1856/// you attemp to name two sets with the same string.
1857#[inline]
1858pub unsafe extern "C-unwind" fn SCNetworkSetSetName(
1859    set: &SCNetworkSet,
1860    name: Option<&CFString>,
1861) -> bool {
1862    extern "C-unwind" {
1863        fn SCNetworkSetSetName(set: &SCNetworkSet, name: Option<&CFString>) -> Boolean;
1864    }
1865    let ret = unsafe { SCNetworkSetSetName(set, name) };
1866    ret != 0
1867}
1868
1869/// Stores the [user specified] ordering of network services for the set.
1870///
1871/// Parameter `set`: The network set.
1872///
1873/// Parameter `newOrder`: The ordered list of CFStringRef service identifiers for the set.
1874///
1875/// Returns: TRUE if the new service order was saved; FALSE if an error was encountered.
1876#[inline]
1877pub unsafe extern "C-unwind" fn SCNetworkSetSetServiceOrder(
1878    set: &SCNetworkSet,
1879    new_order: &CFArray,
1880) -> bool {
1881    extern "C-unwind" {
1882        fn SCNetworkSetSetServiceOrder(set: &SCNetworkSet, new_order: &CFArray) -> Boolean;
1883    }
1884    let ret = unsafe { SCNetworkSetSetServiceOrder(set, new_order) };
1885    ret != 0
1886}