diff --git a/zeroconf/src/bonjour/browser.rs b/zeroconf/src/bonjour/browser.rs index 45fa1b3..ddead28 100644 --- a/zeroconf/src/bonjour/browser.rs +++ b/zeroconf/src/bonjour/browser.rs @@ -115,7 +115,7 @@ impl fmt::Debug for BonjourBrowserContext { } } -unsafe extern "C" fn browse_callback( +unsafe extern "system" fn browse_callback( _sd_ref: DNSServiceRef, _flags: DNSServiceFlags, interface_index: u32, @@ -160,7 +160,7 @@ unsafe fn handle_browse( ) } -unsafe extern "C" fn resolve_callback( +unsafe extern "system" fn resolve_callback( _sd_ref: DNSServiceRef, _flags: DNSServiceFlags, interface_index: u32, @@ -224,7 +224,7 @@ unsafe fn handle_resolve( ) } -unsafe extern "C" fn get_address_info_callback( +unsafe extern "system" fn get_address_info_callback( _sd_ref: DNSServiceRef, _flags: DNSServiceFlags, _interface_index: u32, diff --git a/zeroconf/src/bonjour/service.rs b/zeroconf/src/bonjour/service.rs index 7cff935..2e752b4 100644 --- a/zeroconf/src/bonjour/service.rs +++ b/zeroconf/src/bonjour/service.rs @@ -158,7 +158,7 @@ impl BonjourServiceContext { } } -unsafe extern "C" fn register_callback( +unsafe extern "system" fn register_callback( _sd_ref: DNSServiceRef, _flags: DNSServiceFlags, error: DNSServiceErrorType, diff --git a/zeroconf/src/bonjour/service_ref.rs b/zeroconf/src/bonjour/service_ref.rs index 4a39e28..1070b95 100644 --- a/zeroconf/src/bonjour/service_ref.rs +++ b/zeroconf/src/bonjour/service_ref.rs @@ -2,7 +2,7 @@ use crate::{bonjour::bonjour_util, Result}; use bonjour_sys::{ - DNSServiceBrowse, DNSServiceBrowseReply, DNSServiceFlags, DNSServiceGetAddrInfo, + dnssd_sock_t, DNSServiceBrowse, DNSServiceBrowseReply, DNSServiceFlags, DNSServiceGetAddrInfo, DNSServiceGetAddrInfoReply, DNSServiceProcessResult, DNSServiceProtocol, DNSServiceRef, DNSServiceRefDeallocate, DNSServiceRefSockFD, DNSServiceRegister, DNSServiceRegisterReply, DNSServiceResolve, DNSServiceResolveReply, @@ -177,16 +177,7 @@ impl ManagedDNSServiceRef { /// Delegate function for [`DNSServiceRefSockFD`]. /// /// [`DNSServiceRefSockFD`]: https://developer.apple.com/documentation/dnssd/1804698-dnsservicerefsockfd?language=objc - #[cfg(target_vendor = "apple")] - pub fn sock_fd(&self) -> i32 { - unsafe { DNSServiceRefSockFD(self.0) } - } - - /// Delegate function for [`DNSServiceRefSockFD`]. - /// - /// [`DNSServiceRefSockFD`]: https://developer.apple.com/documentation/dnssd/1804698-dnsservicerefsockfd?language=objc - #[cfg(target_vendor = "pc")] - pub fn sock_fd(&self) -> u64 { + pub fn sock_fd(&self) -> dnssd_sock_t { unsafe { DNSServiceRefSockFD(self.0) } } } diff --git a/zeroconf/src/ffi/mod.rs b/zeroconf/src/ffi/mod.rs index 15ac634..6fe23fa 100644 --- a/zeroconf/src/ffi/mod.rs +++ b/zeroconf/src/ffi/mod.rs @@ -104,7 +104,7 @@ pub(crate) mod bonjour { #[cfg(target_vendor = "pc")] pub(crate) mod bonjour { use crate::Result; - use bonjour_sys::{fd_set, select, timeval}; + use bonjour_sys::{dnssd_sock_t, fd_set, select, timeval}; #[cfg(target_vendor = "apple")] use std::mem; use std::ptr; @@ -115,7 +115,7 @@ pub(crate) mod bonjour { /// /// # Safety /// This function is unsafe because it directly interfaces with C-library system calls. - pub unsafe fn read_select(sock_fd: u64, timeout: Duration) -> Result { + pub unsafe fn read_select(sock_fd: dnssd_sock_t, timeout: Duration) -> Result { if timeout.as_secs() > i32::MAX as u64 { return Err( "Invalid timeout duration, as_secs() value exceeds ::libc::c_long. ".into(),