//! This file has been automatically generated by `objc2`'s `header-translator`. //! DO NOT EDIT use core::ffi::*; use core::ptr::NonNull; use objc2::__framework_prelude::*; use crate::*; extern "C" { /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsnetserviceserrorcode?language=objc) #[cfg(feature = "NSString")] pub static NSNetServicesErrorCode: &'static NSString; } extern "C" { /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsnetserviceserrordomain?language=objc) #[cfg(all(feature = "NSError", feature = "NSString"))] pub static NSNetServicesErrorDomain: &'static NSErrorDomain; } /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsnetserviceserror?language=objc) // NS_ENUM #[repr(transparent)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct NSNetServicesError(pub NSInteger); impl NSNetServicesError { #[doc(alias = "NSNetServicesUnknownError")] pub const UnknownError: Self = Self(-72000); #[doc(alias = "NSNetServicesCollisionError")] pub const CollisionError: Self = Self(-72001); #[doc(alias = "NSNetServicesNotFoundError")] pub const NotFoundError: Self = Self(-72002); #[doc(alias = "NSNetServicesActivityInProgress")] pub const ActivityInProgress: Self = Self(-72003); #[doc(alias = "NSNetServicesBadArgumentError")] pub const BadArgumentError: Self = Self(-72004); #[doc(alias = "NSNetServicesCancelledError")] pub const CancelledError: Self = Self(-72005); #[doc(alias = "NSNetServicesInvalidError")] pub const InvalidError: Self = Self(-72006); #[doc(alias = "NSNetServicesTimeoutError")] pub const TimeoutError: Self = Self(-72007); #[doc(alias = "NSNetServicesMissingRequiredConfigurationError")] pub const MissingRequiredConfigurationError: Self = Self(-72008); } unsafe impl Encode for NSNetServicesError { const ENCODING: Encoding = NSInteger::ENCODING; } unsafe impl RefEncode for NSNetServicesError { const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING); } /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsnetserviceoptions?language=objc) // NS_OPTIONS #[repr(transparent)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct NSNetServiceOptions(pub NSUInteger); bitflags::bitflags! { impl NSNetServiceOptions: NSUInteger { #[doc(alias = "NSNetServiceNoAutoRename")] const NoAutoRename = 1<<0; #[doc(alias = "NSNetServiceListenForConnections")] const ListenForConnections = 1<<1; } } unsafe impl Encode for NSNetServiceOptions { const ENCODING: Encoding = NSUInteger::ENCODING; } unsafe impl RefEncode for NSNetServiceOptions { const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING); } extern_class!( /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsnetservice?language=objc) #[unsafe(super(NSObject))] #[derive(Debug, PartialEq, Eq, Hash)] #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] pub struct NSNetService; ); extern_conformance!( unsafe impl NSObjectProtocol for NSNetService {} ); impl NSNetService { extern_methods!( #[cfg(feature = "NSString")] #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] #[unsafe(method(initWithDomain:type:name:port:))] #[unsafe(method_family = init)] pub fn initWithDomain_type_name_port( this: Allocated, domain: &NSString, r#type: &NSString, name: &NSString, port: c_int, ) -> Retained; #[cfg(feature = "NSString")] #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] #[unsafe(method(initWithDomain:type:name:))] #[unsafe(method_family = init)] pub fn initWithDomain_type_name( this: Allocated, domain: &NSString, r#type: &NSString, name: &NSString, ) -> Retained; #[cfg(all(feature = "NSObjCRuntime", feature = "NSRunLoop", feature = "NSString"))] /// # Safety /// /// `a_run_loop` possibly has additional threading requirements. #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] #[unsafe(method(scheduleInRunLoop:forMode:))] #[unsafe(method_family = none)] pub unsafe fn scheduleInRunLoop_forMode( &self, a_run_loop: &NSRunLoop, mode: &NSRunLoopMode, ); #[cfg(all(feature = "NSObjCRuntime", feature = "NSRunLoop", feature = "NSString"))] /// # Safety /// /// `a_run_loop` possibly has additional threading requirements. #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] #[unsafe(method(removeFromRunLoop:forMode:))] #[unsafe(method_family = none)] pub unsafe fn removeFromRunLoop_forMode( &self, a_run_loop: &NSRunLoop, mode: &NSRunLoopMode, ); /// # Safety /// /// This is not retained internally, you must ensure the object is still alive. #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] #[unsafe(method(delegate))] #[unsafe(method_family = none)] pub unsafe fn delegate(&self) -> Option>>; /// Setter for [`delegate`][Self::delegate]. /// /// # Safety /// /// This is unretained, you must ensure the object is kept alive while in use. #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] #[unsafe(method(setDelegate:))] #[unsafe(method_family = none)] pub unsafe fn setDelegate( &self, delegate: Option<&ProtocolObject>, ); #[unsafe(method(includesPeerToPeer))] #[unsafe(method_family = none)] pub fn includesPeerToPeer(&self) -> bool; /// Setter for [`includesPeerToPeer`][Self::includesPeerToPeer]. #[unsafe(method(setIncludesPeerToPeer:))] #[unsafe(method_family = none)] pub fn setIncludesPeerToPeer(&self, includes_peer_to_peer: bool); #[cfg(feature = "NSString")] #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] #[unsafe(method(name))] #[unsafe(method_family = none)] pub fn name(&self) -> Retained; #[cfg(feature = "NSString")] #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] #[unsafe(method(type))] #[unsafe(method_family = none)] pub fn r#type(&self) -> Retained; #[cfg(feature = "NSString")] #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] #[unsafe(method(domain))] #[unsafe(method_family = none)] pub fn domain(&self) -> Retained; #[cfg(feature = "NSString")] #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] #[unsafe(method(hostName))] #[unsafe(method_family = none)] pub fn hostName(&self) -> Option>; #[cfg(all(feature = "NSArray", feature = "NSData"))] #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] #[unsafe(method(addresses))] #[unsafe(method_family = none)] pub fn addresses(&self) -> Option>>; #[unsafe(method(port))] #[unsafe(method_family = none)] pub fn port(&self) -> NSInteger; #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] #[unsafe(method(publish))] #[unsafe(method_family = none)] pub fn publish(&self); #[unsafe(method(publishWithOptions:))] #[unsafe(method_family = none)] pub fn publishWithOptions(&self, options: NSNetServiceOptions); #[deprecated = "Not supported"] #[unsafe(method(resolve))] #[unsafe(method_family = none)] pub fn resolve(&self); #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] #[unsafe(method(stop))] #[unsafe(method_family = none)] pub fn stop(&self); #[cfg(all(feature = "NSData", feature = "NSDictionary", feature = "NSString"))] #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] #[unsafe(method(dictionaryFromTXTRecordData:))] #[unsafe(method_family = none)] pub fn dictionaryFromTXTRecordData( txt_data: &NSData, ) -> Retained>; #[cfg(all(feature = "NSData", feature = "NSDictionary", feature = "NSString"))] #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] #[unsafe(method(dataFromTXTRecordDictionary:))] #[unsafe(method_family = none)] pub fn dataFromTXTRecordDictionary( txt_dictionary: &NSDictionary, ) -> Retained; #[cfg(feature = "NSDate")] #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] #[unsafe(method(resolveWithTimeout:))] #[unsafe(method_family = none)] pub fn resolveWithTimeout(&self, timeout: NSTimeInterval); #[cfg(feature = "NSStream")] /// # Safety /// /// - `input_stream` must be a valid pointer or null. /// - `output_stream` must be a valid pointer or null. #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] #[unsafe(method(getInputStream:outputStream:))] #[unsafe(method_family = none)] pub unsafe fn getInputStream_outputStream( &self, input_stream: *mut *mut NSInputStream, output_stream: *mut *mut NSOutputStream, ) -> bool; #[cfg(feature = "NSData")] #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] #[unsafe(method(setTXTRecordData:))] #[unsafe(method_family = none)] pub fn setTXTRecordData(&self, record_data: Option<&NSData>) -> bool; #[cfg(feature = "NSData")] #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] #[unsafe(method(TXTRecordData))] #[unsafe(method_family = none)] pub fn TXTRecordData(&self) -> Option>; #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] #[unsafe(method(startMonitoring))] #[unsafe(method_family = none)] pub fn startMonitoring(&self); #[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"] #[unsafe(method(stopMonitoring))] #[unsafe(method_family = none)] pub fn stopMonitoring(&self); ); } /// Methods declared on superclass `NSObject`. impl NSNetService { extern_methods!( #[unsafe(method(init))] #[unsafe(method_family = init)] pub fn init(this: Allocated) -> Retained; #[unsafe(method(new))] #[unsafe(method_family = new)] pub fn new() -> Retained; ); } impl DefaultRetained for NSNetService { #[inline] fn default_retained() -> Retained { Self::new() } } extern_class!( /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsnetservicebrowser?language=objc) #[unsafe(super(NSObject))] #[derive(Debug, PartialEq, Eq, Hash)] #[deprecated = "Use nw_browser_t in Network framework instead"] pub struct NSNetServiceBrowser; ); extern_conformance!( unsafe impl NSObjectProtocol for NSNetServiceBrowser {} ); impl NSNetServiceBrowser { extern_methods!( #[deprecated = "Use nw_browser_t in Network framework instead"] #[unsafe(method(init))] #[unsafe(method_family = init)] pub fn init(this: Allocated) -> Retained; /// # Safety /// /// This is not retained internally, you must ensure the object is still alive. #[deprecated = "Use nw_browser_t in Network framework instead"] #[unsafe(method(delegate))] #[unsafe(method_family = none)] pub unsafe fn delegate( &self, ) -> Option>>; /// Setter for [`delegate`][Self::delegate]. /// /// # Safety /// /// This is unretained, you must ensure the object is kept alive while in use. #[deprecated = "Use nw_browser_t in Network framework instead"] #[unsafe(method(setDelegate:))] #[unsafe(method_family = none)] pub unsafe fn setDelegate( &self, delegate: Option<&ProtocolObject>, ); #[unsafe(method(includesPeerToPeer))] #[unsafe(method_family = none)] pub fn includesPeerToPeer(&self) -> bool; /// Setter for [`includesPeerToPeer`][Self::includesPeerToPeer]. #[unsafe(method(setIncludesPeerToPeer:))] #[unsafe(method_family = none)] pub fn setIncludesPeerToPeer(&self, includes_peer_to_peer: bool); #[cfg(all(feature = "NSObjCRuntime", feature = "NSRunLoop", feature = "NSString"))] /// # Safety /// /// `a_run_loop` possibly has additional threading requirements. #[deprecated = "Use nw_browser_t in Network framework instead"] #[unsafe(method(scheduleInRunLoop:forMode:))] #[unsafe(method_family = none)] pub unsafe fn scheduleInRunLoop_forMode( &self, a_run_loop: &NSRunLoop, mode: &NSRunLoopMode, ); #[cfg(all(feature = "NSObjCRuntime", feature = "NSRunLoop", feature = "NSString"))] /// # Safety /// /// `a_run_loop` possibly has additional threading requirements. #[deprecated = "Use nw_browser_t in Network framework instead"] #[unsafe(method(removeFromRunLoop:forMode:))] #[unsafe(method_family = none)] pub unsafe fn removeFromRunLoop_forMode( &self, a_run_loop: &NSRunLoop, mode: &NSRunLoopMode, ); #[deprecated = "Use nw_browser_t in Network framework instead"] #[unsafe(method(searchForBrowsableDomains))] #[unsafe(method_family = none)] pub fn searchForBrowsableDomains(&self); #[deprecated = "Use nw_browser_t in Network framework instead"] #[unsafe(method(searchForRegistrationDomains))] #[unsafe(method_family = none)] pub fn searchForRegistrationDomains(&self); #[cfg(feature = "NSString")] #[deprecated = "Use nw_browser_t in Network framework instead"] #[unsafe(method(searchForServicesOfType:inDomain:))] #[unsafe(method_family = none)] pub fn searchForServicesOfType_inDomain(&self, r#type: &NSString, domain_string: &NSString); #[deprecated = "Use nw_browser_t in Network framework instead"] #[unsafe(method(stop))] #[unsafe(method_family = none)] pub fn stop(&self); ); } /// Methods declared on superclass `NSObject`. impl NSNetServiceBrowser { extern_methods!( #[unsafe(method(new))] #[unsafe(method_family = new)] pub fn new() -> Retained; ); } impl DefaultRetained for NSNetServiceBrowser { #[inline] fn default_retained() -> Retained { Self::new() } } extern_protocol!( /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsnetservicedelegate?language=objc) pub unsafe trait NSNetServiceDelegate: NSObjectProtocol { #[optional] #[unsafe(method(netServiceWillPublish:))] #[unsafe(method_family = none)] fn netServiceWillPublish(&self, sender: &NSNetService); #[optional] #[unsafe(method(netServiceDidPublish:))] #[unsafe(method_family = none)] fn netServiceDidPublish(&self, sender: &NSNetService); #[cfg(all(feature = "NSDictionary", feature = "NSString", feature = "NSValue"))] #[optional] #[unsafe(method(netService:didNotPublish:))] #[unsafe(method_family = none)] fn netService_didNotPublish( &self, sender: &NSNetService, error_dict: &NSDictionary, ); #[optional] #[unsafe(method(netServiceWillResolve:))] #[unsafe(method_family = none)] fn netServiceWillResolve(&self, sender: &NSNetService); #[optional] #[unsafe(method(netServiceDidResolveAddress:))] #[unsafe(method_family = none)] fn netServiceDidResolveAddress(&self, sender: &NSNetService); #[cfg(all(feature = "NSDictionary", feature = "NSString", feature = "NSValue"))] #[optional] #[unsafe(method(netService:didNotResolve:))] #[unsafe(method_family = none)] fn netService_didNotResolve( &self, sender: &NSNetService, error_dict: &NSDictionary, ); #[optional] #[unsafe(method(netServiceDidStop:))] #[unsafe(method_family = none)] fn netServiceDidStop(&self, sender: &NSNetService); #[cfg(feature = "NSData")] #[optional] #[unsafe(method(netService:didUpdateTXTRecordData:))] #[unsafe(method_family = none)] fn netService_didUpdateTXTRecordData(&self, sender: &NSNetService, data: &NSData); #[cfg(feature = "NSStream")] #[optional] #[unsafe(method(netService:didAcceptConnectionWithInputStream:outputStream:))] #[unsafe(method_family = none)] fn netService_didAcceptConnectionWithInputStream_outputStream( &self, sender: &NSNetService, input_stream: &NSInputStream, output_stream: &NSOutputStream, ); } ); extern_protocol!( /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsnetservicebrowserdelegate?language=objc) pub unsafe trait NSNetServiceBrowserDelegate: NSObjectProtocol { #[optional] #[unsafe(method(netServiceBrowserWillSearch:))] #[unsafe(method_family = none)] fn netServiceBrowserWillSearch(&self, browser: &NSNetServiceBrowser); #[optional] #[unsafe(method(netServiceBrowserDidStopSearch:))] #[unsafe(method_family = none)] fn netServiceBrowserDidStopSearch(&self, browser: &NSNetServiceBrowser); #[cfg(all(feature = "NSDictionary", feature = "NSString", feature = "NSValue"))] #[optional] #[unsafe(method(netServiceBrowser:didNotSearch:))] #[unsafe(method_family = none)] fn netServiceBrowser_didNotSearch( &self, browser: &NSNetServiceBrowser, error_dict: &NSDictionary, ); #[cfg(feature = "NSString")] #[optional] #[unsafe(method(netServiceBrowser:didFindDomain:moreComing:))] #[unsafe(method_family = none)] fn netServiceBrowser_didFindDomain_moreComing( &self, browser: &NSNetServiceBrowser, domain_string: &NSString, more_coming: bool, ); #[optional] #[unsafe(method(netServiceBrowser:didFindService:moreComing:))] #[unsafe(method_family = none)] fn netServiceBrowser_didFindService_moreComing( &self, browser: &NSNetServiceBrowser, service: &NSNetService, more_coming: bool, ); #[cfg(feature = "NSString")] #[optional] #[unsafe(method(netServiceBrowser:didRemoveDomain:moreComing:))] #[unsafe(method_family = none)] fn netServiceBrowser_didRemoveDomain_moreComing( &self, browser: &NSNetServiceBrowser, domain_string: &NSString, more_coming: bool, ); #[optional] #[unsafe(method(netServiceBrowser:didRemoveService:moreComing:))] #[unsafe(method_family = none)] fn netServiceBrowser_didRemoveService_moreComing( &self, browser: &NSNetServiceBrowser, service: &NSNetService, more_coming: bool, ); } );