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;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9use objc2_core_foundation::*;
10
11use crate::*;
12
13/// This is the type of a reference to an object that represents
14/// a network interface.
15///
16/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scnetworkinterface?language=objc)
17#[doc(alias = "SCNetworkInterfaceRef")]
18#[repr(C)]
19pub struct SCNetworkInterface {
20    inner: [u8; 0],
21    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
22}
23
24cf_type!(
25    unsafe impl SCNetworkInterface {}
26);
27#[cfg(feature = "objc2")]
28cf_objc2_type!(
29    unsafe impl RefEncode<"__SCNetworkInterface"> for SCNetworkInterface {}
30);
31
32extern "C" {
33    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetype6to4?language=objc)
34    pub static kSCNetworkInterfaceType6to4: &'static CFString;
35}
36
37extern "C" {
38    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypebluetooth?language=objc)
39    pub static kSCNetworkInterfaceTypeBluetooth: &'static CFString;
40}
41
42extern "C" {
43    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypebond?language=objc)
44    pub static kSCNetworkInterfaceTypeBond: &'static CFString;
45}
46
47extern "C" {
48    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypeethernet?language=objc)
49    pub static kSCNetworkInterfaceTypeEthernet: &'static CFString;
50}
51
52extern "C" {
53    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypefirewire?language=objc)
54    pub static kSCNetworkInterfaceTypeFireWire: &'static CFString;
55}
56
57extern "C" {
58    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypeieee80211?language=objc)
59    pub static kSCNetworkInterfaceTypeIEEE80211: &'static CFString;
60}
61
62extern "C" {
63    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypeipsec?language=objc)
64    pub static kSCNetworkInterfaceTypeIPSec: &'static CFString;
65}
66
67extern "C" {
68    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypeirda?language=objc)
69    #[deprecated = "No longer supported"]
70    pub static kSCNetworkInterfaceTypeIrDA: &'static CFString;
71}
72
73extern "C" {
74    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypel2tp?language=objc)
75    pub static kSCNetworkInterfaceTypeL2TP: &'static CFString;
76}
77
78extern "C" {
79    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypemodem?language=objc)
80    pub static kSCNetworkInterfaceTypeModem: &'static CFString;
81}
82
83extern "C" {
84    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypeppp?language=objc)
85    pub static kSCNetworkInterfaceTypePPP: &'static CFString;
86}
87
88extern "C" {
89    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypepptp?language=objc)
90    #[deprecated = "No longer supported"]
91    pub static kSCNetworkInterfaceTypePPTP: &'static CFString;
92}
93
94extern "C" {
95    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypeserial?language=objc)
96    pub static kSCNetworkInterfaceTypeSerial: &'static CFString;
97}
98
99extern "C" {
100    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypevlan?language=objc)
101    pub static kSCNetworkInterfaceTypeVLAN: &'static CFString;
102}
103
104extern "C" {
105    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypewwan?language=objc)
106    pub static kSCNetworkInterfaceTypeWWAN: &'static CFString;
107}
108
109extern "C" {
110    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfacetypeipv4?language=objc)
111    pub static kSCNetworkInterfaceTypeIPv4: &'static CFString;
112}
113
114extern "C" {
115    /// A network interface that can used for layering other
116    /// interfaces (e.g. 6to4, IPSec, PPTP, L2TP) over an existing
117    /// IPv4 network.
118    ///
119    /// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkinterfaceipv4?language=objc)
120    pub static kSCNetworkInterfaceIPv4: &'static SCNetworkInterface;
121}
122
123/// This is the type of a reference to an object that represents
124/// an Ethernet Bond interface.
125///
126/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scbondinterface?language=objc)
127#[doc(alias = "SCBondInterfaceRef")]
128pub type SCBondInterface = SCNetworkInterface;
129
130/// This is the type of a reference to an object that represents
131/// the status of an Ethernet Bond interface.
132///
133/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scbondstatus?language=objc)
134#[doc(alias = "SCBondStatusRef")]
135#[repr(C)]
136pub struct SCBondStatus {
137    inner: [u8; 0],
138    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
139}
140
141cf_type!(
142    unsafe impl SCBondStatus {}
143);
144#[cfg(feature = "objc2")]
145cf_objc2_type!(
146    unsafe impl RefEncode<"__SCBondStatus"> for SCBondStatus {}
147);
148
149/// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscbondstatusok?language=objc)
150pub const kSCBondStatusOK: c_uint = 0;
151/// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscbondstatuslinkinvalid?language=objc)
152pub const kSCBondStatusLinkInvalid: c_uint = 1;
153/// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscbondstatusnopartner?language=objc)
154pub const kSCBondStatusNoPartner: c_uint = 2;
155/// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscbondstatusnotinactivegroup?language=objc)
156pub const kSCBondStatusNotInActiveGroup: c_uint = 3;
157/// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscbondstatusunknown?language=objc)
158pub const kSCBondStatusUnknown: c_uint = 999;
159
160extern "C" {
161    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscbondstatusdeviceaggregationstatus?language=objc)
162    pub static kSCBondStatusDeviceAggregationStatus: &'static CFString;
163}
164
165extern "C" {
166    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscbondstatusdevicecollecting?language=objc)
167    pub static kSCBondStatusDeviceCollecting: &'static CFString;
168}
169
170extern "C" {
171    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscbondstatusdevicedistributing?language=objc)
172    pub static kSCBondStatusDeviceDistributing: &'static CFString;
173}
174
175/// This is the type of a reference to an object that represents
176/// a Virtual LAN (VLAN) interface.
177///
178/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scvlaninterface?language=objc)
179#[doc(alias = "SCVLANInterfaceRef")]
180pub type SCVLANInterface = SCNetworkInterface;
181
182/// This is the type of a reference to an object that represents
183/// a network protocol.
184///
185/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scnetworkprotocol?language=objc)
186#[doc(alias = "SCNetworkProtocolRef")]
187#[repr(C)]
188pub struct SCNetworkProtocol {
189    inner: [u8; 0],
190    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
191}
192
193cf_type!(
194    unsafe impl SCNetworkProtocol {}
195);
196#[cfg(feature = "objc2")]
197cf_objc2_type!(
198    unsafe impl RefEncode<"__SCNetworkProtocol"> for SCNetworkProtocol {}
199);
200
201extern "C" {
202    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkprotocoltypedns?language=objc)
203    pub static kSCNetworkProtocolTypeDNS: &'static CFString;
204}
205
206extern "C" {
207    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkprotocoltypeipv4?language=objc)
208    pub static kSCNetworkProtocolTypeIPv4: &'static CFString;
209}
210
211extern "C" {
212    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkprotocoltypeipv6?language=objc)
213    pub static kSCNetworkProtocolTypeIPv6: &'static CFString;
214}
215
216extern "C" {
217    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkprotocoltypeproxies?language=objc)
218    pub static kSCNetworkProtocolTypeProxies: &'static CFString;
219}
220
221extern "C" {
222    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscnetworkprotocoltypesmb?language=objc)
223    pub static kSCNetworkProtocolTypeSMB: &'static CFString;
224}
225
226/// This is the type of a reference to an object that represents
227/// a network service.
228///
229/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scnetworkservice?language=objc)
230#[doc(alias = "SCNetworkServiceRef")]
231#[repr(C)]
232pub struct SCNetworkService {
233    inner: [u8; 0],
234    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
235}
236
237cf_type!(
238    unsafe impl SCNetworkService {}
239);
240#[cfg(feature = "objc2")]
241cf_objc2_type!(
242    unsafe impl RefEncode<"__SCNetworkService"> for SCNetworkService {}
243);
244
245/// This is the type of a reference to an object that represents
246/// a network set.
247///
248/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scnetworkset?language=objc)
249#[doc(alias = "SCNetworkSetRef")]
250#[repr(C)]
251pub struct SCNetworkSet {
252    inner: [u8; 0],
253    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
254}
255
256cf_type!(
257    unsafe impl SCNetworkSet {}
258);
259#[cfg(feature = "objc2")]
260cf_objc2_type!(
261    unsafe impl RefEncode<"__SCNetworkSet"> for SCNetworkSet {}
262);
263
264unsafe impl ConcreteType for SCNetworkInterface {
265    /// Returns the type identifier of all SCNetworkInterface instances.
266    #[doc(alias = "SCNetworkInterfaceGetTypeID")]
267    #[inline]
268    fn type_id() -> CFTypeID {
269        extern "C-unwind" {
270            fn SCNetworkInterfaceGetTypeID() -> CFTypeID;
271        }
272        unsafe { SCNetworkInterfaceGetTypeID() }
273    }
274}
275
276impl SCNetworkInterface {
277    /// Returns all network capable interfaces on the system.
278    ///
279    /// Returns: The list of interfaces on the system.
280    /// You must release the returned value.
281    #[doc(alias = "SCNetworkInterfaceCopyAll")]
282    #[inline]
283    pub fn all() -> CFRetained<CFArray> {
284        extern "C-unwind" {
285            fn SCNetworkInterfaceCopyAll() -> Option<NonNull<CFArray>>;
286        }
287        let ret = unsafe { SCNetworkInterfaceCopyAll() };
288        let ret =
289            ret.expect("function was marked as returning non-null, but actually returned NULL");
290        unsafe { CFRetained::from_raw(ret) }
291    }
292
293    /// Identify all of the network interface types (e.g. PPP) that
294    /// can be layered on top of this interface.
295    ///
296    /// Parameter `interface`: The network interface.
297    ///
298    /// Returns: The list of SCNetworkInterface types supported by the interface;
299    /// NULL if no interface types are supported.
300    #[doc(alias = "SCNetworkInterfaceGetSupportedInterfaceTypes")]
301    #[inline]
302    pub fn supported_interface_types(&self) -> Option<CFRetained<CFArray>> {
303        extern "C-unwind" {
304            fn SCNetworkInterfaceGetSupportedInterfaceTypes(
305                interface: &SCNetworkInterface,
306            ) -> Option<NonNull<CFArray>>;
307        }
308        let ret = unsafe { SCNetworkInterfaceGetSupportedInterfaceTypes(self) };
309        ret.map(|ret| unsafe { CFRetained::retain(ret) })
310    }
311
312    /// Identify all of the network protocol types (e.g. IPv4, IPv6) that
313    /// can be layered on top of this interface.
314    ///
315    /// Parameter `interface`: The network interface.
316    ///
317    /// Returns: The list of SCNetworkProtocol types supported by the interface;
318    /// NULL if no protocol types are supported.
319    #[doc(alias = "SCNetworkInterfaceGetSupportedProtocolTypes")]
320    #[inline]
321    pub fn supported_protocol_types(&self) -> Option<CFRetained<CFArray>> {
322        extern "C-unwind" {
323            fn SCNetworkInterfaceGetSupportedProtocolTypes(
324                interface: &SCNetworkInterface,
325            ) -> Option<NonNull<CFArray>>;
326        }
327        let ret = unsafe { SCNetworkInterfaceGetSupportedProtocolTypes(self) };
328        ret.map(|ret| unsafe { CFRetained::retain(ret) })
329    }
330
331    /// Create a new network interface layered on top of another.  For
332    /// example, this function would be used to create a "PPP" interface
333    /// on top of a "modem".
334    ///
335    /// Parameter `interface`: The network interface.
336    ///
337    /// Parameter `interfaceType`: The type of SCNetworkInterface to be layered on
338    /// top of the provided interface.
339    ///
340    /// Returns: A reference to the new SCNetworkInterface.
341    /// You must release the returned value.
342    #[doc(alias = "SCNetworkInterfaceCreateWithInterface")]
343    #[inline]
344    pub fn with_interface(
345        &self,
346        interface_type: &CFString,
347    ) -> Option<CFRetained<SCNetworkInterface>> {
348        extern "C-unwind" {
349            fn SCNetworkInterfaceCreateWithInterface(
350                interface: &SCNetworkInterface,
351                interface_type: &CFString,
352            ) -> Option<NonNull<SCNetworkInterface>>;
353        }
354        let ret = unsafe { SCNetworkInterfaceCreateWithInterface(self, interface_type) };
355        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
356    }
357
358    /// Returns the BSD interface (en0) or device name (modem)
359    /// for the interface.
360    ///
361    /// Parameter `interface`: The network interface.
362    ///
363    /// Returns: The BSD name associated with the interface (e.g. "en0");
364    /// NULL if no BSD name is available.
365    #[doc(alias = "SCNetworkInterfaceGetBSDName")]
366    #[inline]
367    pub fn bsd_name(&self) -> Option<CFRetained<CFString>> {
368        extern "C-unwind" {
369            fn SCNetworkInterfaceGetBSDName(
370                interface: &SCNetworkInterface,
371            ) -> Option<NonNull<CFString>>;
372        }
373        let ret = unsafe { SCNetworkInterfaceGetBSDName(self) };
374        ret.map(|ret| unsafe { CFRetained::retain(ret) })
375    }
376
377    /// Returns the configuration settings associated with a interface.
378    ///
379    /// Parameter `interface`: The network interface.
380    ///
381    /// Returns: The configuration settings associated with the interface;
382    /// NULL if no configuration settings are associated with the interface
383    /// or an error was encountered.
384    #[doc(alias = "SCNetworkInterfaceGetConfiguration")]
385    #[inline]
386    pub fn configuration(&self) -> Option<CFRetained<CFDictionary>> {
387        extern "C-unwind" {
388            fn SCNetworkInterfaceGetConfiguration(
389                interface: &SCNetworkInterface,
390            ) -> Option<NonNull<CFDictionary>>;
391        }
392        let ret = unsafe { SCNetworkInterfaceGetConfiguration(self) };
393        ret.map(|ret| unsafe { CFRetained::retain(ret) })
394    }
395
396    /// Returns the configuration settings associated with a interface.
397    ///
398    /// Parameter `interface`: The network interface.
399    ///
400    /// Parameter `extendedType`: A string representing the type of extended information (e.g. EAPOL).
401    ///
402    /// Returns: The configuration settings associated with the interface;
403    /// NULL if no configuration settings are associated with the interface
404    /// or an error was encountered.
405    #[doc(alias = "SCNetworkInterfaceGetExtendedConfiguration")]
406    #[inline]
407    pub fn extended_configuration(
408        &self,
409        extended_type: &CFString,
410    ) -> Option<CFRetained<CFDictionary>> {
411        extern "C-unwind" {
412            fn SCNetworkInterfaceGetExtendedConfiguration(
413                interface: &SCNetworkInterface,
414                extended_type: &CFString,
415            ) -> Option<NonNull<CFDictionary>>;
416        }
417        let ret = unsafe { SCNetworkInterfaceGetExtendedConfiguration(self, extended_type) };
418        ret.map(|ret| unsafe { CFRetained::retain(ret) })
419    }
420
421    /// Returns a displayable link layer address for the interface.
422    ///
423    /// Parameter `interface`: The network interface.
424    ///
425    /// Returns: A string representing the hardware (MAC) address for the interface.
426    #[doc(alias = "SCNetworkInterfaceGetHardwareAddressString")]
427    #[inline]
428    pub fn hardware_address_string(&self) -> Option<CFRetained<CFString>> {
429        extern "C-unwind" {
430            fn SCNetworkInterfaceGetHardwareAddressString(
431                interface: &SCNetworkInterface,
432            ) -> Option<NonNull<CFString>>;
433        }
434        let ret = unsafe { SCNetworkInterfaceGetHardwareAddressString(self) };
435        ret.map(|ret| unsafe { CFRetained::retain(ret) })
436    }
437
438    /// For layered network interfaces, return the underlying interface.
439    ///
440    /// Parameter `interface`: The network interface.
441    ///
442    /// Returns: The underlying network interface;
443    /// NULL if this is a leaf interface.
444    #[doc(alias = "SCNetworkInterfaceGetInterface")]
445    #[inline]
446    pub fn interface(&self) -> Option<CFRetained<SCNetworkInterface>> {
447        extern "C-unwind" {
448            fn SCNetworkInterfaceGetInterface(
449                interface: &SCNetworkInterface,
450            ) -> Option<NonNull<SCNetworkInterface>>;
451        }
452        let ret = unsafe { SCNetworkInterfaceGetInterface(self) };
453        ret.map(|ret| unsafe { CFRetained::retain(ret) })
454    }
455
456    /// Returns the associated network interface type.
457    ///
458    /// Parameter `interface`: The network interface.
459    ///
460    /// Returns: The interface type.
461    #[doc(alias = "SCNetworkInterfaceGetInterfaceType")]
462    #[inline]
463    pub fn interface_type(&self) -> Option<CFRetained<CFString>> {
464        extern "C-unwind" {
465            fn SCNetworkInterfaceGetInterfaceType(
466                interface: &SCNetworkInterface,
467            ) -> Option<NonNull<CFString>>;
468        }
469        let ret = unsafe { SCNetworkInterfaceGetInterfaceType(self) };
470        ret.map(|ret| unsafe { CFRetained::retain(ret) })
471    }
472
473    /// Returns the localized name (e.g. "Ethernet", "FireWire") for
474    /// the interface.
475    ///
476    /// Parameter `interface`: The network interface.
477    ///
478    /// Returns: A localized, display name for the interface;
479    /// NULL if no name is available.
480    #[doc(alias = "SCNetworkInterfaceGetLocalizedDisplayName")]
481    #[inline]
482    pub fn localized_display_name(&self) -> Option<CFRetained<CFString>> {
483        extern "C-unwind" {
484            fn SCNetworkInterfaceGetLocalizedDisplayName(
485                interface: &SCNetworkInterface,
486            ) -> Option<NonNull<CFString>>;
487        }
488        let ret = unsafe { SCNetworkInterfaceGetLocalizedDisplayName(self) };
489        ret.map(|ret| unsafe { CFRetained::retain(ret) })
490    }
491
492    /// Stores the configuration settings for the interface.
493    ///
494    /// Parameter `interface`: The network interface.
495    ///
496    /// Parameter `config`: The configuration settings to associate with this interface.
497    ///
498    /// Returns: TRUE if the configuration was stored; FALSE if an error was encountered.
499    ///
500    /// # Safety
501    ///
502    /// `config` generics must be of the correct type.
503    #[doc(alias = "SCNetworkInterfaceSetConfiguration")]
504    #[inline]
505    pub unsafe fn set_configuration(&self, config: Option<&CFDictionary>) -> bool {
506        extern "C-unwind" {
507            fn SCNetworkInterfaceSetConfiguration(
508                interface: &SCNetworkInterface,
509                config: Option<&CFDictionary>,
510            ) -> Boolean;
511        }
512        let ret = unsafe { SCNetworkInterfaceSetConfiguration(self, config) };
513        ret != 0
514    }
515
516    /// Stores the configuration settings for the interface.
517    ///
518    /// Parameter `interface`: The network interface.
519    ///
520    /// Parameter `config`: The configuration settings to associate with this interface.
521    ///
522    /// Returns: TRUE if the configuration was stored; FALSE if an error was encountered.
523    ///
524    /// # Safety
525    ///
526    /// `config` generics must be of the correct type.
527    #[doc(alias = "SCNetworkInterfaceSetExtendedConfiguration")]
528    #[inline]
529    pub unsafe fn set_extended_configuration(
530        &self,
531        extended_type: &CFString,
532        config: Option<&CFDictionary>,
533    ) -> bool {
534        extern "C-unwind" {
535            fn SCNetworkInterfaceSetExtendedConfiguration(
536                interface: &SCNetworkInterface,
537                extended_type: &CFString,
538                config: Option<&CFDictionary>,
539            ) -> Boolean;
540        }
541        let ret =
542            unsafe { SCNetworkInterfaceSetExtendedConfiguration(self, extended_type, config) };
543        ret != 0
544    }
545
546    /// For the specified network interface, returns information
547    /// about the currently requested media options, the active media
548    /// options, and the media options which are available.
549    ///
550    /// Parameter `interface`: The desired network interface.
551    ///
552    /// Parameter `current`: A pointer to memory that will be filled with a CFDictionaryRef
553    /// representing the currently requested media options (subtype, options).
554    /// If NULL, the current options will not be returned.
555    ///
556    /// Parameter `active`: A pointer to memory that will be filled with a CFDictionaryRef
557    /// representing the active media options (subtype, options).
558    /// If NULL, the active options will not be returned.
559    ///
560    /// Parameter `available`: A pointer to memory that will be filled with a CFArrayRef
561    /// representing the possible media options (subtype, options).
562    /// If NULL, the available options will not be returned.
563    ///
564    /// Parameter `filter`: A boolean indicating whether the available options should be
565    /// filtered to exclude those options which would not normally be
566    /// requested by a user/admin (e.g. hw-loopback).
567    ///
568    /// Returns: TRUE if requested information has been returned.
569    ///
570    /// # Safety
571    ///
572    /// - `current` must be a valid pointer or null.
573    /// - `active` must be a valid pointer or null.
574    /// - `available` must be a valid pointer or null.
575    #[doc(alias = "SCNetworkInterfaceCopyMediaOptions")]
576    #[inline]
577    pub unsafe fn media_options(
578        &self,
579        current: *mut *const CFDictionary,
580        active: *mut *const CFDictionary,
581        available: *mut *const CFArray,
582        filter: bool,
583    ) -> bool {
584        extern "C-unwind" {
585            fn SCNetworkInterfaceCopyMediaOptions(
586                interface: &SCNetworkInterface,
587                current: *mut *const CFDictionary,
588                active: *mut *const CFDictionary,
589                available: *mut *const CFArray,
590                filter: Boolean,
591            ) -> Boolean;
592        }
593        let ret = unsafe {
594            SCNetworkInterfaceCopyMediaOptions(self, current, active, available, filter as _)
595        };
596        ret != 0
597    }
598
599    /// For the provided interface configuration options, return a list
600    /// of available media subtypes.
601    ///
602    /// Parameter `available`: The available options as returned by the
603    /// SCNetworkInterfaceCopyMediaOptions function.
604    ///
605    /// Returns: An array of available media subtypes CFString's (e.g. 10BaseT/UTP,
606    /// 100baseTX, etc).  NULL if no subtypes are available.
607    #[doc(alias = "SCNetworkInterfaceCopyMediaSubTypes")]
608    #[inline]
609    pub fn media_sub_types(available: &CFArray) -> Option<CFRetained<CFArray>> {
610        extern "C-unwind" {
611            fn SCNetworkInterfaceCopyMediaSubTypes(available: &CFArray)
612                -> Option<NonNull<CFArray>>;
613        }
614        let ret = unsafe { SCNetworkInterfaceCopyMediaSubTypes(available) };
615        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
616    }
617
618    /// For the provided interface configuration options and specific
619    /// subtype, return a list of available media options.
620    ///
621    /// Parameter `available`: The available options as returned by the
622    /// SCNetworkInterfaceCopyMediaOptions function.
623    ///
624    /// Parameter `subType`: The subtype
625    ///
626    /// Returns: An array of available media options.  Each of the available options
627    /// is returned as an array of CFString's (e.g.
628    /// <half
629    /// -duplex>,
630    /// <full
631    /// -duplex,flow-control>).  NULL if no options are available.
632    #[doc(alias = "SCNetworkInterfaceCopyMediaSubTypeOptions")]
633    #[inline]
634    pub fn media_sub_type_options(
635        available: &CFArray,
636        sub_type: &CFString,
637    ) -> Option<CFRetained<CFArray>> {
638        extern "C-unwind" {
639            fn SCNetworkInterfaceCopyMediaSubTypeOptions(
640                available: &CFArray,
641                sub_type: &CFString,
642            ) -> Option<NonNull<CFArray>>;
643        }
644        let ret = unsafe { SCNetworkInterfaceCopyMediaSubTypeOptions(available, sub_type) };
645        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
646    }
647
648    /// For the specified network interface, returns information
649    /// about the currently MTU setting and the range of allowable
650    /// values.
651    ///
652    /// Parameter `interface`: The desired network interface.
653    ///
654    /// Parameter `mtu_cur`: A pointer to memory that will be filled with the current
655    /// MTU setting for the interface.
656    ///
657    /// Parameter `mtu_min`: A pointer to memory that will be filled with the minimum
658    /// MTU setting for the interface.  If negative, the minimum setting
659    /// could not be determined.
660    ///
661    /// Parameter `mtu_max`: A pointer to memory that will be filled with the maximum
662    /// MTU setting for the interface.  If negative, the maximum setting
663    /// could not be determined.
664    ///
665    /// Returns: TRUE if requested information has been returned.
666    ///
667    /// # Safety
668    ///
669    /// - `mtu_cur` must be a valid pointer or null.
670    /// - `mtu_min` must be a valid pointer or null.
671    /// - `mtu_max` must be a valid pointer or null.
672    #[doc(alias = "SCNetworkInterfaceCopyMTU")]
673    #[inline]
674    pub unsafe fn mtu(
675        &self,
676        mtu_cur: *mut c_int,
677        mtu_min: *mut c_int,
678        mtu_max: *mut c_int,
679    ) -> bool {
680        extern "C-unwind" {
681            fn SCNetworkInterfaceCopyMTU(
682                interface: &SCNetworkInterface,
683                mtu_cur: *mut c_int,
684                mtu_min: *mut c_int,
685                mtu_max: *mut c_int,
686            ) -> Boolean;
687        }
688        let ret = unsafe { SCNetworkInterfaceCopyMTU(self, mtu_cur, mtu_min, mtu_max) };
689        ret != 0
690    }
691
692    /// For the specified network interface, sets the requested
693    /// media subtype and options.
694    ///
695    /// Parameter `interface`: The desired network interface.
696    ///
697    /// Parameter `subtype`: The desired media subtype (e.g. "autoselect", "100baseTX", ...).
698    /// If NULL, no specific media subtype will be requested.
699    ///
700    /// Parameter `options`: The desired media options (e.g. "half-duplex", "full-duplex", ...).
701    /// If NULL, no specific media options will be requested.
702    ///
703    /// Returns: TRUE if the configuration was updated; FALSE if an error was encountered.
704    #[doc(alias = "SCNetworkInterfaceSetMediaOptions")]
705    #[inline]
706    pub fn set_media_options(&self, subtype: Option<&CFString>, options: Option<&CFArray>) -> bool {
707        extern "C-unwind" {
708            fn SCNetworkInterfaceSetMediaOptions(
709                interface: &SCNetworkInterface,
710                subtype: Option<&CFString>,
711                options: Option<&CFArray>,
712            ) -> Boolean;
713        }
714        let ret = unsafe { SCNetworkInterfaceSetMediaOptions(self, subtype, options) };
715        ret != 0
716    }
717
718    /// For the specified network interface, sets the
719    /// requested MTU setting.
720    ///
721    /// Parameter `interface`: The desired network interface.
722    ///
723    /// Parameter `mtu`: The desired MTU setting for the interface.
724    /// If zero, the interface will use the default MTU setting.
725    ///
726    /// Returns: TRUE if the configuration was updated; FALSE if an error was encountered.
727    #[doc(alias = "SCNetworkInterfaceSetMTU")]
728    #[inline]
729    pub fn set_mtu(&self, mtu: c_int) -> bool {
730        extern "C-unwind" {
731            fn SCNetworkInterfaceSetMTU(interface: &SCNetworkInterface, mtu: c_int) -> Boolean;
732        }
733        let ret = unsafe { SCNetworkInterfaceSetMTU(self, mtu) };
734        ret != 0
735    }
736
737    /// Sends a notification to interested network configuration
738    /// agents to immediately retry their configuration. For example,
739    /// calling this function will cause the DHCP client to contact
740    /// the DHCP server immediately rather than waiting until its
741    /// timeout has expired.  The utility of this function is to
742    /// allow the caller to give a hint to the system that the
743    /// network infrastructure or configuration has changed.
744    ///
745    /// Note: This function requires root (euid==0) privilege or,
746    /// alternatively, you may pass an SCNetworkInterface which
747    /// is derived from a sequence of calls to :
748    ///
749    /// SCPreferencesCreateWithAuthorization
750    /// SCNetworkSetCopy...
751    /// SCNetworkServiceGetInterface
752    ///
753    /// Parameter `interface`: The desired network interface.
754    ///
755    /// Returns: Returns TRUE if the notification was sent; FALSE otherwise.
756    #[doc(alias = "SCNetworkInterfaceForceConfigurationRefresh")]
757    #[inline]
758    pub fn force_configuration_refresh(&self) -> bool {
759        extern "C-unwind" {
760            fn SCNetworkInterfaceForceConfigurationRefresh(
761                interface: &SCNetworkInterface,
762            ) -> Boolean;
763        }
764        let ret = unsafe { SCNetworkInterfaceForceConfigurationRefresh(self) };
765        ret != 0
766    }
767}
768
769/// Returns all Ethernet Bond interfaces on the system.
770///
771/// Parameter `prefs`: The "preferences" session.
772///
773/// Returns: The list of Ethernet Bond interfaces on the system.
774/// You must release the returned value.
775#[cfg(feature = "SCPreferences")]
776#[inline]
777pub extern "C-unwind" fn SCBondInterfaceCopyAll(prefs: &SCPreferences) -> CFRetained<CFArray> {
778    extern "C-unwind" {
779        fn SCBondInterfaceCopyAll(prefs: &SCPreferences) -> Option<NonNull<CFArray>>;
780    }
781    let ret = unsafe { SCBondInterfaceCopyAll(prefs) };
782    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
783    unsafe { CFRetained::from_raw(ret) }
784}
785
786/// Returns all network capable devices on the system
787/// that can be added to an Ethernet Bond interface.
788///
789/// Parameter `prefs`: The "preferences" session.
790///
791/// Returns: The list of interfaces.
792/// You must release the returned value.
793#[cfg(feature = "SCPreferences")]
794#[inline]
795pub extern "C-unwind" fn SCBondInterfaceCopyAvailableMemberInterfaces(
796    prefs: &SCPreferences,
797) -> CFRetained<CFArray> {
798    extern "C-unwind" {
799        fn SCBondInterfaceCopyAvailableMemberInterfaces(
800            prefs: &SCPreferences,
801        ) -> Option<NonNull<CFArray>>;
802    }
803    let ret = unsafe { SCBondInterfaceCopyAvailableMemberInterfaces(prefs) };
804    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
805    unsafe { CFRetained::from_raw(ret) }
806}
807
808/// Create a new SCBondInterface interface.
809///
810/// Parameter `prefs`: The "preferences" session.
811///
812/// Returns: A reference to the new SCBondInterface.
813/// You must release the returned value.
814#[cfg(feature = "SCPreferences")]
815#[inline]
816pub extern "C-unwind" fn SCBondInterfaceCreate(
817    prefs: &SCPreferences,
818) -> Option<CFRetained<SCBondInterface>> {
819    extern "C-unwind" {
820        fn SCBondInterfaceCreate(prefs: &SCPreferences) -> Option<NonNull<SCBondInterface>>;
821    }
822    let ret = unsafe { SCBondInterfaceCreate(prefs) };
823    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
824}
825
826/// Removes the SCBondInterface from the configuration.
827///
828/// Parameter `bond`: The SCBondInterface interface.
829///
830/// Returns: TRUE if the interface was removed; FALSE if an error was encountered.
831#[inline]
832pub extern "C-unwind" fn SCBondInterfaceRemove(bond: &SCBondInterface) -> bool {
833    extern "C-unwind" {
834        fn SCBondInterfaceRemove(bond: &SCBondInterface) -> Boolean;
835    }
836    let ret = unsafe { SCBondInterfaceRemove(bond) };
837    ret != 0
838}
839
840/// Returns the member interfaces for the specified Ethernet Bond interface.
841///
842/// Parameter `bond`: The SCBondInterface interface.
843///
844/// Returns: The list of interfaces.
845#[inline]
846pub extern "C-unwind" fn SCBondInterfaceGetMemberInterfaces(
847    bond: &SCBondInterface,
848) -> Option<CFRetained<CFArray>> {
849    extern "C-unwind" {
850        fn SCBondInterfaceGetMemberInterfaces(bond: &SCBondInterface) -> Option<NonNull<CFArray>>;
851    }
852    let ret = unsafe { SCBondInterfaceGetMemberInterfaces(bond) };
853    ret.map(|ret| unsafe { CFRetained::retain(ret) })
854}
855
856/// Returns the configuration settings associated with a Ethernet Bond interface.
857///
858/// Parameter `bond`: The SCBondInterface interface.
859///
860/// Returns: The configuration settings associated with the Ethernet Bond interface;
861/// NULL if no changes to the default configuration have been saved.
862#[inline]
863pub extern "C-unwind" fn SCBondInterfaceGetOptions(
864    bond: &SCBondInterface,
865) -> Option<CFRetained<CFDictionary>> {
866    extern "C-unwind" {
867        fn SCBondInterfaceGetOptions(bond: &SCBondInterface) -> Option<NonNull<CFDictionary>>;
868    }
869    let ret = unsafe { SCBondInterfaceGetOptions(bond) };
870    ret.map(|ret| unsafe { CFRetained::retain(ret) })
871}
872
873/// Sets the member interfaces for the specified Ethernet Bond interface.
874///
875/// Parameter `bond`: The SCBondInterface interface.
876///
877/// Parameter `members`: The desired member interfaces.
878///
879/// Returns: TRUE if the configuration was stored; FALSE if an error was encountered.
880///
881/// # Safety
882///
883/// `members` generic must be of the correct type.
884#[inline]
885pub unsafe extern "C-unwind" fn SCBondInterfaceSetMemberInterfaces(
886    bond: &SCBondInterface,
887    members: &CFArray,
888) -> bool {
889    extern "C-unwind" {
890        fn SCBondInterfaceSetMemberInterfaces(bond: &SCBondInterface, members: &CFArray)
891            -> Boolean;
892    }
893    let ret = unsafe { SCBondInterfaceSetMemberInterfaces(bond, members) };
894    ret != 0
895}
896
897/// Sets the localized display name for the specified Ethernet Bond interface.
898///
899/// Parameter `bond`: The SCBondInterface interface.
900///
901/// Parameter `newName`: The new display name.
902///
903/// Returns: TRUE if the configuration was stored; FALSE if an error was encountered.
904#[inline]
905pub extern "C-unwind" fn SCBondInterfaceSetLocalizedDisplayName(
906    bond: &SCBondInterface,
907    new_name: &CFString,
908) -> bool {
909    extern "C-unwind" {
910        fn SCBondInterfaceSetLocalizedDisplayName(
911            bond: &SCBondInterface,
912            new_name: &CFString,
913        ) -> Boolean;
914    }
915    let ret = unsafe { SCBondInterfaceSetLocalizedDisplayName(bond, new_name) };
916    ret != 0
917}
918
919/// Sets the configuration settings for the specified Ethernet Bond interface.
920///
921/// Parameter `bond`: The SCBondInterface interface.
922///
923/// Parameter `newOptions`: The new configuration settings.
924///
925/// Returns: TRUE if the configuration was stored; FALSE if an error was encountered.
926///
927/// # Safety
928///
929/// `new_options` generics must be of the correct type.
930#[inline]
931pub unsafe extern "C-unwind" fn SCBondInterfaceSetOptions(
932    bond: &SCBondInterface,
933    new_options: &CFDictionary,
934) -> bool {
935    extern "C-unwind" {
936        fn SCBondInterfaceSetOptions(bond: &SCBondInterface, new_options: &CFDictionary)
937            -> Boolean;
938    }
939    let ret = unsafe { SCBondInterfaceSetOptions(bond, new_options) };
940    ret != 0
941}
942
943/// Returns the status of the specified Ethernet Bond interface.
944///
945/// Parameter `bond`: The SCBondInterface interface.
946///
947/// Returns: The status associated with the interface.
948/// You must release the returned value.
949#[inline]
950pub extern "C-unwind" fn SCBondInterfaceCopyStatus(
951    bond: &SCBondInterface,
952) -> Option<CFRetained<SCBondStatus>> {
953    extern "C-unwind" {
954        fn SCBondInterfaceCopyStatus(bond: &SCBondInterface) -> Option<NonNull<SCBondStatus>>;
955    }
956    let ret = unsafe { SCBondInterfaceCopyStatus(bond) };
957    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
958}
959
960unsafe impl ConcreteType for SCBondStatus {
961    /// Returns the type identifier of all SCBondStatus instances.
962    #[doc(alias = "SCBondStatusGetTypeID")]
963    #[inline]
964    fn type_id() -> CFTypeID {
965        extern "C-unwind" {
966            fn SCBondStatusGetTypeID() -> CFTypeID;
967        }
968        unsafe { SCBondStatusGetTypeID() }
969    }
970}
971
972impl SCBondStatus {
973    /// Returns the member interfaces that are represented with the
974    /// Ethernet Bond interface.
975    ///
976    /// Parameter `bondStatus`: The Ethernet Bond status.
977    ///
978    /// Returns: The list of interfaces.
979    #[doc(alias = "SCBondStatusGetMemberInterfaces")]
980    #[inline]
981    pub fn member_interfaces(&self) -> Option<CFRetained<CFArray>> {
982        extern "C-unwind" {
983            fn SCBondStatusGetMemberInterfaces(
984                bond_status: &SCBondStatus,
985            ) -> Option<NonNull<CFArray>>;
986        }
987        let ret = unsafe { SCBondStatusGetMemberInterfaces(self) };
988        ret.map(|ret| unsafe { CFRetained::retain(ret) })
989    }
990
991    /// Returns the status of a specific member interface of an
992    /// Ethernet Bond or the status of the bond as a whole.
993    ///
994    /// Parameter `bondStatus`: The Ethernet Bond status.
995    ///
996    /// Parameter `interface`: The specific member interface; NULL if you want the
997    /// status of the Ethernet Bond.
998    ///
999    /// Returns: The interface status.
1000    ///
1001    /// Note: at present, no information about the status of the Ethernet
1002    /// Bond is returned.  As long as one member interface is active
1003    /// then the bond should be operational.
1004    #[doc(alias = "SCBondStatusGetInterfaceStatus")]
1005    #[inline]
1006    pub fn interface_status(
1007        &self,
1008        interface: Option<&SCNetworkInterface>,
1009    ) -> Option<CFRetained<CFDictionary>> {
1010        extern "C-unwind" {
1011            fn SCBondStatusGetInterfaceStatus(
1012                bond_status: &SCBondStatus,
1013                interface: Option<&SCNetworkInterface>,
1014            ) -> Option<NonNull<CFDictionary>>;
1015        }
1016        let ret = unsafe { SCBondStatusGetInterfaceStatus(self, interface) };
1017        ret.map(|ret| unsafe { CFRetained::retain(ret) })
1018    }
1019}
1020
1021/// Returns all VLAN interfaces on the system.
1022///
1023/// Returns: The list of VLAN interfaces on the system.
1024/// You must release the returned value.
1025#[cfg(feature = "SCPreferences")]
1026#[inline]
1027pub extern "C-unwind" fn SCVLANInterfaceCopyAll(prefs: &SCPreferences) -> CFRetained<CFArray> {
1028    extern "C-unwind" {
1029        fn SCVLANInterfaceCopyAll(prefs: &SCPreferences) -> Option<NonNull<CFArray>>;
1030    }
1031    let ret = unsafe { SCVLANInterfaceCopyAll(prefs) };
1032    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
1033    unsafe { CFRetained::from_raw(ret) }
1034}
1035
1036/// Returns the network capable devices on the system
1037/// that can be associated with a VLAN interface.
1038///
1039/// Returns: The list of interfaces.
1040/// You must release the returned value.
1041#[inline]
1042pub extern "C-unwind" fn SCVLANInterfaceCopyAvailablePhysicalInterfaces() -> CFRetained<CFArray> {
1043    extern "C-unwind" {
1044        fn SCVLANInterfaceCopyAvailablePhysicalInterfaces() -> Option<NonNull<CFArray>>;
1045    }
1046    let ret = unsafe { SCVLANInterfaceCopyAvailablePhysicalInterfaces() };
1047    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
1048    unsafe { CFRetained::from_raw(ret) }
1049}
1050
1051/// Create a new SCVLANInterface interface.
1052///
1053/// Parameter `prefs`: The "preferences" session.
1054///
1055/// Parameter `physical`: The physical interface to associate with the VLAN.
1056///
1057/// Parameter `tag`: The tag to associate with the VLAN.
1058///
1059/// Returns: A reference to the new SCVLANInterface.
1060/// You must release the returned value.
1061///
1062/// Note: the tag must be in the range (1
1063/// <
1064/// = tag
1065/// <
1066/// = 4094)
1067#[cfg(feature = "SCPreferences")]
1068#[inline]
1069pub extern "C-unwind" fn SCVLANInterfaceCreate(
1070    prefs: &SCPreferences,
1071    physical: &SCNetworkInterface,
1072    tag: &CFNumber,
1073) -> Option<CFRetained<SCVLANInterface>> {
1074    extern "C-unwind" {
1075        fn SCVLANInterfaceCreate(
1076            prefs: &SCPreferences,
1077            physical: &SCNetworkInterface,
1078            tag: &CFNumber,
1079        ) -> Option<NonNull<SCVLANInterface>>;
1080    }
1081    let ret = unsafe { SCVLANInterfaceCreate(prefs, physical, tag) };
1082    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1083}
1084
1085/// Removes the SCVLANInterface from the configuration.
1086///
1087/// Parameter `vlan`: The SCVLANInterface interface.
1088///
1089/// Returns: TRUE if the interface was removed; FALSE if an error was encountered.
1090#[inline]
1091pub extern "C-unwind" fn SCVLANInterfaceRemove(vlan: &SCVLANInterface) -> bool {
1092    extern "C-unwind" {
1093        fn SCVLANInterfaceRemove(vlan: &SCVLANInterface) -> Boolean;
1094    }
1095    let ret = unsafe { SCVLANInterfaceRemove(vlan) };
1096    ret != 0
1097}
1098
1099/// Returns the physical interface for the specified VLAN interface.
1100///
1101/// Parameter `vlan`: The SCVLANInterface interface.
1102///
1103/// Returns: The list of interfaces.
1104#[inline]
1105pub extern "C-unwind" fn SCVLANInterfaceGetPhysicalInterface(
1106    vlan: &SCVLANInterface,
1107) -> Option<CFRetained<SCNetworkInterface>> {
1108    extern "C-unwind" {
1109        fn SCVLANInterfaceGetPhysicalInterface(
1110            vlan: &SCVLANInterface,
1111        ) -> Option<NonNull<SCNetworkInterface>>;
1112    }
1113    let ret = unsafe { SCVLANInterfaceGetPhysicalInterface(vlan) };
1114    ret.map(|ret| unsafe { CFRetained::retain(ret) })
1115}
1116
1117/// Returns the tag for the specified VLAN interface.
1118///
1119/// Parameter `vlan`: The SCVLANInterface interface.
1120///
1121/// Returns: The tag.
1122#[inline]
1123pub extern "C-unwind" fn SCVLANInterfaceGetTag(
1124    vlan: &SCVLANInterface,
1125) -> Option<CFRetained<CFNumber>> {
1126    extern "C-unwind" {
1127        fn SCVLANInterfaceGetTag(vlan: &SCVLANInterface) -> Option<NonNull<CFNumber>>;
1128    }
1129    let ret = unsafe { SCVLANInterfaceGetTag(vlan) };
1130    ret.map(|ret| unsafe { CFRetained::retain(ret) })
1131}
1132
1133/// Returns the configuration settings associated with the VLAN interface.
1134///
1135/// Parameter `vlan`: The SCVLANInterface interface.
1136///
1137/// Returns: The configuration settings associated with the VLAN interface;
1138/// NULL if no changes to the default configuration have been saved.
1139#[inline]
1140pub extern "C-unwind" fn SCVLANInterfaceGetOptions(
1141    vlan: &SCVLANInterface,
1142) -> Option<CFRetained<CFDictionary>> {
1143    extern "C-unwind" {
1144        fn SCVLANInterfaceGetOptions(vlan: &SCVLANInterface) -> Option<NonNull<CFDictionary>>;
1145    }
1146    let ret = unsafe { SCVLANInterfaceGetOptions(vlan) };
1147    ret.map(|ret| unsafe { CFRetained::retain(ret) })
1148}
1149
1150/// Updates the specified VLAN interface.
1151///
1152/// Parameter `vlan`: The SCVLANInterface interface.
1153///
1154/// Parameter `physical`: The physical interface to associate with the VLAN.
1155///
1156/// Parameter `tag`: The tag to associate with the VLAN.
1157///
1158/// Returns: TRUE if the configuration was stored; FALSE if an error was encountered.
1159///
1160/// Note: the tag must be in the range (1
1161/// <
1162/// = tag
1163/// <
1164/// = 4094)
1165#[inline]
1166pub extern "C-unwind" fn SCVLANInterfaceSetPhysicalInterfaceAndTag(
1167    vlan: &SCVLANInterface,
1168    physical: &SCNetworkInterface,
1169    tag: &CFNumber,
1170) -> bool {
1171    extern "C-unwind" {
1172        fn SCVLANInterfaceSetPhysicalInterfaceAndTag(
1173            vlan: &SCVLANInterface,
1174            physical: &SCNetworkInterface,
1175            tag: &CFNumber,
1176        ) -> Boolean;
1177    }
1178    let ret = unsafe { SCVLANInterfaceSetPhysicalInterfaceAndTag(vlan, physical, tag) };
1179    ret != 0
1180}
1181
1182/// Sets the localized display name for the specified VLAN interface.
1183///
1184/// Parameter `vlan`: The SCVLANInterface interface.
1185///
1186/// Parameter `newName`: The new display name.
1187///
1188/// Returns: TRUE if the configuration was stored; FALSE if an error was encountered.
1189#[inline]
1190pub extern "C-unwind" fn SCVLANInterfaceSetLocalizedDisplayName(
1191    vlan: &SCVLANInterface,
1192    new_name: &CFString,
1193) -> bool {
1194    extern "C-unwind" {
1195        fn SCVLANInterfaceSetLocalizedDisplayName(
1196            vlan: &SCVLANInterface,
1197            new_name: &CFString,
1198        ) -> Boolean;
1199    }
1200    let ret = unsafe { SCVLANInterfaceSetLocalizedDisplayName(vlan, new_name) };
1201    ret != 0
1202}
1203
1204/// Sets the configuration settings for the specified VLAN interface.
1205///
1206/// Parameter `vlan`: The SCVLANInterface interface.
1207///
1208/// Parameter `newOptions`: The new configuration settings.
1209///
1210/// Returns: TRUE if the configuration was stored; FALSE if an error was encountered.
1211///
1212/// # Safety
1213///
1214/// `new_options` generics must be of the correct type.
1215#[inline]
1216pub unsafe extern "C-unwind" fn SCVLANInterfaceSetOptions(
1217    vlan: &SCVLANInterface,
1218    new_options: &CFDictionary,
1219) -> bool {
1220    extern "C-unwind" {
1221        fn SCVLANInterfaceSetOptions(vlan: &SCVLANInterface, new_options: &CFDictionary)
1222            -> Boolean;
1223    }
1224    let ret = unsafe { SCVLANInterfaceSetOptions(vlan, new_options) };
1225    ret != 0
1226}
1227
1228unsafe impl ConcreteType for SCNetworkProtocol {
1229    /// Returns the type identifier of all SCNetworkProtocol instances.
1230    #[doc(alias = "SCNetworkProtocolGetTypeID")]
1231    #[inline]
1232    fn type_id() -> CFTypeID {
1233        extern "C-unwind" {
1234            fn SCNetworkProtocolGetTypeID() -> CFTypeID;
1235        }
1236        unsafe { SCNetworkProtocolGetTypeID() }
1237    }
1238}
1239
1240impl SCNetworkProtocol {
1241    /// Returns the configuration settings associated with the protocol.
1242    ///
1243    /// Parameter `protocol`: The network protocol.
1244    ///
1245    /// Returns: The configuration settings associated with the protocol;
1246    /// NULL if no configuration settings are associated with the protocol
1247    /// or an error was encountered.
1248    #[doc(alias = "SCNetworkProtocolGetConfiguration")]
1249    #[inline]
1250    pub fn configuration(&self) -> Option<CFRetained<CFDictionary>> {
1251        extern "C-unwind" {
1252            fn SCNetworkProtocolGetConfiguration(
1253                protocol: &SCNetworkProtocol,
1254            ) -> Option<NonNull<CFDictionary>>;
1255        }
1256        let ret = unsafe { SCNetworkProtocolGetConfiguration(self) };
1257        ret.map(|ret| unsafe { CFRetained::retain(ret) })
1258    }
1259
1260    /// Returns whether this protocol has been enabled.
1261    ///
1262    /// Parameter `protocol`: The network protocol.
1263    ///
1264    /// Returns: TRUE if the protocol is enabled.
1265    #[doc(alias = "SCNetworkProtocolGetEnabled")]
1266    #[inline]
1267    pub fn enabled(&self) -> bool {
1268        extern "C-unwind" {
1269            fn SCNetworkProtocolGetEnabled(protocol: &SCNetworkProtocol) -> Boolean;
1270        }
1271        let ret = unsafe { SCNetworkProtocolGetEnabled(self) };
1272        ret != 0
1273    }
1274
1275    /// Returns the associated network protocol type.
1276    ///
1277    /// Parameter `protocol`: The network protocol.
1278    ///
1279    /// Returns: The protocol type.
1280    #[doc(alias = "SCNetworkProtocolGetProtocolType")]
1281    #[inline]
1282    pub fn protocol_type(&self) -> Option<CFRetained<CFString>> {
1283        extern "C-unwind" {
1284            fn SCNetworkProtocolGetProtocolType(
1285                protocol: &SCNetworkProtocol,
1286            ) -> Option<NonNull<CFString>>;
1287        }
1288        let ret = unsafe { SCNetworkProtocolGetProtocolType(self) };
1289        ret.map(|ret| unsafe { CFRetained::retain(ret) })
1290    }
1291
1292    /// Stores the configuration settings for the protocol.
1293    ///
1294    /// Parameter `protocol`: The network protocol.
1295    ///
1296    /// Parameter `config`: The configuration settings to associate with this protocol.
1297    ///
1298    /// Returns: TRUE if the configuration was stored; FALSE if an error was encountered.
1299    ///
1300    /// # Safety
1301    ///
1302    /// `config` generics must be of the correct type.
1303    #[doc(alias = "SCNetworkProtocolSetConfiguration")]
1304    #[inline]
1305    pub unsafe fn set_configuration(&self, config: Option<&CFDictionary>) -> bool {
1306        extern "C-unwind" {
1307            fn SCNetworkProtocolSetConfiguration(
1308                protocol: &SCNetworkProtocol,
1309                config: Option<&CFDictionary>,
1310            ) -> Boolean;
1311        }
1312        let ret = unsafe { SCNetworkProtocolSetConfiguration(self, config) };
1313        ret != 0
1314    }
1315
1316    /// Enables or disables the protocol.
1317    ///
1318    /// Parameter `protocol`: The network protocol.
1319    ///
1320    /// Parameter `enabled`: TRUE if the protocol should be enabled.
1321    ///
1322    /// Returns: TRUE if the enabled status was saved; FALSE if an error was encountered.
1323    #[doc(alias = "SCNetworkProtocolSetEnabled")]
1324    #[inline]
1325    pub fn set_enabled(&self, enabled: bool) -> bool {
1326        extern "C-unwind" {
1327            fn SCNetworkProtocolSetEnabled(
1328                protocol: &SCNetworkProtocol,
1329                enabled: Boolean,
1330            ) -> Boolean;
1331        }
1332        let ret = unsafe { SCNetworkProtocolSetEnabled(self, enabled as _) };
1333        ret != 0
1334    }
1335}
1336
1337unsafe impl ConcreteType for SCNetworkService {
1338    /// Returns the type identifier of all SCNetworkService instances.
1339    #[doc(alias = "SCNetworkServiceGetTypeID")]
1340    #[inline]
1341    fn type_id() -> CFTypeID {
1342        extern "C-unwind" {
1343            fn SCNetworkServiceGetTypeID() -> CFTypeID;
1344        }
1345        unsafe { SCNetworkServiceGetTypeID() }
1346    }
1347}
1348
1349impl SCNetworkService {
1350    /// Adds a network protocol of the specified type to the
1351    /// service.  The protocol configuration is set to default values
1352    /// that are appropriate for the interface associated with the
1353    /// service.
1354    ///
1355    /// Parameter `service`: The network service.
1356    ///
1357    /// Parameter `protocolType`: The type of SCNetworkProtocol to be added to the service.
1358    ///
1359    /// Returns: TRUE if the protocol was added to the service; FALSE if the
1360    /// protocol was already present or an error was encountered.
1361    #[doc(alias = "SCNetworkServiceAddProtocolType")]
1362    #[inline]
1363    pub fn add_protocol_type(&self, protocol_type: &CFString) -> bool {
1364        extern "C-unwind" {
1365            fn SCNetworkServiceAddProtocolType(
1366                service: &SCNetworkService,
1367                protocol_type: &CFString,
1368            ) -> Boolean;
1369        }
1370        let ret = unsafe { SCNetworkServiceAddProtocolType(self, protocol_type) };
1371        ret != 0
1372    }
1373
1374    /// Returns all available network services for the specified preferences.
1375    ///
1376    /// Parameter `prefs`: The "preferences" session.
1377    ///
1378    /// Returns: The list of SCNetworkService services associated with the preferences.
1379    /// You must release the returned value.
1380    #[doc(alias = "SCNetworkServiceCopyAll")]
1381    #[cfg(feature = "SCPreferences")]
1382    #[inline]
1383    pub fn all(prefs: &SCPreferences) -> Option<CFRetained<CFArray>> {
1384        extern "C-unwind" {
1385            fn SCNetworkServiceCopyAll(prefs: &SCPreferences) -> Option<NonNull<CFArray>>;
1386        }
1387        let ret = unsafe { SCNetworkServiceCopyAll(prefs) };
1388        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1389    }
1390
1391    /// Returns all network protocols associated with the service.
1392    ///
1393    /// Parameter `service`: The network service.
1394    ///
1395    /// Returns: The list of SCNetworkProtocol protocols associated with the service.
1396    /// You must release the returned value.
1397    #[doc(alias = "SCNetworkServiceCopyProtocols")]
1398    #[inline]
1399    pub fn protocols(&self) -> Option<CFRetained<CFArray>> {
1400        extern "C-unwind" {
1401            fn SCNetworkServiceCopyProtocols(
1402                service: &SCNetworkService,
1403            ) -> Option<NonNull<CFArray>>;
1404        }
1405        let ret = unsafe { SCNetworkServiceCopyProtocols(self) };
1406        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1407    }
1408
1409    /// Create a new network service for the specified interface in the
1410    /// configuration.
1411    ///
1412    /// Parameter `prefs`: The "preferences" session.
1413    ///
1414    /// Returns: A reference to the new SCNetworkService.
1415    /// You must release the returned value.
1416    #[doc(alias = "SCNetworkServiceCreate")]
1417    #[cfg(feature = "SCPreferences")]
1418    #[inline]
1419    pub fn new(
1420        prefs: &SCPreferences,
1421        interface: &SCNetworkInterface,
1422    ) -> Option<CFRetained<SCNetworkService>> {
1423        extern "C-unwind" {
1424            fn SCNetworkServiceCreate(
1425                prefs: &SCPreferences,
1426                interface: &SCNetworkInterface,
1427            ) -> Option<NonNull<SCNetworkService>>;
1428        }
1429        let ret = unsafe { SCNetworkServiceCreate(prefs, interface) };
1430        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1431    }
1432
1433    /// Returns the network service with the specified identifier.
1434    ///
1435    /// Parameter `prefs`: The "preferences" session.
1436    ///
1437    /// Parameter `serviceID`: The unique identifier for the service.
1438    ///
1439    /// Returns: A reference to the SCNetworkService from the associated preferences;
1440    /// NULL if the serviceID does not exist in the preferences or if an
1441    /// error was encountered.
1442    /// You must release the returned value.
1443    #[doc(alias = "SCNetworkServiceCopy")]
1444    #[cfg(feature = "SCPreferences")]
1445    #[inline]
1446    pub fn copy(
1447        prefs: &SCPreferences,
1448        service_id: &CFString,
1449    ) -> Option<CFRetained<SCNetworkService>> {
1450        extern "C-unwind" {
1451            fn SCNetworkServiceCopy(
1452                prefs: &SCPreferences,
1453                service_id: &CFString,
1454            ) -> Option<NonNull<SCNetworkService>>;
1455        }
1456        let ret = unsafe { SCNetworkServiceCopy(prefs, service_id) };
1457        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1458    }
1459
1460    /// Establishes the "default" configuration for a network
1461    /// service.  This configuration includes the addition of
1462    /// network protocols for the service (with "default"
1463    /// configuration options).
1464    ///
1465    /// Parameter `service`: The network service.
1466    ///
1467    /// Returns: TRUE if the configuration was updated; FALSE if an error was encountered.
1468    #[doc(alias = "SCNetworkServiceEstablishDefaultConfiguration")]
1469    #[inline]
1470    pub fn establish_default_configuration(&self) -> bool {
1471        extern "C-unwind" {
1472            fn SCNetworkServiceEstablishDefaultConfiguration(service: &SCNetworkService)
1473                -> Boolean;
1474        }
1475        let ret = unsafe { SCNetworkServiceEstablishDefaultConfiguration(self) };
1476        ret != 0
1477    }
1478
1479    /// Returns whether this service has been enabled.
1480    ///
1481    /// Parameter `service`: The network service.
1482    ///
1483    /// Returns: TRUE if the service is enabled.
1484    #[doc(alias = "SCNetworkServiceGetEnabled")]
1485    #[inline]
1486    pub fn enabled(&self) -> bool {
1487        extern "C-unwind" {
1488            fn SCNetworkServiceGetEnabled(service: &SCNetworkService) -> Boolean;
1489        }
1490        let ret = unsafe { SCNetworkServiceGetEnabled(self) };
1491        ret != 0
1492    }
1493
1494    /// Returns the network interface associated with the service.
1495    ///
1496    /// Parameter `service`: The network service.
1497    ///
1498    /// Returns: A reference to the SCNetworkInterface associated with the service;
1499    /// NULL if an error was encountered.
1500    #[doc(alias = "SCNetworkServiceGetInterface")]
1501    #[inline]
1502    pub fn interface(&self) -> Option<CFRetained<SCNetworkInterface>> {
1503        extern "C-unwind" {
1504            fn SCNetworkServiceGetInterface(
1505                service: &SCNetworkService,
1506            ) -> Option<NonNull<SCNetworkInterface>>;
1507        }
1508        let ret = unsafe { SCNetworkServiceGetInterface(self) };
1509        ret.map(|ret| unsafe { CFRetained::retain(ret) })
1510    }
1511
1512    /// Returns the [user specified] name associated with the service.
1513    ///
1514    /// Parameter `service`: The network service.
1515    ///
1516    /// Returns: The [user specified] name.
1517    #[doc(alias = "SCNetworkServiceGetName")]
1518    #[inline]
1519    pub fn name(&self) -> Option<CFRetained<CFString>> {
1520        extern "C-unwind" {
1521            fn SCNetworkServiceGetName(service: &SCNetworkService) -> Option<NonNull<CFString>>;
1522        }
1523        let ret = unsafe { SCNetworkServiceGetName(self) };
1524        ret.map(|ret| unsafe { CFRetained::retain(ret) })
1525    }
1526
1527    /// Returns the network protocol of the specified type for
1528    /// the service.
1529    ///
1530    /// Parameter `service`: The network service.
1531    ///
1532    /// Returns: A reference to the SCNetworkProtocol associated with the service;
1533    /// NULL if this protocol has not been added or if an error was encountered.
1534    /// You must release the returned value.
1535    #[doc(alias = "SCNetworkServiceCopyProtocol")]
1536    #[inline]
1537    pub fn protocol(&self, protocol_type: &CFString) -> Option<CFRetained<SCNetworkProtocol>> {
1538        extern "C-unwind" {
1539            fn SCNetworkServiceCopyProtocol(
1540                service: &SCNetworkService,
1541                protocol_type: &CFString,
1542            ) -> Option<NonNull<SCNetworkProtocol>>;
1543        }
1544        let ret = unsafe { SCNetworkServiceCopyProtocol(self, protocol_type) };
1545        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1546    }
1547
1548    /// Returns the identifier for the service.
1549    ///
1550    /// Parameter `service`: The network service.
1551    ///
1552    /// Returns: The service identifier.
1553    #[doc(alias = "SCNetworkServiceGetServiceID")]
1554    #[inline]
1555    pub fn service_id(&self) -> Option<CFRetained<CFString>> {
1556        extern "C-unwind" {
1557            fn SCNetworkServiceGetServiceID(
1558                service: &SCNetworkService,
1559            ) -> Option<NonNull<CFString>>;
1560        }
1561        let ret = unsafe { SCNetworkServiceGetServiceID(self) };
1562        ret.map(|ret| unsafe { CFRetained::retain(ret) })
1563    }
1564
1565    /// Removes the network service from the configuration.
1566    ///
1567    /// Parameter `service`: The network service.
1568    ///
1569    /// Returns: TRUE if the service was removed; FALSE if an error was encountered.
1570    #[doc(alias = "SCNetworkServiceRemove")]
1571    #[inline]
1572    pub fn remove(&self) -> bool {
1573        extern "C-unwind" {
1574            fn SCNetworkServiceRemove(service: &SCNetworkService) -> Boolean;
1575        }
1576        let ret = unsafe { SCNetworkServiceRemove(self) };
1577        ret != 0
1578    }
1579
1580    /// Removes the network protocol of the specified type from the service.
1581    ///
1582    /// Parameter `service`: The network service.
1583    ///
1584    /// Parameter `protocolType`: The type of SCNetworkProtocol to be removed from the service.
1585    ///
1586    /// Returns: TRUE if the protocol was removed to the service; FALSE if the
1587    /// protocol was not configured or an error was encountered.
1588    #[doc(alias = "SCNetworkServiceRemoveProtocolType")]
1589    #[inline]
1590    pub fn remove_protocol_type(&self, protocol_type: &CFString) -> bool {
1591        extern "C-unwind" {
1592            fn SCNetworkServiceRemoveProtocolType(
1593                service: &SCNetworkService,
1594                protocol_type: &CFString,
1595            ) -> Boolean;
1596        }
1597        let ret = unsafe { SCNetworkServiceRemoveProtocolType(self, protocol_type) };
1598        ret != 0
1599    }
1600
1601    /// Enables or disables the service.
1602    ///
1603    /// Parameter `service`: The network service.
1604    ///
1605    /// Parameter `enabled`: TRUE if the service should be enabled.
1606    ///
1607    /// Returns: TRUE if the enabled status was saved; FALSE if an error was encountered.
1608    #[doc(alias = "SCNetworkServiceSetEnabled")]
1609    #[inline]
1610    pub fn set_enabled(&self, enabled: bool) -> bool {
1611        extern "C-unwind" {
1612            fn SCNetworkServiceSetEnabled(service: &SCNetworkService, enabled: Boolean) -> Boolean;
1613        }
1614        let ret = unsafe { SCNetworkServiceSetEnabled(self, enabled as _) };
1615        ret != 0
1616    }
1617
1618    /// Stores the [user specified] name for the service.
1619    ///
1620    /// Parameter `service`: The network service.
1621    ///
1622    /// Parameter `name`: The [user defined] name to associate with the service.
1623    ///
1624    /// Returns: TRUE if the name was saved; FALSE if an error was encountered.
1625    ///
1626    /// Note: although not technically required, the [user specified] names
1627    /// for all services within any given set should be unique.  As such, an
1628    /// error will be returned if you attemp to name two services with the
1629    /// same string.
1630    #[doc(alias = "SCNetworkServiceSetName")]
1631    #[inline]
1632    pub fn set_name(&self, name: Option<&CFString>) -> bool {
1633        extern "C-unwind" {
1634            fn SCNetworkServiceSetName(
1635                service: &SCNetworkService,
1636                name: Option<&CFString>,
1637            ) -> Boolean;
1638        }
1639        let ret = unsafe { SCNetworkServiceSetName(self, name) };
1640        ret != 0
1641    }
1642}
1643
1644unsafe impl ConcreteType for SCNetworkSet {
1645    /// Returns the type identifier of all SCNetworkSet instances.
1646    #[doc(alias = "SCNetworkSetGetTypeID")]
1647    #[inline]
1648    fn type_id() -> CFTypeID {
1649        extern "C-unwind" {
1650            fn SCNetworkSetGetTypeID() -> CFTypeID;
1651        }
1652        unsafe { SCNetworkSetGetTypeID() }
1653    }
1654}
1655
1656impl SCNetworkSet {
1657    /// Adds the network service to the set.
1658    ///
1659    /// Parameter `set`: The network set.
1660    ///
1661    /// Parameter `service`: The service to be added.
1662    ///
1663    /// Returns: TRUE if the service was added to the set; FALSE if the
1664    /// service was already present or an error was encountered.
1665    ///
1666    /// Note: prior to Mac OS X 10.5, the Network Preferences UI
1667    /// did not support having a single service being a member of
1668    /// more than one set.  An error will be returned if you attempt
1669    /// to add a service to more than one set on a pre-10.5 system.
1670    #[doc(alias = "SCNetworkSetAddService")]
1671    #[inline]
1672    pub fn add_service(&self, service: &SCNetworkService) -> bool {
1673        extern "C-unwind" {
1674            fn SCNetworkSetAddService(set: &SCNetworkSet, service: &SCNetworkService) -> Boolean;
1675        }
1676        let ret = unsafe { SCNetworkSetAddService(self, service) };
1677        ret != 0
1678    }
1679
1680    /// Checks if an interface is represented by at least one
1681    /// network service in the specified set.
1682    ///
1683    /// Parameter `set`: The network set.
1684    ///
1685    /// Parameter `interface`: The network interface.
1686    ///
1687    /// Returns: TRUE if the interface is represented in the set; FALSE if not.
1688    #[doc(alias = "SCNetworkSetContainsInterface")]
1689    #[inline]
1690    pub fn contains_interface(&self, interface: &SCNetworkInterface) -> bool {
1691        extern "C-unwind" {
1692            fn SCNetworkSetContainsInterface(
1693                set: &SCNetworkSet,
1694                interface: &SCNetworkInterface,
1695            ) -> Boolean;
1696        }
1697        let ret = unsafe { SCNetworkSetContainsInterface(self, interface) };
1698        ret != 0
1699    }
1700
1701    /// Returns all available sets for the specified preferences.
1702    ///
1703    /// Parameter `prefs`: The "preferences" session.
1704    ///
1705    /// Returns: The list of SCNetworkSet sets associated with the preferences.
1706    /// You must release the returned value.
1707    #[doc(alias = "SCNetworkSetCopyAll")]
1708    #[cfg(feature = "SCPreferences")]
1709    #[inline]
1710    pub fn all(prefs: &SCPreferences) -> Option<CFRetained<CFArray>> {
1711        extern "C-unwind" {
1712            fn SCNetworkSetCopyAll(prefs: &SCPreferences) -> Option<NonNull<CFArray>>;
1713        }
1714        let ret = unsafe { SCNetworkSetCopyAll(prefs) };
1715        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1716    }
1717
1718    /// Returns the "current" set.
1719    ///
1720    /// Parameter `prefs`: The "preferences" session.
1721    ///
1722    /// Returns: The current set; NULL if no current set has been defined.
1723    #[doc(alias = "SCNetworkSetCopyCurrent")]
1724    #[cfg(feature = "SCPreferences")]
1725    #[inline]
1726    pub fn current(prefs: &SCPreferences) -> Option<CFRetained<SCNetworkSet>> {
1727        extern "C-unwind" {
1728            fn SCNetworkSetCopyCurrent(prefs: &SCPreferences) -> Option<NonNull<SCNetworkSet>>;
1729        }
1730        let ret = unsafe { SCNetworkSetCopyCurrent(prefs) };
1731        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1732    }
1733
1734    /// Returns all network services associated with the set.
1735    ///
1736    /// Parameter `set`: The network set.
1737    ///
1738    /// Returns: The list of SCNetworkService services associated with the set.
1739    /// You must release the returned value.
1740    #[doc(alias = "SCNetworkSetCopyServices")]
1741    #[inline]
1742    pub fn services(&self) -> Option<CFRetained<CFArray>> {
1743        extern "C-unwind" {
1744            fn SCNetworkSetCopyServices(set: &SCNetworkSet) -> Option<NonNull<CFArray>>;
1745        }
1746        let ret = unsafe { SCNetworkSetCopyServices(self) };
1747        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1748    }
1749
1750    /// Create a new set in the configuration.
1751    ///
1752    /// Parameter `prefs`: The "preferences" session.
1753    ///
1754    /// Returns: A reference to the new SCNetworkSet.
1755    /// You must release the returned value.
1756    #[doc(alias = "SCNetworkSetCreate")]
1757    #[cfg(feature = "SCPreferences")]
1758    #[inline]
1759    pub fn new(prefs: &SCPreferences) -> Option<CFRetained<SCNetworkSet>> {
1760        extern "C-unwind" {
1761            fn SCNetworkSetCreate(prefs: &SCPreferences) -> Option<NonNull<SCNetworkSet>>;
1762        }
1763        let ret = unsafe { SCNetworkSetCreate(prefs) };
1764        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1765    }
1766
1767    /// Returns the set with the specified identifier.
1768    ///
1769    /// Parameter `prefs`: The "preferences" session.
1770    ///
1771    /// Parameter `setID`: The unique identifier for the set.
1772    ///
1773    /// Returns: A reference to the SCNetworkSet from the associated preferences;
1774    /// NULL if the setID does not exist in the preferences or if an
1775    /// error was encountered.
1776    /// You must release the returned value.
1777    #[doc(alias = "SCNetworkSetCopy")]
1778    #[cfg(feature = "SCPreferences")]
1779    #[inline]
1780    pub fn copy(prefs: &SCPreferences, set_id: &CFString) -> Option<CFRetained<SCNetworkSet>> {
1781        extern "C-unwind" {
1782            fn SCNetworkSetCopy(
1783                prefs: &SCPreferences,
1784                set_id: &CFString,
1785            ) -> Option<NonNull<SCNetworkSet>>;
1786        }
1787        let ret = unsafe { SCNetworkSetCopy(prefs, set_id) };
1788        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1789    }
1790
1791    /// Returns the [user specified] name associated with the set.
1792    ///
1793    /// Parameter `set`: The network set.
1794    ///
1795    /// Returns: The [user specified] name.
1796    #[doc(alias = "SCNetworkSetGetName")]
1797    #[inline]
1798    pub fn name(&self) -> Option<CFRetained<CFString>> {
1799        extern "C-unwind" {
1800            fn SCNetworkSetGetName(set: &SCNetworkSet) -> Option<NonNull<CFString>>;
1801        }
1802        let ret = unsafe { SCNetworkSetGetName(self) };
1803        ret.map(|ret| unsafe { CFRetained::retain(ret) })
1804    }
1805
1806    /// Returns the identifier for the set.
1807    ///
1808    /// Parameter `set`: The network set.
1809    ///
1810    /// Returns: The set identifier.
1811    #[doc(alias = "SCNetworkSetGetSetID")]
1812    #[inline]
1813    pub fn set_id(&self) -> Option<CFRetained<CFString>> {
1814        extern "C-unwind" {
1815            fn SCNetworkSetGetSetID(set: &SCNetworkSet) -> Option<NonNull<CFString>>;
1816        }
1817        let ret = unsafe { SCNetworkSetGetSetID(self) };
1818        ret.map(|ret| unsafe { CFRetained::retain(ret) })
1819    }
1820
1821    /// Returns the [user specified] ordering of network services
1822    /// within the set.
1823    ///
1824    /// Parameter `set`: The network set.
1825    ///
1826    /// Returns: The ordered list of CFStringRef service identifiers associated
1827    /// with the set;
1828    /// NULL if no service order has been specified or if an error
1829    /// was encountered.
1830    #[doc(alias = "SCNetworkSetGetServiceOrder")]
1831    #[inline]
1832    pub fn service_order(&self) -> Option<CFRetained<CFArray>> {
1833        extern "C-unwind" {
1834            fn SCNetworkSetGetServiceOrder(set: &SCNetworkSet) -> Option<NonNull<CFArray>>;
1835        }
1836        let ret = unsafe { SCNetworkSetGetServiceOrder(self) };
1837        ret.map(|ret| unsafe { CFRetained::retain(ret) })
1838    }
1839
1840    /// Removes the set from the configuration.
1841    ///
1842    /// Parameter `set`: The network set.
1843    ///
1844    /// Returns: TRUE if the set was removed; FALSE if an error was encountered.
1845    #[doc(alias = "SCNetworkSetRemove")]
1846    #[inline]
1847    pub fn remove(&self) -> bool {
1848        extern "C-unwind" {
1849            fn SCNetworkSetRemove(set: &SCNetworkSet) -> Boolean;
1850        }
1851        let ret = unsafe { SCNetworkSetRemove(self) };
1852        ret != 0
1853    }
1854
1855    /// Removes the network service from the set.
1856    ///
1857    /// Parameter `set`: The network set.
1858    ///
1859    /// Parameter `service`: The service to be removed.
1860    ///
1861    /// Returns: TRUE if the service was removed from the set; FALSE if the
1862    /// service was not already present or an error was encountered.
1863    #[doc(alias = "SCNetworkSetRemoveService")]
1864    #[inline]
1865    pub fn remove_service(&self, service: &SCNetworkService) -> bool {
1866        extern "C-unwind" {
1867            fn SCNetworkSetRemoveService(set: &SCNetworkSet, service: &SCNetworkService)
1868                -> Boolean;
1869        }
1870        let ret = unsafe { SCNetworkSetRemoveService(self, service) };
1871        ret != 0
1872    }
1873
1874    /// Specifies the set that should be the "current" set.
1875    ///
1876    /// Parameter `set`: The network set.
1877    ///
1878    /// Returns: TRUE if the current set was updated;
1879    /// FALSE if an error was encountered.
1880    #[doc(alias = "SCNetworkSetSetCurrent")]
1881    #[inline]
1882    pub fn set_current(&self) -> bool {
1883        extern "C-unwind" {
1884            fn SCNetworkSetSetCurrent(set: &SCNetworkSet) -> Boolean;
1885        }
1886        let ret = unsafe { SCNetworkSetSetCurrent(self) };
1887        ret != 0
1888    }
1889
1890    /// Stores the [user specified] name for the set.
1891    ///
1892    /// Parameter `set`: The network set.
1893    ///
1894    /// Parameter `name`: The [user defined] name to associate with the set.
1895    ///
1896    /// Returns: TRUE if the name was saved; FALSE if an error was encountered.
1897    ///
1898    /// Note: although not technically required, the [user specified] names
1899    /// for all set should be unique.  As such, an error will be returned if
1900    /// you attemp to name two sets with the same string.
1901    #[doc(alias = "SCNetworkSetSetName")]
1902    #[inline]
1903    pub fn set_name(&self, name: Option<&CFString>) -> bool {
1904        extern "C-unwind" {
1905            fn SCNetworkSetSetName(set: &SCNetworkSet, name: Option<&CFString>) -> Boolean;
1906        }
1907        let ret = unsafe { SCNetworkSetSetName(self, name) };
1908        ret != 0
1909    }
1910
1911    /// Stores the [user specified] ordering of network services for the set.
1912    ///
1913    /// Parameter `set`: The network set.
1914    ///
1915    /// Parameter `newOrder`: The ordered list of CFStringRef service identifiers for the set.
1916    ///
1917    /// Returns: TRUE if the new service order was saved; FALSE if an error was encountered.
1918    ///
1919    /// # Safety
1920    ///
1921    /// `new_order` generic must be of the correct type.
1922    #[doc(alias = "SCNetworkSetSetServiceOrder")]
1923    #[inline]
1924    pub unsafe fn set_service_order(&self, new_order: &CFArray) -> bool {
1925        extern "C-unwind" {
1926            fn SCNetworkSetSetServiceOrder(set: &SCNetworkSet, new_order: &CFArray) -> Boolean;
1927        }
1928        let ret = unsafe { SCNetworkSetSetServiceOrder(self, new_order) };
1929        ret != 0
1930    }
1931}
1932
1933#[deprecated = "renamed to `SCNetworkInterface::all`"]
1934#[inline]
1935pub extern "C-unwind" fn SCNetworkInterfaceCopyAll() -> CFRetained<CFArray> {
1936    extern "C-unwind" {
1937        fn SCNetworkInterfaceCopyAll() -> Option<NonNull<CFArray>>;
1938    }
1939    let ret = unsafe { SCNetworkInterfaceCopyAll() };
1940    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
1941    unsafe { CFRetained::from_raw(ret) }
1942}
1943
1944#[deprecated = "renamed to `SCNetworkInterface::supported_interface_types`"]
1945#[inline]
1946pub extern "C-unwind" fn SCNetworkInterfaceGetSupportedInterfaceTypes(
1947    interface: &SCNetworkInterface,
1948) -> Option<CFRetained<CFArray>> {
1949    extern "C-unwind" {
1950        fn SCNetworkInterfaceGetSupportedInterfaceTypes(
1951            interface: &SCNetworkInterface,
1952        ) -> Option<NonNull<CFArray>>;
1953    }
1954    let ret = unsafe { SCNetworkInterfaceGetSupportedInterfaceTypes(interface) };
1955    ret.map(|ret| unsafe { CFRetained::retain(ret) })
1956}
1957
1958#[deprecated = "renamed to `SCNetworkInterface::supported_protocol_types`"]
1959#[inline]
1960pub extern "C-unwind" fn SCNetworkInterfaceGetSupportedProtocolTypes(
1961    interface: &SCNetworkInterface,
1962) -> Option<CFRetained<CFArray>> {
1963    extern "C-unwind" {
1964        fn SCNetworkInterfaceGetSupportedProtocolTypes(
1965            interface: &SCNetworkInterface,
1966        ) -> Option<NonNull<CFArray>>;
1967    }
1968    let ret = unsafe { SCNetworkInterfaceGetSupportedProtocolTypes(interface) };
1969    ret.map(|ret| unsafe { CFRetained::retain(ret) })
1970}
1971
1972#[deprecated = "renamed to `SCNetworkInterface::with_interface`"]
1973#[inline]
1974pub extern "C-unwind" fn SCNetworkInterfaceCreateWithInterface(
1975    interface: &SCNetworkInterface,
1976    interface_type: &CFString,
1977) -> Option<CFRetained<SCNetworkInterface>> {
1978    extern "C-unwind" {
1979        fn SCNetworkInterfaceCreateWithInterface(
1980            interface: &SCNetworkInterface,
1981            interface_type: &CFString,
1982        ) -> Option<NonNull<SCNetworkInterface>>;
1983    }
1984    let ret = unsafe { SCNetworkInterfaceCreateWithInterface(interface, interface_type) };
1985    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1986}
1987
1988#[deprecated = "renamed to `SCNetworkInterface::bsd_name`"]
1989#[inline]
1990pub extern "C-unwind" fn SCNetworkInterfaceGetBSDName(
1991    interface: &SCNetworkInterface,
1992) -> Option<CFRetained<CFString>> {
1993    extern "C-unwind" {
1994        fn SCNetworkInterfaceGetBSDName(
1995            interface: &SCNetworkInterface,
1996        ) -> Option<NonNull<CFString>>;
1997    }
1998    let ret = unsafe { SCNetworkInterfaceGetBSDName(interface) };
1999    ret.map(|ret| unsafe { CFRetained::retain(ret) })
2000}
2001
2002#[deprecated = "renamed to `SCNetworkInterface::configuration`"]
2003#[inline]
2004pub extern "C-unwind" fn SCNetworkInterfaceGetConfiguration(
2005    interface: &SCNetworkInterface,
2006) -> Option<CFRetained<CFDictionary>> {
2007    extern "C-unwind" {
2008        fn SCNetworkInterfaceGetConfiguration(
2009            interface: &SCNetworkInterface,
2010        ) -> Option<NonNull<CFDictionary>>;
2011    }
2012    let ret = unsafe { SCNetworkInterfaceGetConfiguration(interface) };
2013    ret.map(|ret| unsafe { CFRetained::retain(ret) })
2014}
2015
2016#[deprecated = "renamed to `SCNetworkInterface::extended_configuration`"]
2017#[inline]
2018pub extern "C-unwind" fn SCNetworkInterfaceGetExtendedConfiguration(
2019    interface: &SCNetworkInterface,
2020    extended_type: &CFString,
2021) -> Option<CFRetained<CFDictionary>> {
2022    extern "C-unwind" {
2023        fn SCNetworkInterfaceGetExtendedConfiguration(
2024            interface: &SCNetworkInterface,
2025            extended_type: &CFString,
2026        ) -> Option<NonNull<CFDictionary>>;
2027    }
2028    let ret = unsafe { SCNetworkInterfaceGetExtendedConfiguration(interface, extended_type) };
2029    ret.map(|ret| unsafe { CFRetained::retain(ret) })
2030}
2031
2032#[deprecated = "renamed to `SCNetworkInterface::hardware_address_string`"]
2033#[inline]
2034pub extern "C-unwind" fn SCNetworkInterfaceGetHardwareAddressString(
2035    interface: &SCNetworkInterface,
2036) -> Option<CFRetained<CFString>> {
2037    extern "C-unwind" {
2038        fn SCNetworkInterfaceGetHardwareAddressString(
2039            interface: &SCNetworkInterface,
2040        ) -> Option<NonNull<CFString>>;
2041    }
2042    let ret = unsafe { SCNetworkInterfaceGetHardwareAddressString(interface) };
2043    ret.map(|ret| unsafe { CFRetained::retain(ret) })
2044}
2045
2046#[deprecated = "renamed to `SCNetworkInterface::interface`"]
2047#[inline]
2048pub extern "C-unwind" fn SCNetworkInterfaceGetInterface(
2049    interface: &SCNetworkInterface,
2050) -> Option<CFRetained<SCNetworkInterface>> {
2051    extern "C-unwind" {
2052        fn SCNetworkInterfaceGetInterface(
2053            interface: &SCNetworkInterface,
2054        ) -> Option<NonNull<SCNetworkInterface>>;
2055    }
2056    let ret = unsafe { SCNetworkInterfaceGetInterface(interface) };
2057    ret.map(|ret| unsafe { CFRetained::retain(ret) })
2058}
2059
2060#[deprecated = "renamed to `SCNetworkInterface::interface_type`"]
2061#[inline]
2062pub extern "C-unwind" fn SCNetworkInterfaceGetInterfaceType(
2063    interface: &SCNetworkInterface,
2064) -> Option<CFRetained<CFString>> {
2065    extern "C-unwind" {
2066        fn SCNetworkInterfaceGetInterfaceType(
2067            interface: &SCNetworkInterface,
2068        ) -> Option<NonNull<CFString>>;
2069    }
2070    let ret = unsafe { SCNetworkInterfaceGetInterfaceType(interface) };
2071    ret.map(|ret| unsafe { CFRetained::retain(ret) })
2072}
2073
2074#[deprecated = "renamed to `SCNetworkInterface::localized_display_name`"]
2075#[inline]
2076pub extern "C-unwind" fn SCNetworkInterfaceGetLocalizedDisplayName(
2077    interface: &SCNetworkInterface,
2078) -> Option<CFRetained<CFString>> {
2079    extern "C-unwind" {
2080        fn SCNetworkInterfaceGetLocalizedDisplayName(
2081            interface: &SCNetworkInterface,
2082        ) -> Option<NonNull<CFString>>;
2083    }
2084    let ret = unsafe { SCNetworkInterfaceGetLocalizedDisplayName(interface) };
2085    ret.map(|ret| unsafe { CFRetained::retain(ret) })
2086}
2087
2088#[deprecated = "renamed to `SCNetworkInterface::set_configuration`"]
2089#[inline]
2090pub unsafe extern "C-unwind" fn SCNetworkInterfaceSetConfiguration(
2091    interface: &SCNetworkInterface,
2092    config: Option<&CFDictionary>,
2093) -> bool {
2094    extern "C-unwind" {
2095        fn SCNetworkInterfaceSetConfiguration(
2096            interface: &SCNetworkInterface,
2097            config: Option<&CFDictionary>,
2098        ) -> Boolean;
2099    }
2100    let ret = unsafe { SCNetworkInterfaceSetConfiguration(interface, config) };
2101    ret != 0
2102}
2103
2104#[deprecated = "renamed to `SCNetworkInterface::set_extended_configuration`"]
2105#[inline]
2106pub unsafe extern "C-unwind" fn SCNetworkInterfaceSetExtendedConfiguration(
2107    interface: &SCNetworkInterface,
2108    extended_type: &CFString,
2109    config: Option<&CFDictionary>,
2110) -> bool {
2111    extern "C-unwind" {
2112        fn SCNetworkInterfaceSetExtendedConfiguration(
2113            interface: &SCNetworkInterface,
2114            extended_type: &CFString,
2115            config: Option<&CFDictionary>,
2116        ) -> Boolean;
2117    }
2118    let ret =
2119        unsafe { SCNetworkInterfaceSetExtendedConfiguration(interface, extended_type, config) };
2120    ret != 0
2121}
2122
2123#[deprecated = "renamed to `SCNetworkInterface::media_options`"]
2124#[inline]
2125pub unsafe extern "C-unwind" fn SCNetworkInterfaceCopyMediaOptions(
2126    interface: &SCNetworkInterface,
2127    current: *mut *const CFDictionary,
2128    active: *mut *const CFDictionary,
2129    available: *mut *const CFArray,
2130    filter: bool,
2131) -> bool {
2132    extern "C-unwind" {
2133        fn SCNetworkInterfaceCopyMediaOptions(
2134            interface: &SCNetworkInterface,
2135            current: *mut *const CFDictionary,
2136            active: *mut *const CFDictionary,
2137            available: *mut *const CFArray,
2138            filter: Boolean,
2139        ) -> Boolean;
2140    }
2141    let ret = unsafe {
2142        SCNetworkInterfaceCopyMediaOptions(interface, current, active, available, filter as _)
2143    };
2144    ret != 0
2145}
2146
2147#[deprecated = "renamed to `SCNetworkInterface::media_sub_types`"]
2148#[inline]
2149pub extern "C-unwind" fn SCNetworkInterfaceCopyMediaSubTypes(
2150    available: &CFArray,
2151) -> Option<CFRetained<CFArray>> {
2152    extern "C-unwind" {
2153        fn SCNetworkInterfaceCopyMediaSubTypes(available: &CFArray) -> Option<NonNull<CFArray>>;
2154    }
2155    let ret = unsafe { SCNetworkInterfaceCopyMediaSubTypes(available) };
2156    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2157}
2158
2159#[deprecated = "renamed to `SCNetworkInterface::media_sub_type_options`"]
2160#[inline]
2161pub extern "C-unwind" fn SCNetworkInterfaceCopyMediaSubTypeOptions(
2162    available: &CFArray,
2163    sub_type: &CFString,
2164) -> Option<CFRetained<CFArray>> {
2165    extern "C-unwind" {
2166        fn SCNetworkInterfaceCopyMediaSubTypeOptions(
2167            available: &CFArray,
2168            sub_type: &CFString,
2169        ) -> Option<NonNull<CFArray>>;
2170    }
2171    let ret = unsafe { SCNetworkInterfaceCopyMediaSubTypeOptions(available, sub_type) };
2172    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2173}
2174
2175#[deprecated = "renamed to `SCNetworkInterface::mtu`"]
2176#[inline]
2177pub unsafe extern "C-unwind" fn SCNetworkInterfaceCopyMTU(
2178    interface: &SCNetworkInterface,
2179    mtu_cur: *mut c_int,
2180    mtu_min: *mut c_int,
2181    mtu_max: *mut c_int,
2182) -> bool {
2183    extern "C-unwind" {
2184        fn SCNetworkInterfaceCopyMTU(
2185            interface: &SCNetworkInterface,
2186            mtu_cur: *mut c_int,
2187            mtu_min: *mut c_int,
2188            mtu_max: *mut c_int,
2189        ) -> Boolean;
2190    }
2191    let ret = unsafe { SCNetworkInterfaceCopyMTU(interface, mtu_cur, mtu_min, mtu_max) };
2192    ret != 0
2193}
2194
2195#[deprecated = "renamed to `SCNetworkInterface::set_media_options`"]
2196#[inline]
2197pub extern "C-unwind" fn SCNetworkInterfaceSetMediaOptions(
2198    interface: &SCNetworkInterface,
2199    subtype: Option<&CFString>,
2200    options: Option<&CFArray>,
2201) -> bool {
2202    extern "C-unwind" {
2203        fn SCNetworkInterfaceSetMediaOptions(
2204            interface: &SCNetworkInterface,
2205            subtype: Option<&CFString>,
2206            options: Option<&CFArray>,
2207        ) -> Boolean;
2208    }
2209    let ret = unsafe { SCNetworkInterfaceSetMediaOptions(interface, subtype, options) };
2210    ret != 0
2211}
2212
2213#[deprecated = "renamed to `SCNetworkInterface::set_mtu`"]
2214#[inline]
2215pub extern "C-unwind" fn SCNetworkInterfaceSetMTU(
2216    interface: &SCNetworkInterface,
2217    mtu: c_int,
2218) -> bool {
2219    extern "C-unwind" {
2220        fn SCNetworkInterfaceSetMTU(interface: &SCNetworkInterface, mtu: c_int) -> Boolean;
2221    }
2222    let ret = unsafe { SCNetworkInterfaceSetMTU(interface, mtu) };
2223    ret != 0
2224}
2225
2226#[deprecated = "renamed to `SCNetworkInterface::force_configuration_refresh`"]
2227#[inline]
2228pub extern "C-unwind" fn SCNetworkInterfaceForceConfigurationRefresh(
2229    interface: &SCNetworkInterface,
2230) -> bool {
2231    extern "C-unwind" {
2232        fn SCNetworkInterfaceForceConfigurationRefresh(interface: &SCNetworkInterface) -> Boolean;
2233    }
2234    let ret = unsafe { SCNetworkInterfaceForceConfigurationRefresh(interface) };
2235    ret != 0
2236}
2237
2238#[deprecated = "renamed to `SCBondStatus::member_interfaces`"]
2239#[inline]
2240pub extern "C-unwind" fn SCBondStatusGetMemberInterfaces(
2241    bond_status: &SCBondStatus,
2242) -> Option<CFRetained<CFArray>> {
2243    extern "C-unwind" {
2244        fn SCBondStatusGetMemberInterfaces(bond_status: &SCBondStatus) -> Option<NonNull<CFArray>>;
2245    }
2246    let ret = unsafe { SCBondStatusGetMemberInterfaces(bond_status) };
2247    ret.map(|ret| unsafe { CFRetained::retain(ret) })
2248}
2249
2250#[deprecated = "renamed to `SCBondStatus::interface_status`"]
2251#[inline]
2252pub extern "C-unwind" fn SCBondStatusGetInterfaceStatus(
2253    bond_status: &SCBondStatus,
2254    interface: Option<&SCNetworkInterface>,
2255) -> Option<CFRetained<CFDictionary>> {
2256    extern "C-unwind" {
2257        fn SCBondStatusGetInterfaceStatus(
2258            bond_status: &SCBondStatus,
2259            interface: Option<&SCNetworkInterface>,
2260        ) -> Option<NonNull<CFDictionary>>;
2261    }
2262    let ret = unsafe { SCBondStatusGetInterfaceStatus(bond_status, interface) };
2263    ret.map(|ret| unsafe { CFRetained::retain(ret) })
2264}
2265
2266#[deprecated = "renamed to `SCNetworkProtocol::configuration`"]
2267#[inline]
2268pub extern "C-unwind" fn SCNetworkProtocolGetConfiguration(
2269    protocol: &SCNetworkProtocol,
2270) -> Option<CFRetained<CFDictionary>> {
2271    extern "C-unwind" {
2272        fn SCNetworkProtocolGetConfiguration(
2273            protocol: &SCNetworkProtocol,
2274        ) -> Option<NonNull<CFDictionary>>;
2275    }
2276    let ret = unsafe { SCNetworkProtocolGetConfiguration(protocol) };
2277    ret.map(|ret| unsafe { CFRetained::retain(ret) })
2278}
2279
2280#[deprecated = "renamed to `SCNetworkProtocol::enabled`"]
2281#[inline]
2282pub extern "C-unwind" fn SCNetworkProtocolGetEnabled(protocol: &SCNetworkProtocol) -> bool {
2283    extern "C-unwind" {
2284        fn SCNetworkProtocolGetEnabled(protocol: &SCNetworkProtocol) -> Boolean;
2285    }
2286    let ret = unsafe { SCNetworkProtocolGetEnabled(protocol) };
2287    ret != 0
2288}
2289
2290#[deprecated = "renamed to `SCNetworkProtocol::protocol_type`"]
2291#[inline]
2292pub extern "C-unwind" fn SCNetworkProtocolGetProtocolType(
2293    protocol: &SCNetworkProtocol,
2294) -> Option<CFRetained<CFString>> {
2295    extern "C-unwind" {
2296        fn SCNetworkProtocolGetProtocolType(
2297            protocol: &SCNetworkProtocol,
2298        ) -> Option<NonNull<CFString>>;
2299    }
2300    let ret = unsafe { SCNetworkProtocolGetProtocolType(protocol) };
2301    ret.map(|ret| unsafe { CFRetained::retain(ret) })
2302}
2303
2304#[deprecated = "renamed to `SCNetworkProtocol::set_configuration`"]
2305#[inline]
2306pub unsafe extern "C-unwind" fn SCNetworkProtocolSetConfiguration(
2307    protocol: &SCNetworkProtocol,
2308    config: Option<&CFDictionary>,
2309) -> bool {
2310    extern "C-unwind" {
2311        fn SCNetworkProtocolSetConfiguration(
2312            protocol: &SCNetworkProtocol,
2313            config: Option<&CFDictionary>,
2314        ) -> Boolean;
2315    }
2316    let ret = unsafe { SCNetworkProtocolSetConfiguration(protocol, config) };
2317    ret != 0
2318}
2319
2320#[deprecated = "renamed to `SCNetworkProtocol::set_enabled`"]
2321#[inline]
2322pub extern "C-unwind" fn SCNetworkProtocolSetEnabled(
2323    protocol: &SCNetworkProtocol,
2324    enabled: bool,
2325) -> bool {
2326    extern "C-unwind" {
2327        fn SCNetworkProtocolSetEnabled(protocol: &SCNetworkProtocol, enabled: Boolean) -> Boolean;
2328    }
2329    let ret = unsafe { SCNetworkProtocolSetEnabled(protocol, enabled as _) };
2330    ret != 0
2331}
2332
2333#[deprecated = "renamed to `SCNetworkService::add_protocol_type`"]
2334#[inline]
2335pub extern "C-unwind" fn SCNetworkServiceAddProtocolType(
2336    service: &SCNetworkService,
2337    protocol_type: &CFString,
2338) -> bool {
2339    extern "C-unwind" {
2340        fn SCNetworkServiceAddProtocolType(
2341            service: &SCNetworkService,
2342            protocol_type: &CFString,
2343        ) -> Boolean;
2344    }
2345    let ret = unsafe { SCNetworkServiceAddProtocolType(service, protocol_type) };
2346    ret != 0
2347}
2348
2349#[cfg(feature = "SCPreferences")]
2350#[deprecated = "renamed to `SCNetworkService::all`"]
2351#[inline]
2352pub extern "C-unwind" fn SCNetworkServiceCopyAll(
2353    prefs: &SCPreferences,
2354) -> Option<CFRetained<CFArray>> {
2355    extern "C-unwind" {
2356        fn SCNetworkServiceCopyAll(prefs: &SCPreferences) -> Option<NonNull<CFArray>>;
2357    }
2358    let ret = unsafe { SCNetworkServiceCopyAll(prefs) };
2359    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2360}
2361
2362#[deprecated = "renamed to `SCNetworkService::protocols`"]
2363#[inline]
2364pub extern "C-unwind" fn SCNetworkServiceCopyProtocols(
2365    service: &SCNetworkService,
2366) -> Option<CFRetained<CFArray>> {
2367    extern "C-unwind" {
2368        fn SCNetworkServiceCopyProtocols(service: &SCNetworkService) -> Option<NonNull<CFArray>>;
2369    }
2370    let ret = unsafe { SCNetworkServiceCopyProtocols(service) };
2371    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2372}
2373
2374#[cfg(feature = "SCPreferences")]
2375#[deprecated = "renamed to `SCNetworkService::new`"]
2376#[inline]
2377pub extern "C-unwind" fn SCNetworkServiceCreate(
2378    prefs: &SCPreferences,
2379    interface: &SCNetworkInterface,
2380) -> Option<CFRetained<SCNetworkService>> {
2381    extern "C-unwind" {
2382        fn SCNetworkServiceCreate(
2383            prefs: &SCPreferences,
2384            interface: &SCNetworkInterface,
2385        ) -> Option<NonNull<SCNetworkService>>;
2386    }
2387    let ret = unsafe { SCNetworkServiceCreate(prefs, interface) };
2388    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2389}
2390
2391#[cfg(feature = "SCPreferences")]
2392#[deprecated = "renamed to `SCNetworkService::copy`"]
2393#[inline]
2394pub extern "C-unwind" fn SCNetworkServiceCopy(
2395    prefs: &SCPreferences,
2396    service_id: &CFString,
2397) -> Option<CFRetained<SCNetworkService>> {
2398    extern "C-unwind" {
2399        fn SCNetworkServiceCopy(
2400            prefs: &SCPreferences,
2401            service_id: &CFString,
2402        ) -> Option<NonNull<SCNetworkService>>;
2403    }
2404    let ret = unsafe { SCNetworkServiceCopy(prefs, service_id) };
2405    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2406}
2407
2408#[deprecated = "renamed to `SCNetworkService::establish_default_configuration`"]
2409#[inline]
2410pub extern "C-unwind" fn SCNetworkServiceEstablishDefaultConfiguration(
2411    service: &SCNetworkService,
2412) -> bool {
2413    extern "C-unwind" {
2414        fn SCNetworkServiceEstablishDefaultConfiguration(service: &SCNetworkService) -> Boolean;
2415    }
2416    let ret = unsafe { SCNetworkServiceEstablishDefaultConfiguration(service) };
2417    ret != 0
2418}
2419
2420#[deprecated = "renamed to `SCNetworkService::enabled`"]
2421#[inline]
2422pub extern "C-unwind" fn SCNetworkServiceGetEnabled(service: &SCNetworkService) -> bool {
2423    extern "C-unwind" {
2424        fn SCNetworkServiceGetEnabled(service: &SCNetworkService) -> Boolean;
2425    }
2426    let ret = unsafe { SCNetworkServiceGetEnabled(service) };
2427    ret != 0
2428}
2429
2430#[deprecated = "renamed to `SCNetworkService::interface`"]
2431#[inline]
2432pub extern "C-unwind" fn SCNetworkServiceGetInterface(
2433    service: &SCNetworkService,
2434) -> Option<CFRetained<SCNetworkInterface>> {
2435    extern "C-unwind" {
2436        fn SCNetworkServiceGetInterface(
2437            service: &SCNetworkService,
2438        ) -> Option<NonNull<SCNetworkInterface>>;
2439    }
2440    let ret = unsafe { SCNetworkServiceGetInterface(service) };
2441    ret.map(|ret| unsafe { CFRetained::retain(ret) })
2442}
2443
2444#[deprecated = "renamed to `SCNetworkService::name`"]
2445#[inline]
2446pub extern "C-unwind" fn SCNetworkServiceGetName(
2447    service: &SCNetworkService,
2448) -> Option<CFRetained<CFString>> {
2449    extern "C-unwind" {
2450        fn SCNetworkServiceGetName(service: &SCNetworkService) -> Option<NonNull<CFString>>;
2451    }
2452    let ret = unsafe { SCNetworkServiceGetName(service) };
2453    ret.map(|ret| unsafe { CFRetained::retain(ret) })
2454}
2455
2456#[deprecated = "renamed to `SCNetworkService::protocol`"]
2457#[inline]
2458pub extern "C-unwind" fn SCNetworkServiceCopyProtocol(
2459    service: &SCNetworkService,
2460    protocol_type: &CFString,
2461) -> Option<CFRetained<SCNetworkProtocol>> {
2462    extern "C-unwind" {
2463        fn SCNetworkServiceCopyProtocol(
2464            service: &SCNetworkService,
2465            protocol_type: &CFString,
2466        ) -> Option<NonNull<SCNetworkProtocol>>;
2467    }
2468    let ret = unsafe { SCNetworkServiceCopyProtocol(service, protocol_type) };
2469    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2470}
2471
2472#[deprecated = "renamed to `SCNetworkService::service_id`"]
2473#[inline]
2474pub extern "C-unwind" fn SCNetworkServiceGetServiceID(
2475    service: &SCNetworkService,
2476) -> Option<CFRetained<CFString>> {
2477    extern "C-unwind" {
2478        fn SCNetworkServiceGetServiceID(service: &SCNetworkService) -> Option<NonNull<CFString>>;
2479    }
2480    let ret = unsafe { SCNetworkServiceGetServiceID(service) };
2481    ret.map(|ret| unsafe { CFRetained::retain(ret) })
2482}
2483
2484#[deprecated = "renamed to `SCNetworkService::remove`"]
2485#[inline]
2486pub extern "C-unwind" fn SCNetworkServiceRemove(service: &SCNetworkService) -> bool {
2487    extern "C-unwind" {
2488        fn SCNetworkServiceRemove(service: &SCNetworkService) -> Boolean;
2489    }
2490    let ret = unsafe { SCNetworkServiceRemove(service) };
2491    ret != 0
2492}
2493
2494#[deprecated = "renamed to `SCNetworkService::remove_protocol_type`"]
2495#[inline]
2496pub extern "C-unwind" fn SCNetworkServiceRemoveProtocolType(
2497    service: &SCNetworkService,
2498    protocol_type: &CFString,
2499) -> bool {
2500    extern "C-unwind" {
2501        fn SCNetworkServiceRemoveProtocolType(
2502            service: &SCNetworkService,
2503            protocol_type: &CFString,
2504        ) -> Boolean;
2505    }
2506    let ret = unsafe { SCNetworkServiceRemoveProtocolType(service, protocol_type) };
2507    ret != 0
2508}
2509
2510#[deprecated = "renamed to `SCNetworkService::set_enabled`"]
2511#[inline]
2512pub extern "C-unwind" fn SCNetworkServiceSetEnabled(
2513    service: &SCNetworkService,
2514    enabled: bool,
2515) -> bool {
2516    extern "C-unwind" {
2517        fn SCNetworkServiceSetEnabled(service: &SCNetworkService, enabled: Boolean) -> Boolean;
2518    }
2519    let ret = unsafe { SCNetworkServiceSetEnabled(service, enabled as _) };
2520    ret != 0
2521}
2522
2523#[deprecated = "renamed to `SCNetworkService::set_name`"]
2524#[inline]
2525pub extern "C-unwind" fn SCNetworkServiceSetName(
2526    service: &SCNetworkService,
2527    name: Option<&CFString>,
2528) -> bool {
2529    extern "C-unwind" {
2530        fn SCNetworkServiceSetName(service: &SCNetworkService, name: Option<&CFString>) -> Boolean;
2531    }
2532    let ret = unsafe { SCNetworkServiceSetName(service, name) };
2533    ret != 0
2534}
2535
2536#[deprecated = "renamed to `SCNetworkSet::add_service`"]
2537#[inline]
2538pub extern "C-unwind" fn SCNetworkSetAddService(
2539    set: &SCNetworkSet,
2540    service: &SCNetworkService,
2541) -> bool {
2542    extern "C-unwind" {
2543        fn SCNetworkSetAddService(set: &SCNetworkSet, service: &SCNetworkService) -> Boolean;
2544    }
2545    let ret = unsafe { SCNetworkSetAddService(set, service) };
2546    ret != 0
2547}
2548
2549#[deprecated = "renamed to `SCNetworkSet::contains_interface`"]
2550#[inline]
2551pub extern "C-unwind" fn SCNetworkSetContainsInterface(
2552    set: &SCNetworkSet,
2553    interface: &SCNetworkInterface,
2554) -> bool {
2555    extern "C-unwind" {
2556        fn SCNetworkSetContainsInterface(
2557            set: &SCNetworkSet,
2558            interface: &SCNetworkInterface,
2559        ) -> Boolean;
2560    }
2561    let ret = unsafe { SCNetworkSetContainsInterface(set, interface) };
2562    ret != 0
2563}
2564
2565#[cfg(feature = "SCPreferences")]
2566#[deprecated = "renamed to `SCNetworkSet::all`"]
2567#[inline]
2568pub extern "C-unwind" fn SCNetworkSetCopyAll(prefs: &SCPreferences) -> Option<CFRetained<CFArray>> {
2569    extern "C-unwind" {
2570        fn SCNetworkSetCopyAll(prefs: &SCPreferences) -> Option<NonNull<CFArray>>;
2571    }
2572    let ret = unsafe { SCNetworkSetCopyAll(prefs) };
2573    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2574}
2575
2576#[cfg(feature = "SCPreferences")]
2577#[deprecated = "renamed to `SCNetworkSet::current`"]
2578#[inline]
2579pub extern "C-unwind" fn SCNetworkSetCopyCurrent(
2580    prefs: &SCPreferences,
2581) -> Option<CFRetained<SCNetworkSet>> {
2582    extern "C-unwind" {
2583        fn SCNetworkSetCopyCurrent(prefs: &SCPreferences) -> Option<NonNull<SCNetworkSet>>;
2584    }
2585    let ret = unsafe { SCNetworkSetCopyCurrent(prefs) };
2586    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2587}
2588
2589#[deprecated = "renamed to `SCNetworkSet::services`"]
2590#[inline]
2591pub extern "C-unwind" fn SCNetworkSetCopyServices(
2592    set: &SCNetworkSet,
2593) -> Option<CFRetained<CFArray>> {
2594    extern "C-unwind" {
2595        fn SCNetworkSetCopyServices(set: &SCNetworkSet) -> Option<NonNull<CFArray>>;
2596    }
2597    let ret = unsafe { SCNetworkSetCopyServices(set) };
2598    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2599}
2600
2601#[cfg(feature = "SCPreferences")]
2602#[deprecated = "renamed to `SCNetworkSet::new`"]
2603#[inline]
2604pub extern "C-unwind" fn SCNetworkSetCreate(
2605    prefs: &SCPreferences,
2606) -> Option<CFRetained<SCNetworkSet>> {
2607    extern "C-unwind" {
2608        fn SCNetworkSetCreate(prefs: &SCPreferences) -> Option<NonNull<SCNetworkSet>>;
2609    }
2610    let ret = unsafe { SCNetworkSetCreate(prefs) };
2611    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2612}
2613
2614#[cfg(feature = "SCPreferences")]
2615#[deprecated = "renamed to `SCNetworkSet::copy`"]
2616#[inline]
2617pub extern "C-unwind" fn SCNetworkSetCopy(
2618    prefs: &SCPreferences,
2619    set_id: &CFString,
2620) -> Option<CFRetained<SCNetworkSet>> {
2621    extern "C-unwind" {
2622        fn SCNetworkSetCopy(
2623            prefs: &SCPreferences,
2624            set_id: &CFString,
2625        ) -> Option<NonNull<SCNetworkSet>>;
2626    }
2627    let ret = unsafe { SCNetworkSetCopy(prefs, set_id) };
2628    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2629}
2630
2631#[deprecated = "renamed to `SCNetworkSet::name`"]
2632#[inline]
2633pub extern "C-unwind" fn SCNetworkSetGetName(set: &SCNetworkSet) -> Option<CFRetained<CFString>> {
2634    extern "C-unwind" {
2635        fn SCNetworkSetGetName(set: &SCNetworkSet) -> Option<NonNull<CFString>>;
2636    }
2637    let ret = unsafe { SCNetworkSetGetName(set) };
2638    ret.map(|ret| unsafe { CFRetained::retain(ret) })
2639}
2640
2641#[deprecated = "renamed to `SCNetworkSet::set_id`"]
2642#[inline]
2643pub extern "C-unwind" fn SCNetworkSetGetSetID(set: &SCNetworkSet) -> Option<CFRetained<CFString>> {
2644    extern "C-unwind" {
2645        fn SCNetworkSetGetSetID(set: &SCNetworkSet) -> Option<NonNull<CFString>>;
2646    }
2647    let ret = unsafe { SCNetworkSetGetSetID(set) };
2648    ret.map(|ret| unsafe { CFRetained::retain(ret) })
2649}
2650
2651#[deprecated = "renamed to `SCNetworkSet::service_order`"]
2652#[inline]
2653pub extern "C-unwind" fn SCNetworkSetGetServiceOrder(
2654    set: &SCNetworkSet,
2655) -> Option<CFRetained<CFArray>> {
2656    extern "C-unwind" {
2657        fn SCNetworkSetGetServiceOrder(set: &SCNetworkSet) -> Option<NonNull<CFArray>>;
2658    }
2659    let ret = unsafe { SCNetworkSetGetServiceOrder(set) };
2660    ret.map(|ret| unsafe { CFRetained::retain(ret) })
2661}
2662
2663#[deprecated = "renamed to `SCNetworkSet::remove`"]
2664#[inline]
2665pub extern "C-unwind" fn SCNetworkSetRemove(set: &SCNetworkSet) -> bool {
2666    extern "C-unwind" {
2667        fn SCNetworkSetRemove(set: &SCNetworkSet) -> Boolean;
2668    }
2669    let ret = unsafe { SCNetworkSetRemove(set) };
2670    ret != 0
2671}
2672
2673#[deprecated = "renamed to `SCNetworkSet::remove_service`"]
2674#[inline]
2675pub extern "C-unwind" fn SCNetworkSetRemoveService(
2676    set: &SCNetworkSet,
2677    service: &SCNetworkService,
2678) -> bool {
2679    extern "C-unwind" {
2680        fn SCNetworkSetRemoveService(set: &SCNetworkSet, service: &SCNetworkService) -> Boolean;
2681    }
2682    let ret = unsafe { SCNetworkSetRemoveService(set, service) };
2683    ret != 0
2684}
2685
2686#[deprecated = "renamed to `SCNetworkSet::set_current`"]
2687#[inline]
2688pub extern "C-unwind" fn SCNetworkSetSetCurrent(set: &SCNetworkSet) -> bool {
2689    extern "C-unwind" {
2690        fn SCNetworkSetSetCurrent(set: &SCNetworkSet) -> Boolean;
2691    }
2692    let ret = unsafe { SCNetworkSetSetCurrent(set) };
2693    ret != 0
2694}
2695
2696#[deprecated = "renamed to `SCNetworkSet::set_name`"]
2697#[inline]
2698pub extern "C-unwind" fn SCNetworkSetSetName(set: &SCNetworkSet, name: Option<&CFString>) -> bool {
2699    extern "C-unwind" {
2700        fn SCNetworkSetSetName(set: &SCNetworkSet, name: Option<&CFString>) -> Boolean;
2701    }
2702    let ret = unsafe { SCNetworkSetSetName(set, name) };
2703    ret != 0
2704}
2705
2706#[deprecated = "renamed to `SCNetworkSet::set_service_order`"]
2707#[inline]
2708pub unsafe extern "C-unwind" fn SCNetworkSetSetServiceOrder(
2709    set: &SCNetworkSet,
2710    new_order: &CFArray,
2711) -> bool {
2712    extern "C-unwind" {
2713        fn SCNetworkSetSetServiceOrder(set: &SCNetworkSet, new_order: &CFArray) -> Boolean;
2714    }
2715    let ret = unsafe { SCNetworkSetSetServiceOrder(set, new_order) };
2716    ret != 0
2717}