1use 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#[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 pub static kSCNetworkInterfaceType6to4: &'static CFString;
35}
36
37extern "C" {
38 pub static kSCNetworkInterfaceTypeBluetooth: &'static CFString;
40}
41
42extern "C" {
43 pub static kSCNetworkInterfaceTypeBond: &'static CFString;
45}
46
47extern "C" {
48 pub static kSCNetworkInterfaceTypeEthernet: &'static CFString;
50}
51
52extern "C" {
53 pub static kSCNetworkInterfaceTypeFireWire: &'static CFString;
55}
56
57extern "C" {
58 pub static kSCNetworkInterfaceTypeIEEE80211: &'static CFString;
60}
61
62extern "C" {
63 pub static kSCNetworkInterfaceTypeIPSec: &'static CFString;
65}
66
67extern "C" {
68 #[deprecated = "No longer supported"]
70 pub static kSCNetworkInterfaceTypeIrDA: &'static CFString;
71}
72
73extern "C" {
74 pub static kSCNetworkInterfaceTypeL2TP: &'static CFString;
76}
77
78extern "C" {
79 pub static kSCNetworkInterfaceTypeModem: &'static CFString;
81}
82
83extern "C" {
84 pub static kSCNetworkInterfaceTypePPP: &'static CFString;
86}
87
88extern "C" {
89 #[deprecated = "No longer supported"]
91 pub static kSCNetworkInterfaceTypePPTP: &'static CFString;
92}
93
94extern "C" {
95 pub static kSCNetworkInterfaceTypeSerial: &'static CFString;
97}
98
99extern "C" {
100 pub static kSCNetworkInterfaceTypeVLAN: &'static CFString;
102}
103
104extern "C" {
105 pub static kSCNetworkInterfaceTypeWWAN: &'static CFString;
107}
108
109extern "C" {
110 pub static kSCNetworkInterfaceTypeIPv4: &'static CFString;
112}
113
114extern "C" {
115 pub static kSCNetworkInterfaceIPv4: &'static SCNetworkInterface;
121}
122
123#[doc(alias = "SCBondInterfaceRef")]
128pub type SCBondInterface = SCNetworkInterface;
129
130#[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
149pub const kSCBondStatusOK: c_uint = 0;
151pub const kSCBondStatusLinkInvalid: c_uint = 1;
153pub const kSCBondStatusNoPartner: c_uint = 2;
155pub const kSCBondStatusNotInActiveGroup: c_uint = 3;
157pub const kSCBondStatusUnknown: c_uint = 999;
159
160extern "C" {
161 pub static kSCBondStatusDeviceAggregationStatus: &'static CFString;
163}
164
165extern "C" {
166 pub static kSCBondStatusDeviceCollecting: &'static CFString;
168}
169
170extern "C" {
171 pub static kSCBondStatusDeviceDistributing: &'static CFString;
173}
174
175#[doc(alias = "SCVLANInterfaceRef")]
180pub type SCVLANInterface = SCNetworkInterface;
181
182#[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 pub static kSCNetworkProtocolTypeDNS: &'static CFString;
204}
205
206extern "C" {
207 pub static kSCNetworkProtocolTypeIPv4: &'static CFString;
209}
210
211extern "C" {
212 pub static kSCNetworkProtocolTypeIPv6: &'static CFString;
214}
215
216extern "C" {
217 pub static kSCNetworkProtocolTypeProxies: &'static CFString;
219}
220
221extern "C" {
222 pub static kSCNetworkProtocolTypeSMB: &'static CFString;
224}
225
226#[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#[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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#[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#[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#[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#[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#[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#[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#[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#[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#[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#[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 #[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 #[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 #[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#[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#[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#[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#[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#[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#[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#[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#[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#[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#[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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}