objc2_network_extension/generated/
mod.rs

1// This file has been automatically generated by `objc2`'s `header-translator`.
2// DO NOT EDIT
3
4#![allow(unused_imports)]
5#![allow(deprecated)]
6#![allow(non_snake_case)]
7#![allow(non_camel_case_types)]
8#![allow(non_upper_case_globals)]
9#![allow(missing_docs)]
10#![allow(clippy::too_many_arguments)]
11#![allow(clippy::type_complexity)]
12#![allow(clippy::upper_case_acronyms)]
13#![allow(clippy::identity_op)]
14#![allow(clippy::missing_safety_doc)]
15#![allow(clippy::doc_lazy_continuation)]
16#![allow(rustdoc::broken_intra_doc_links)]
17#![allow(rustdoc::bare_urls)]
18#![allow(rustdoc::unportable_markdown)]
19#![allow(rustdoc::invalid_html_tags)]
20
21#[link(name = "NetworkExtension", kind = "framework")]
22extern "C" {}
23
24use core::ffi::*;
25use core::ptr::NonNull;
26#[cfg(feature = "dispatch2")]
27use dispatch2::*;
28use objc2::__framework_prelude::*;
29use objc2_foundation::*;
30#[cfg(feature = "objc2-security")]
31use objc2_security::*;
32
33use crate::*;
34
35/// Flow error codes
36///
37/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neappproxyflowerror?language=objc)
38// NS_ENUM
39#[repr(transparent)]
40#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
41pub struct NEAppProxyFlowError(pub NSInteger);
42impl NEAppProxyFlowError {
43    #[doc(alias = "NEAppProxyFlowErrorNotConnected")]
44    pub const NotConnected: Self = Self(1);
45    #[doc(alias = "NEAppProxyFlowErrorPeerReset")]
46    pub const PeerReset: Self = Self(2);
47    #[doc(alias = "NEAppProxyFlowErrorHostUnreachable")]
48    pub const HostUnreachable: Self = Self(3);
49    #[doc(alias = "NEAppProxyFlowErrorInvalidArgument")]
50    pub const InvalidArgument: Self = Self(4);
51    #[doc(alias = "NEAppProxyFlowErrorAborted")]
52    pub const Aborted: Self = Self(5);
53    #[doc(alias = "NEAppProxyFlowErrorRefused")]
54    pub const Refused: Self = Self(6);
55    #[doc(alias = "NEAppProxyFlowErrorTimedOut")]
56    pub const TimedOut: Self = Self(7);
57    #[doc(alias = "NEAppProxyFlowErrorInternal")]
58    pub const Internal: Self = Self(8);
59    #[doc(alias = "NEAppProxyFlowErrorDatagramTooLarge")]
60    pub const DatagramTooLarge: Self = Self(9);
61    #[doc(alias = "NEAppProxyFlowErrorReadAlreadyPending")]
62    pub const ReadAlreadyPending: Self = Self(10);
63}
64
65unsafe impl Encode for NEAppProxyFlowError {
66    const ENCODING: Encoding = NSInteger::ENCODING;
67}
68
69unsafe impl RefEncode for NEAppProxyFlowError {
70    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
71}
72
73extern "C" {
74    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/neappproxyerrordomain?language=objc)
75    pub static NEAppProxyErrorDomain: &'static NSString;
76}
77
78extern_class!(
79    /// The NEAppProxyFlow class is an abstract base class that declares the programmatic interface for a flow of network data.
80    ///
81    /// NEAppProxyFlow is part of NetworkExtension.framework.
82    ///
83    /// Instances of this class are thread safe.
84    ///
85    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neappproxyflow?language=objc)
86    #[unsafe(super(NSObject))]
87    #[derive(Debug, PartialEq, Eq, Hash)]
88    pub struct NEAppProxyFlow;
89);
90
91extern_conformance!(
92    unsafe impl NSObjectProtocol for NEAppProxyFlow {}
93);
94
95impl NEAppProxyFlow {
96    extern_methods!(
97        #[cfg(feature = "block2")]
98        /// This function is used by an NEProvider implementation to indicate that it is ready to handle flow data.
99        ///
100        /// Parameter `localEndpoint`: The address and port that should be used as the local endpoint of the socket associated with this flow. If the source application already specified a local endpoint by binding the socket then this parameter is ignored.
101        ///
102        /// Parameter `completionHandler`: A block that is called when the process of opening flow is complete. A nil value passed to this block indicates that the flow was opened successfully. A non-nil NSError value indicates that the flow failed to open successfully.
103        #[deprecated]
104        #[unsafe(method(openWithLocalEndpoint:completionHandler:))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn openWithLocalEndpoint_completionHandler(
107            &self,
108            local_endpoint: Option<&NWHostEndpoint>,
109            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
110        );
111
112        /// This function is used by an NEProvider implementation to indicate that it does not want to receive any more data from the flow.
113        ///
114        /// Parameter `error`: An error in NEAppProxyErrorDomain that should be passed to the flow's source application.
115        #[unsafe(method(closeReadWithError:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn closeReadWithError(&self, error: Option<&NSError>);
118
119        /// This functions is used by an NEProvider implementation to indicate that it does not have any more data to write to the flow.
120        ///
121        /// Parameter `error`: An error in NEAppProxyErrorDomain that should be passed to the flow's source application.
122        #[unsafe(method(closeWriteWithError:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn closeWriteWithError(&self, error: Option<&NSError>);
125
126        /// An NEFlowMetaData object containing meta data for the flow.
127        #[unsafe(method(metaData))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn metaData(&self) -> Retained<NEFlowMetaData>;
130
131        /// If the flow was created by passing a hostname to a "connect by name" API such as NSURLSession or Network.framework, this property is set to the
132        /// remote hostname.
133        #[unsafe(method(remoteHostname))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn remoteHostname(&self) -> Option<Retained<NSString>>;
136
137        /// YES if the flow was bound by the application to a specific interface (contained in the networkInterface property), NO otherwise.
138        #[unsafe(method(isBound))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn isBound(&self) -> bool;
141    );
142}
143
144/// Methods declared on superclass `NSObject`.
145impl NEAppProxyFlow {
146    extern_methods!(
147        #[unsafe(method(init))]
148        #[unsafe(method_family = init)]
149        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
150
151        #[unsafe(method(new))]
152        #[unsafe(method_family = new)]
153        pub unsafe fn new() -> Retained<Self>;
154    );
155}
156
157/// Provider stop reasons
158///
159/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neproviderstopreason?language=objc)
160// NS_ENUM
161#[repr(transparent)]
162#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
163pub struct NEProviderStopReason(pub NSInteger);
164impl NEProviderStopReason {
165    #[doc(alias = "NEProviderStopReasonNone")]
166    pub const None: Self = Self(0);
167    #[doc(alias = "NEProviderStopReasonUserInitiated")]
168    pub const UserInitiated: Self = Self(1);
169    #[doc(alias = "NEProviderStopReasonProviderFailed")]
170    pub const ProviderFailed: Self = Self(2);
171    #[doc(alias = "NEProviderStopReasonNoNetworkAvailable")]
172    pub const NoNetworkAvailable: Self = Self(3);
173    #[doc(alias = "NEProviderStopReasonUnrecoverableNetworkChange")]
174    pub const UnrecoverableNetworkChange: Self = Self(4);
175    #[doc(alias = "NEProviderStopReasonProviderDisabled")]
176    pub const ProviderDisabled: Self = Self(5);
177    #[doc(alias = "NEProviderStopReasonAuthenticationCanceled")]
178    pub const AuthenticationCanceled: Self = Self(6);
179    #[doc(alias = "NEProviderStopReasonConfigurationFailed")]
180    pub const ConfigurationFailed: Self = Self(7);
181    #[doc(alias = "NEProviderStopReasonIdleTimeout")]
182    pub const IdleTimeout: Self = Self(8);
183    #[doc(alias = "NEProviderStopReasonConfigurationDisabled")]
184    pub const ConfigurationDisabled: Self = Self(9);
185    #[doc(alias = "NEProviderStopReasonConfigurationRemoved")]
186    pub const ConfigurationRemoved: Self = Self(10);
187    #[doc(alias = "NEProviderStopReasonSuperceded")]
188    pub const Superceded: Self = Self(11);
189    #[doc(alias = "NEProviderStopReasonUserLogout")]
190    pub const UserLogout: Self = Self(12);
191    #[doc(alias = "NEProviderStopReasonUserSwitch")]
192    pub const UserSwitch: Self = Self(13);
193    #[doc(alias = "NEProviderStopReasonConnectionFailed")]
194    pub const ConnectionFailed: Self = Self(14);
195    #[doc(alias = "NEProviderStopReasonSleep")]
196    pub const Sleep: Self = Self(15);
197    #[doc(alias = "NEProviderStopReasonAppUpdate")]
198    pub const AppUpdate: Self = Self(16);
199    #[doc(alias = "NEProviderStopReasonInternalError")]
200    pub const InternalError: Self = Self(17);
201}
202
203unsafe impl Encode for NEProviderStopReason {
204    const ENCODING: Encoding = NSInteger::ENCODING;
205}
206
207unsafe impl RefEncode for NEProviderStopReason {
208    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
209}
210
211extern_class!(
212    /// The NEProvider class declares the programmatic interface that is common for all Network Extension providers.
213    ///
214    /// See the sub classes of NEProvider for more details. Developers of Network Extension providers should create sub classes of the sub classes of NEProvider.
215    ///
216    /// Instances of this class are thread safe.
217    ///
218    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neprovider?language=objc)
219    #[unsafe(super(NSObject))]
220    #[derive(Debug, PartialEq, Eq, Hash)]
221    pub struct NEProvider;
222);
223
224extern_conformance!(
225    unsafe impl NSObjectProtocol for NEProvider {}
226);
227
228impl NEProvider {
229    extern_methods!(
230        #[cfg(feature = "block2")]
231        /// This function is called by the framework when the system is about to go to sleep. Subclass developers can override this method to implement custom behavior such as closing connections or pausing some network activity.
232        ///
233        /// Parameter `completionHandler`: When the method is finished handling the sleep event it must execute this completion handler.
234        #[unsafe(method(sleepWithCompletionHandler:))]
235        #[unsafe(method_family = none)]
236        pub unsafe fn sleepWithCompletionHandler(
237            &self,
238            completion_handler: &block2::DynBlock<dyn Fn()>,
239        );
240
241        /// This function is called by the framework immediately after the system wakes up from sleep. Subclass developers can override this method to implement custom behavior such as re-establishing connections or resuming some network activity.
242        #[unsafe(method(wake))]
243        #[unsafe(method_family = none)]
244        pub unsafe fn wake(&self);
245
246        /// This function can be called by subclass implementations to create a TCP connection to a given network endpoint. This function should not be overridden by subclasses.
247        ///
248        /// Parameter `remoteEndpoint`: An NWEndpoint object that specifies the remote network endpoint to connect to.
249        ///
250        /// Parameter `enableTLS`: A flag indicating if a TLS session should be negotiated on the connection.
251        ///
252        /// Parameter `TLSParameters`: A set of optional TLS parameters. Only valid if enableTLS is YES. If TLSParameters is nil, the default system parameters will be used for TLS negotiation.
253        ///
254        /// Parameter `delegate`: An object to use as the connections delegate. This object should conform to the NWTCPConnectionAuthenticationDelegate protocol.
255        ///
256        /// Returns: An NWTCPConnection object.
257        #[deprecated = "Use nw_connection_t in Network framework instead"]
258        #[unsafe(method(createTCPConnectionToEndpoint:enableTLS:TLSParameters:delegate:))]
259        #[unsafe(method_family = none)]
260        pub unsafe fn createTCPConnectionToEndpoint_enableTLS_TLSParameters_delegate(
261            &self,
262            remote_endpoint: &NWEndpoint,
263            enable_tls: bool,
264            tls_parameters: Option<&NWTLSParameters>,
265            delegate: Option<&AnyObject>,
266        ) -> Retained<NWTCPConnection>;
267
268        /// This function can be called by subclass implementations to create a UDP session between a local network endpoint and a remote network endpoint. This function should not be overridden by subclasses.
269        ///
270        /// Parameter `remoteEndpoint`: An NWEndpoint object that specifies the remote endpoint to which UDP datagrams will be sent by the UDP session.
271        ///
272        /// Parameter `localEndpoint`: An NWHostEndpoint object that specifies the local IP address endpoint to use as the source endpoint of the UDP session.
273        ///
274        /// Returns: An NWUDPSession object.
275        #[deprecated = "Use nw_connection_t in Network framework instead"]
276        #[unsafe(method(createUDPSessionToEndpoint:fromEndpoint:))]
277        #[unsafe(method_family = none)]
278        pub unsafe fn createUDPSessionToEndpoint_fromEndpoint(
279            &self,
280            remote_endpoint: &NWEndpoint,
281            local_endpoint: Option<&NWHostEndpoint>,
282        ) -> Retained<NWUDPSession>;
283
284        #[cfg(feature = "block2")]
285        /// This method can be called by subclass implementations to display a message to the user.
286        ///
287        /// Parameter `message`: The message to be displayed.
288        ///
289        /// Parameter `completionHandler`: A block that is executed when the user acknowledges the message. If this method is called on a NEFilterDataProvider instance or the message cannot be displayed, then the completion handler block will be executed immediately with success parameter set to NO. If the message was successfully displayed to the user, then the completion handler block is executed with the success parameter set to YES when the user dismisses the message.
290        #[deprecated]
291        #[unsafe(method(displayMessage:completionHandler:))]
292        #[unsafe(method_family = none)]
293        pub unsafe fn displayMessage_completionHandler(
294            &self,
295            message: &NSString,
296            completion_handler: &block2::DynBlock<dyn Fn(Bool)>,
297        );
298
299        /// Start the Network Extension machinery in a system extension (.system bundle). This class method will cause the calling system extension to start handling
300        /// requests from nesessionmanager to instantiate appropriate NEProvider sub-class instances. The system extension must declare a mapping of Network Extension extension points to
301        /// NEProvider sub-class instances in its Info.plist:
302        /// Key: NetworkExtension
303        /// Type: Dictionary containing information about the NetworkExtension capabilities of the system extension.
304        ///
305        /// Key: NEProviderClasses
306        /// Type: Dictionary mapping NetworkExtension extension point identifiers to NEProvider sub-classes
307        ///
308        /// Example:
309        ///
310        /// <key
311        /// >NetworkExtension
312        /// </key
313        /// >
314        /// <dict
315        /// >
316        /// <key
317        /// >NEProviderClasses
318        /// </key
319        /// >
320        /// <dict
321        /// >
322        /// <key
323        /// >com.apple.networkextension.app-proxy
324        /// </key
325        /// >
326        /// <string
327        /// >$(PRODUCT_MODULE_NAME).AppProxyProvider
328        /// </string
329        /// >
330        /// <key
331        /// >com.apple.networkextension.filter-data
332        /// </key
333        /// >
334        /// <string
335        /// >$(PRODUCT_MODULE_NAME).FilterDataProvider
336        /// </string
337        /// >
338        /// </dict
339        /// >
340        /// </dict
341        /// >
342        ///
343        /// This method should be called as early as possible after the system extension starts.
344        #[unsafe(method(startSystemExtensionMode))]
345        #[unsafe(method_family = none)]
346        pub unsafe fn startSystemExtensionMode();
347
348        /// The current default path for connections created by the provider. Use KVO to watch for network changes.
349        #[deprecated = "Use nw_path_monitor_t in Network framework instead"]
350        #[unsafe(method(defaultPath))]
351        #[unsafe(method_family = none)]
352        pub unsafe fn defaultPath(&self) -> Option<Retained<NWPath>>;
353    );
354}
355
356/// Methods declared on superclass `NSObject`.
357impl NEProvider {
358    extern_methods!(
359        #[unsafe(method(init))]
360        #[unsafe(method_family = init)]
361        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
362
363        #[unsafe(method(new))]
364        #[unsafe(method_family = new)]
365        pub unsafe fn new() -> Retained<Self>;
366    );
367}
368
369/// Tunnel Provider error codes
370///
371/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netunnelprovidererror?language=objc)
372// NS_ENUM
373#[repr(transparent)]
374#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
375pub struct NETunnelProviderError(pub NSInteger);
376impl NETunnelProviderError {
377    #[doc(alias = "NETunnelProviderErrorNetworkSettingsInvalid")]
378    pub const NetworkSettingsInvalid: Self = Self(1);
379    #[doc(alias = "NETunnelProviderErrorNetworkSettingsCanceled")]
380    pub const NetworkSettingsCanceled: Self = Self(2);
381    #[doc(alias = "NETunnelProviderErrorNetworkSettingsFailed")]
382    pub const NetworkSettingsFailed: Self = Self(3);
383}
384
385unsafe impl Encode for NETunnelProviderError {
386    const ENCODING: Encoding = NSInteger::ENCODING;
387}
388
389unsafe impl RefEncode for NETunnelProviderError {
390    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
391}
392
393/// Network traffic routing methods.
394///
395/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netunnelproviderroutingmethod?language=objc)
396// NS_ENUM
397#[repr(transparent)]
398#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
399pub struct NETunnelProviderRoutingMethod(pub NSInteger);
400impl NETunnelProviderRoutingMethod {
401    #[doc(alias = "NETunnelProviderRoutingMethodDestinationIP")]
402    pub const DestinationIP: Self = Self(1);
403    #[doc(alias = "NETunnelProviderRoutingMethodSourceApplication")]
404    pub const SourceApplication: Self = Self(2);
405    #[doc(alias = "NETunnelProviderRoutingMethodNetworkRule")]
406    pub const NetworkRule: Self = Self(3);
407}
408
409unsafe impl Encode for NETunnelProviderRoutingMethod {
410    const ENCODING: Encoding = NSInteger::ENCODING;
411}
412
413unsafe impl RefEncode for NETunnelProviderRoutingMethod {
414    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
415}
416
417extern "C" {
418    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/netunnelprovidererrordomain?language=objc)
419    pub static NETunnelProviderErrorDomain: &'static NSString;
420}
421
422extern_class!(
423    /// The NETunnelProvider class declares the programmatic interface for an object that provides a network tunnel service.
424    ///
425    /// Instances of this class are thread safe.
426    ///
427    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netunnelprovider?language=objc)
428    #[unsafe(super(NEProvider, NSObject))]
429    #[derive(Debug, PartialEq, Eq, Hash)]
430    pub struct NETunnelProvider;
431);
432
433extern_conformance!(
434    unsafe impl NSObjectProtocol for NETunnelProvider {}
435);
436
437impl NETunnelProvider {
438    extern_methods!(
439        #[cfg(feature = "block2")]
440        /// This function is called by the framework when the container app sends a message to the provider. Subclasses should override this method to handle the message and optionally send a response.
441        ///
442        /// Parameter `messageData`: An NSData object containing the message sent by the container app.
443        ///
444        /// Parameter `completionHandler`: A block that the method can execute to send a response to the container app. If this parameter is non-nil then the method implementation should always execute the block. If this parameter is nil then the method implementation should treat this as an indication that the container app is not expecting a response.
445        #[unsafe(method(handleAppMessage:completionHandler:))]
446        #[unsafe(method_family = none)]
447        pub unsafe fn handleAppMessage_completionHandler(
448            &self,
449            message_data: &NSData,
450            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSData)>>,
451        );
452
453        #[cfg(feature = "block2")]
454        /// This function is called by tunnel provider implementations to set the network settings of the tunnel, including IP routes, DNS servers, and virtual interface addresses depending on the tunnel type. Subclasses should not override this method. This method can be called multiple times during the lifetime of a particular tunnel. It is not necessary to call this function with nil to clear out the existing settings before calling this function with a non-nil configuration.
455        ///
456        /// Parameter `tunnelNetworkSettings`: An NETunnelNetworkSettings object containing all of the desired network settings for the tunnel. Pass nil to clear out the current network settings.
457        ///
458        /// Parameter `completionHandler`: A block that will be called by the framework when the process of setting or clearing the network settings is complete. If an error occurred during the process of setting or clearing the IP network settings then a non-nill NSError object will be passed to this block containing error details.
459        #[unsafe(method(setTunnelNetworkSettings:completionHandler:))]
460        #[unsafe(method_family = none)]
461        pub unsafe fn setTunnelNetworkSettings_completionHandler(
462            &self,
463            tunnel_network_settings: Option<&NETunnelNetworkSettings>,
464            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
465        );
466
467        /// An NEVPNProtocol object containing the provider's current configuration. The value of this property may change during the lifetime of the tunnel provided by this NETunnelProvider, KVO can be used to detect when changes occur.  For different protocol types, this property will contain the corresponding subclass.   For NEVPNProtocolTypePlugin protocol type, this property will contain the NETunnelProviderProtocol subclass.  For NEVPNProtocolTypeIKEv2 protocol type, this property will contain the NEVPNProtocolIKEv2 subclass.
468        #[unsafe(method(protocolConfiguration))]
469        #[unsafe(method_family = none)]
470        pub unsafe fn protocolConfiguration(&self) -> Retained<NEVPNProtocol>;
471
472        /// An array of NEAppRule objects specifying which applications are currently being routed through the tunnel provided by this NETunnelProvider. If application-based routing is not enabled for the tunnel, then this property is set to nil.
473        #[unsafe(method(appRules))]
474        #[unsafe(method_family = none)]
475        pub unsafe fn appRules(&self) -> Option<Retained<NSArray<NEAppRule>>>;
476
477        /// The method by which network traffic is routed to the tunnel. The default is NETunnelProviderRoutingMethodDestinationIP.
478        #[unsafe(method(routingMethod))]
479        #[unsafe(method_family = none)]
480        pub unsafe fn routingMethod(&self) -> NETunnelProviderRoutingMethod;
481
482        /// A flag that indicates to the framework if this NETunnelProvider is currently re-establishing the tunnel. Setting this flag will cause the session status visible to the user to change to "Reasserting". Clearing this flag will change the user-visible status of the session back to "Connected". Setting and clearing this flag only has an effect if the session is in the "Connected" state.
483        #[unsafe(method(reasserting))]
484        #[unsafe(method_family = none)]
485        pub unsafe fn reasserting(&self) -> bool;
486
487        /// Setter for [`reasserting`][Self::reasserting].
488        #[unsafe(method(setReasserting:))]
489        #[unsafe(method_family = none)]
490        pub unsafe fn setReasserting(&self, reasserting: bool);
491    );
492}
493
494/// Methods declared on superclass `NSObject`.
495impl NETunnelProvider {
496    extern_methods!(
497        #[unsafe(method(init))]
498        #[unsafe(method_family = init)]
499        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
500
501        #[unsafe(method(new))]
502        #[unsafe(method_family = new)]
503        pub unsafe fn new() -> Retained<Self>;
504    );
505}
506
507extern_class!(
508    /// The NEAppProxyProvider class declares the programmatic interface for an object that implements the client side of a custom network proxy solution.
509    ///
510    /// NEAppProxyProvider is part of NetworkExtension.framework
511    ///
512    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neappproxyprovider?language=objc)
513    #[unsafe(super(NETunnelProvider, NEProvider, NSObject))]
514    #[derive(Debug, PartialEq, Eq, Hash)]
515    pub struct NEAppProxyProvider;
516);
517
518extern_conformance!(
519    unsafe impl NSObjectProtocol for NEAppProxyProvider {}
520);
521
522impl NEAppProxyProvider {
523    extern_methods!(
524        #[cfg(feature = "block2")]
525        /// This function is called by the framework when a new proxy instance is being created. Subclasses must override this method to perform whatever steps are necessary to ready the proxy for handling flows of network data.
526        ///
527        /// Parameter `options`: A dictionary containing keys and values passed by the provider's containing app. If the containing app did not start the proxy then this parameter will be nil.
528        ///
529        /// Parameter `completionHandler`: A block that must be called when the process of starting the proxy is complete. If the proxy cannot be started then the subclass' implementation of this method must pass a non-nil NSError object to this block. A value of nil passed to the completion handler indicates that the proxy was successfully started.
530        #[unsafe(method(startProxyWithOptions:completionHandler:))]
531        #[unsafe(method_family = none)]
532        pub unsafe fn startProxyWithOptions_completionHandler(
533            &self,
534            options: Option<&NSDictionary<NSString, AnyObject>>,
535            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
536        );
537
538        #[cfg(feature = "block2")]
539        /// This function is called by the framework when the proxy is being stopped. Subclasses must override this method to perform whatever steps are necessary to stop the proxy.
540        ///
541        /// Parameter `reason`: An NEProviderStopReason indicating why the proxy is being stopped.
542        ///
543        /// Parameter `completionHandler`: A block that must be called when the proxy is completely stopped.
544        #[unsafe(method(stopProxyWithReason:completionHandler:))]
545        #[unsafe(method_family = none)]
546        pub unsafe fn stopProxyWithReason_completionHandler(
547            &self,
548            reason: NEProviderStopReason,
549            completion_handler: &block2::DynBlock<dyn Fn()>,
550        );
551
552        /// This function is called by proxy provider implementations to stop the proxy when a network error is encountered that renders the proxy no longer viable. Subclasses should not override this method.
553        ///
554        /// Parameter `error`: An NSError object containing details about the error that the proxy provider implementation encountered.
555        #[unsafe(method(cancelProxyWithError:))]
556        #[unsafe(method_family = none)]
557        pub unsafe fn cancelProxyWithError(&self, error: Option<&NSError>);
558
559        /// This function is called by the framework to deliver a new network data flow to the proxy provider implementation. Subclasses must override this method to perform whatever steps are necessary to ready the proxy to receive data from the flow. The proxy provider implementation indicates that the proxy is ready to handle flow data by calling -[NEAppProxyFlow openWithLocalFlowEndpoint:completionHandler:] on the flow. If the proxy implementation decides to not handle the flow and instead terminate it, the subclass implementation of this method should return NO. If the proxy implementation decides to handle the flow, the subclass implementation of this method should return YES. In this case the proxy implementation is responsible for retaining the NEAppProxyFlow object.
560        ///
561        /// Parameter `flow`: The new flow
562        ///
563        /// Returns: YES if the proxy implementation has retained the flow and intends to handle the flow data. NO if the proxy implementation has not retained the flow and will not handle the flow data. In NETransparentProxyProvider sub-classes returning NO causes the flow to be handled by the networking stack without any proxy. In all other cases the flow is terminated when NO is returned.
564        #[unsafe(method(handleNewFlow:))]
565        #[unsafe(method_family = none)]
566        pub unsafe fn handleNewFlow(&self, flow: &NEAppProxyFlow) -> bool;
567
568        /// This function is called by the framework to deliver a new UDP data flow to the proxy provider implementation. Subclasses can override this method to perform whatever steps are necessary to ready the proxy to receive
569        /// data from the flow. The proxy provider implementation indicates that the proxy is ready to handle flow data by calling -[NEAppProxyFlow openWithLocalEndpoint:completionHandler:] on the flow. If the proxy implementation decides
570        /// to not handle the flow and instead terminate it, the subclass implementation of this method should return NO. If the proxy implementation decides to handle the flow, the subclass implementation of this method should return YES.
571        /// In this case the proxy implementation is responsible for retaining the NEAppProxyUDPFlow object.
572        /// The default implementation of this method calls -[NEAppProxyProvider handleNewFlow:] and returns its result.
573        ///
574        /// Parameter `flow`: The new UDP flow
575        ///
576        /// Parameter `remoteEndpoint`: The initial remote endpoint provided by the proxied app when the flow was opened.
577        ///
578        /// Returns: YES if the proxy implementation has retained the flow and intends to handle the flow data. NO if the proxy implementation has not retained the flow and will not handle the flow data. In NETransparentProxyProvider sub-classes returning NO causes the flow to be handled by the networking stack without any proxy. In all other cases the flow is terminated when NO is returned.
579        #[deprecated]
580        #[unsafe(method(handleNewUDPFlow:initialRemoteEndpoint:))]
581        #[unsafe(method_family = none)]
582        pub unsafe fn handleNewUDPFlow_initialRemoteEndpoint(
583            &self,
584            flow: &NEAppProxyUDPFlow,
585            remote_endpoint: &NWEndpoint,
586        ) -> bool;
587    );
588}
589
590/// Methods declared on superclass `NSObject`.
591impl NEAppProxyProvider {
592    extern_methods!(
593        #[unsafe(method(init))]
594        #[unsafe(method_family = init)]
595        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
596
597        #[unsafe(method(new))]
598        #[unsafe(method_family = new)]
599        pub unsafe fn new() -> Retained<Self>;
600    );
601}
602
603/// VPN error codes
604///
605/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnerror?language=objc)
606// NS_ENUM
607#[repr(transparent)]
608#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
609pub struct NEVPNError(pub NSInteger);
610impl NEVPNError {
611    #[doc(alias = "NEVPNErrorConfigurationInvalid")]
612    pub const ConfigurationInvalid: Self = Self(1);
613    #[doc(alias = "NEVPNErrorConfigurationDisabled")]
614    pub const ConfigurationDisabled: Self = Self(2);
615    #[doc(alias = "NEVPNErrorConnectionFailed")]
616    pub const ConnectionFailed: Self = Self(3);
617    #[doc(alias = "NEVPNErrorConfigurationStale")]
618    pub const ConfigurationStale: Self = Self(4);
619    #[doc(alias = "NEVPNErrorConfigurationReadWriteFailed")]
620    pub const ConfigurationReadWriteFailed: Self = Self(5);
621    #[doc(alias = "NEVPNErrorConfigurationUnknown")]
622    pub const ConfigurationUnknown: Self = Self(6);
623}
624
625unsafe impl Encode for NEVPNError {
626    const ENCODING: Encoding = NSInteger::ENCODING;
627}
628
629unsafe impl RefEncode for NEVPNError {
630    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
631}
632
633extern "C" {
634    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnerrordomain?language=objc)
635    pub static NEVPNErrorDomain: &'static NSString;
636}
637
638extern "C" {
639    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnconfigurationchangenotification?language=objc)
640    pub static NEVPNConfigurationChangeNotification: &'static NSString;
641}
642
643extern_class!(
644    /// The NEVPNManager class declares the programmatic interface for an object that manages Virtual Private Network (VPN) configurations.
645    ///
646    /// NEVPNManager declares methods and properties for configuring and controlling a VPN.
647    ///
648    /// Instances of this class are thread safe.
649    ///
650    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnmanager?language=objc)
651    #[unsafe(super(NSObject))]
652    #[derive(Debug, PartialEq, Eq, Hash)]
653    pub struct NEVPNManager;
654);
655
656extern_conformance!(
657    unsafe impl NSObjectProtocol for NEVPNManager {}
658);
659
660impl NEVPNManager {
661    extern_methods!(
662        /// Returns: The singleton NEVPNManager object for the calling process.
663        #[unsafe(method(sharedManager))]
664        #[unsafe(method_family = none)]
665        pub unsafe fn sharedManager() -> Retained<NEVPNManager>;
666
667        #[cfg(feature = "block2")]
668        /// This function loads the current VPN configuration from the caller's VPN preferences.
669        ///
670        /// Parameter `completionHandler`: A block that will be called on the main thread when the load operation is completed. The NSError passed to this block will be nil if the load operation succeeded, non-nil otherwise.
671        #[unsafe(method(loadFromPreferencesWithCompletionHandler:))]
672        #[unsafe(method_family = none)]
673        pub unsafe fn loadFromPreferencesWithCompletionHandler(
674            &self,
675            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
676        );
677
678        #[cfg(feature = "block2")]
679        /// This function removes the VPN configuration from the caller's VPN preferences. If the VPN is enabled, has VPN On Demand enabled, and has VPN On Demand rules, the VPN is disabled and the VPN On Demand rules are de-activated.
680        ///
681        /// Parameter `completionHandler`: A block that will be called on the main thread when the remove operation is completed. The NSError passed to this block will be nil if the remove operation succeeded, non-nil otherwise.
682        #[unsafe(method(removeFromPreferencesWithCompletionHandler:))]
683        #[unsafe(method_family = none)]
684        pub unsafe fn removeFromPreferencesWithCompletionHandler(
685            &self,
686            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
687        );
688
689        #[cfg(feature = "block2")]
690        /// This function saves the VPN configuration in the caller's VPN preferences. If the VPN is enabled, has VPN On Demand enabled, and has VPN On Demand rules, the VPN On Demand rules are activated.
691        ///
692        ///
693        /// Parameter `completionHandler`: A block that will be called on the main thread when the save operation is completed. The NSError passed to this block will be nil if the save operation succeeded, non-nil otherwise.
694        #[unsafe(method(saveToPreferencesWithCompletionHandler:))]
695        #[unsafe(method_family = none)]
696        pub unsafe fn saveToPreferencesWithCompletionHandler(
697            &self,
698            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
699        );
700
701        #[cfg(feature = "objc2-security")]
702        /// This function sets an authorization object that can be used to obtain the authorization rights necessary to modify the system VPN configuration.
703        ///
704        /// Parameter `authorization`: The AuthorizationRef to use to obtain rights.
705        #[unsafe(method(setAuthorization:))]
706        #[unsafe(method_family = none)]
707        pub unsafe fn setAuthorization(&self, authorization: AuthorizationRef);
708
709        /// An array of NEOnDemandRule objects.
710        #[unsafe(method(onDemandRules))]
711        #[unsafe(method_family = none)]
712        pub unsafe fn onDemandRules(&self) -> Option<Retained<NSArray<NEOnDemandRule>>>;
713
714        /// Setter for [`onDemandRules`][Self::onDemandRules].
715        #[unsafe(method(setOnDemandRules:))]
716        #[unsafe(method_family = none)]
717        pub unsafe fn setOnDemandRules(&self, on_demand_rules: Option<&NSArray<NEOnDemandRule>>);
718
719        /// Toggles VPN On Demand.
720        #[unsafe(method(isOnDemandEnabled))]
721        #[unsafe(method_family = none)]
722        pub unsafe fn isOnDemandEnabled(&self) -> bool;
723
724        /// Setter for [`isOnDemandEnabled`][Self::isOnDemandEnabled].
725        #[unsafe(method(setOnDemandEnabled:))]
726        #[unsafe(method_family = none)]
727        pub unsafe fn setOnDemandEnabled(&self, on_demand_enabled: bool);
728
729        /// A string containing a description of the VPN.
730        #[unsafe(method(localizedDescription))]
731        #[unsafe(method_family = none)]
732        pub unsafe fn localizedDescription(&self) -> Option<Retained<NSString>>;
733
734        /// Setter for [`localizedDescription`][Self::localizedDescription].
735        #[unsafe(method(setLocalizedDescription:))]
736        #[unsafe(method_family = none)]
737        pub unsafe fn setLocalizedDescription(&self, localized_description: Option<&NSString>);
738
739        /// An NEVPNProtocol object containing the protocol-specific portion of the VPN configuration.
740        #[deprecated]
741        #[unsafe(method(protocol))]
742        #[unsafe(method_family = none)]
743        pub unsafe fn protocol(&self) -> Option<Retained<NEVPNProtocol>>;
744
745        /// Setter for [`protocol`][Self::protocol].
746        #[deprecated]
747        #[unsafe(method(setProtocol:))]
748        #[unsafe(method_family = none)]
749        pub unsafe fn setProtocol(&self, protocol: Option<&NEVPNProtocol>);
750
751        /// An NEVPNProtocol object containing the protocol-specific portion of the VPN configuration.
752        #[unsafe(method(protocolConfiguration))]
753        #[unsafe(method_family = none)]
754        pub unsafe fn protocolConfiguration(&self) -> Option<Retained<NEVPNProtocol>>;
755
756        /// Setter for [`protocolConfiguration`][Self::protocolConfiguration].
757        #[unsafe(method(setProtocolConfiguration:))]
758        #[unsafe(method_family = none)]
759        pub unsafe fn setProtocolConfiguration(
760            &self,
761            protocol_configuration: Option<&NEVPNProtocol>,
762        );
763
764        /// The NEVPNConnection object used for controlling the VPN tunnel.
765        #[unsafe(method(connection))]
766        #[unsafe(method_family = none)]
767        pub unsafe fn connection(&self) -> Retained<NEVPNConnection>;
768
769        /// Toggles the enabled status of the VPN. Setting this property will disable VPN configurations of other apps. This property will be set to NO  when other VPN configurations are enabled.
770        #[unsafe(method(isEnabled))]
771        #[unsafe(method_family = none)]
772        pub unsafe fn isEnabled(&self) -> bool;
773
774        /// Setter for [`isEnabled`][Self::isEnabled].
775        #[unsafe(method(setEnabled:))]
776        #[unsafe(method_family = none)]
777        pub unsafe fn setEnabled(&self, enabled: bool);
778    );
779}
780
781/// Methods declared on superclass `NSObject`.
782impl NEVPNManager {
783    extern_methods!(
784        #[unsafe(method(init))]
785        #[unsafe(method_family = init)]
786        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
787
788        #[unsafe(method(new))]
789        #[unsafe(method_family = new)]
790        pub unsafe fn new() -> Retained<Self>;
791    );
792}
793
794extern_class!(
795    /// The NETunnelProviderManager class declares the programmatic interface for an object that is used to configure and control network tunnels provided by NETunnelProviders.
796    ///
797    /// Instances of this class are thread safe.
798    ///
799    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netunnelprovidermanager?language=objc)
800    #[unsafe(super(NEVPNManager, NSObject))]
801    #[derive(Debug, PartialEq, Eq, Hash)]
802    pub struct NETunnelProviderManager;
803);
804
805extern_conformance!(
806    unsafe impl NSObjectProtocol for NETunnelProviderManager {}
807);
808
809impl NETunnelProviderManager {
810    extern_methods!(
811        #[cfg(feature = "block2")]
812        /// This function asynchronously reads all of the NETunnelProvider configurations created by the calling app that have previously been saved to disk and returns them as NETunnelProviderManager objects.
813        ///
814        /// Parameter `completionHandler`: A block that takes an array NETunnelProviderManager objects. The array passed to the block may be empty if no NETunnelProvider configurations were successfully read from the disk.  The NSError passed to this block will be nil if the load operation succeeded, non-nil otherwise.
815        #[unsafe(method(loadAllFromPreferencesWithCompletionHandler:))]
816        #[unsafe(method_family = none)]
817        pub unsafe fn loadAllFromPreferencesWithCompletionHandler(
818            completion_handler: &block2::DynBlock<
819                dyn Fn(*mut NSArray<NETunnelProviderManager>, *mut NSError),
820            >,
821        );
822
823        /// Create a NETunnelProviderManager instance that is used to manage a per-app VPN configuration.
824        #[unsafe(method(forPerAppVPN))]
825        #[unsafe(method_family = none)]
826        pub unsafe fn forPerAppVPN() -> Retained<Self>;
827
828        /// This function returns an array of NEAppRule objects.
829        #[unsafe(method(copyAppRules))]
830        #[unsafe(method_family = copy)]
831        pub unsafe fn copyAppRules(&self) -> Option<Retained<NSArray<NEAppRule>>>;
832
833        /// The method by which network traffic is routed to the tunnel. The default is NETunnelProviderRoutingMethodDestinationIP.
834        #[unsafe(method(routingMethod))]
835        #[unsafe(method_family = none)]
836        pub unsafe fn routingMethod(&self) -> NETunnelProviderRoutingMethod;
837
838        /// An array of domain strings. Only applies to per-app VPN configurations. When the per-app VPN is enabled and the user navigates in Safari to a web site within one of these domains,
839        /// the web site network traffic is routed through the per-app VPN.
840        #[unsafe(method(safariDomains))]
841        #[unsafe(method_family = none)]
842        pub unsafe fn safariDomains(&self) -> Retained<NSArray<NSString>>;
843
844        /// Setter for [`safariDomains`][Self::safariDomains].
845        #[unsafe(method(setSafariDomains:))]
846        #[unsafe(method_family = none)]
847        pub unsafe fn setSafariDomains(&self, safari_domains: &NSArray<NSString>);
848
849        /// An array of domain strings. Only applies to per-app VPN configurations. When the per-app VPN is enabled, connections from the Mail app to mail servers within
850        /// one of these domains are routed through the per-app VPN.
851        #[unsafe(method(mailDomains))]
852        #[unsafe(method_family = none)]
853        pub unsafe fn mailDomains(&self) -> Retained<NSArray<NSString>>;
854
855        /// Setter for [`mailDomains`][Self::mailDomains].
856        #[unsafe(method(setMailDomains:))]
857        #[unsafe(method_family = none)]
858        pub unsafe fn setMailDomains(&self, mail_domains: &NSArray<NSString>);
859
860        /// An array of domain strings. Only applies to per-app VPN configurations. When the per-app VPN is enabled, connections from the Calendar app to calendar servers within one of
861        /// these domains are routed through the per-app VPN.
862        #[unsafe(method(calendarDomains))]
863        #[unsafe(method_family = none)]
864        pub unsafe fn calendarDomains(&self) -> Retained<NSArray<NSString>>;
865
866        /// Setter for [`calendarDomains`][Self::calendarDomains].
867        #[unsafe(method(setCalendarDomains:))]
868        #[unsafe(method_family = none)]
869        pub unsafe fn setCalendarDomains(&self, calendar_domains: &NSArray<NSString>);
870
871        /// An array of domain strings. Only applies to per-app VPN configurations. When the per-app VPN is enabled, connections from the Contacts app to contacts servers within one of these
872        /// domains are routed through the per-app VPN.
873        #[unsafe(method(contactsDomains))]
874        #[unsafe(method_family = none)]
875        pub unsafe fn contactsDomains(&self) -> Retained<NSArray<NSString>>;
876
877        /// Setter for [`contactsDomains`][Self::contactsDomains].
878        #[unsafe(method(setContactsDomains:))]
879        #[unsafe(method_family = none)]
880        pub unsafe fn setContactsDomains(&self, contacts_domains: &NSArray<NSString>);
881
882        #[unsafe(method(appRules))]
883        #[unsafe(method_family = none)]
884        pub unsafe fn appRules(&self) -> Retained<NSArray<NEAppRule>>;
885
886        /// Setter for [`appRules`][Self::appRules].
887        #[unsafe(method(setAppRules:))]
888        #[unsafe(method_family = none)]
889        pub unsafe fn setAppRules(&self, app_rules: &NSArray<NEAppRule>);
890
891        /// per-app VPN.
892        #[unsafe(method(excludedDomains))]
893        #[unsafe(method_family = none)]
894        pub unsafe fn excludedDomains(&self) -> Retained<NSArray<NSString>>;
895
896        /// Setter for [`excludedDomains`][Self::excludedDomains].
897        #[unsafe(method(setExcludedDomains:))]
898        #[unsafe(method_family = none)]
899        pub unsafe fn setExcludedDomains(&self, excluded_domains: &NSArray<NSString>);
900
901        #[unsafe(method(associatedDomains))]
902        #[unsafe(method_family = none)]
903        pub unsafe fn associatedDomains(&self) -> Retained<NSArray<NSString>>;
904
905        /// Setter for [`associatedDomains`][Self::associatedDomains].
906        #[unsafe(method(setAssociatedDomains:))]
907        #[unsafe(method_family = none)]
908        pub unsafe fn setAssociatedDomains(&self, associated_domains: &NSArray<NSString>);
909    );
910}
911
912/// Methods declared on superclass `NSObject`.
913impl NETunnelProviderManager {
914    extern_methods!(
915        #[unsafe(method(init))]
916        #[unsafe(method_family = init)]
917        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
918
919        #[unsafe(method(new))]
920        #[unsafe(method_family = new)]
921        pub unsafe fn new() -> Retained<Self>;
922    );
923}
924
925extern_class!(
926    /// The NEAppProxyProviderManager class declares the programmatic interface for an object that is used to configure and control network tunnels provided by NEAppProxyProviders.
927    ///
928    /// Instances of this class are thread safe.
929    ///
930    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neappproxyprovidermanager?language=objc)
931    #[unsafe(super(NETunnelProviderManager, NEVPNManager, NSObject))]
932    #[derive(Debug, PartialEq, Eq, Hash)]
933    pub struct NEAppProxyProviderManager;
934);
935
936extern_conformance!(
937    unsafe impl NSObjectProtocol for NEAppProxyProviderManager {}
938);
939
940impl NEAppProxyProviderManager {
941    extern_methods!(
942        #[cfg(feature = "block2")]
943        /// This function asynchronously reads all of the NEAppProxy configurations associated with the calling app that have previously been saved to disk and returns them as NEAppProxyProviderManager objects.
944        ///
945        /// Parameter `completionHandler`: A block that takes an array NEAppProxyProviderManager objects. The array passed to the block may be empty if no NETunnelProvider configurations were successfully read from the disk.  The NSError passed to this block will be nil if the load operation succeeded, non-nil otherwise.
946        #[unsafe(method(loadAllFromPreferencesWithCompletionHandler:))]
947        #[unsafe(method_family = none)]
948        pub unsafe fn loadAllFromPreferencesWithCompletionHandler(
949            completion_handler: &block2::DynBlock<
950                dyn Fn(*mut NSArray<NEAppProxyProviderManager>, *mut NSError),
951            >,
952        );
953    );
954}
955
956/// Methods declared on superclass `NETunnelProviderManager`.
957impl NEAppProxyProviderManager {
958    extern_methods!(
959        /// Create a NETunnelProviderManager instance that is used to manage a per-app VPN configuration.
960        #[unsafe(method(forPerAppVPN))]
961        #[unsafe(method_family = none)]
962        pub unsafe fn forPerAppVPN() -> Retained<Self>;
963    );
964}
965
966/// Methods declared on superclass `NSObject`.
967impl NEAppProxyProviderManager {
968    extern_methods!(
969        #[unsafe(method(init))]
970        #[unsafe(method_family = init)]
971        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
972
973        #[unsafe(method(new))]
974        #[unsafe(method_family = new)]
975        pub unsafe fn new() -> Retained<Self>;
976    );
977}
978
979extern_class!(
980    /// The NEAppProxyTCPFlow class declares the programmatic interface of an object that is used by NEAppProxyProvider implementations to proxy the payload of TCP connections.
981    ///
982    /// NEAppProxyTCPFlow is part of NetworkExtension.framework
983    ///
984    /// Instances of this class are thread safe.
985    ///
986    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neappproxytcpflow?language=objc)
987    #[unsafe(super(NEAppProxyFlow, NSObject))]
988    #[derive(Debug, PartialEq, Eq, Hash)]
989    pub struct NEAppProxyTCPFlow;
990);
991
992extern_conformance!(
993    unsafe impl NSObjectProtocol for NEAppProxyTCPFlow {}
994);
995
996impl NEAppProxyTCPFlow {
997    extern_methods!(
998        #[cfg(feature = "block2")]
999        /// Read data from the flow.
1000        ///
1001        /// Parameter `completionHandler`: A block that will be executed when some data is read from the flow. The block is passed either the data that was read or a non-nil error if an error occurred. If data has a length of 0 then no data can be subsequently read from the flow. The completion handler is only called for the single read operation that was initiated by calling this method. If the caller wants to read more data then it should call this method again to schedule another read operation and another execution of the completion handler block.
1002        #[unsafe(method(readDataWithCompletionHandler:))]
1003        #[unsafe(method_family = none)]
1004        pub unsafe fn readDataWithCompletionHandler(
1005            &self,
1006            completion_handler: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
1007        );
1008
1009        #[cfg(feature = "block2")]
1010        /// Write data to the flow.
1011        ///
1012        /// Parameter `data`: The data to write.
1013        ///
1014        /// Parameter `completionHandler`: A block that will be executed when the data is written into the associated socket's receive buffer. The caller should use this callback as an indication that it is possible to write more data to the flow without using up excessive buffer memory. If an error occurs while writing the data then a non-nil NSError object is passed to the block.
1015        #[unsafe(method(writeData:withCompletionHandler:))]
1016        #[unsafe(method_family = none)]
1017        pub unsafe fn writeData_withCompletionHandler(
1018            &self,
1019            data: &NSData,
1020            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1021        );
1022
1023        /// An NWEndpoint object containing information about the intended remote endpoint of the flow.
1024        #[deprecated]
1025        #[unsafe(method(remoteEndpoint))]
1026        #[unsafe(method_family = none)]
1027        pub unsafe fn remoteEndpoint(&self) -> Retained<NWEndpoint>;
1028    );
1029}
1030
1031/// Methods declared on superclass `NSObject`.
1032impl NEAppProxyTCPFlow {
1033    extern_methods!(
1034        #[unsafe(method(init))]
1035        #[unsafe(method_family = init)]
1036        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1037
1038        #[unsafe(method(new))]
1039        #[unsafe(method_family = new)]
1040        pub unsafe fn new() -> Retained<Self>;
1041    );
1042}
1043
1044extern_class!(
1045    /// The NEAppProxyUDPFlow class declares the programmatic interface of an object that is used by NEAppProxyProvider implementations to proxy the payload of UDP datagrams.
1046    ///
1047    /// NEAppProxyUDPFlow is part of NetworkExtension.framework.
1048    ///
1049    /// Instances of this class are thread safe.
1050    ///
1051    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neappproxyudpflow?language=objc)
1052    #[unsafe(super(NEAppProxyFlow, NSObject))]
1053    #[derive(Debug, PartialEq, Eq, Hash)]
1054    pub struct NEAppProxyUDPFlow;
1055);
1056
1057extern_conformance!(
1058    unsafe impl NSObjectProtocol for NEAppProxyUDPFlow {}
1059);
1060
1061impl NEAppProxyUDPFlow {
1062    extern_methods!(
1063        #[cfg(feature = "block2")]
1064        /// Read datagrams from the flow.
1065        ///
1066        /// Parameter `completionHandler`: A block that will be executed when datagrams have been read from the flow. The block takes the datagrams that were read, the destination endpoints of the datagrams, and an NSError. If an error occurred while reading then the error parameter will be non-nil.
1067        #[deprecated]
1068        #[unsafe(method(readDatagramsWithCompletionHandler:))]
1069        #[unsafe(method_family = none)]
1070        pub unsafe fn readDatagramsWithCompletionHandler(
1071            &self,
1072            completion_handler: &block2::DynBlock<
1073                dyn Fn(*mut NSArray<NSData>, *mut NSArray<NWEndpoint>, *mut NSError),
1074            >,
1075        );
1076
1077        #[cfg(feature = "block2")]
1078        /// Write datagrams to the flow.
1079        ///
1080        /// Parameter `datagrams`: An array of NSData objects containing the data to be written.
1081        ///
1082        /// Parameter `remoteEndpoints`: The source endpoints of the datagrams.
1083        ///
1084        /// Parameter `completionHandler`: A block that will be executed when the datagrams have been written to the corresponding socket's receive buffer.
1085        #[deprecated]
1086        #[unsafe(method(writeDatagrams:sentByEndpoints:completionHandler:))]
1087        #[unsafe(method_family = none)]
1088        pub unsafe fn writeDatagrams_sentByEndpoints_completionHandler(
1089            &self,
1090            datagrams: &NSArray<NSData>,
1091            remote_endpoints: &NSArray<NWEndpoint>,
1092            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1093        );
1094
1095        /// An NWEndpoint object containing the local endpoint of the flow's corresponding socket.
1096        #[deprecated]
1097        #[unsafe(method(localEndpoint))]
1098        #[unsafe(method_family = none)]
1099        pub unsafe fn localEndpoint(&self) -> Option<Retained<NWEndpoint>>;
1100    );
1101}
1102
1103/// Methods declared on superclass `NSObject`.
1104impl NEAppProxyUDPFlow {
1105    extern_methods!(
1106        #[unsafe(method(init))]
1107        #[unsafe(method_family = init)]
1108        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1109
1110        #[unsafe(method(new))]
1111        #[unsafe(method_family = new)]
1112        pub unsafe fn new() -> Retained<Self>;
1113    );
1114}
1115
1116extern_class!(
1117    /// The NEAppRule class declares the programmatic interface for an object that contains the match conditions for a rule that is used to match network traffic originated by applications.
1118    ///
1119    /// NEAppRule is used in the context of a Network Extension configuration to specify what traffic should be made available to the Network Extension.
1120    ///
1121    /// Instances of this class are thread safe.
1122    ///
1123    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neapprule?language=objc)
1124    #[unsafe(super(NSObject))]
1125    #[derive(Debug, PartialEq, Eq, Hash)]
1126    pub struct NEAppRule;
1127);
1128
1129extern_conformance!(
1130    unsafe impl NSCoding for NEAppRule {}
1131);
1132
1133extern_conformance!(
1134    unsafe impl NSCopying for NEAppRule {}
1135);
1136
1137unsafe impl CopyingHelper for NEAppRule {
1138    type Result = Self;
1139}
1140
1141extern_conformance!(
1142    unsafe impl NSObjectProtocol for NEAppRule {}
1143);
1144
1145extern_conformance!(
1146    unsafe impl NSSecureCoding for NEAppRule {}
1147);
1148
1149impl NEAppRule {
1150    extern_methods!(
1151        /// Initializes a newly-allocated NEAppRule object.
1152        ///
1153        /// Parameter `signingIdentifier`: The signing identifier of the executable that matches the rule.
1154        #[unsafe(method(initWithSigningIdentifier:))]
1155        #[unsafe(method_family = init)]
1156        pub unsafe fn initWithSigningIdentifier(
1157            this: Allocated<Self>,
1158            signing_identifier: &NSString,
1159        ) -> Retained<Self>;
1160
1161        /// Initializes a newly-allocated NEAppRule object.
1162        ///
1163        /// Parameter `signingIdentifier`: The signing identifier of the executable that matches the rule.
1164        ///
1165        /// Parameter `designatedRequirement`: The designated requirement of the executable that matches the rule.
1166        #[unsafe(method(initWithSigningIdentifier:designatedRequirement:))]
1167        #[unsafe(method_family = init)]
1168        pub unsafe fn initWithSigningIdentifier_designatedRequirement(
1169            this: Allocated<Self>,
1170            signing_identifier: &NSString,
1171            designated_requirement: &NSString,
1172        ) -> Retained<Self>;
1173
1174        /// A string containing a signing identifier. If the code signature of the executable being evaluated has a signing identifier equal to this string and all other conditions of the rule match, then the rule matches.
1175        #[unsafe(method(matchSigningIdentifier))]
1176        #[unsafe(method_family = none)]
1177        pub unsafe fn matchSigningIdentifier(&self) -> Retained<NSString>;
1178
1179        /// A string containing a designated requirement. If the code signature of the exectuable being evaluated has a designated requirement equal to this string and all other conditions of the rule match, then the rule matches. This property is required on Mac OS X.
1180        #[unsafe(method(matchDesignatedRequirement))]
1181        #[unsafe(method_family = none)]
1182        pub unsafe fn matchDesignatedRequirement(&self) -> Retained<NSString>;
1183
1184        /// A string containing a file system path. If the file system path of the executable being evaluated is equal to this string and all other conditions of the rule match, then the rule matches. This property is optional.
1185        #[unsafe(method(matchPath))]
1186        #[unsafe(method_family = none)]
1187        pub unsafe fn matchPath(&self) -> Option<Retained<NSString>>;
1188
1189        /// Setter for [`matchPath`][Self::matchPath].
1190        #[unsafe(method(setMatchPath:))]
1191        #[unsafe(method_family = none)]
1192        pub unsafe fn setMatchPath(&self, match_path: Option<&NSString>);
1193
1194        /// An array of strings. This property is actually read-only. If the destination host of the network traffic being evaluated has a suffix equal to one of the strings in this array and all other conditions of the rule match, then the rule matches. This property is optional.
1195        #[unsafe(method(matchDomains))]
1196        #[unsafe(method_family = none)]
1197        pub unsafe fn matchDomains(&self) -> Option<Retained<NSArray>>;
1198
1199        /// Setter for [`matchDomains`][Self::matchDomains].
1200        #[unsafe(method(setMatchDomains:))]
1201        #[unsafe(method_family = none)]
1202        pub unsafe fn setMatchDomains(&self, match_domains: Option<&NSArray>);
1203
1204        /// An array of NEAppRule objects. Use this property to restrict this rule to only match network traffic that is generated by one or more "helper tool" processes that are spawned by the app that matches this rule.
1205        /// For example, to match network traffic generated by the "curl" command line tool when the tool is run from Terminal.app, create an NEAppRule for Terminal.app and set the app rule's matchTools property to an array that
1206        /// contains an NEAppRule for the "curl" command line tool.
1207        /// Set this property to nil (which is the default) to match all network traffic generated by the matching app and all helper tool processes spawned by the matching app.
1208        #[unsafe(method(matchTools))]
1209        #[unsafe(method_family = none)]
1210        pub unsafe fn matchTools(&self) -> Option<Retained<NSArray<NEAppRule>>>;
1211
1212        /// Setter for [`matchTools`][Self::matchTools].
1213        #[unsafe(method(setMatchTools:))]
1214        #[unsafe(method_family = none)]
1215        pub unsafe fn setMatchTools(&self, match_tools: Option<&NSArray<NEAppRule>>);
1216    );
1217}
1218
1219/// Methods declared on superclass `NSObject`.
1220impl NEAppRule {
1221    extern_methods!(
1222        #[unsafe(method(init))]
1223        #[unsafe(method_family = init)]
1224        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1225
1226        #[unsafe(method(new))]
1227        #[unsafe(method_family = new)]
1228        pub unsafe fn new() -> Retained<Self>;
1229    );
1230}
1231
1232/// DNS proxy error codes
1233///
1234/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednsproxymanagererror?language=objc)
1235// NS_ENUM
1236#[repr(transparent)]
1237#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1238pub struct NEDNSProxyManagerError(pub NSInteger);
1239impl NEDNSProxyManagerError {
1240    #[doc(alias = "NEDNSProxyManagerErrorConfigurationInvalid")]
1241    pub const ConfigurationInvalid: Self = Self(1);
1242    #[doc(alias = "NEDNSProxyManagerErrorConfigurationDisabled")]
1243    pub const ConfigurationDisabled: Self = Self(2);
1244    #[doc(alias = "NEDNSProxyManagerErrorConfigurationStale")]
1245    pub const ConfigurationStale: Self = Self(3);
1246    #[doc(alias = "NEDNSProxyManagerErrorConfigurationCannotBeRemoved")]
1247    pub const ConfigurationCannotBeRemoved: Self = Self(4);
1248}
1249
1250unsafe impl Encode for NEDNSProxyManagerError {
1251    const ENCODING: Encoding = NSInteger::ENCODING;
1252}
1253
1254unsafe impl RefEncode for NEDNSProxyManagerError {
1255    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1256}
1257
1258extern "C" {
1259    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednsproxyerrordomain?language=objc)
1260    pub static NEDNSProxyErrorDomain: &'static NSString;
1261}
1262
1263extern "C" {
1264    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednsproxyconfigurationdidchangenotification?language=objc)
1265    pub static NEDNSProxyConfigurationDidChangeNotification: &'static NSString;
1266}
1267
1268extern_class!(
1269    /// The NEDNSProxyManager class declares the programmatic interface for an object that manages DNS proxy configurations.
1270    ///
1271    /// NEDNSProxyManager declares methods and properties for configuring and controlling a DNS proxy.
1272    ///
1273    /// Instances of this class are thread safe.
1274    ///
1275    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednsproxymanager?language=objc)
1276    #[unsafe(super(NSObject))]
1277    #[derive(Debug, PartialEq, Eq, Hash)]
1278    pub struct NEDNSProxyManager;
1279);
1280
1281extern_conformance!(
1282    unsafe impl NSObjectProtocol for NEDNSProxyManager {}
1283);
1284
1285impl NEDNSProxyManager {
1286    extern_methods!(
1287        /// Returns: The singleton NEDNSProxyManager object for the calling process.
1288        #[unsafe(method(sharedManager))]
1289        #[unsafe(method_family = none)]
1290        pub unsafe fn sharedManager() -> Retained<NEDNSProxyManager>;
1291
1292        #[cfg(feature = "block2")]
1293        /// This function loads the current DNS proxy configuration from the caller's DNS proxy preferences.
1294        ///
1295        /// Parameter `completionHandler`: A block that will be called when the load operation is completed. The NSError passed to this block will be nil if the load operation succeeded, non-nil otherwise.
1296        #[unsafe(method(loadFromPreferencesWithCompletionHandler:))]
1297        #[unsafe(method_family = none)]
1298        pub unsafe fn loadFromPreferencesWithCompletionHandler(
1299            &self,
1300            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1301        );
1302
1303        #[cfg(feature = "block2")]
1304        /// This function removes the DNS proxy configuration from the caller's DNS proxy preferences. If the DNS proxy is enabled, the DNS proxy becomes disabled.
1305        ///
1306        /// Parameter `completionHandler`: A block that will be called when the remove operation is completed. The NSError passed to this block will be nil if the remove operation succeeded, non-nil otherwise.
1307        #[unsafe(method(removeFromPreferencesWithCompletionHandler:))]
1308        #[unsafe(method_family = none)]
1309        pub unsafe fn removeFromPreferencesWithCompletionHandler(
1310            &self,
1311            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1312        );
1313
1314        #[cfg(feature = "block2")]
1315        /// This function saves the DNS proxy configuration in the caller's DNS proxy preferences. If the DNS proxy is enabled, it will become active.
1316        ///
1317        /// Parameter `completionHandler`: A block that will be called when the save operation is completed. The NSError passed to this block will be nil if the save operation succeeded, non-nil otherwise.
1318        #[unsafe(method(saveToPreferencesWithCompletionHandler:))]
1319        #[unsafe(method_family = none)]
1320        pub unsafe fn saveToPreferencesWithCompletionHandler(
1321            &self,
1322            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1323        );
1324
1325        /// A string containing a description of the DNS proxy.
1326        #[unsafe(method(localizedDescription))]
1327        #[unsafe(method_family = none)]
1328        pub unsafe fn localizedDescription(&self) -> Option<Retained<NSString>>;
1329
1330        /// Setter for [`localizedDescription`][Self::localizedDescription].
1331        #[unsafe(method(setLocalizedDescription:))]
1332        #[unsafe(method_family = none)]
1333        pub unsafe fn setLocalizedDescription(&self, localized_description: Option<&NSString>);
1334
1335        /// An NEDNSProxyProviderProtocol object containing the provider-specific portion of the DNS proxy configuration.
1336        #[unsafe(method(providerProtocol))]
1337        #[unsafe(method_family = none)]
1338        pub unsafe fn providerProtocol(&self) -> Option<Retained<NEDNSProxyProviderProtocol>>;
1339
1340        /// Setter for [`providerProtocol`][Self::providerProtocol].
1341        #[unsafe(method(setProviderProtocol:))]
1342        #[unsafe(method_family = none)]
1343        pub unsafe fn setProviderProtocol(
1344            &self,
1345            provider_protocol: Option<&NEDNSProxyProviderProtocol>,
1346        );
1347
1348        /// Toggles the enabled status of the DNS proxy. Setting this property will disable DNS proxy configurations of other apps. This property will be set to NO when other DNS proxy configurations are enabled.
1349        #[unsafe(method(isEnabled))]
1350        #[unsafe(method_family = none)]
1351        pub unsafe fn isEnabled(&self) -> bool;
1352
1353        /// Setter for [`isEnabled`][Self::isEnabled].
1354        #[unsafe(method(setEnabled:))]
1355        #[unsafe(method_family = none)]
1356        pub unsafe fn setEnabled(&self, enabled: bool);
1357    );
1358}
1359
1360/// Methods declared on superclass `NSObject`.
1361impl NEDNSProxyManager {
1362    extern_methods!(
1363        #[unsafe(method(init))]
1364        #[unsafe(method_family = init)]
1365        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1366
1367        #[unsafe(method(new))]
1368        #[unsafe(method_family = new)]
1369        pub unsafe fn new() -> Retained<Self>;
1370    );
1371}
1372
1373extern_class!(
1374    /// The NEDNSProxyProvider class declares the programmatic interface for an object that implements the client side of a custom DNS proxy solution.
1375    ///
1376    /// NEDNSProxyProvider is part of NetworkExtension.framework
1377    ///
1378    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednsproxyprovider?language=objc)
1379    #[unsafe(super(NEProvider, NSObject))]
1380    #[derive(Debug, PartialEq, Eq, Hash)]
1381    pub struct NEDNSProxyProvider;
1382);
1383
1384extern_conformance!(
1385    unsafe impl NSObjectProtocol for NEDNSProxyProvider {}
1386);
1387
1388impl NEDNSProxyProvider {
1389    extern_methods!(
1390        #[cfg(feature = "block2")]
1391        /// This function is called by the framework when a new proxy instance is being created. Subclasses must override this method to perform whatever steps are necessary to ready the proxy for handling flows of network data.
1392        ///
1393        /// Parameter `options`: A dictionary containing keys and values passed by the provider's containing app. If the containing app did not start the proxy then this parameter will be nil.
1394        ///
1395        /// Parameter `completionHandler`: A block that must be called when the process of starting the proxy is complete. If the proxy cannot be started then the subclass' implementation of this method must pass a non-nil NSError object to this block. A value of nil passed to the completion handler indicates that the proxy was successfully started.
1396        #[unsafe(method(startProxyWithOptions:completionHandler:))]
1397        #[unsafe(method_family = none)]
1398        pub unsafe fn startProxyWithOptions_completionHandler(
1399            &self,
1400            options: Option<&NSDictionary<NSString, AnyObject>>,
1401            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1402        );
1403
1404        #[cfg(feature = "block2")]
1405        /// This function is called by the framework when the proxy is being stopped. Subclasses must override this method to perform whatever steps are necessary to stop the proxy.
1406        ///
1407        /// Parameter `reason`: An NEProviderStopReason indicating why the proxy is being stopped.
1408        ///
1409        /// Parameter `completionHandler`: A block that must be called when the proxy is completely stopped.
1410        #[unsafe(method(stopProxyWithReason:completionHandler:))]
1411        #[unsafe(method_family = none)]
1412        pub unsafe fn stopProxyWithReason_completionHandler(
1413            &self,
1414            reason: NEProviderStopReason,
1415            completion_handler: &block2::DynBlock<dyn Fn()>,
1416        );
1417
1418        /// This function is called by proxy provider implementations to stop the proxy when a network error is encountered that renders the proxy no longer viable. Subclasses should not override this method.
1419        ///
1420        /// Parameter `error`: An NSError object containing details about the error that the proxy provider implementation encountered.
1421        #[unsafe(method(cancelProxyWithError:))]
1422        #[unsafe(method_family = none)]
1423        pub unsafe fn cancelProxyWithError(&self, error: Option<&NSError>);
1424
1425        /// This function is called by the framework to deliver a new network data flow to the proxy provider implementation. Subclasses must override this method to perform whatever steps are necessary to ready the proxy to receive data from the flow. The proxy provider implementation indicates that the proxy is ready to handle flow data by calling -[NEAppProxyFlow openWithLocalFlowEndpoint:completionHandler:] on the flow. If the proxy implementation decides to not handle the flow and instead terminate it, the subclass implementation of this method should return NO. If the proxy implementation decides to handle the flow, the subclass implementation of this method should return YES. In this case the proxy implementation is responsible for retaining the NEAppProxyFlow object.
1426        ///
1427        /// Parameter `flow`: The new flow
1428        ///
1429        /// Returns: YES if the proxy implementation has retained the flow and intends to handle the flow data. NO if the proxy implementation has not retained the flow and will not handle the flow data. In this case the flow is terminated.
1430        #[unsafe(method(handleNewFlow:))]
1431        #[unsafe(method_family = none)]
1432        pub unsafe fn handleNewFlow(&self, flow: &NEAppProxyFlow) -> bool;
1433
1434        /// This function is called by the framework to deliver a new UDP data flow to the proxy provider implementation. Subclasses can override this method to perform whatever steps are necessary to ready the proxy to receive
1435        /// data from the flow. The proxy provider implementation indicates that the proxy is ready to handle flow data by calling -[NEAppProxyFlow openWithLocalEndpoint:completionHandler:] on the flow. If the proxy implementation decides
1436        /// to not handle the flow and instead terminate it, the subclass implementation of this method should return NO. If the proxy implementation decides to handle the flow, the subclass implementation of this method should return YES.
1437        /// In this case the proxy implementation is responsible for retaining the NEAppProxyUDPFlow object.
1438        /// The default implementation of this method calls -[NEAppProxyProvider handleNewFlow:] and returns its result.
1439        ///
1440        /// Parameter `flow`: The new UDP flow
1441        ///
1442        /// Parameter `remoteEndpoint`: The initial remote endpoint provided by the proxied app when the flow was opened.
1443        ///
1444        /// Returns: YES if the proxy implementation has retained the flow and intends to handle the flow data. NO if the proxy implementation has not retained the flow and will not handle the flow data. In this case the flow is terminated.
1445        #[deprecated]
1446        #[unsafe(method(handleNewUDPFlow:initialRemoteEndpoint:))]
1447        #[unsafe(method_family = none)]
1448        pub unsafe fn handleNewUDPFlow_initialRemoteEndpoint(
1449            &self,
1450            flow: &NEAppProxyUDPFlow,
1451            remote_endpoint: &NWEndpoint,
1452        ) -> bool;
1453
1454        /// The current system DNS settings. Use KVO to watch for changes.
1455        #[unsafe(method(systemDNSSettings))]
1456        #[unsafe(method_family = none)]
1457        pub unsafe fn systemDNSSettings(&self) -> Option<Retained<NSArray<NEDNSSettings>>>;
1458    );
1459}
1460
1461/// Methods declared on superclass `NSObject`.
1462impl NEDNSProxyProvider {
1463    extern_methods!(
1464        #[unsafe(method(init))]
1465        #[unsafe(method_family = init)]
1466        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1467
1468        #[unsafe(method(new))]
1469        #[unsafe(method_family = new)]
1470        pub unsafe fn new() -> Retained<Self>;
1471    );
1472}
1473
1474extern_class!(
1475    /// The NEProxyServer class declares the programmatic interface for an object that contains settings for a proxy server.
1476    ///
1477    /// Instances of this class are thread safe.
1478    ///
1479    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neproxyserver?language=objc)
1480    #[unsafe(super(NSObject))]
1481    #[derive(Debug, PartialEq, Eq, Hash)]
1482    pub struct NEProxyServer;
1483);
1484
1485extern_conformance!(
1486    unsafe impl NSCoding for NEProxyServer {}
1487);
1488
1489extern_conformance!(
1490    unsafe impl NSCopying for NEProxyServer {}
1491);
1492
1493unsafe impl CopyingHelper for NEProxyServer {
1494    type Result = Self;
1495}
1496
1497extern_conformance!(
1498    unsafe impl NSObjectProtocol for NEProxyServer {}
1499);
1500
1501extern_conformance!(
1502    unsafe impl NSSecureCoding for NEProxyServer {}
1503);
1504
1505impl NEProxyServer {
1506    extern_methods!(
1507        /// This function initializes a newly-allocated NEProxyServer object
1508        ///
1509        /// Parameter `address`: The string representation of the proxy server IP address.
1510        ///
1511        /// Parameter `port`: The TCP port of the proxy server.
1512        #[unsafe(method(initWithAddress:port:))]
1513        #[unsafe(method_family = init)]
1514        pub unsafe fn initWithAddress_port(
1515            this: Allocated<Self>,
1516            address: &NSString,
1517            port: NSInteger,
1518        ) -> Retained<Self>;
1519
1520        /// The string representation of the proxy server IP address.
1521        #[unsafe(method(address))]
1522        #[unsafe(method_family = none)]
1523        pub unsafe fn address(&self) -> Retained<NSString>;
1524
1525        /// The TCP port of the proxy server.
1526        #[unsafe(method(port))]
1527        #[unsafe(method_family = none)]
1528        pub unsafe fn port(&self) -> NSInteger;
1529
1530        /// A flag indicating if the server requires authentication credentials.
1531        #[unsafe(method(authenticationRequired))]
1532        #[unsafe(method_family = none)]
1533        pub unsafe fn authenticationRequired(&self) -> bool;
1534
1535        /// Setter for [`authenticationRequired`][Self::authenticationRequired].
1536        #[unsafe(method(setAuthenticationRequired:))]
1537        #[unsafe(method_family = none)]
1538        pub unsafe fn setAuthenticationRequired(&self, authentication_required: bool);
1539
1540        /// The username portion of the authentication credential to use when communicating with the proxy server.
1541        #[unsafe(method(username))]
1542        #[unsafe(method_family = none)]
1543        pub unsafe fn username(&self) -> Option<Retained<NSString>>;
1544
1545        /// Setter for [`username`][Self::username].
1546        #[unsafe(method(setUsername:))]
1547        #[unsafe(method_family = none)]
1548        pub unsafe fn setUsername(&self, username: Option<&NSString>);
1549
1550        /// The password portion of the authentication credential to use when communicating with the proxy server. This property is only saved persistently if the username property is non-nil and non-empty and if the authenticationRequired flag is set.
1551        #[unsafe(method(password))]
1552        #[unsafe(method_family = none)]
1553        pub unsafe fn password(&self) -> Option<Retained<NSString>>;
1554
1555        /// Setter for [`password`][Self::password].
1556        #[unsafe(method(setPassword:))]
1557        #[unsafe(method_family = none)]
1558        pub unsafe fn setPassword(&self, password: Option<&NSString>);
1559    );
1560}
1561
1562/// Methods declared on superclass `NSObject`.
1563impl NEProxyServer {
1564    extern_methods!(
1565        #[unsafe(method(init))]
1566        #[unsafe(method_family = init)]
1567        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1568
1569        #[unsafe(method(new))]
1570        #[unsafe(method_family = new)]
1571        pub unsafe fn new() -> Retained<Self>;
1572    );
1573}
1574
1575extern_class!(
1576    /// The NEProxySettings class declares the programmatic interface for an object that contains proxy settings.
1577    ///
1578    /// NEProxySettings is used in the context of a Network Extension configuration to specify the proxy that should be used for network traffic when the Network Extension is active.
1579    ///
1580    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neproxysettings?language=objc)
1581    #[unsafe(super(NSObject))]
1582    #[derive(Debug, PartialEq, Eq, Hash)]
1583    pub struct NEProxySettings;
1584);
1585
1586extern_conformance!(
1587    unsafe impl NSCoding for NEProxySettings {}
1588);
1589
1590extern_conformance!(
1591    unsafe impl NSCopying for NEProxySettings {}
1592);
1593
1594unsafe impl CopyingHelper for NEProxySettings {
1595    type Result = Self;
1596}
1597
1598extern_conformance!(
1599    unsafe impl NSObjectProtocol for NEProxySettings {}
1600);
1601
1602extern_conformance!(
1603    unsafe impl NSSecureCoding for NEProxySettings {}
1604);
1605
1606impl NEProxySettings {
1607    extern_methods!(
1608        /// A boolean indicating if proxy auto-configuration is enabled.
1609        #[unsafe(method(autoProxyConfigurationEnabled))]
1610        #[unsafe(method_family = none)]
1611        pub unsafe fn autoProxyConfigurationEnabled(&self) -> bool;
1612
1613        /// Setter for [`autoProxyConfigurationEnabled`][Self::autoProxyConfigurationEnabled].
1614        #[unsafe(method(setAutoProxyConfigurationEnabled:))]
1615        #[unsafe(method_family = none)]
1616        pub unsafe fn setAutoProxyConfigurationEnabled(
1617            &self,
1618            auto_proxy_configuration_enabled: bool,
1619        );
1620
1621        /// A URL specifying where the PAC script is located.
1622        #[unsafe(method(proxyAutoConfigurationURL))]
1623        #[unsafe(method_family = none)]
1624        pub unsafe fn proxyAutoConfigurationURL(&self) -> Option<Retained<NSURL>>;
1625
1626        /// Setter for [`proxyAutoConfigurationURL`][Self::proxyAutoConfigurationURL].
1627        #[unsafe(method(setProxyAutoConfigurationURL:))]
1628        #[unsafe(method_family = none)]
1629        pub unsafe fn setProxyAutoConfigurationURL(
1630            &self,
1631            proxy_auto_configuration_url: Option<&NSURL>,
1632        );
1633
1634        /// A string containing the PAC JavaScript source code.
1635        #[unsafe(method(proxyAutoConfigurationJavaScript))]
1636        #[unsafe(method_family = none)]
1637        pub unsafe fn proxyAutoConfigurationJavaScript(&self) -> Option<Retained<NSString>>;
1638
1639        /// Setter for [`proxyAutoConfigurationJavaScript`][Self::proxyAutoConfigurationJavaScript].
1640        #[unsafe(method(setProxyAutoConfigurationJavaScript:))]
1641        #[unsafe(method_family = none)]
1642        pub unsafe fn setProxyAutoConfigurationJavaScript(
1643            &self,
1644            proxy_auto_configuration_java_script: Option<&NSString>,
1645        );
1646
1647        /// A boolean indicating if the static HTTP proxy is enabled.
1648        #[unsafe(method(HTTPEnabled))]
1649        #[unsafe(method_family = none)]
1650        pub unsafe fn HTTPEnabled(&self) -> bool;
1651
1652        /// Setter for [`HTTPEnabled`][Self::HTTPEnabled].
1653        #[unsafe(method(setHTTPEnabled:))]
1654        #[unsafe(method_family = none)]
1655        pub unsafe fn setHTTPEnabled(&self, http_enabled: bool);
1656
1657        /// A NEProxyServer object containing the HTTP proxy server settings.
1658        #[unsafe(method(HTTPServer))]
1659        #[unsafe(method_family = none)]
1660        pub unsafe fn HTTPServer(&self) -> Option<Retained<NEProxyServer>>;
1661
1662        /// Setter for [`HTTPServer`][Self::HTTPServer].
1663        #[unsafe(method(setHTTPServer:))]
1664        #[unsafe(method_family = none)]
1665        pub unsafe fn setHTTPServer(&self, http_server: Option<&NEProxyServer>);
1666
1667        /// A boolean indicating if the static HTTPS proxy is enabled.
1668        #[unsafe(method(HTTPSEnabled))]
1669        #[unsafe(method_family = none)]
1670        pub unsafe fn HTTPSEnabled(&self) -> bool;
1671
1672        /// Setter for [`HTTPSEnabled`][Self::HTTPSEnabled].
1673        #[unsafe(method(setHTTPSEnabled:))]
1674        #[unsafe(method_family = none)]
1675        pub unsafe fn setHTTPSEnabled(&self, https_enabled: bool);
1676
1677        /// A NEProxyServer object containing the HTTPS proxy server settings.
1678        #[unsafe(method(HTTPSServer))]
1679        #[unsafe(method_family = none)]
1680        pub unsafe fn HTTPSServer(&self) -> Option<Retained<NEProxyServer>>;
1681
1682        /// Setter for [`HTTPSServer`][Self::HTTPSServer].
1683        #[unsafe(method(setHTTPSServer:))]
1684        #[unsafe(method_family = none)]
1685        pub unsafe fn setHTTPSServer(&self, https_server: Option<&NEProxyServer>);
1686
1687        /// A flag indicating if the proxy settings should not be used for network destinations specified using single-label host names.
1688        #[unsafe(method(excludeSimpleHostnames))]
1689        #[unsafe(method_family = none)]
1690        pub unsafe fn excludeSimpleHostnames(&self) -> bool;
1691
1692        /// Setter for [`excludeSimpleHostnames`][Self::excludeSimpleHostnames].
1693        #[unsafe(method(setExcludeSimpleHostnames:))]
1694        #[unsafe(method_family = none)]
1695        pub unsafe fn setExcludeSimpleHostnames(&self, exclude_simple_hostnames: bool);
1696
1697        /// An array of domain strings. If the destination host name of a connection shares a suffix with one of these strings then the proxy settings will not be used for the connection.
1698        #[unsafe(method(exceptionList))]
1699        #[unsafe(method_family = none)]
1700        pub unsafe fn exceptionList(&self) -> Option<Retained<NSArray<NSString>>>;
1701
1702        /// Setter for [`exceptionList`][Self::exceptionList].
1703        #[unsafe(method(setExceptionList:))]
1704        #[unsafe(method_family = none)]
1705        pub unsafe fn setExceptionList(&self, exception_list: Option<&NSArray<NSString>>);
1706
1707        /// An array of domain strings. If the destination host name of a connection shares a suffix with one of these strings then the proxy settings will be used for the connection. Otherwise the proxy settings will not be used. If this property is nil then all connections to which the Network Extension applies will use the proxy settings.
1708        #[unsafe(method(matchDomains))]
1709        #[unsafe(method_family = none)]
1710        pub unsafe fn matchDomains(&self) -> Option<Retained<NSArray<NSString>>>;
1711
1712        /// Setter for [`matchDomains`][Self::matchDomains].
1713        #[unsafe(method(setMatchDomains:))]
1714        #[unsafe(method_family = none)]
1715        pub unsafe fn setMatchDomains(&self, match_domains: Option<&NSArray<NSString>>);
1716    );
1717}
1718
1719/// Methods declared on superclass `NSObject`.
1720impl NEProxySettings {
1721    extern_methods!(
1722        #[unsafe(method(init))]
1723        #[unsafe(method_family = init)]
1724        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1725
1726        #[unsafe(method(new))]
1727        #[unsafe(method_family = new)]
1728        pub unsafe fn new() -> Retained<Self>;
1729    );
1730}
1731
1732extern_class!(
1733    /// The NEVPNProtocol class declares the programmatic interface of an object that manages the protocol-specific portion of a VPN configuration.
1734    ///
1735    /// NEVPNProtocol is an abstract base class from which other protocol-specific classes are derived.
1736    ///
1737    /// Instances of this class are thread safe.
1738    ///
1739    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnprotocol?language=objc)
1740    #[unsafe(super(NSObject))]
1741    #[derive(Debug, PartialEq, Eq, Hash)]
1742    pub struct NEVPNProtocol;
1743);
1744
1745extern_conformance!(
1746    unsafe impl NSCoding for NEVPNProtocol {}
1747);
1748
1749extern_conformance!(
1750    unsafe impl NSCopying for NEVPNProtocol {}
1751);
1752
1753unsafe impl CopyingHelper for NEVPNProtocol {
1754    type Result = Self;
1755}
1756
1757extern_conformance!(
1758    unsafe impl NSObjectProtocol for NEVPNProtocol {}
1759);
1760
1761extern_conformance!(
1762    unsafe impl NSSecureCoding for NEVPNProtocol {}
1763);
1764
1765impl NEVPNProtocol {
1766    extern_methods!(
1767        /// The VPN server. Depending on the protocol, may be an IP address, host name, or URL.
1768        #[unsafe(method(serverAddress))]
1769        #[unsafe(method_family = none)]
1770        pub unsafe fn serverAddress(&self) -> Option<Retained<NSString>>;
1771
1772        /// Setter for [`serverAddress`][Self::serverAddress].
1773        #[unsafe(method(setServerAddress:))]
1774        #[unsafe(method_family = none)]
1775        pub unsafe fn setServerAddress(&self, server_address: Option<&NSString>);
1776
1777        /// The username component of the VPN authentication credential.
1778        #[unsafe(method(username))]
1779        #[unsafe(method_family = none)]
1780        pub unsafe fn username(&self) -> Option<Retained<NSString>>;
1781
1782        /// Setter for [`username`][Self::username].
1783        #[unsafe(method(setUsername:))]
1784        #[unsafe(method_family = none)]
1785        pub unsafe fn setUsername(&self, username: Option<&NSString>);
1786
1787        /// The password component of the VPN authentication credential. The value is a persistent reference to a keychain item with the kSecClassGenericPassword class.
1788        #[unsafe(method(passwordReference))]
1789        #[unsafe(method_family = none)]
1790        pub unsafe fn passwordReference(&self) -> Option<Retained<NSData>>;
1791
1792        /// Setter for [`passwordReference`][Self::passwordReference].
1793        #[unsafe(method(setPasswordReference:))]
1794        #[unsafe(method_family = none)]
1795        pub unsafe fn setPasswordReference(&self, password_reference: Option<&NSData>);
1796
1797        /// The certificate and private key component of the VPN authentication credential. The value is a persistent reference to a keychain item with the kSecClassIdentity class.
1798        #[unsafe(method(identityReference))]
1799        #[unsafe(method_family = none)]
1800        pub unsafe fn identityReference(&self) -> Option<Retained<NSData>>;
1801
1802        /// Setter for [`identityReference`][Self::identityReference].
1803        #[unsafe(method(setIdentityReference:))]
1804        #[unsafe(method_family = none)]
1805        pub unsafe fn setIdentityReference(&self, identity_reference: Option<&NSData>);
1806
1807        /// The PKCS12 data for the VPN authentication identity. The value is a NSData in PKCS12 format.
1808        #[unsafe(method(identityData))]
1809        #[unsafe(method_family = none)]
1810        pub unsafe fn identityData(&self) -> Option<Retained<NSData>>;
1811
1812        /// Setter for [`identityData`][Self::identityData].
1813        #[unsafe(method(setIdentityData:))]
1814        #[unsafe(method_family = none)]
1815        pub unsafe fn setIdentityData(&self, identity_data: Option<&NSData>);
1816
1817        /// The password to be used to decrypt the PKCS12 identity data.
1818        #[unsafe(method(identityDataPassword))]
1819        #[unsafe(method_family = none)]
1820        pub unsafe fn identityDataPassword(&self) -> Option<Retained<NSString>>;
1821
1822        /// Setter for [`identityDataPassword`][Self::identityDataPassword].
1823        #[unsafe(method(setIdentityDataPassword:))]
1824        #[unsafe(method_family = none)]
1825        pub unsafe fn setIdentityDataPassword(&self, identity_data_password: Option<&NSString>);
1826
1827        /// If YES, the VPN connection will be disconnected when the device goes to sleep. The default is NO.
1828        #[unsafe(method(disconnectOnSleep))]
1829        #[unsafe(method_family = none)]
1830        pub unsafe fn disconnectOnSleep(&self) -> bool;
1831
1832        /// Setter for [`disconnectOnSleep`][Self::disconnectOnSleep].
1833        #[unsafe(method(setDisconnectOnSleep:))]
1834        #[unsafe(method_family = none)]
1835        pub unsafe fn setDisconnectOnSleep(&self, disconnect_on_sleep: bool);
1836
1837        /// An NEProxySettings object containing the proxy settings to use for connections routed through the tunnel.
1838        #[unsafe(method(proxySettings))]
1839        #[unsafe(method_family = none)]
1840        pub unsafe fn proxySettings(&self) -> Option<Retained<NEProxySettings>>;
1841
1842        /// Setter for [`proxySettings`][Self::proxySettings].
1843        #[unsafe(method(setProxySettings:))]
1844        #[unsafe(method_family = none)]
1845        pub unsafe fn setProxySettings(&self, proxy_settings: Option<&NEProxySettings>);
1846
1847        /// If this property is set to YES then all network traffic is routed through the tunnel, with some exclusions. Several of the exclusions
1848        /// can be controlled with the excludeLocalNetworks, excludeCellularServices, excludeAPNs and excludeDeviceCommunication properties. See the documentation for those properties.
1849        /// The following traffic is always excluded from the tunnel:
1850        /// - Traffic necessary for connecting and maintaining the device's network connection, such as DHCP.
1851        /// - Traffic necessary for connecting to captive networks.
1852        /// - Certain cellular services traffic that is not routable over the internet and is instead directly routed to the cellular network. See the
1853        /// excludeCellularServices property for more details.
1854        /// - Network communication with a companion device such as a watchOS device.
1855        /// The default value of this property is NO.
1856        #[unsafe(method(includeAllNetworks))]
1857        #[unsafe(method_family = none)]
1858        pub unsafe fn includeAllNetworks(&self) -> bool;
1859
1860        /// Setter for [`includeAllNetworks`][Self::includeAllNetworks].
1861        #[unsafe(method(setIncludeAllNetworks:))]
1862        #[unsafe(method_family = none)]
1863        pub unsafe fn setIncludeAllNetworks(&self, include_all_networks: bool);
1864
1865        /// If YES, all traffic destined for local networks will be excluded from the tunnel. The default is NO on macOS and YES on iOS.
1866        #[unsafe(method(excludeLocalNetworks))]
1867        #[unsafe(method_family = none)]
1868        pub unsafe fn excludeLocalNetworks(&self) -> bool;
1869
1870        /// Setter for [`excludeLocalNetworks`][Self::excludeLocalNetworks].
1871        #[unsafe(method(setExcludeLocalNetworks:))]
1872        #[unsafe(method_family = none)]
1873        pub unsafe fn setExcludeLocalNetworks(&self, exclude_local_networks: bool);
1874
1875        /// If includeAllNetworks is set to YES and this property is set to YES, then internet-routable network traffic for cellular services
1876        /// (VoLTE, Wi-Fi Calling, IMS, MMS, Visual Voicemail, etc.) is excluded from the tunnel. Note that some cellular carriers route cellular services traffic
1877        /// directly to the carrier network, bypassing the internet. Such cellular services traffic is always excluded from the tunnel. The default value of this
1878        /// property is YES.
1879        #[unsafe(method(excludeCellularServices))]
1880        #[unsafe(method_family = none)]
1881        pub unsafe fn excludeCellularServices(&self) -> bool;
1882
1883        /// Setter for [`excludeCellularServices`][Self::excludeCellularServices].
1884        #[unsafe(method(setExcludeCellularServices:))]
1885        #[unsafe(method_family = none)]
1886        pub unsafe fn setExcludeCellularServices(&self, exclude_cellular_services: bool);
1887
1888        /// If includeAllNetworks is set to YES and this property is set to YES, then network traffic for the Apple Push Notification service (APNs)
1889        /// is excluded from the tunnel. The default value of this property is YES.
1890        #[unsafe(method(excludeAPNs))]
1891        #[unsafe(method_family = none)]
1892        pub unsafe fn excludeAPNs(&self) -> bool;
1893
1894        /// Setter for [`excludeAPNs`][Self::excludeAPNs].
1895        #[unsafe(method(setExcludeAPNs:))]
1896        #[unsafe(method_family = none)]
1897        pub unsafe fn setExcludeAPNs(&self, exclude_ap_ns: bool);
1898
1899        /// If includeAllNetworks is set to YES and this property is set to YES, then network traffic used for communicating with devices connected via USB or Wi-Fi is excluded
1900        /// from the tunnel. For example, Xcode uses a network tunnel to communicate with connected development devices like iPhone, iPad and TV. The default value of this
1901        /// property is YES.
1902        #[unsafe(method(excludeDeviceCommunication))]
1903        #[unsafe(method_family = none)]
1904        pub unsafe fn excludeDeviceCommunication(&self) -> bool;
1905
1906        /// Setter for [`excludeDeviceCommunication`][Self::excludeDeviceCommunication].
1907        #[unsafe(method(setExcludeDeviceCommunication:))]
1908        #[unsafe(method_family = none)]
1909        pub unsafe fn setExcludeDeviceCommunication(&self, exclude_device_communication: bool);
1910
1911        /// If YES, route rules for this tunnel will take precendence over any locally-defined routes. The default is NO.
1912        #[unsafe(method(enforceRoutes))]
1913        #[unsafe(method_family = none)]
1914        pub unsafe fn enforceRoutes(&self) -> bool;
1915
1916        /// Setter for [`enforceRoutes`][Self::enforceRoutes].
1917        #[unsafe(method(setEnforceRoutes:))]
1918        #[unsafe(method_family = none)]
1919        pub unsafe fn setEnforceRoutes(&self, enforce_routes: bool);
1920
1921        /// Identification string of the associated Cellular slice.  If present, VPN tunnel will be scoped to the associated Cellular slice whenever slice is active.
1922        /// Otherwise, VPN tunnel will fallback onto the primary interface.
1923        #[unsafe(method(sliceUUID))]
1924        #[unsafe(method_family = none)]
1925        pub unsafe fn sliceUUID(&self) -> Option<Retained<NSString>>;
1926
1927        /// Setter for [`sliceUUID`][Self::sliceUUID].
1928        #[unsafe(method(setSliceUUID:))]
1929        #[unsafe(method_family = none)]
1930        pub unsafe fn setSliceUUID(&self, slice_uuid: Option<&NSString>);
1931    );
1932}
1933
1934/// Methods declared on superclass `NSObject`.
1935impl NEVPNProtocol {
1936    extern_methods!(
1937        #[unsafe(method(init))]
1938        #[unsafe(method_family = init)]
1939        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1940
1941        #[unsafe(method(new))]
1942        #[unsafe(method_family = new)]
1943        pub unsafe fn new() -> Retained<Self>;
1944    );
1945}
1946
1947extern_class!(
1948    /// The NEDNSProxyProviderProtocol class declares the programmatic interface for an object that contains NEDNSProxyProvider-specific configuration settings.
1949    ///
1950    /// Instances of this class are thread safe.
1951    ///
1952    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednsproxyproviderprotocol?language=objc)
1953    #[unsafe(super(NEVPNProtocol, NSObject))]
1954    #[derive(Debug, PartialEq, Eq, Hash)]
1955    pub struct NEDNSProxyProviderProtocol;
1956);
1957
1958extern_conformance!(
1959    unsafe impl NSCoding for NEDNSProxyProviderProtocol {}
1960);
1961
1962extern_conformance!(
1963    unsafe impl NSCopying for NEDNSProxyProviderProtocol {}
1964);
1965
1966unsafe impl CopyingHelper for NEDNSProxyProviderProtocol {
1967    type Result = Self;
1968}
1969
1970extern_conformance!(
1971    unsafe impl NSObjectProtocol for NEDNSProxyProviderProtocol {}
1972);
1973
1974extern_conformance!(
1975    unsafe impl NSSecureCoding for NEDNSProxyProviderProtocol {}
1976);
1977
1978impl NEDNSProxyProviderProtocol {
1979    extern_methods!(
1980        /// A dictionary containing NEDNSProxyProvider vendor-specific configuration parameters. This dictionary is passed as-is to NEDNSProxyProviders when a DNS proxy is started.
1981        #[unsafe(method(providerConfiguration))]
1982        #[unsafe(method_family = none)]
1983        pub unsafe fn providerConfiguration(
1984            &self,
1985        ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
1986
1987        /// Setter for [`providerConfiguration`][Self::providerConfiguration].
1988        #[unsafe(method(setProviderConfiguration:))]
1989        #[unsafe(method_family = none)]
1990        pub unsafe fn setProviderConfiguration(
1991            &self,
1992            provider_configuration: Option<&NSDictionary<NSString, AnyObject>>,
1993        );
1994
1995        /// A string containing the bundle identifier of the NEDNSProxyProvider to be used by this configuration.
1996        #[unsafe(method(providerBundleIdentifier))]
1997        #[unsafe(method_family = none)]
1998        pub unsafe fn providerBundleIdentifier(&self) -> Option<Retained<NSString>>;
1999
2000        /// Setter for [`providerBundleIdentifier`][Self::providerBundleIdentifier].
2001        #[unsafe(method(setProviderBundleIdentifier:))]
2002        #[unsafe(method_family = none)]
2003        pub unsafe fn setProviderBundleIdentifier(
2004            &self,
2005            provider_bundle_identifier: Option<&NSString>,
2006        );
2007    );
2008}
2009
2010/// Methods declared on superclass `NSObject`.
2011impl NEDNSProxyProviderProtocol {
2012    extern_methods!(
2013        #[unsafe(method(init))]
2014        #[unsafe(method_family = init)]
2015        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2016
2017        #[unsafe(method(new))]
2018        #[unsafe(method_family = new)]
2019        pub unsafe fn new() -> Retained<Self>;
2020    );
2021}
2022
2023/// DNS protocol variants
2024///
2025/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednsprotocol?language=objc)
2026// NS_ENUM
2027#[repr(transparent)]
2028#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2029pub struct NEDNSProtocol(pub NSInteger);
2030impl NEDNSProtocol {
2031    #[doc(alias = "NEDNSProtocolCleartext")]
2032    pub const Cleartext: Self = Self(1);
2033    #[doc(alias = "NEDNSProtocolTLS")]
2034    pub const TLS: Self = Self(2);
2035    #[doc(alias = "NEDNSProtocolHTTPS")]
2036    pub const HTTPS: Self = Self(3);
2037}
2038
2039unsafe impl Encode for NEDNSProtocol {
2040    const ENCODING: Encoding = NSInteger::ENCODING;
2041}
2042
2043unsafe impl RefEncode for NEDNSProtocol {
2044    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2045}
2046
2047extern_class!(
2048    /// The NEDNSSettings class declares the programmatic interface for an object that contains DNS settings.
2049    ///
2050    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednssettings?language=objc)
2051    #[unsafe(super(NSObject))]
2052    #[derive(Debug, PartialEq, Eq, Hash)]
2053    pub struct NEDNSSettings;
2054);
2055
2056extern_conformance!(
2057    unsafe impl NSCoding for NEDNSSettings {}
2058);
2059
2060extern_conformance!(
2061    unsafe impl NSCopying for NEDNSSettings {}
2062);
2063
2064unsafe impl CopyingHelper for NEDNSSettings {
2065    type Result = Self;
2066}
2067
2068extern_conformance!(
2069    unsafe impl NSObjectProtocol for NEDNSSettings {}
2070);
2071
2072extern_conformance!(
2073    unsafe impl NSSecureCoding for NEDNSSettings {}
2074);
2075
2076impl NEDNSSettings {
2077    extern_methods!(
2078        /// The DNS protocol used by the settings.
2079        #[unsafe(method(dnsProtocol))]
2080        #[unsafe(method_family = none)]
2081        pub unsafe fn dnsProtocol(&self) -> NEDNSProtocol;
2082
2083        /// Initialize a newly-allocated NEDNSSettings object.
2084        ///
2085        /// Parameter `servers`: An array of DNS server IP address strings.
2086        #[unsafe(method(initWithServers:))]
2087        #[unsafe(method_family = init)]
2088        pub unsafe fn initWithServers(
2089            this: Allocated<Self>,
2090            servers: &NSArray<NSString>,
2091        ) -> Retained<Self>;
2092
2093        /// An array of DNS server address strings.
2094        #[unsafe(method(servers))]
2095        #[unsafe(method_family = none)]
2096        pub unsafe fn servers(&self) -> Retained<NSArray<NSString>>;
2097
2098        /// An array of DNS server search domain strings.
2099        #[unsafe(method(searchDomains))]
2100        #[unsafe(method_family = none)]
2101        pub unsafe fn searchDomains(&self) -> Option<Retained<NSArray<NSString>>>;
2102
2103        /// Setter for [`searchDomains`][Self::searchDomains].
2104        #[unsafe(method(setSearchDomains:))]
2105        #[unsafe(method_family = none)]
2106        pub unsafe fn setSearchDomains(&self, search_domains: Option<&NSArray<NSString>>);
2107
2108        /// A string containing the DNS domain.
2109        #[unsafe(method(domainName))]
2110        #[unsafe(method_family = none)]
2111        pub unsafe fn domainName(&self) -> Option<Retained<NSString>>;
2112
2113        /// Setter for [`domainName`][Self::domainName].
2114        #[unsafe(method(setDomainName:))]
2115        #[unsafe(method_family = none)]
2116        pub unsafe fn setDomainName(&self, domain_name: Option<&NSString>);
2117
2118        /// An array of strings containing domain strings. If this property is non-nil, the DNS settings will only be used to resolve host names within the specified domains.
2119        #[unsafe(method(matchDomains))]
2120        #[unsafe(method_family = none)]
2121        pub unsafe fn matchDomains(&self) -> Option<Retained<NSArray<NSString>>>;
2122
2123        /// Setter for [`matchDomains`][Self::matchDomains].
2124        #[unsafe(method(setMatchDomains:))]
2125        #[unsafe(method_family = none)]
2126        pub unsafe fn setMatchDomains(&self, match_domains: Option<&NSArray<NSString>>);
2127
2128        /// A boolean indicating if the match domains should be appended to the search domain list.  Default is NO (match domains will be appended to the search domain list).
2129        #[unsafe(method(matchDomainsNoSearch))]
2130        #[unsafe(method_family = none)]
2131        pub unsafe fn matchDomainsNoSearch(&self) -> bool;
2132
2133        /// Setter for [`matchDomainsNoSearch`][Self::matchDomainsNoSearch].
2134        #[unsafe(method(setMatchDomainsNoSearch:))]
2135        #[unsafe(method_family = none)]
2136        pub unsafe fn setMatchDomainsNoSearch(&self, match_domains_no_search: bool);
2137    );
2138}
2139
2140/// Methods declared on superclass `NSObject`.
2141impl NEDNSSettings {
2142    extern_methods!(
2143        #[unsafe(method(init))]
2144        #[unsafe(method_family = init)]
2145        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2146
2147        #[unsafe(method(new))]
2148        #[unsafe(method_family = new)]
2149        pub unsafe fn new() -> Retained<Self>;
2150    );
2151}
2152
2153extern_class!(
2154    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednsovertlssettings?language=objc)
2155    #[unsafe(super(NEDNSSettings, NSObject))]
2156    #[derive(Debug, PartialEq, Eq, Hash)]
2157    pub struct NEDNSOverTLSSettings;
2158);
2159
2160extern_conformance!(
2161    unsafe impl NSCoding for NEDNSOverTLSSettings {}
2162);
2163
2164extern_conformance!(
2165    unsafe impl NSCopying for NEDNSOverTLSSettings {}
2166);
2167
2168unsafe impl CopyingHelper for NEDNSOverTLSSettings {
2169    type Result = Self;
2170}
2171
2172extern_conformance!(
2173    unsafe impl NSObjectProtocol for NEDNSOverTLSSettings {}
2174);
2175
2176extern_conformance!(
2177    unsafe impl NSSecureCoding for NEDNSOverTLSSettings {}
2178);
2179
2180impl NEDNSOverTLSSettings {
2181    extern_methods!(
2182        /// The name of the server to use for TLS certificate validation.
2183        #[unsafe(method(serverName))]
2184        #[unsafe(method_family = none)]
2185        pub unsafe fn serverName(&self) -> Option<Retained<NSString>>;
2186
2187        /// Setter for [`serverName`][Self::serverName].
2188        #[unsafe(method(setServerName:))]
2189        #[unsafe(method_family = none)]
2190        pub unsafe fn setServerName(&self, server_name: Option<&NSString>);
2191
2192        /// The optional certificate identity keychain reference to use as a TLS client certificate.
2193        #[unsafe(method(identityReference))]
2194        #[unsafe(method_family = none)]
2195        pub unsafe fn identityReference(&self) -> Option<Retained<NSData>>;
2196
2197        /// Setter for [`identityReference`][Self::identityReference].
2198        #[unsafe(method(setIdentityReference:))]
2199        #[unsafe(method_family = none)]
2200        pub unsafe fn setIdentityReference(&self, identity_reference: Option<&NSData>);
2201    );
2202}
2203
2204/// Methods declared on superclass `NEDNSSettings`.
2205impl NEDNSOverTLSSettings {
2206    extern_methods!(
2207        /// Initialize a newly-allocated NEDNSSettings object.
2208        ///
2209        /// Parameter `servers`: An array of DNS server IP address strings.
2210        #[unsafe(method(initWithServers:))]
2211        #[unsafe(method_family = init)]
2212        pub unsafe fn initWithServers(
2213            this: Allocated<Self>,
2214            servers: &NSArray<NSString>,
2215        ) -> Retained<Self>;
2216    );
2217}
2218
2219/// Methods declared on superclass `NSObject`.
2220impl NEDNSOverTLSSettings {
2221    extern_methods!(
2222        #[unsafe(method(init))]
2223        #[unsafe(method_family = init)]
2224        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2225
2226        #[unsafe(method(new))]
2227        #[unsafe(method_family = new)]
2228        pub unsafe fn new() -> Retained<Self>;
2229    );
2230}
2231
2232extern_class!(
2233    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednsoverhttpssettings?language=objc)
2234    #[unsafe(super(NEDNSSettings, NSObject))]
2235    #[derive(Debug, PartialEq, Eq, Hash)]
2236    pub struct NEDNSOverHTTPSSettings;
2237);
2238
2239extern_conformance!(
2240    unsafe impl NSCoding for NEDNSOverHTTPSSettings {}
2241);
2242
2243extern_conformance!(
2244    unsafe impl NSCopying for NEDNSOverHTTPSSettings {}
2245);
2246
2247unsafe impl CopyingHelper for NEDNSOverHTTPSSettings {
2248    type Result = Self;
2249}
2250
2251extern_conformance!(
2252    unsafe impl NSObjectProtocol for NEDNSOverHTTPSSettings {}
2253);
2254
2255extern_conformance!(
2256    unsafe impl NSSecureCoding for NEDNSOverHTTPSSettings {}
2257);
2258
2259impl NEDNSOverHTTPSSettings {
2260    extern_methods!(
2261        /// The URL to which to make DNS-over-HTTPS requests. The format should be an HTTPS URL with the path indicating the location of the DNS-over-HTTPS server, such as: "https://dnsserver.example.net/dns-query".
2262        #[unsafe(method(serverURL))]
2263        #[unsafe(method_family = none)]
2264        pub unsafe fn serverURL(&self) -> Option<Retained<NSURL>>;
2265
2266        /// Setter for [`serverURL`][Self::serverURL].
2267        #[unsafe(method(setServerURL:))]
2268        #[unsafe(method_family = none)]
2269        pub unsafe fn setServerURL(&self, server_url: Option<&NSURL>);
2270
2271        /// The optional certificate identity keychain reference to use as a TLS client certificate.
2272        #[unsafe(method(identityReference))]
2273        #[unsafe(method_family = none)]
2274        pub unsafe fn identityReference(&self) -> Option<Retained<NSData>>;
2275
2276        /// Setter for [`identityReference`][Self::identityReference].
2277        #[unsafe(method(setIdentityReference:))]
2278        #[unsafe(method_family = none)]
2279        pub unsafe fn setIdentityReference(&self, identity_reference: Option<&NSData>);
2280    );
2281}
2282
2283/// Methods declared on superclass `NEDNSSettings`.
2284impl NEDNSOverHTTPSSettings {
2285    extern_methods!(
2286        /// Initialize a newly-allocated NEDNSSettings object.
2287        ///
2288        /// Parameter `servers`: An array of DNS server IP address strings.
2289        #[unsafe(method(initWithServers:))]
2290        #[unsafe(method_family = init)]
2291        pub unsafe fn initWithServers(
2292            this: Allocated<Self>,
2293            servers: &NSArray<NSString>,
2294        ) -> Retained<Self>;
2295    );
2296}
2297
2298/// Methods declared on superclass `NSObject`.
2299impl NEDNSOverHTTPSSettings {
2300    extern_methods!(
2301        #[unsafe(method(init))]
2302        #[unsafe(method_family = init)]
2303        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2304
2305        #[unsafe(method(new))]
2306        #[unsafe(method_family = new)]
2307        pub unsafe fn new() -> Retained<Self>;
2308    );
2309}
2310
2311/// DNS Settings Manager error codes
2312///
2313/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednssettingsmanagererror?language=objc)
2314// NS_ENUM
2315#[repr(transparent)]
2316#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2317pub struct NEDNSSettingsManagerError(pub NSInteger);
2318impl NEDNSSettingsManagerError {
2319    #[doc(alias = "NEDNSSettingsManagerErrorConfigurationInvalid")]
2320    pub const ConfigurationInvalid: Self = Self(1);
2321    #[doc(alias = "NEDNSSettingsManagerErrorConfigurationDisabled")]
2322    pub const ConfigurationDisabled: Self = Self(2);
2323    #[doc(alias = "NEDNSSettingsManagerErrorConfigurationStale")]
2324    pub const ConfigurationStale: Self = Self(3);
2325    #[doc(alias = "NEDNSSettingsManagerErrorConfigurationCannotBeRemoved")]
2326    pub const ConfigurationCannotBeRemoved: Self = Self(4);
2327}
2328
2329unsafe impl Encode for NEDNSSettingsManagerError {
2330    const ENCODING: Encoding = NSInteger::ENCODING;
2331}
2332
2333unsafe impl RefEncode for NEDNSSettingsManagerError {
2334    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2335}
2336
2337extern "C" {
2338    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednssettingserrordomain?language=objc)
2339    pub static NEDNSSettingsErrorDomain: &'static NSString;
2340}
2341
2342extern "C" {
2343    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednssettingsconfigurationdidchangenotification?language=objc)
2344    pub static NEDNSSettingsConfigurationDidChangeNotification: &'static NSString;
2345}
2346
2347extern_class!(
2348    /// The NEDNSSettingsManager class declares the programmatic interface for an object that manages DNS settings configurations.
2349    ///
2350    /// NEDNSSettingsManager declares methods and properties for configuring and controlling DNS settings on the system.
2351    ///
2352    /// Instances of this class are thread safe.
2353    ///
2354    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednssettingsmanager?language=objc)
2355    #[unsafe(super(NSObject))]
2356    #[derive(Debug, PartialEq, Eq, Hash)]
2357    pub struct NEDNSSettingsManager;
2358);
2359
2360extern_conformance!(
2361    unsafe impl NSObjectProtocol for NEDNSSettingsManager {}
2362);
2363
2364impl NEDNSSettingsManager {
2365    extern_methods!(
2366        /// Returns: The singleton NEDNSSettingsManager object for the calling process.
2367        #[unsafe(method(sharedManager))]
2368        #[unsafe(method_family = none)]
2369        pub unsafe fn sharedManager() -> Retained<NEDNSSettingsManager>;
2370
2371        #[cfg(feature = "block2")]
2372        /// This function loads the current DNS settings configuration from the caller's DNS settings preferences.
2373        ///
2374        /// Parameter `completionHandler`: A block that will be called when the load operation is completed. The NSError passed to this block will be nil if the load operation succeeded, non-nil otherwise.
2375        #[unsafe(method(loadFromPreferencesWithCompletionHandler:))]
2376        #[unsafe(method_family = none)]
2377        pub unsafe fn loadFromPreferencesWithCompletionHandler(
2378            &self,
2379            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
2380        );
2381
2382        #[cfg(feature = "block2")]
2383        /// This function removes the DNS settings configuration from the caller's DNS settings preferences. If the DNS settings are enabled, the DNS settings becomes disabled.
2384        ///
2385        /// Parameter `completionHandler`: A block that will be called when the remove operation is completed. The NSError passed to this block will be nil if the remove operation succeeded, non-nil otherwise.
2386        #[unsafe(method(removeFromPreferencesWithCompletionHandler:))]
2387        #[unsafe(method_family = none)]
2388        pub unsafe fn removeFromPreferencesWithCompletionHandler(
2389            &self,
2390            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
2391        );
2392
2393        #[cfg(feature = "block2")]
2394        /// This function saves the DNS settingsconfiguration in the caller's DNS settings preferences. If the DNS settings are enabled, they will become active.
2395        ///
2396        /// Parameter `completionHandler`: A block that will be called when the save operation is completed. The NSError passed to this block will be nil if the save operation succeeded, non-nil otherwise.
2397        #[unsafe(method(saveToPreferencesWithCompletionHandler:))]
2398        #[unsafe(method_family = none)]
2399        pub unsafe fn saveToPreferencesWithCompletionHandler(
2400            &self,
2401            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
2402        );
2403
2404        /// A string containing a description of the DNS settings.
2405        #[unsafe(method(localizedDescription))]
2406        #[unsafe(method_family = none)]
2407        pub unsafe fn localizedDescription(&self) -> Option<Retained<NSString>>;
2408
2409        /// Setter for [`localizedDescription`][Self::localizedDescription].
2410        #[unsafe(method(setLocalizedDescription:))]
2411        #[unsafe(method_family = none)]
2412        pub unsafe fn setLocalizedDescription(&self, localized_description: Option<&NSString>);
2413
2414        /// An NEDNSSettings object containing the DNS resolver configuration to apply to the system.
2415        #[unsafe(method(dnsSettings))]
2416        #[unsafe(method_family = none)]
2417        pub unsafe fn dnsSettings(&self) -> Option<Retained<NEDNSSettings>>;
2418
2419        /// Setter for [`dnsSettings`][Self::dnsSettings].
2420        #[unsafe(method(setDnsSettings:))]
2421        #[unsafe(method_family = none)]
2422        pub unsafe fn setDnsSettings(&self, dns_settings: Option<&NEDNSSettings>);
2423
2424        /// An array of NEOnDemandRule objects. If nil, the associated DNS settings will always apply. If non-nil, the array describes the networks on which the DNS configuration should take effect or not.
2425        #[unsafe(method(onDemandRules))]
2426        #[unsafe(method_family = none)]
2427        pub unsafe fn onDemandRules(&self) -> Option<Retained<NSArray<NEOnDemandRule>>>;
2428
2429        /// Setter for [`onDemandRules`][Self::onDemandRules].
2430        #[unsafe(method(setOnDemandRules:))]
2431        #[unsafe(method_family = none)]
2432        pub unsafe fn setOnDemandRules(&self, on_demand_rules: Option<&NSArray<NEOnDemandRule>>);
2433
2434        /// Checks the enabled status of the DNS settings. DNS settings must be enabled by the user in Settings or System Preferences.
2435        #[unsafe(method(isEnabled))]
2436        #[unsafe(method_family = none)]
2437        pub unsafe fn isEnabled(&self) -> bool;
2438    );
2439}
2440
2441/// Methods declared on superclass `NSObject`.
2442impl NEDNSSettingsManager {
2443    extern_methods!(
2444        #[unsafe(method(init))]
2445        #[unsafe(method_family = init)]
2446        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2447
2448        #[unsafe(method(new))]
2449        #[unsafe(method_family = new)]
2450        pub unsafe fn new() -> Retained<Self>;
2451    );
2452}
2453
2454/// IP protocols
2455///
2456/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nenetworkruleprotocol?language=objc)
2457// NS_ENUM
2458#[repr(transparent)]
2459#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2460pub struct NENetworkRuleProtocol(pub NSInteger);
2461impl NENetworkRuleProtocol {
2462    #[doc(alias = "NENetworkRuleProtocolAny")]
2463    pub const Any: Self = Self(0);
2464    #[doc(alias = "NENetworkRuleProtocolTCP")]
2465    pub const TCP: Self = Self(1);
2466    #[doc(alias = "NENetworkRuleProtocolUDP")]
2467    pub const UDP: Self = Self(2);
2468}
2469
2470unsafe impl Encode for NENetworkRuleProtocol {
2471    const ENCODING: Encoding = NSInteger::ENCODING;
2472}
2473
2474unsafe impl RefEncode for NENetworkRuleProtocol {
2475    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2476}
2477
2478/// The direction of network traffic
2479///
2480/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netrafficdirection?language=objc)
2481// NS_ENUM
2482#[repr(transparent)]
2483#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2484pub struct NETrafficDirection(pub NSInteger);
2485impl NETrafficDirection {
2486    #[doc(alias = "NETrafficDirectionAny")]
2487    pub const Any: Self = Self(0);
2488    #[doc(alias = "NETrafficDirectionInbound")]
2489    pub const Inbound: Self = Self(1);
2490    #[doc(alias = "NETrafficDirectionOutbound")]
2491    pub const Outbound: Self = Self(2);
2492}
2493
2494unsafe impl Encode for NETrafficDirection {
2495    const ENCODING: Encoding = NSInteger::ENCODING;
2496}
2497
2498unsafe impl RefEncode for NETrafficDirection {
2499    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2500}
2501
2502extern_class!(
2503    /// The NENetworkRule class declares the programmatic interface of an object that contains a specification of a rule that matches the attributes of network traffic.
2504    ///
2505    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nenetworkrule?language=objc)
2506    #[unsafe(super(NSObject))]
2507    #[derive(Debug, PartialEq, Eq, Hash)]
2508    pub struct NENetworkRule;
2509);
2510
2511extern_conformance!(
2512    unsafe impl NSCoding for NENetworkRule {}
2513);
2514
2515extern_conformance!(
2516    unsafe impl NSCopying for NENetworkRule {}
2517);
2518
2519unsafe impl CopyingHelper for NENetworkRule {
2520    type Result = Self;
2521}
2522
2523extern_conformance!(
2524    unsafe impl NSObjectProtocol for NENetworkRule {}
2525);
2526
2527extern_conformance!(
2528    unsafe impl NSSecureCoding for NENetworkRule {}
2529);
2530
2531impl NENetworkRule {
2532    extern_methods!(
2533        /// Initialize a newly-allocated NENetworkRule object that matches network traffic destined for a host within a specific network.
2534        ///
2535        /// Parameter `networkEndpoint`: An endpoint object that contains the port and address or network that the rule matches. This endpoint must contain an address, not a hostname.
2536        /// If the address is a wildcard address (0.0.0.0 or ::) then the rule will match all destinations except for loopback (127.0.0.1 or ::1). To match loopback traffic set the address to the loopback address.
2537        /// If the port string of the endpoint is "0" or is the empty string, then the rule will match traffic on any port destined for the given address or network.
2538        ///
2539        /// Parameter `destinationPrefix`: An integer that in combination with the address in the endpoint specifies the destination network that the rule matches.
2540        ///
2541        /// Parameter `protocol`: A NENetworkRuleProtocol value indicating the protocol that the rule matches.
2542        ///
2543        /// Returns: The initialized NENetworkRule instance.
2544        #[deprecated]
2545        #[unsafe(method(initWithDestinationNetwork:prefix:protocol:))]
2546        #[unsafe(method_family = init)]
2547        pub unsafe fn initWithDestinationNetwork_prefix_protocol(
2548            this: Allocated<Self>,
2549            network_endpoint: &NWHostEndpoint,
2550            destination_prefix: NSUInteger,
2551            protocol: NENetworkRuleProtocol,
2552        ) -> Retained<Self>;
2553
2554        /// Initialize a newly-allocated NENetworkRule object that matches network traffic destined for a host within a specific DNS domain.
2555        ///
2556        /// Parameter `hostEndpoint`: An endpoint object that contains the port and hostname or domain that the rule matches. This endpoint must contain a hostname, not an address.
2557        /// If the port string of the NWHostEndpoint is "0" or is the empty string, then the rule will match traffic on any port destined for the given hostname or domain.
2558        /// If the hostname string of the endpoint consists of a single label, then the rule will match traffic destined to the specific host with that single label as its name.
2559        /// If the hostname string of the endpoint consists of 2 or more labels, then the rule will match traffic destined to hosts within the domain specified by the hostname string.
2560        /// Examples:
2561        /// [[NENetworkRule alloc] initWithDestinationHost:[NWHostEndpoint endpointWithHostname:
2562        /// "
2563        /// com" port:@"0"] protocol:NENetworkRuleProtocolAny] - matches all TCP and UDP traffic to the host named "com".
2564        /// [[NENetworkRule alloc] initWithDestinationHost:[NWHostEndpoint endpointWithHostname:
2565        /// "
2566        /// example.com" port:@"0"] protocol:NENetworkRuleProtocolAny] - matches all TCP and UDP traffic to hosts in the "example.com" DNS domain, including all DNS queries for names in the example.com DNS domain.
2567        /// [[NENetworkRule alloc] initWithDestinationHost:[NWHostEndpoint endpointWithHostname:
2568        /// "
2569        /// example.com" port:@"53"] protocol:NENetworkRuleProtocolAny] - matches all DNS queries/responses for hosts in the "example.com" domain.
2570        /// [[NENetworkRule alloc] initWithDestinationHost:[NWHostEndpoint endpointWithHostname:
2571        /// "
2572        /// example.com" port:@"443"] protocol:NENetworkRuleProtocolTCP] - matches all TCP port 443 traffic to hosts in the "example.com" domain.
2573        ///
2574        /// Parameter `protocol`: A NENetworkRuleProtocol value indicating the protocol that the rule matches.
2575        ///
2576        /// Returns: The initialized NENetworkRule instance.
2577        #[deprecated]
2578        #[unsafe(method(initWithDestinationHost:protocol:))]
2579        #[unsafe(method_family = init)]
2580        pub unsafe fn initWithDestinationHost_protocol(
2581            this: Allocated<Self>,
2582            host_endpoint: &NWHostEndpoint,
2583            protocol: NENetworkRuleProtocol,
2584        ) -> Retained<Self>;
2585
2586        /// Initialize a newly-allocated NENetworkRule object that matches traffic by remote network, local network, protocol, and direction. If both remoteNetwork and localNetwork are nil
2587        /// then the rule will match all traffic of the given protocol and direction, except for loopback traffic. To match loopback traffic create a NENetworkRule with remoteNetwork and/or localNetwork properties that
2588        /// explicitly match traffic to the loopback address (127.0.0.1 or ::1).
2589        ///
2590        /// Parameter `remoteNetwork`: An endpoint object that contains the remote port and the remote address or network that the rule matches. This endpoint must contain an address, not a hostname.
2591        /// If the address is a wildcard address (0.0.0.0 or ::) then the rule will match all destinations except for loopback (127.0.0.1 or ::1). To match loopback traffic set the address to the loopback address.
2592        /// If the port string of the endpoint is "0" or is the empty string, then the rule will match traffic on any port coming from the remote network.
2593        /// Pass nil to cause the rule to match any remote network.
2594        ///
2595        /// Parameter `remotePrefix`: An integer that in combination with the address in remoteNetwork specifies the remote network that the rule matches.
2596        ///
2597        /// Parameter `localNetwork`: An endpoint object that contains the local port and the local address or network that the rule matches. This endpoint must contain an address, not a hostname.
2598        /// If the address is a wildcard address (0.0.0.0 or ::) then the rule will match all local networks except for loopback (127.0.0.1 or ::1). To match loopback traffic set the address to the loopback address.
2599        /// If the port string of the endpoint is "0" or is the empty string, then the rule will match traffic on any port coming from the local network.
2600        /// Pass nil to cause the rule to match any local network.
2601        ///
2602        /// Parameter `localPrefix`: An integer that in combination with the address in localNetwork specifies the local network that the rule matches. This parameter
2603        /// is ignored if localNetwork is nil.
2604        ///
2605        /// Parameter `protocol`: A NENetworkRuleProtocol value indicating the protocol that the rule matches.
2606        ///
2607        /// Parameter `direction`: A NETrafficDirection value indicating the direction of network traffic that the rule matches.
2608        ///
2609        /// Returns: The initialized NENetworkRule instance.
2610        #[deprecated]
2611        #[unsafe(method(initWithRemoteNetwork:remotePrefix:localNetwork:localPrefix:protocol:direction:))]
2612        #[unsafe(method_family = init)]
2613        pub unsafe fn initWithRemoteNetwork_remotePrefix_localNetwork_localPrefix_protocol_direction(
2614            this: Allocated<Self>,
2615            remote_network: Option<&NWHostEndpoint>,
2616            remote_prefix: NSUInteger,
2617            local_network: Option<&NWHostEndpoint>,
2618            local_prefix: NSUInteger,
2619            protocol: NENetworkRuleProtocol,
2620            direction: NETrafficDirection,
2621        ) -> Retained<Self>;
2622
2623        /// The remote endpoint that the rule matches.
2624        #[deprecated]
2625        #[unsafe(method(matchRemoteEndpoint))]
2626        #[unsafe(method_family = none)]
2627        pub unsafe fn matchRemoteEndpoint(&self) -> Option<Retained<NWHostEndpoint>>;
2628
2629        /// A number that specifies the remote sub-network that the rule matches. This property is set to NSNotFound for rules where matchRemoteEndpoint does not contain an IP address.
2630        #[unsafe(method(matchRemotePrefix))]
2631        #[unsafe(method_family = none)]
2632        pub unsafe fn matchRemotePrefix(&self) -> NSUInteger;
2633
2634        /// The local network that the rule matches.
2635        #[deprecated]
2636        #[unsafe(method(matchLocalNetwork))]
2637        #[unsafe(method_family = none)]
2638        pub unsafe fn matchLocalNetwork(&self) -> Option<Retained<NWHostEndpoint>>;
2639
2640        /// A number that specifies the local sub-network that the rule matches. This property is set to NSNotFound for rules with a nil matchLocalNetwork property.
2641        #[unsafe(method(matchLocalPrefix))]
2642        #[unsafe(method_family = none)]
2643        pub unsafe fn matchLocalPrefix(&self) -> NSUInteger;
2644
2645        /// A NENetworkRuleProtocol value containing the protocol that the rule matches.
2646        #[unsafe(method(matchProtocol))]
2647        #[unsafe(method_family = none)]
2648        pub unsafe fn matchProtocol(&self) -> NENetworkRuleProtocol;
2649
2650        /// A NETrafficDirection value indicating the network traffic direction that the rule matches.
2651        #[unsafe(method(matchDirection))]
2652        #[unsafe(method_family = none)]
2653        pub unsafe fn matchDirection(&self) -> NETrafficDirection;
2654    );
2655}
2656
2657/// Methods declared on superclass `NSObject`.
2658impl NENetworkRule {
2659    extern_methods!(
2660        #[unsafe(method(init))]
2661        #[unsafe(method_family = init)]
2662        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2663
2664        #[unsafe(method(new))]
2665        #[unsafe(method_family = new)]
2666        pub unsafe fn new() -> Retained<Self>;
2667    );
2668}
2669
2670extern_class!(
2671    /// The NEFilterFlow class declares the programmatic interface of an object that represents a flow of network data to be filtered.
2672    ///
2673    /// NEFilterFlow is part of NetworkExtension.framework
2674    ///
2675    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterflow?language=objc)
2676    #[unsafe(super(NSObject))]
2677    #[derive(Debug, PartialEq, Eq, Hash)]
2678    pub struct NEFilterFlow;
2679);
2680
2681extern_conformance!(
2682    unsafe impl NSCoding for NEFilterFlow {}
2683);
2684
2685extern_conformance!(
2686    unsafe impl NSCopying for NEFilterFlow {}
2687);
2688
2689unsafe impl CopyingHelper for NEFilterFlow {
2690    type Result = Self;
2691}
2692
2693extern_conformance!(
2694    unsafe impl NSObjectProtocol for NEFilterFlow {}
2695);
2696
2697extern_conformance!(
2698    unsafe impl NSSecureCoding for NEFilterFlow {}
2699);
2700
2701impl NEFilterFlow {
2702    extern_methods!(
2703        /// The flow's HTTP request URL. Will be nil if the flow did not originate from WebKit.
2704        #[unsafe(method(URL))]
2705        #[unsafe(method_family = none)]
2706        pub unsafe fn URL(&self) -> Option<Retained<NSURL>>;
2707
2708        /// A byte string that uniquely identifies the binary for each build of the source application of the flow.
2709        #[unsafe(method(sourceAppUniqueIdentifier))]
2710        #[unsafe(method_family = none)]
2711        pub unsafe fn sourceAppUniqueIdentifier(&self) -> Option<Retained<NSData>>;
2712
2713        /// A string containing the identifier of the source application of the flow. This identifier stays the same for all versions and builds of the application. This identifier is unique among all applications.
2714        #[unsafe(method(sourceAppIdentifier))]
2715        #[unsafe(method_family = none)]
2716        pub unsafe fn sourceAppIdentifier(&self) -> Option<Retained<NSString>>;
2717
2718        /// The short version string of the source application. Will be nil if the app info is unavailable.
2719        #[unsafe(method(sourceAppVersion))]
2720        #[unsafe(method_family = none)]
2721        pub unsafe fn sourceAppVersion(&self) -> Option<Retained<NSString>>;
2722
2723        /// Initial direction of the flow (outgoing or incoming flow)
2724        #[unsafe(method(direction))]
2725        #[unsafe(method_family = none)]
2726        pub unsafe fn direction(&self) -> NETrafficDirection;
2727
2728        /// Audit token of the source application of the flow.
2729        #[unsafe(method(sourceAppAuditToken))]
2730        #[unsafe(method_family = none)]
2731        pub unsafe fn sourceAppAuditToken(&self) -> Option<Retained<NSData>>;
2732
2733        /// The audit token of the process that created the flow. In cases where the connection was created by a system process on behalf of the source application,
2734        /// sourceProcessAuditToken will be different from sourceAppAuditToken and will contain the audit token of the system process. In cases where the source application directly
2735        /// created the connection sourceAppAuditToken and sourceProcessAuditToken will be identical.
2736        #[unsafe(method(sourceProcessAuditToken))]
2737        #[unsafe(method_family = none)]
2738        pub unsafe fn sourceProcessAuditToken(&self) -> Option<Retained<NSData>>;
2739
2740        /// The unique identifier of the flow.
2741        #[unsafe(method(identifier))]
2742        #[unsafe(method_family = none)]
2743        pub unsafe fn identifier(&self) -> Retained<NSUUID>;
2744    );
2745}
2746
2747/// Methods declared on superclass `NSObject`.
2748impl NEFilterFlow {
2749    extern_methods!(
2750        #[unsafe(method(init))]
2751        #[unsafe(method_family = init)]
2752        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2753
2754        #[unsafe(method(new))]
2755        #[unsafe(method_family = new)]
2756        pub unsafe fn new() -> Retained<Self>;
2757    );
2758}
2759
2760extern_class!(
2761    /// The NEFilterBrowserFlow class declares the programmatic interface of an object that represents a flow of network data to be filtered, which is originated from NEFilterSource.
2762    ///
2763    /// NEFilterBrowserFlow is part of NetworkExtension.framework
2764    ///
2765    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterbrowserflow?language=objc)
2766    #[unsafe(super(NEFilterFlow, NSObject))]
2767    #[derive(Debug, PartialEq, Eq, Hash)]
2768    pub struct NEFilterBrowserFlow;
2769);
2770
2771extern_conformance!(
2772    unsafe impl NSCoding for NEFilterBrowserFlow {}
2773);
2774
2775extern_conformance!(
2776    unsafe impl NSCopying for NEFilterBrowserFlow {}
2777);
2778
2779unsafe impl CopyingHelper for NEFilterBrowserFlow {
2780    type Result = Self;
2781}
2782
2783extern_conformance!(
2784    unsafe impl NSObjectProtocol for NEFilterBrowserFlow {}
2785);
2786
2787extern_conformance!(
2788    unsafe impl NSSecureCoding for NEFilterBrowserFlow {}
2789);
2790
2791impl NEFilterBrowserFlow {
2792    extern_methods!(
2793        /// The NSURLRequest of the flow. This property is always nil for the control providers.
2794        #[unsafe(method(request))]
2795        #[unsafe(method_family = none)]
2796        pub unsafe fn request(&self) -> Option<Retained<NSURLRequest>>;
2797
2798        /// The NSURLResponse of the flow. This will be nil until the request is sent to the server and the response headers are received. And this property is always nil for the control providers.
2799        #[unsafe(method(response))]
2800        #[unsafe(method_family = none)]
2801        pub unsafe fn response(&self) -> Option<Retained<NSURLResponse>>;
2802
2803        /// The parent URL for the current flow which is created to load the sub frames because the flow with the parent URL was allowed. Will be nil if the parent flow does not exist.
2804        #[unsafe(method(parentURL))]
2805        #[unsafe(method_family = none)]
2806        pub unsafe fn parentURL(&self) -> Option<Retained<NSURL>>;
2807    );
2808}
2809
2810/// Methods declared on superclass `NSObject`.
2811impl NEFilterBrowserFlow {
2812    extern_methods!(
2813        #[unsafe(method(init))]
2814        #[unsafe(method_family = init)]
2815        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2816
2817        #[unsafe(method(new))]
2818        #[unsafe(method_family = new)]
2819        pub unsafe fn new() -> Retained<Self>;
2820    );
2821}
2822
2823extern_class!(
2824    /// The NEFilterSocketFlow class declares the programmatic interface of an object that represents a flow of network data to be filtered, which is originated from the socket.
2825    ///
2826    /// NEFilterSocketFlow is part of NetworkExtension.framework
2827    ///
2828    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefiltersocketflow?language=objc)
2829    #[unsafe(super(NEFilterFlow, NSObject))]
2830    #[derive(Debug, PartialEq, Eq, Hash)]
2831    pub struct NEFilterSocketFlow;
2832);
2833
2834extern_conformance!(
2835    unsafe impl NSCoding for NEFilterSocketFlow {}
2836);
2837
2838extern_conformance!(
2839    unsafe impl NSCopying for NEFilterSocketFlow {}
2840);
2841
2842unsafe impl CopyingHelper for NEFilterSocketFlow {
2843    type Result = Self;
2844}
2845
2846extern_conformance!(
2847    unsafe impl NSObjectProtocol for NEFilterSocketFlow {}
2848);
2849
2850extern_conformance!(
2851    unsafe impl NSSecureCoding for NEFilterSocketFlow {}
2852);
2853
2854impl NEFilterSocketFlow {
2855    extern_methods!(
2856        /// The flow's remote endpoint. This endpoint object may be nil when [NEFilterDataProvider handleNewFlow:] is invoked and if so will be populated upon receiving network data.
2857        /// In such a case, filtering on the flow may still be performed based on its socket type, socket family or socket protocol.
2858        #[deprecated]
2859        #[unsafe(method(remoteEndpoint))]
2860        #[unsafe(method_family = none)]
2861        pub unsafe fn remoteEndpoint(&self) -> Option<Retained<NWEndpoint>>;
2862
2863        /// The flow's remote hostname. This property is only non-nil if the flow was created using Network.framework or NSURLSession.
2864        #[unsafe(method(remoteHostname))]
2865        #[unsafe(method_family = none)]
2866        pub unsafe fn remoteHostname(&self) -> Option<Retained<NSString>>;
2867
2868        /// The flow's local endpoint. This endpoint object may be nil when [NEFilterDataProvider handleNewFlow:] is invoked and if so will be populated upon receiving network data.
2869        /// In such a case, filtering on the flow may still be performed based on its socket type, socket family or socket protocol.
2870        #[deprecated]
2871        #[unsafe(method(localEndpoint))]
2872        #[unsafe(method_family = none)]
2873        pub unsafe fn localEndpoint(&self) -> Option<Retained<NWEndpoint>>;
2874
2875        /// Socket family of the socket flow, such as PF_INET.
2876        #[unsafe(method(socketFamily))]
2877        #[unsafe(method_family = none)]
2878        pub unsafe fn socketFamily(&self) -> c_int;
2879
2880        /// Socket type of the socket flow, such as SOCK_STREAM.
2881        #[unsafe(method(socketType))]
2882        #[unsafe(method_family = none)]
2883        pub unsafe fn socketType(&self) -> c_int;
2884
2885        /// Socket protocol of the socket flow, such as IPPROTO_TCP.
2886        #[unsafe(method(socketProtocol))]
2887        #[unsafe(method_family = none)]
2888        pub unsafe fn socketProtocol(&self) -> c_int;
2889    );
2890}
2891
2892/// Methods declared on superclass `NSObject`.
2893impl NEFilterSocketFlow {
2894    extern_methods!(
2895        #[unsafe(method(init))]
2896        #[unsafe(method_family = init)]
2897        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2898
2899        #[unsafe(method(new))]
2900        #[unsafe(method_family = new)]
2901        pub unsafe fn new() -> Retained<Self>;
2902    );
2903}
2904
2905extern_class!(
2906    /// The NEFilterProvider class is an abstract base class that declares the programmatic interface of an
2907    /// object that implements a socket filter.
2908    ///
2909    /// NEFilterProvider is part of NetworkExtension.framework
2910    ///
2911    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterprovider?language=objc)
2912    #[unsafe(super(NEProvider, NSObject))]
2913    #[derive(Debug, PartialEq, Eq, Hash)]
2914    pub struct NEFilterProvider;
2915);
2916
2917extern_conformance!(
2918    unsafe impl NSObjectProtocol for NEFilterProvider {}
2919);
2920
2921impl NEFilterProvider {
2922    extern_methods!(
2923        #[cfg(feature = "block2")]
2924        /// This function is called by the framework when the content filter is being started. Subclasses must
2925        /// override this method and perform whatever steps are necessary to start the filter.
2926        ///
2927        /// Parameter `completionHandler`: A block that must be called when the process of starting the filter is complete. If the
2928        /// filter was started successfully, subclass implementations must pass the nil value to this block. If an error occurred
2929        /// while starting the filter, sublcass implementations must pass a non-nil NSError containing more details about the error.
2930        #[unsafe(method(startFilterWithCompletionHandler:))]
2931        #[unsafe(method_family = none)]
2932        pub unsafe fn startFilterWithCompletionHandler(
2933            &self,
2934            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
2935        );
2936
2937        #[cfg(feature = "block2")]
2938        /// This function is called by the framework when the content filter is being stopped. Subclasses must
2939        /// override this method and perform whatever steps are necessary to stop the filter.
2940        ///
2941        /// Parameter `reason`: An NEProviderStopReason indicating why the filter is being stopped.
2942        ///
2943        /// Parameter `completionHandler`: A block that must be called when the process of stopping the filter is complete.
2944        #[unsafe(method(stopFilterWithReason:completionHandler:))]
2945        #[unsafe(method_family = none)]
2946        pub unsafe fn stopFilterWithReason_completionHandler(
2947            &self,
2948            reason: NEProviderStopReason,
2949            completion_handler: &block2::DynBlock<dyn Fn()>,
2950        );
2951
2952        /// An NEContentFilterConfiguration object containing the current filter configuration. The value of this
2953        /// property can change during the lifetime of a filter. Filter implementations can use KVO to be notified when the
2954        /// configuration changes.
2955        #[unsafe(method(filterConfiguration))]
2956        #[unsafe(method_family = none)]
2957        pub unsafe fn filterConfiguration(&self) -> Retained<NEFilterProviderConfiguration>;
2958
2959        /// This function is called by the framework when the data provider extension returns a verdict with the report property set to True.
2960        /// Subclass implementations may override this method to handle the flow report.
2961        ///
2962        /// Parameter `report`: The report being delivered.
2963        #[unsafe(method(handleReport:))]
2964        #[unsafe(method_family = none)]
2965        pub unsafe fn handleReport(&self, report: &NEFilterReport);
2966    );
2967}
2968
2969/// Methods declared on superclass `NSObject`.
2970impl NEFilterProvider {
2971    extern_methods!(
2972        #[unsafe(method(init))]
2973        #[unsafe(method_family = init)]
2974        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2975
2976        #[unsafe(method(new))]
2977        #[unsafe(method_family = new)]
2978        pub unsafe fn new() -> Retained<Self>;
2979    );
2980}
2981
2982/// A NEFilterReportFrequency controls the frequency of periodic reports.
2983///
2984/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterreportfrequency?language=objc)
2985// NS_ENUM
2986#[repr(transparent)]
2987#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2988pub struct NEFilterReportFrequency(pub NSInteger);
2989impl NEFilterReportFrequency {
2990    #[doc(alias = "NEFilterReportFrequencyNone")]
2991    pub const None: Self = Self(0);
2992    #[doc(alias = "NEFilterReportFrequencyLow")]
2993    pub const Low: Self = Self(1);
2994    #[doc(alias = "NEFilterReportFrequencyMedium")]
2995    pub const Medium: Self = Self(2);
2996    #[doc(alias = "NEFilterReportFrequencyHigh")]
2997    pub const High: Self = Self(3);
2998}
2999
3000unsafe impl Encode for NEFilterReportFrequency {
3001    const ENCODING: Encoding = NSInteger::ENCODING;
3002}
3003
3004unsafe impl RefEncode for NEFilterReportFrequency {
3005    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3006}
3007
3008extern_class!(
3009    /// The NEFilterVerdict class declares the programmatic interface for an object that is the verdict for a
3010    /// flow of network data.
3011    ///
3012    /// NEFilterVerdict is part of NetworkExtension.framework
3013    ///
3014    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterverdict?language=objc)
3015    #[unsafe(super(NSObject))]
3016    #[derive(Debug, PartialEq, Eq, Hash)]
3017    pub struct NEFilterVerdict;
3018);
3019
3020extern_conformance!(
3021    unsafe impl NSCoding for NEFilterVerdict {}
3022);
3023
3024extern_conformance!(
3025    unsafe impl NSCopying for NEFilterVerdict {}
3026);
3027
3028unsafe impl CopyingHelper for NEFilterVerdict {
3029    type Result = Self;
3030}
3031
3032extern_conformance!(
3033    unsafe impl NSObjectProtocol for NEFilterVerdict {}
3034);
3035
3036extern_conformance!(
3037    unsafe impl NSSecureCoding for NEFilterVerdict {}
3038);
3039
3040impl NEFilterVerdict {
3041    extern_methods!(
3042        /// Whether or not to send a report to the control provider's -[NEFilterProvider handleReport:]
3043        /// method when processing this verdict and when the flow is closed. Since the data provider does not need to wait
3044        /// for a response from the control provider before continuing to process the flow, this is a more efficient way to
3045        /// report a flow to the control provider than returning a "need rules" verdict. If the verdict originates in the
3046        /// control provider, this property has no effect. This property applies when the action taken upon a flow is allow,
3047        /// deny, remediate, or filterData (filterData for new flows only). Setting this flag on a verdict for a socket
3048        /// flow will also cause the data provider's -[NEFilterProvider handleReport:] method to be called when the flow
3049        /// is closed.
3050        #[unsafe(method(shouldReport))]
3051        #[unsafe(method_family = none)]
3052        pub unsafe fn shouldReport(&self) -> bool;
3053
3054        /// Setter for [`shouldReport`][Self::shouldReport].
3055        #[unsafe(method(setShouldReport:))]
3056        #[unsafe(method_family = none)]
3057        pub unsafe fn setShouldReport(&self, should_report: bool);
3058    );
3059}
3060
3061/// Methods declared on superclass `NSObject`.
3062impl NEFilterVerdict {
3063    extern_methods!(
3064        #[unsafe(method(init))]
3065        #[unsafe(method_family = init)]
3066        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3067
3068        #[unsafe(method(new))]
3069        #[unsafe(method_family = new)]
3070        pub unsafe fn new() -> Retained<Self>;
3071    );
3072}
3073
3074extern_class!(
3075    /// The NEFilterNewFlowVerdict declares the programmatic interface of an object that is the verdict for a
3076    /// new flow of network data before any of the flow's data has been seen by the filter.
3077    ///
3078    /// NEFilterNewFlowVerdict is part of NetworkExtension.framework
3079    ///
3080    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilternewflowverdict?language=objc)
3081    #[unsafe(super(NEFilterVerdict, NSObject))]
3082    #[derive(Debug, PartialEq, Eq, Hash)]
3083    pub struct NEFilterNewFlowVerdict;
3084);
3085
3086extern_conformance!(
3087    unsafe impl NSCoding for NEFilterNewFlowVerdict {}
3088);
3089
3090extern_conformance!(
3091    unsafe impl NSCopying for NEFilterNewFlowVerdict {}
3092);
3093
3094unsafe impl CopyingHelper for NEFilterNewFlowVerdict {
3095    type Result = Self;
3096}
3097
3098extern_conformance!(
3099    unsafe impl NSObjectProtocol for NEFilterNewFlowVerdict {}
3100);
3101
3102extern_conformance!(
3103    unsafe impl NSSecureCoding for NEFilterNewFlowVerdict {}
3104);
3105
3106impl NEFilterNewFlowVerdict {
3107    extern_methods!(
3108        /// The frequency at which the data provider's -[NEFilterProvider handleReport:] method is called with a NEFilterReport instance with an event of NEFilterReportEventFlowStatistics.
3109        /// The default value is NEFilterReportFrequencyNone, so by default no statistics are reported.
3110        #[unsafe(method(statisticsReportFrequency))]
3111        #[unsafe(method_family = none)]
3112        pub unsafe fn statisticsReportFrequency(&self) -> NEFilterReportFrequency;
3113
3114        /// Setter for [`statisticsReportFrequency`][Self::statisticsReportFrequency].
3115        #[unsafe(method(setStatisticsReportFrequency:))]
3116        #[unsafe(method_family = none)]
3117        pub unsafe fn setStatisticsReportFrequency(
3118            &self,
3119            statistics_report_frequency: NEFilterReportFrequency,
3120        );
3121
3122        /// This class method returns a verdict indicating that control provider needs to be asked how to handle
3123        /// the new flow. The control provider can either drop or allow the flow, or update the rules and ask the data provider
3124        /// to decide on the new flow again.
3125        ///
3126        /// Returns: The NEFilterNewFlowVerdict object.
3127        #[unsafe(method(needRulesVerdict))]
3128        #[unsafe(method_family = none)]
3129        pub unsafe fn needRulesVerdict() -> Retained<NEFilterNewFlowVerdict>;
3130
3131        /// This class method returns a verdict indicating that the flow should be allowed.
3132        ///
3133        /// Returns: The NEFilterNewFlowVerdict object.
3134        #[unsafe(method(allowVerdict))]
3135        #[unsafe(method_family = none)]
3136        pub unsafe fn allowVerdict() -> Retained<NEFilterNewFlowVerdict>;
3137
3138        /// This class method returns a verdict indicating that the flow should be dropped.
3139        ///
3140        /// Returns: The NEFilterNewFlowVerdict object.
3141        #[unsafe(method(dropVerdict))]
3142        #[unsafe(method_family = none)]
3143        pub unsafe fn dropVerdict() -> Retained<NEFilterNewFlowVerdict>;
3144
3145        /// This class method returns a verdict indicating that a "content blocked" page should be displayed to
3146        /// the user. The block page should contain a link to the given URL.
3147        ///
3148        /// Parameter `remediationURLMapKey`: Remediation map key used by data plugin to get remediation url
3149        ///
3150        /// Returns: The NEFilterNewFlowVerdict object.
3151        #[unsafe(method(remediateVerdictWithRemediationURLMapKey:remediationButtonTextMapKey:))]
3152        #[unsafe(method_family = none)]
3153        pub unsafe fn remediateVerdictWithRemediationURLMapKey_remediationButtonTextMapKey(
3154            remediation_url_map_key: &NSString,
3155            remediation_button_text_map_key: &NSString,
3156        ) -> Retained<NEFilterNewFlowVerdict>;
3157
3158        /// This class method returns a verdict indicating that safe search URL for the new should be specified
3159        ///
3160        /// Parameter `urlAppendMapKey`: URL Append map key to be used by the data plugin to notify what the url should be appended with
3161        ///
3162        /// Returns: The NEFilterNewFlowVerdict object.
3163        #[unsafe(method(URLAppendStringVerdictWithMapKey:))]
3164        #[unsafe(method_family = none)]
3165        pub unsafe fn URLAppendStringVerdictWithMapKey(
3166            url_append_map_key: &NSString,
3167        ) -> Retained<NEFilterNewFlowVerdict>;
3168
3169        /// This class method returns a new flow verdict indicating that the filter needs to make a decision about
3170        /// a new flow after seeing a portion of the flow's data.
3171        ///
3172        /// Parameter `filterInbound`: A boolean indicating if the filter needs to see inbound data
3173        ///
3174        /// Parameter `peekInboundBytes`: The number of inbound bytes that the filter needs to see in the subsequent call to
3175        /// -[NEFilterDataProvider handleInboundDataFromFlow:readBytesStartOffset:readBytes:].
3176        ///
3177        /// Parameter `filterOutbound`: boolean indicating if the filter needs to see outbound data
3178        ///
3179        /// Parameter `peekOutboundBytes`: The number of outbound bytes that the filter needs to see in the subsequent call to
3180        /// -[NEFilterDataProvider handleOutboundDataFromFlow:readBytesStartOffset:readBytes:].
3181        ///
3182        /// Returns: The new flow verdict.
3183        #[unsafe(method(filterDataVerdictWithFilterInbound:peekInboundBytes:filterOutbound:peekOutboundBytes:))]
3184        #[unsafe(method_family = none)]
3185        pub unsafe fn filterDataVerdictWithFilterInbound_peekInboundBytes_filterOutbound_peekOutboundBytes(
3186            filter_inbound: bool,
3187            peek_inbound_bytes: NSUInteger,
3188            filter_outbound: bool,
3189            peek_outbound_bytes: NSUInteger,
3190        ) -> Retained<NEFilterNewFlowVerdict>;
3191
3192        /// This class method returns a verdict indicating that none of the data provider's handler callbacks shall be called for the flow until after the flow is resumed
3193        /// by a call to -[NEFilterDataProvider resumeFlow:withVerdict:]. TCP flows may be paused indefinitely. UDP flows will be dropped if not resumed within 10 seconds of
3194        /// being paused. It is invalid to pause a flow that is already paused.
3195        ///
3196        /// Returns: The NEFilterNewFlowVerdict object.
3197        #[unsafe(method(pauseVerdict))]
3198        #[unsafe(method_family = none)]
3199        pub unsafe fn pauseVerdict() -> Retained<NEFilterNewFlowVerdict>;
3200    );
3201}
3202
3203/// Methods declared on superclass `NSObject`.
3204impl NEFilterNewFlowVerdict {
3205    extern_methods!(
3206        #[unsafe(method(init))]
3207        #[unsafe(method_family = init)]
3208        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3209
3210        #[unsafe(method(new))]
3211        #[unsafe(method_family = new)]
3212        pub unsafe fn new() -> Retained<Self>;
3213    );
3214}
3215
3216extern_class!(
3217    /// The NEFilterControlVerdict declares the programmatic interface of an object that is the verdict for a
3218    /// new flow of network data by the control provider.
3219    ///
3220    /// NEFilterControlVerdict is part of NetworkExtension.framework
3221    ///
3222    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefiltercontrolverdict?language=objc)
3223    #[unsafe(super(NEFilterNewFlowVerdict, NEFilterVerdict, NSObject))]
3224    #[derive(Debug, PartialEq, Eq, Hash)]
3225    pub struct NEFilterControlVerdict;
3226);
3227
3228extern_conformance!(
3229    unsafe impl NSCoding for NEFilterControlVerdict {}
3230);
3231
3232extern_conformance!(
3233    unsafe impl NSCopying for NEFilterControlVerdict {}
3234);
3235
3236unsafe impl CopyingHelper for NEFilterControlVerdict {
3237    type Result = Self;
3238}
3239
3240extern_conformance!(
3241    unsafe impl NSObjectProtocol for NEFilterControlVerdict {}
3242);
3243
3244extern_conformance!(
3245    unsafe impl NSSecureCoding for NEFilterControlVerdict {}
3246);
3247
3248impl NEFilterControlVerdict {
3249    extern_methods!(
3250        /// This class method returns a verdict indicating that the flow should be allowed to go through, and also
3251        /// tell the data provider whether to update its rules or not.
3252        ///
3253        /// Parameter `updateRules`: YES if the control provider has updated the rules and wants to communicate that to the data provider
3254        ///
3255        /// Returns: The NEFilterControlVerdict object.
3256        #[unsafe(method(allowVerdictWithUpdateRules:))]
3257        #[unsafe(method_family = none)]
3258        pub unsafe fn allowVerdictWithUpdateRules(
3259            update_rules: bool,
3260        ) -> Retained<NEFilterControlVerdict>;
3261
3262        /// This class method returns a verdict indicating that the flow should be dropped, and also tell the data
3263        /// provider whether to update its rules or not.
3264        ///
3265        /// Parameter `updateRules`: YES if the control provider has updated the rules and wants to communicate that to the data provider
3266        ///
3267        /// Returns: The NEFilterControlVerdict object.
3268        #[unsafe(method(dropVerdictWithUpdateRules:))]
3269        #[unsafe(method_family = none)]
3270        pub unsafe fn dropVerdictWithUpdateRules(
3271            update_rules: bool,
3272        ) -> Retained<NEFilterControlVerdict>;
3273
3274        /// This class method returns a verdict indicating that the flow should be handled by the data provider,
3275        /// and the rules needed by the data provider have been set.
3276        ///
3277        /// Returns: The NEFilterControlVerdict object.
3278        #[unsafe(method(updateRules))]
3279        #[unsafe(method_family = none)]
3280        pub unsafe fn updateRules() -> Retained<NEFilterControlVerdict>;
3281    );
3282}
3283
3284/// Methods declared on superclass `NSObject`.
3285impl NEFilterControlVerdict {
3286    extern_methods!(
3287        #[unsafe(method(init))]
3288        #[unsafe(method_family = init)]
3289        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3290
3291        #[unsafe(method(new))]
3292        #[unsafe(method_family = new)]
3293        pub unsafe fn new() -> Retained<Self>;
3294    );
3295}
3296
3297/// A NEFilterAction represents the possible actions taken upon a NEFilterFlow that can be reported by the
3298/// data provider extension to the control provider extension.
3299///
3300/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilteraction?language=objc)
3301// NS_ENUM
3302#[repr(transparent)]
3303#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
3304pub struct NEFilterAction(pub NSInteger);
3305impl NEFilterAction {
3306    #[doc(alias = "NEFilterActionInvalid")]
3307    pub const Invalid: Self = Self(0);
3308    #[doc(alias = "NEFilterActionAllow")]
3309    pub const Allow: Self = Self(1);
3310    #[doc(alias = "NEFilterActionDrop")]
3311    pub const Drop: Self = Self(2);
3312    #[doc(alias = "NEFilterActionRemediate")]
3313    pub const Remediate: Self = Self(3);
3314    #[doc(alias = "NEFilterActionFilterData")]
3315    pub const FilterData: Self = Self(4);
3316}
3317
3318unsafe impl Encode for NEFilterAction {
3319    const ENCODING: Encoding = NSInteger::ENCODING;
3320}
3321
3322unsafe impl RefEncode for NEFilterAction {
3323    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3324}
3325
3326/// A NEFilterReportEvent represents the event that is being reported by the NEFilterReport.
3327///
3328/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterreportevent?language=objc)
3329// NS_ENUM
3330#[repr(transparent)]
3331#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
3332pub struct NEFilterReportEvent(pub NSInteger);
3333impl NEFilterReportEvent {
3334    #[doc(alias = "NEFilterReportEventNewFlow")]
3335    pub const NewFlow: Self = Self(1);
3336    #[doc(alias = "NEFilterReportEventDataDecision")]
3337    pub const DataDecision: Self = Self(2);
3338    #[doc(alias = "NEFilterReportEventFlowClosed")]
3339    pub const FlowClosed: Self = Self(3);
3340    #[doc(alias = "NEFilterReportEventStatistics")]
3341    pub const Statistics: Self = Self(4);
3342}
3343
3344unsafe impl Encode for NEFilterReportEvent {
3345    const ENCODING: Encoding = NSInteger::ENCODING;
3346}
3347
3348unsafe impl RefEncode for NEFilterReportEvent {
3349    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3350}
3351
3352extern_class!(
3353    /// The NEFilterReport declares the programmatic interface of an object that is a report of actions taken by
3354    /// the data provider.
3355    ///
3356    /// NEFilterReport is part of NetworkExtension.framework
3357    ///
3358    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterreport?language=objc)
3359    #[unsafe(super(NSObject))]
3360    #[derive(Debug, PartialEq, Eq, Hash)]
3361    pub struct NEFilterReport;
3362);
3363
3364extern_conformance!(
3365    unsafe impl NSCoding for NEFilterReport {}
3366);
3367
3368extern_conformance!(
3369    unsafe impl NSCopying for NEFilterReport {}
3370);
3371
3372unsafe impl CopyingHelper for NEFilterReport {
3373    type Result = Self;
3374}
3375
3376extern_conformance!(
3377    unsafe impl NSObjectProtocol for NEFilterReport {}
3378);
3379
3380extern_conformance!(
3381    unsafe impl NSSecureCoding for NEFilterReport {}
3382);
3383
3384impl NEFilterReport {
3385    extern_methods!(
3386        /// The flow on which the described action was taken.
3387        #[unsafe(method(flow))]
3388        #[unsafe(method_family = none)]
3389        pub unsafe fn flow(&self) -> Option<Retained<NEFilterFlow>>;
3390
3391        /// The action taken upon the reported flow.
3392        #[unsafe(method(action))]
3393        #[unsafe(method_family = none)]
3394        pub unsafe fn action(&self) -> NEFilterAction;
3395
3396        /// The type of event that the report is reporting.
3397        #[unsafe(method(event))]
3398        #[unsafe(method_family = none)]
3399        pub unsafe fn event(&self) -> NEFilterReportEvent;
3400
3401        /// The number of inbound bytes received from the flow. This property is only non-zero when the report event is NEFilterReportEventFlowClosed or NEFilterReportEventFlowStatistics.
3402        #[unsafe(method(bytesInboundCount))]
3403        #[unsafe(method_family = none)]
3404        pub unsafe fn bytesInboundCount(&self) -> NSUInteger;
3405
3406        /// The number of outbound bytes sent on the flow. This property is only non-zero when the report event is NEFilterReportEventFlowClosed or NEFilterReportEventFlowStatistics.
3407        #[unsafe(method(bytesOutboundCount))]
3408        #[unsafe(method_family = none)]
3409        pub unsafe fn bytesOutboundCount(&self) -> NSUInteger;
3410    );
3411}
3412
3413/// Methods declared on superclass `NSObject`.
3414impl NEFilterReport {
3415    extern_methods!(
3416        #[unsafe(method(init))]
3417        #[unsafe(method_family = init)]
3418        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3419
3420        #[unsafe(method(new))]
3421        #[unsafe(method_family = new)]
3422        pub unsafe fn new() -> Retained<Self>;
3423    );
3424}
3425
3426extern_class!(
3427    /// The NEFilterControlProvider class declares the programmatic interface for an object that is responsible for installing filtering rules on the device.
3428    ///
3429    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefiltercontrolprovider?language=objc)
3430    #[unsafe(super(NEFilterProvider, NEProvider, NSObject))]
3431    #[derive(Debug, PartialEq, Eq, Hash)]
3432    pub struct NEFilterControlProvider;
3433);
3434
3435extern_conformance!(
3436    unsafe impl NSObjectProtocol for NEFilterControlProvider {}
3437);
3438
3439impl NEFilterControlProvider {
3440    extern_methods!(
3441        /// A dictionary containing custom strings to be inserted into the "content blocked" page displayed in WebKit. Each key in this dictionary corresponds to a string in the "content blocked" page. The value of each key is a dictionary that maps keys to the custom strings to be inserted into the "content blocked" page. The keys for the sub-dictionaries are defined by the control provider. When the data provider creates a "remediate" verdict using [NEFilterDataVerdict remediateVerdictWithRemediationURLMapKey:remediationButtonTextMapKey:], it passes the key corresponding to the custom string to be inserted into the "content blocked" page.
3442        ///
3443        /// Here is a sample remediationMap dictionary:
3444        ///
3445        /// remediationMap =
3446        /// @
3447        /// { NEFilterProviderRemediationMapRemediationURLs :
3448        /// @
3449        /// {
3450        /// "
3451        /// RemediateKey1" : @"http://www.remediation_url_1.com",
3452        /// "
3453        /// RemediateKey2" : @"http://www.remediation_url_2.com"
3454        /// },
3455        /// NEFilterProviderRemediationMapRemediationButtonTexts :
3456        /// @
3457        /// {
3458        /// "
3459        /// RemediationButtonText1" : @"Remediate URL"
3460        /// }
3461        /// };
3462        #[unsafe(method(remediationMap))]
3463        #[unsafe(method_family = none)]
3464        pub unsafe fn remediationMap(
3465            &self,
3466        ) -> Option<Retained<NSDictionary<NSString, NSDictionary<NSString, NSObject>>>>;
3467
3468        /// Setter for [`remediationMap`][Self::remediationMap].
3469        #[unsafe(method(setRemediationMap:))]
3470        #[unsafe(method_family = none)]
3471        pub unsafe fn setRemediationMap(
3472            &self,
3473            remediation_map: Option<&NSDictionary<NSString, NSDictionary<NSString, NSObject>>>,
3474        );
3475
3476        /// A dictionary containing strings to be appended to URLs.
3477        #[unsafe(method(URLAppendStringMap))]
3478        #[unsafe(method_family = none)]
3479        pub unsafe fn URLAppendStringMap(
3480            &self,
3481        ) -> Option<Retained<NSDictionary<NSString, NSString>>>;
3482
3483        /// Setter for [`URLAppendStringMap`][Self::URLAppendStringMap].
3484        #[unsafe(method(setURLAppendStringMap:))]
3485        #[unsafe(method_family = none)]
3486        pub unsafe fn setURLAppendStringMap(
3487            &self,
3488            url_append_string_map: Option<&NSDictionary<NSString, NSString>>,
3489        );
3490
3491        #[cfg(feature = "block2")]
3492        /// This function is called by the framework when the NEFilterDataProvider indicates that the filtering verdict for the given flow is NEFilterRemediateVerdictNeedRules. Subclass implementations must override this method and implement whatever steps are necessary to remediate the given flow.
3493        ///
3494        /// Parameter `flow`: An NEFilterFlow object containing details about the flow that requires remediation.
3495        ///
3496        /// Parameter `completionHandler`: A block that must be called when the NEFilterControlProvider is ready for the NEFilterDataProvider to re-process the new flow. NEFilterControlVerdict stores the verdict through which the control provider determines if a flow needs to be dropped or allowed. The verdict also indicates if the control plugin wants the data plugin to update its rules and handle the verdict.
3497        #[unsafe(method(handleRemediationForFlow:completionHandler:))]
3498        #[unsafe(method_family = none)]
3499        pub unsafe fn handleRemediationForFlow_completionHandler(
3500            &self,
3501            flow: &NEFilterFlow,
3502            completion_handler: &block2::DynBlock<dyn Fn(NonNull<NEFilterControlVerdict>)>,
3503        );
3504
3505        #[cfg(feature = "block2")]
3506        /// This function is called by the framework when the NEFilterDataProvider indicates that the filtering verdict for the given flow is NEFilterNewFlowVerdictNeedRules. Subclass implementations must override this method and implement whatever steps are necessary to fetch new rules pertaining to the given flow and place them on disk in a location accessible by the NEFilterDataProvider.
3507        ///
3508        /// Parameter `flow`: An NEFilterFlow object containing details about the flow that requires a rules update.
3509        ///
3510        /// Parameter `completionHandler`: A block that must be called when the NEFilterControlProvider is ready for the NEFilterDataProvider to re-process the new flow. NEFilterControlVerdict stores the verdict through which the control provider determines if a flow needs to be dropped or allowed. The verdict also indicates if the control plugin wants the data plugin to update its rules and handle the verdict.
3511        #[unsafe(method(handleNewFlow:completionHandler:))]
3512        #[unsafe(method_family = none)]
3513        pub unsafe fn handleNewFlow_completionHandler(
3514            &self,
3515            flow: &NEFilterFlow,
3516            completion_handler: &block2::DynBlock<dyn Fn(NonNull<NEFilterControlVerdict>)>,
3517        );
3518
3519        /// This function is called by filter control implementations to notify the data provider "out of band" that the rules changed.
3520        #[unsafe(method(notifyRulesChanged))]
3521        #[unsafe(method_family = none)]
3522        pub unsafe fn notifyRulesChanged(&self);
3523    );
3524}
3525
3526/// Methods declared on superclass `NSObject`.
3527impl NEFilterControlProvider {
3528    extern_methods!(
3529        #[unsafe(method(init))]
3530        #[unsafe(method_family = init)]
3531        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3532
3533        #[unsafe(method(new))]
3534        #[unsafe(method_family = new)]
3535        pub unsafe fn new() -> Retained<Self>;
3536    );
3537}
3538
3539/// Attribute flags describing data
3540///
3541/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterdataattribute?language=objc)
3542// NS_ENUM
3543#[repr(transparent)]
3544#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
3545pub struct NEFilterDataAttribute(pub NSInteger);
3546impl NEFilterDataAttribute {
3547    #[doc(alias = "NEFilterDataAttributeHasIPHeader")]
3548    pub const HasIPHeader: Self = Self(0x00000001);
3549}
3550
3551unsafe impl Encode for NEFilterDataAttribute {
3552    const ENCODING: Encoding = NSInteger::ENCODING;
3553}
3554
3555unsafe impl RefEncode for NEFilterDataAttribute {
3556    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3557}
3558
3559extern_class!(
3560    /// The NEFilterDataProvider class declares the programmatic interface for an object that evaluates network data flows based on a set of locally-available rules and makes decisions about whether to block or allow the flows.
3561    ///
3562    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterdataprovider?language=objc)
3563    #[unsafe(super(NEFilterProvider, NEProvider, NSObject))]
3564    #[derive(Debug, PartialEq, Eq, Hash)]
3565    pub struct NEFilterDataProvider;
3566);
3567
3568extern_conformance!(
3569    unsafe impl NSObjectProtocol for NEFilterDataProvider {}
3570);
3571
3572impl NEFilterDataProvider {
3573    extern_methods!(
3574        /// This function is called by the framework when a filtering decision needs to be made about a new network data flow. Subclasses must override this method to implement the steps necessary to match the flow against some locally stored rules and return an appropriate verdict.
3575        ///
3576        /// Parameter `flow`: An NEFilterFlow object containing details about the new flow.
3577        ///
3578        /// Returns: An NEFilterNewFlowVerdict object containing the verdict for the new flow.
3579        #[unsafe(method(handleNewFlow:))]
3580        #[unsafe(method_family = none)]
3581        pub unsafe fn handleNewFlow(&self, flow: &NEFilterFlow)
3582            -> Retained<NEFilterNewFlowVerdict>;
3583
3584        /// This function is called by the framework when a filtering decision needs to be made about some inbound data that the filter previously requested access to via the NEFilterFlowDataVerdict or the NEFilterNewFlowVerdict. Subclasses must override this method.
3585        ///
3586        /// Parameter `flow`: The NEFilterFlow from which the data was read.
3587        ///
3588        /// Parameter `offset`: The offset in bytes from the start of the flow's inbound data at which readBytes begins.
3589        ///
3590        /// Parameter `readBytes`: The data that was read.  For non-UDP/TCP flows, since data may optionally include the IP header, readBytes includes a 4-bytes NEFilterDataAttribute field preceding the user data.  Handler must examine the NEFilterDataAttribute field and handle the data accordingly.
3591        ///
3592        /// Returns: An NEFilterFlowDataVerdict containing the verdict for the flow.
3593        #[unsafe(method(handleInboundDataFromFlow:readBytesStartOffset:readBytes:))]
3594        #[unsafe(method_family = none)]
3595        pub unsafe fn handleInboundDataFromFlow_readBytesStartOffset_readBytes(
3596            &self,
3597            flow: &NEFilterFlow,
3598            offset: NSUInteger,
3599            read_bytes: &NSData,
3600        ) -> Retained<NEFilterDataVerdict>;
3601
3602        /// This function is called by the framework when a filtering decision needs to be made about some outbound data that the filter previously requested access to via the NEFilterFlowDataVerdict or the NEFilterNewFlowVerdict. Subclasses must override this method.
3603        ///
3604        /// Parameter `flow`: The NEFilterFlow from which the data was read.
3605        ///
3606        /// Parameter `offset`: The offset in bytes from the start of the flow's outbound data at which readBytes begins.
3607        ///
3608        /// Parameter `readBytes`: The data that was read.  For non-UDP/TCP flows, since data may optionally include the IP header, readBytes includes a 4-bytes NEFilterDataAttribute field preceding the user data.  Handler must examine the NEFilterDataAttribute field and handle the data accordingly.
3609        ///
3610        /// Returns: An NEFilterFlowDataVerdict containing the verdict for the flow.
3611        #[unsafe(method(handleOutboundDataFromFlow:readBytesStartOffset:readBytes:))]
3612        #[unsafe(method_family = none)]
3613        pub unsafe fn handleOutboundDataFromFlow_readBytesStartOffset_readBytes(
3614            &self,
3615            flow: &NEFilterFlow,
3616            offset: NSUInteger,
3617            read_bytes: &NSData,
3618        ) -> Retained<NEFilterDataVerdict>;
3619
3620        /// This function is called by the framework after all of the inbound data for a flow has been seen by the filter. Subclasses must override this method to return an appropriate pass/block result.
3621        ///
3622        /// Parameter `flow`: The flow
3623        ///
3624        /// Returns: The final NEFilterFlowDataVerdict verdict for the flow.
3625        #[unsafe(method(handleInboundDataCompleteForFlow:))]
3626        #[unsafe(method_family = none)]
3627        pub unsafe fn handleInboundDataCompleteForFlow(
3628            &self,
3629            flow: &NEFilterFlow,
3630        ) -> Retained<NEFilterDataVerdict>;
3631
3632        /// This function is called by the framework after all of the outbound data for a flow has been seen by the filter. Subclasses must override this method to return an appropriate pass/block result.
3633        ///
3634        /// Parameter `flow`: The flow
3635        ///
3636        /// Returns: The final NEFilterFlowDataVerdict verdict for the flow.
3637        #[unsafe(method(handleOutboundDataCompleteForFlow:))]
3638        #[unsafe(method_family = none)]
3639        pub unsafe fn handleOutboundDataCompleteForFlow(
3640            &self,
3641            flow: &NEFilterFlow,
3642        ) -> Retained<NEFilterDataVerdict>;
3643
3644        /// This function is called by the framework after the user requests remediation for a blocked flow. Subclasses must override this method to return an appropriate pass/block result.
3645        ///
3646        /// Parameter `flow`: The flow
3647        ///
3648        /// Returns: The final NEFilterRemediationVerdict verdict for the flow.
3649        #[unsafe(method(handleRemediationForFlow:))]
3650        #[unsafe(method_family = none)]
3651        pub unsafe fn handleRemediationForFlow(
3652            &self,
3653            flow: &NEFilterFlow,
3654        ) -> Retained<NEFilterRemediationVerdict>;
3655
3656        /// This function is called by the framework when -[NEFilterControlProvider notifyRulesChanged] is called. Subclasses should override this method to reload new rules from disk.
3657        #[unsafe(method(handleRulesChanged))]
3658        #[unsafe(method_family = none)]
3659        pub unsafe fn handleRulesChanged(&self);
3660
3661        #[cfg(feature = "block2")]
3662        /// The provider calls this function to apply the current set of filtering rules associated with the provider and also change the default filtering action.
3663        ///
3664        /// Parameter `settings`: A NEFilterSettings object containing the filter settings to apply to the system. Pass nil to revert to the default settings, which are an
3665        /// empty list of rules and a default action of NEFilterActionFilterData.
3666        ///
3667        /// Parameter `completionHandler`: A block that will be executed when the settings have been applied to the system. If an error occurs then the error parameter will be non-nil.
3668        #[unsafe(method(applySettings:completionHandler:))]
3669        #[unsafe(method_family = none)]
3670        pub unsafe fn applySettings_completionHandler(
3671            &self,
3672            settings: Option<&NEFilterSettings>,
3673            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
3674        );
3675
3676        /// This function is called by the provider to resume a flow that was previously paused by the provider returning a pause verdict.
3677        ///
3678        /// Parameter `flow`: The flow to resume
3679        ///
3680        /// Parameter `verdict`: The next NEFilterDataVerdict for the flow. This verdict is used as the verdict corresponding to the
3681        /// flow handler callback (handleNewFlow:, handleInboundDataFromFlow:, etc.) that returned the pause verdict that
3682        /// paused the flow. This must be either a NEFilterDataVerdict or a NEFilterNewFlowVerdict. It is invalid to resume
3683        /// a flow that is not paused.
3684        #[unsafe(method(resumeFlow:withVerdict:))]
3685        #[unsafe(method_family = none)]
3686        pub unsafe fn resumeFlow_withVerdict(&self, flow: &NEFilterFlow, verdict: &NEFilterVerdict);
3687
3688        /// This function is called by the provider to update the verdict for a flow outside the context of any NEFilterDataProvider callback.
3689        ///
3690        /// Parameter `flow`: The NEFilterSocketFlow to update the verdict for.
3691        ///
3692        /// Parameter `verdict`: The NEFilterDataVerdict. Must be a +[NEFilterDataVerdict allowVerdict], a +[NEFilterDataVerdict dropVerdict], or a +[NEFilterDataVerdict dataVerdictWithPassBytes:peekBytes:].
3693        ///
3694        /// Parameter `direction`: The direction to which the verdict applies. Pass NETrafficDirectionAny to update the verdict for both the inbound and outbound directions. This parameter is ignored if the verdict is +[NEFilterDataVerdict dropVerdict].
3695        #[unsafe(method(updateFlow:usingVerdict:forDirection:))]
3696        #[unsafe(method_family = none)]
3697        pub unsafe fn updateFlow_usingVerdict_forDirection(
3698            &self,
3699            flow: &NEFilterSocketFlow,
3700            verdict: &NEFilterDataVerdict,
3701            direction: NETrafficDirection,
3702        );
3703    );
3704}
3705
3706/// Methods declared on superclass `NSObject`.
3707impl NEFilterDataProvider {
3708    extern_methods!(
3709        #[unsafe(method(init))]
3710        #[unsafe(method_family = init)]
3711        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3712
3713        #[unsafe(method(new))]
3714        #[unsafe(method_family = new)]
3715        pub unsafe fn new() -> Retained<Self>;
3716    );
3717}
3718
3719extern_class!(
3720    /// The NEFilterDataVerdict class declares the programmatic interface of an object that is the verdict for a flow of network data after some of the data has been seen by the filter.
3721    ///
3722    /// NEFilterDataVerdict is part of NetworkExtension.framework
3723    ///
3724    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterdataverdict?language=objc)
3725    #[unsafe(super(NEFilterVerdict, NSObject))]
3726    #[derive(Debug, PartialEq, Eq, Hash)]
3727    pub struct NEFilterDataVerdict;
3728);
3729
3730extern_conformance!(
3731    unsafe impl NSCoding for NEFilterDataVerdict {}
3732);
3733
3734extern_conformance!(
3735    unsafe impl NSCopying for NEFilterDataVerdict {}
3736);
3737
3738unsafe impl CopyingHelper for NEFilterDataVerdict {
3739    type Result = Self;
3740}
3741
3742extern_conformance!(
3743    unsafe impl NSObjectProtocol for NEFilterDataVerdict {}
3744);
3745
3746extern_conformance!(
3747    unsafe impl NSSecureCoding for NEFilterDataVerdict {}
3748);
3749
3750impl NEFilterDataVerdict {
3751    extern_methods!(
3752        /// The frequency at which the data provider's -[NEFilterProvider handleReport:] method is called with a NEFilterReport instance with an event of NEFilterReportEventFlowStatistics.
3753        /// The default value is NEFilterReportFrequencyNone, so by default no statistics are reported.
3754        #[unsafe(method(statisticsReportFrequency))]
3755        #[unsafe(method_family = none)]
3756        pub unsafe fn statisticsReportFrequency(&self) -> NEFilterReportFrequency;
3757
3758        /// Setter for [`statisticsReportFrequency`][Self::statisticsReportFrequency].
3759        #[unsafe(method(setStatisticsReportFrequency:))]
3760        #[unsafe(method_family = none)]
3761        pub unsafe fn setStatisticsReportFrequency(
3762            &self,
3763            statistics_report_frequency: NEFilterReportFrequency,
3764        );
3765
3766        /// This class method returns a verdict indicating that the flow should be allowed.
3767        ///
3768        /// Returns: The NEFilterDataVerdict object.
3769        #[unsafe(method(allowVerdict))]
3770        #[unsafe(method_family = none)]
3771        pub unsafe fn allowVerdict() -> Retained<NEFilterDataVerdict>;
3772
3773        /// This class method returns a verdict indicating that the flow should be dropped.
3774        ///
3775        /// Returns: The NEFilterDataVerdict object.
3776        #[unsafe(method(dropVerdict))]
3777        #[unsafe(method_family = none)]
3778        pub unsafe fn dropVerdict() -> Retained<NEFilterDataVerdict>;
3779
3780        /// This class method returns a verdict indicating that a "content blocked" page should be displayed to the user. The block page should contain a link to the given URL.
3781        ///
3782        /// Parameter `remediationURLMapKey`: Remediation map key used by data plugin to get remediation url. Passing nil will result into data provider being notified with the callback handleRemediationForFlow:
3783        ///
3784        /// Parameter `remediationButtonTextMapKey`: Remediation button map key used by the data plugin to get the remediation button text. Passing nil will set the button text to "Request Access"
3785        ///
3786        /// Returns: The NEFilterDataVerdict object.
3787        #[unsafe(method(remediateVerdictWithRemediationURLMapKey:remediationButtonTextMapKey:))]
3788        #[unsafe(method_family = none)]
3789        pub unsafe fn remediateVerdictWithRemediationURLMapKey_remediationButtonTextMapKey(
3790            remediation_url_map_key: Option<&NSString>,
3791            remediation_button_text_map_key: Option<&NSString>,
3792        ) -> Retained<NEFilterDataVerdict>;
3793
3794        /// This class method returns a data verdict indicating that the filter is passing a given number of bytes through the filter and needs to see a given number of bytes after the bytes that are passed.
3795        ///
3796        /// Parameter `passBytes`: The number of bytes to pass through the filter.
3797        ///
3798        /// Parameter `peekBytes`: The number of bytes after the end of the bytes passed that the filter wants to see in the next call to -[NEFilterDataProvider handleOutboundDataFromFlow:readBytesStartOffset:readBytes:] or -[NEFilterDataProvider handleInboundDataFromFlow:readBytesStartOffset:readBytes:].
3799        ///
3800        /// Returns: The data flow verdict.
3801        #[unsafe(method(dataVerdictWithPassBytes:peekBytes:))]
3802        #[unsafe(method_family = none)]
3803        pub unsafe fn dataVerdictWithPassBytes_peekBytes(
3804            pass_bytes: NSUInteger,
3805            peek_bytes: NSUInteger,
3806        ) -> Retained<NEFilterDataVerdict>;
3807
3808        /// This class method returns a verdict indicating that control provider needs to be asked how to handle the data flow. The control provider can either drop or allow the flow, or update the rules and ask the data provider to decide on the data flow again.
3809        ///
3810        /// Returns: The NEFilterDataVerdict object.
3811        #[unsafe(method(needRulesVerdict))]
3812        #[unsafe(method_family = none)]
3813        pub unsafe fn needRulesVerdict() -> Retained<NEFilterDataVerdict>;
3814
3815        /// This class method returns a verdict indicating that none of the data provider's handler callbacks shall be called for the flow until after the flow is resumed
3816        /// by a call to -[NEFilterDataProvider resumeFlow:withVerdict:]. TCP flows may be paused indefinitely. UDP flows will be dropped if not resumed within 10 seconds of
3817        /// being paused. It is invalid to pause a flow that is already paused.
3818        ///
3819        /// Returns: The NEFilterDataVerdict object.
3820        #[unsafe(method(pauseVerdict))]
3821        #[unsafe(method_family = none)]
3822        pub unsafe fn pauseVerdict() -> Retained<NEFilterDataVerdict>;
3823    );
3824}
3825
3826/// Methods declared on superclass `NSObject`.
3827impl NEFilterDataVerdict {
3828    extern_methods!(
3829        #[unsafe(method(init))]
3830        #[unsafe(method_family = init)]
3831        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3832
3833        #[unsafe(method(new))]
3834        #[unsafe(method_family = new)]
3835        pub unsafe fn new() -> Retained<Self>;
3836    );
3837}
3838
3839extern_class!(
3840    /// The NEFilterRemediationVerdict class declares the programmatic interface of an object that is the verdict for a flow which has been blocked by the filter, but the user has made a request for remediation.
3841    ///
3842    /// NEFilterRemediationVerdict is part of NetworkExtension.framework
3843    ///
3844    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterremediationverdict?language=objc)
3845    #[unsafe(super(NEFilterVerdict, NSObject))]
3846    #[derive(Debug, PartialEq, Eq, Hash)]
3847    pub struct NEFilterRemediationVerdict;
3848);
3849
3850extern_conformance!(
3851    unsafe impl NSCoding for NEFilterRemediationVerdict {}
3852);
3853
3854extern_conformance!(
3855    unsafe impl NSCopying for NEFilterRemediationVerdict {}
3856);
3857
3858unsafe impl CopyingHelper for NEFilterRemediationVerdict {
3859    type Result = Self;
3860}
3861
3862extern_conformance!(
3863    unsafe impl NSObjectProtocol for NEFilterRemediationVerdict {}
3864);
3865
3866extern_conformance!(
3867    unsafe impl NSSecureCoding for NEFilterRemediationVerdict {}
3868);
3869
3870impl NEFilterRemediationVerdict {
3871    extern_methods!(
3872        /// This class method returns a verdict indicating that the flow should be allowed.
3873        ///
3874        /// Returns: The NEFilterRemediationVerdict object.
3875        #[unsafe(method(allowVerdict))]
3876        #[unsafe(method_family = none)]
3877        pub unsafe fn allowVerdict() -> Retained<NEFilterRemediationVerdict>;
3878
3879        /// This class method returns a verdict indicating that the flow should be dropped.
3880        ///
3881        /// Returns: The NEFilterRemediationVerdict object.
3882        #[unsafe(method(dropVerdict))]
3883        #[unsafe(method_family = none)]
3884        pub unsafe fn dropVerdict() -> Retained<NEFilterRemediationVerdict>;
3885
3886        /// This class method returns a verdict indicating that control provider needs to be asked how to handle the remediation. The control provider can either drop or allow the flow, or update the rules and ask the data provider to decide on the data flow again.
3887        ///
3888        /// Returns: The NEFilterRemediationVerdict object.
3889        #[unsafe(method(needRulesVerdict))]
3890        #[unsafe(method_family = none)]
3891        pub unsafe fn needRulesVerdict() -> Retained<NEFilterRemediationVerdict>;
3892    );
3893}
3894
3895/// Methods declared on superclass `NSObject`.
3896impl NEFilterRemediationVerdict {
3897    extern_methods!(
3898        #[unsafe(method(init))]
3899        #[unsafe(method_family = init)]
3900        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3901
3902        #[unsafe(method(new))]
3903        #[unsafe(method_family = new)]
3904        pub unsafe fn new() -> Retained<Self>;
3905    );
3906}
3907
3908/// Filter error codes
3909///
3910/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefiltermanagererror?language=objc)
3911// NS_ENUM
3912#[repr(transparent)]
3913#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
3914pub struct NEFilterManagerError(pub NSInteger);
3915impl NEFilterManagerError {
3916    #[doc(alias = "NEFilterManagerErrorConfigurationInvalid")]
3917    pub const ConfigurationInvalid: Self = Self(1);
3918    #[doc(alias = "NEFilterManagerErrorConfigurationDisabled")]
3919    pub const ConfigurationDisabled: Self = Self(2);
3920    #[doc(alias = "NEFilterManagerErrorConfigurationStale")]
3921    pub const ConfigurationStale: Self = Self(3);
3922    #[doc(alias = "NEFilterManagerErrorConfigurationCannotBeRemoved")]
3923    pub const ConfigurationCannotBeRemoved: Self = Self(4);
3924    #[doc(alias = "NEFilterManagerErrorConfigurationPermissionDenied")]
3925    pub const ConfigurationPermissionDenied: Self = Self(5);
3926    #[doc(alias = "NEFilterManagerErrorConfigurationInternalError")]
3927    pub const ConfigurationInternalError: Self = Self(6);
3928}
3929
3930unsafe impl Encode for NEFilterManagerError {
3931    const ENCODING: Encoding = NSInteger::ENCODING;
3932}
3933
3934unsafe impl RefEncode for NEFilterManagerError {
3935    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3936}
3937
3938extern "C" {
3939    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefiltererrordomain?language=objc)
3940    pub static NEFilterErrorDomain: &'static NSString;
3941}
3942
3943extern "C" {
3944    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterconfigurationdidchangenotification?language=objc)
3945    pub static NEFilterConfigurationDidChangeNotification: &'static NSString;
3946}
3947
3948/// Filter grade
3949///
3950/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefiltermanagergrade?language=objc)
3951// NS_ENUM
3952#[repr(transparent)]
3953#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
3954pub struct NEFilterManagerGrade(pub NSInteger);
3955impl NEFilterManagerGrade {
3956    #[doc(alias = "NEFilterManagerGradeFirewall")]
3957    pub const Firewall: Self = Self(1);
3958    #[doc(alias = "NEFilterManagerGradeInspector")]
3959    pub const Inspector: Self = Self(2);
3960}
3961
3962unsafe impl Encode for NEFilterManagerGrade {
3963    const ENCODING: Encoding = NSInteger::ENCODING;
3964}
3965
3966unsafe impl RefEncode for NEFilterManagerGrade {
3967    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3968}
3969
3970extern_class!(
3971    /// The NEFilterManager class declares the programmatic interface for an object that manages content filtering configurations.
3972    ///
3973    /// NEFilterManager declares methods and properties for configuring and controlling a filter.
3974    ///
3975    /// Instances of this class are thread safe.
3976    ///
3977    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefiltermanager?language=objc)
3978    #[unsafe(super(NSObject))]
3979    #[derive(Debug, PartialEq, Eq, Hash)]
3980    pub struct NEFilterManager;
3981);
3982
3983extern_conformance!(
3984    unsafe impl NSObjectProtocol for NEFilterManager {}
3985);
3986
3987impl NEFilterManager {
3988    extern_methods!(
3989        /// Returns: The singleton NEFilterManager object for the calling process.
3990        #[unsafe(method(sharedManager))]
3991        #[unsafe(method_family = none)]
3992        pub unsafe fn sharedManager() -> Retained<NEFilterManager>;
3993
3994        #[cfg(feature = "block2")]
3995        /// This function loads the current filter configuration from the caller's filter preferences.
3996        ///
3997        /// Parameter `completionHandler`: A block that will be called when the load operation is completed. The NSError passed to this block will be nil if the load operation succeeded, non-nil otherwise.
3998        #[unsafe(method(loadFromPreferencesWithCompletionHandler:))]
3999        #[unsafe(method_family = none)]
4000        pub unsafe fn loadFromPreferencesWithCompletionHandler(
4001            &self,
4002            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
4003        );
4004
4005        #[cfg(feature = "block2")]
4006        /// This function removes the filter configuration from the caller's filter preferences. If the filter is enabled, the filter becomes disabled.
4007        ///
4008        /// Parameter `completionHandler`: A block that will be called when the remove operation is completed. The NSError passed to this block will be nil if the remove operation succeeded, non-nil otherwise.
4009        #[unsafe(method(removeFromPreferencesWithCompletionHandler:))]
4010        #[unsafe(method_family = none)]
4011        pub unsafe fn removeFromPreferencesWithCompletionHandler(
4012            &self,
4013            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
4014        );
4015
4016        #[cfg(feature = "block2")]
4017        /// This function saves the filter configuration in the caller's filter preferences. If the filter is enabled, it will become active.
4018        ///
4019        /// Parameter `completionHandler`: A block that will be called when the save operation is completed. The NSError passed to this block will be nil if the save operation succeeded, non-nil otherwise.
4020        #[unsafe(method(saveToPreferencesWithCompletionHandler:))]
4021        #[unsafe(method_family = none)]
4022        pub unsafe fn saveToPreferencesWithCompletionHandler(
4023            &self,
4024            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
4025        );
4026
4027        /// A string containing a description of the filter.
4028        #[unsafe(method(localizedDescription))]
4029        #[unsafe(method_family = none)]
4030        pub unsafe fn localizedDescription(&self) -> Option<Retained<NSString>>;
4031
4032        /// Setter for [`localizedDescription`][Self::localizedDescription].
4033        #[unsafe(method(setLocalizedDescription:))]
4034        #[unsafe(method_family = none)]
4035        pub unsafe fn setLocalizedDescription(&self, localized_description: Option<&NSString>);
4036
4037        /// An NEFilterProviderConfiguration object containing the provider-specific portion of the filter configuration.
4038        #[unsafe(method(providerConfiguration))]
4039        #[unsafe(method_family = none)]
4040        pub unsafe fn providerConfiguration(
4041            &self,
4042        ) -> Option<Retained<NEFilterProviderConfiguration>>;
4043
4044        /// Setter for [`providerConfiguration`][Self::providerConfiguration].
4045        #[unsafe(method(setProviderConfiguration:))]
4046        #[unsafe(method_family = none)]
4047        pub unsafe fn setProviderConfiguration(
4048            &self,
4049            provider_configuration: Option<&NEFilterProviderConfiguration>,
4050        );
4051
4052        /// Toggles the enabled status of the filter. On iOS, setting this property will disable filter configurations of other apps, and this property will be set to NO when other filter configurations are enabled.
4053        /// On macOS, up to 4 filter configurations of the same grade can be enabled simultaneously.
4054        #[unsafe(method(isEnabled))]
4055        #[unsafe(method_family = none)]
4056        pub unsafe fn isEnabled(&self) -> bool;
4057
4058        /// Setter for [`isEnabled`][Self::isEnabled].
4059        #[unsafe(method(setEnabled:))]
4060        #[unsafe(method_family = none)]
4061        pub unsafe fn setEnabled(&self, enabled: bool);
4062
4063        /// The grade of the filter. The default grade is NEFilterManagerGradeFirewall.
4064        #[unsafe(method(grade))]
4065        #[unsafe(method_family = none)]
4066        pub unsafe fn grade(&self) -> NEFilterManagerGrade;
4067
4068        /// Setter for [`grade`][Self::grade].
4069        #[unsafe(method(setGrade:))]
4070        #[unsafe(method_family = none)]
4071        pub unsafe fn setGrade(&self, grade: NEFilterManagerGrade);
4072
4073        /// Causes the content filter to disable any other installed encrypted DNS settings, including iCloud Private Relay system-wide DNS encryption. This should only be used if
4074        /// the content filter expects to intercept cleartext UDP DNS packets.
4075        #[unsafe(method(disableEncryptedDNSSettings))]
4076        #[unsafe(method_family = none)]
4077        pub unsafe fn disableEncryptedDNSSettings(&self) -> bool;
4078
4079        /// Setter for [`disableEncryptedDNSSettings`][Self::disableEncryptedDNSSettings].
4080        #[unsafe(method(setDisableEncryptedDNSSettings:))]
4081        #[unsafe(method_family = none)]
4082        pub unsafe fn setDisableEncryptedDNSSettings(&self, disable_encrypted_dns_settings: bool);
4083    );
4084}
4085
4086/// Methods declared on superclass `NSObject`.
4087impl NEFilterManager {
4088    extern_methods!(
4089        #[unsafe(method(init))]
4090        #[unsafe(method_family = init)]
4091        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4092
4093        #[unsafe(method(new))]
4094        #[unsafe(method_family = new)]
4095        pub unsafe fn new() -> Retained<Self>;
4096    );
4097}
4098
4099extern_class!(
4100    /// The NEFilterPacketContext class identifies the current filtering context.
4101    ///
4102    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterpacketcontext?language=objc)
4103    #[unsafe(super(NSObject))]
4104    #[derive(Debug, PartialEq, Eq, Hash)]
4105    pub struct NEFilterPacketContext;
4106);
4107
4108extern_conformance!(
4109    unsafe impl NSObjectProtocol for NEFilterPacketContext {}
4110);
4111
4112impl NEFilterPacketContext {
4113    extern_methods!();
4114}
4115
4116/// Methods declared on superclass `NSObject`.
4117impl NEFilterPacketContext {
4118    extern_methods!(
4119        #[unsafe(method(init))]
4120        #[unsafe(method_family = init)]
4121        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4122
4123        #[unsafe(method(new))]
4124        #[unsafe(method_family = new)]
4125        pub unsafe fn new() -> Retained<Self>;
4126    );
4127}
4128
4129/// Verdict for a packet
4130///
4131/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterpacketproviderverdict?language=objc)
4132// NS_ENUM
4133#[repr(transparent)]
4134#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
4135pub struct NEFilterPacketProviderVerdict(pub NSInteger);
4136impl NEFilterPacketProviderVerdict {
4137    #[doc(alias = "NEFilterPacketProviderVerdictAllow")]
4138    pub const Allow: Self = Self(0);
4139    #[doc(alias = "NEFilterPacketProviderVerdictDrop")]
4140    pub const Drop: Self = Self(1);
4141    #[doc(alias = "NEFilterPacketProviderVerdictDelay")]
4142    pub const Delay: Self = Self(2);
4143}
4144
4145unsafe impl Encode for NEFilterPacketProviderVerdict {
4146    const ENCODING: Encoding = NSInteger::ENCODING;
4147}
4148
4149unsafe impl RefEncode for NEFilterPacketProviderVerdict {
4150    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
4151}
4152
4153extern_class!(
4154    /// The NEFilterPacketProvider class declares the programmatic interface for an object that evaluates network packets decisions about whether to block, allow, or delay the packets.
4155    ///
4156    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterpacketprovider?language=objc)
4157    #[unsafe(super(NEFilterProvider, NEProvider, NSObject))]
4158    #[derive(Debug, PartialEq, Eq, Hash)]
4159    pub struct NEFilterPacketProvider;
4160);
4161
4162extern_conformance!(
4163    unsafe impl NSObjectProtocol for NEFilterPacketProvider {}
4164);
4165
4166impl NEFilterPacketProvider {
4167    extern_methods!(
4168        /// This function is used to delay a packet currently presented by packetHandler.
4169        /// This function is only valid within the packetHandler block and a verdict of
4170        /// NEFilterPacketProviderVerdictDelay must be returned after a packet is delayed.  A delayed
4171        /// packet will be prevented from continuing its journey through the networking stack until
4172        /// it is either allowed by calling allow() or is dropped by being released.
4173        ///
4174        /// Parameter `context`: The context of the current packet filter which is passed to the packetHandler block.
4175        /// The packetHandler block must pass this context when calling delayCurrentPacket().
4176        #[unsafe(method(delayCurrentPacket:))]
4177        #[unsafe(method_family = none)]
4178        pub unsafe fn delayCurrentPacket(
4179            &self,
4180            context: &NEFilterPacketContext,
4181        ) -> Retained<NEPacket>;
4182
4183        /// This function is used to allow a previously-delayed packet to continue its journey into or out of the networking stack.
4184        ///
4185        /// Parameter `packet`: A NEPacket object that contains the data of the packet that was previously delayed by the NEFilterPacketProvider.
4186        #[unsafe(method(allowPacket:))]
4187        #[unsafe(method_family = none)]
4188        pub unsafe fn allowPacket(&self, packet: &NEPacket);
4189    );
4190}
4191
4192/// Methods declared on superclass `NSObject`.
4193impl NEFilterPacketProvider {
4194    extern_methods!(
4195        #[unsafe(method(init))]
4196        #[unsafe(method_family = init)]
4197        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4198
4199        #[unsafe(method(new))]
4200        #[unsafe(method_family = new)]
4201        pub unsafe fn new() -> Retained<Self>;
4202    );
4203}
4204
4205extern_class!(
4206    /// The NEFilterProviderConfiguration class declares the programmatic interface of an object that configures a plugin-based content filter.
4207    ///
4208    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterproviderconfiguration?language=objc)
4209    #[unsafe(super(NSObject))]
4210    #[derive(Debug, PartialEq, Eq, Hash)]
4211    pub struct NEFilterProviderConfiguration;
4212);
4213
4214extern_conformance!(
4215    unsafe impl NSCoding for NEFilterProviderConfiguration {}
4216);
4217
4218extern_conformance!(
4219    unsafe impl NSCopying for NEFilterProviderConfiguration {}
4220);
4221
4222unsafe impl CopyingHelper for NEFilterProviderConfiguration {
4223    type Result = Self;
4224}
4225
4226extern_conformance!(
4227    unsafe impl NSObjectProtocol for NEFilterProviderConfiguration {}
4228);
4229
4230extern_conformance!(
4231    unsafe impl NSSecureCoding for NEFilterProviderConfiguration {}
4232);
4233
4234impl NEFilterProviderConfiguration {
4235    extern_methods!(
4236        /// If YES, the filter plugin will be allowed to filter browser traffic. If NO, the filter plugin will not see any browser flows. Defaults to NO. At least one of filterBrowsers and filterSockets should be set to YES to make the filter take effect.
4237        #[deprecated = "filterBrowsers is not supported on macOS"]
4238        #[unsafe(method(filterBrowsers))]
4239        #[unsafe(method_family = none)]
4240        pub unsafe fn filterBrowsers(&self) -> bool;
4241
4242        /// Setter for [`filterBrowsers`][Self::filterBrowsers].
4243        #[deprecated = "filterBrowsers is not supported on macOS"]
4244        #[unsafe(method(setFilterBrowsers:))]
4245        #[unsafe(method_family = none)]
4246        pub unsafe fn setFilterBrowsers(&self, filter_browsers: bool);
4247
4248        /// If YES, the filter plugin will be allowed to filter socket traffic. If NO, the filter plugin will not see any socket flows. Defaults to NO. At least one of filterBrowsers and filterSockets should be set to YES to make the filter take effect.
4249        #[unsafe(method(filterSockets))]
4250        #[unsafe(method_family = none)]
4251        pub unsafe fn filterSockets(&self) -> bool;
4252
4253        /// Setter for [`filterSockets`][Self::filterSockets].
4254        #[unsafe(method(setFilterSockets:))]
4255        #[unsafe(method_family = none)]
4256        pub unsafe fn setFilterSockets(&self, filter_sockets: bool);
4257
4258        /// If YES, a NEFilterPacketProvider will be instantiated and will be allowed to filter packets.
4259        #[unsafe(method(filterPackets))]
4260        #[unsafe(method_family = none)]
4261        pub unsafe fn filterPackets(&self) -> bool;
4262
4263        /// Setter for [`filterPackets`][Self::filterPackets].
4264        #[unsafe(method(setFilterPackets:))]
4265        #[unsafe(method_family = none)]
4266        pub unsafe fn setFilterPackets(&self, filter_packets: bool);
4267
4268        /// An optional dictionary of plugin-specific keys to be passed to the plugin.
4269        #[unsafe(method(vendorConfiguration))]
4270        #[unsafe(method_family = none)]
4271        pub unsafe fn vendorConfiguration(
4272            &self,
4273        ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
4274
4275        /// Setter for [`vendorConfiguration`][Self::vendorConfiguration].
4276        #[unsafe(method(setVendorConfiguration:))]
4277        #[unsafe(method_family = none)]
4278        pub unsafe fn setVendorConfiguration(
4279            &self,
4280            vendor_configuration: Option<&NSDictionary<NSString, AnyObject>>,
4281        );
4282
4283        /// The optional address of the server used to support the filter.
4284        #[unsafe(method(serverAddress))]
4285        #[unsafe(method_family = none)]
4286        pub unsafe fn serverAddress(&self) -> Option<Retained<NSString>>;
4287
4288        /// Setter for [`serverAddress`][Self::serverAddress].
4289        #[unsafe(method(setServerAddress:))]
4290        #[unsafe(method_family = none)]
4291        pub unsafe fn setServerAddress(&self, server_address: Option<&NSString>);
4292
4293        /// The optional username associated with the filter.
4294        #[unsafe(method(username))]
4295        #[unsafe(method_family = none)]
4296        pub unsafe fn username(&self) -> Option<Retained<NSString>>;
4297
4298        /// Setter for [`username`][Self::username].
4299        #[unsafe(method(setUsername:))]
4300        #[unsafe(method_family = none)]
4301        pub unsafe fn setUsername(&self, username: Option<&NSString>);
4302
4303        /// The optional organization associated with the filter.
4304        #[unsafe(method(organization))]
4305        #[unsafe(method_family = none)]
4306        pub unsafe fn organization(&self) -> Option<Retained<NSString>>;
4307
4308        /// Setter for [`organization`][Self::organization].
4309        #[unsafe(method(setOrganization:))]
4310        #[unsafe(method_family = none)]
4311        pub unsafe fn setOrganization(&self, organization: Option<&NSString>);
4312
4313        /// The optional password keychain reference associated with the filter.
4314        #[unsafe(method(passwordReference))]
4315        #[unsafe(method_family = none)]
4316        pub unsafe fn passwordReference(&self) -> Option<Retained<NSData>>;
4317
4318        /// Setter for [`passwordReference`][Self::passwordReference].
4319        #[unsafe(method(setPasswordReference:))]
4320        #[unsafe(method_family = none)]
4321        pub unsafe fn setPasswordReference(&self, password_reference: Option<&NSData>);
4322
4323        /// The optional certificate identity keychain reference associated with the filter.
4324        #[unsafe(method(identityReference))]
4325        #[unsafe(method_family = none)]
4326        pub unsafe fn identityReference(&self) -> Option<Retained<NSData>>;
4327
4328        /// Setter for [`identityReference`][Self::identityReference].
4329        #[unsafe(method(setIdentityReference:))]
4330        #[unsafe(method_family = none)]
4331        pub unsafe fn setIdentityReference(&self, identity_reference: Option<&NSData>);
4332
4333        /// A string containing the bundle identifier of the NEFilterDataProvider app extension or system extension.
4334        /// If this property is nil, then the bundle identifier of the NEFilterDataProvider extension in the calling app's
4335        /// bundle is used, and if the calling app's bundle contains more than one NEFilterDataProvider extension then which one will
4336        /// be used is undefined.
4337        #[unsafe(method(filterDataProviderBundleIdentifier))]
4338        #[unsafe(method_family = none)]
4339        pub unsafe fn filterDataProviderBundleIdentifier(&self) -> Option<Retained<NSString>>;
4340
4341        /// Setter for [`filterDataProviderBundleIdentifier`][Self::filterDataProviderBundleIdentifier].
4342        #[unsafe(method(setFilterDataProviderBundleIdentifier:))]
4343        #[unsafe(method_family = none)]
4344        pub unsafe fn setFilterDataProviderBundleIdentifier(
4345            &self,
4346            filter_data_provider_bundle_identifier: Option<&NSString>,
4347        );
4348
4349        /// A string containing the bundle identifier of the NEFilterPacketProvider app extension or system extension.
4350        /// If this property is nil, then the bundle identifier of the NEFilterPacketProvider extension in the calling app's
4351        /// bundle is used, and if the calling app's bundle contains more than one NEFilterPacketProvider extension then which one will
4352        /// be used is undefined.
4353        #[unsafe(method(filterPacketProviderBundleIdentifier))]
4354        #[unsafe(method_family = none)]
4355        pub unsafe fn filterPacketProviderBundleIdentifier(&self) -> Option<Retained<NSString>>;
4356
4357        /// Setter for [`filterPacketProviderBundleIdentifier`][Self::filterPacketProviderBundleIdentifier].
4358        #[unsafe(method(setFilterPacketProviderBundleIdentifier:))]
4359        #[unsafe(method_family = none)]
4360        pub unsafe fn setFilterPacketProviderBundleIdentifier(
4361            &self,
4362            filter_packet_provider_bundle_identifier: Option<&NSString>,
4363        );
4364    );
4365}
4366
4367/// Methods declared on superclass `NSObject`.
4368impl NEFilterProviderConfiguration {
4369    extern_methods!(
4370        #[unsafe(method(init))]
4371        #[unsafe(method_family = init)]
4372        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4373
4374        #[unsafe(method(new))]
4375        #[unsafe(method_family = new)]
4376        pub unsafe fn new() -> Retained<Self>;
4377    );
4378}
4379
4380extern_class!(
4381    /// The NEFilterRule class declares the programmatic interface of an object that defines a rule for matching network traffic and the action to take when the rule matches.
4382    ///
4383    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterrule?language=objc)
4384    #[unsafe(super(NSObject))]
4385    #[derive(Debug, PartialEq, Eq, Hash)]
4386    pub struct NEFilterRule;
4387);
4388
4389extern_conformance!(
4390    unsafe impl NSCoding for NEFilterRule {}
4391);
4392
4393extern_conformance!(
4394    unsafe impl NSCopying for NEFilterRule {}
4395);
4396
4397unsafe impl CopyingHelper for NEFilterRule {
4398    type Result = Self;
4399}
4400
4401extern_conformance!(
4402    unsafe impl NSObjectProtocol for NEFilterRule {}
4403);
4404
4405extern_conformance!(
4406    unsafe impl NSSecureCoding for NEFilterRule {}
4407);
4408
4409impl NEFilterRule {
4410    extern_methods!(
4411        /// Initialize a newly-allocated NEFilterRule object
4412        ///
4413        /// Parameter `networkRule`: A NENetworkRule object that defines the network traffic characteristics that this rule matches.
4414        ///
4415        /// Parameter `action`: The action to take when this rule matches.
4416        #[unsafe(method(initWithNetworkRule:action:))]
4417        #[unsafe(method_family = init)]
4418        pub unsafe fn initWithNetworkRule_action(
4419            this: Allocated<Self>,
4420            network_rule: &NENetworkRule,
4421            action: NEFilterAction,
4422        ) -> Retained<Self>;
4423
4424        /// The NENetworkRule that defines the network traffic characteristics that this rule matches.
4425        #[unsafe(method(networkRule))]
4426        #[unsafe(method_family = none)]
4427        pub unsafe fn networkRule(&self) -> Retained<NENetworkRule>;
4428
4429        /// The action to take when this rule matches network traffic.
4430        #[unsafe(method(action))]
4431        #[unsafe(method_family = none)]
4432        pub unsafe fn action(&self) -> NEFilterAction;
4433    );
4434}
4435
4436/// Methods declared on superclass `NSObject`.
4437impl NEFilterRule {
4438    extern_methods!(
4439        #[unsafe(method(init))]
4440        #[unsafe(method_family = init)]
4441        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4442
4443        #[unsafe(method(new))]
4444        #[unsafe(method_family = new)]
4445        pub unsafe fn new() -> Retained<Self>;
4446    );
4447}
4448
4449extern_class!(
4450    /// The NEFilterSettings class declares the programmatic interface for an object that contains filter settings.
4451    ///
4452    /// NEFilterSettings is used by NEFilterDataProviders to communicate the desired settings for the filter to the framework. The framework takes care of applying the contained settings to the system.
4453    ///
4454    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefiltersettings?language=objc)
4455    #[unsafe(super(NSObject))]
4456    #[derive(Debug, PartialEq, Eq, Hash)]
4457    pub struct NEFilterSettings;
4458);
4459
4460extern_conformance!(
4461    unsafe impl NSCoding for NEFilterSettings {}
4462);
4463
4464extern_conformance!(
4465    unsafe impl NSCopying for NEFilterSettings {}
4466);
4467
4468unsafe impl CopyingHelper for NEFilterSettings {
4469    type Result = Self;
4470}
4471
4472extern_conformance!(
4473    unsafe impl NSObjectProtocol for NEFilterSettings {}
4474);
4475
4476extern_conformance!(
4477    unsafe impl NSSecureCoding for NEFilterSettings {}
4478);
4479
4480impl NEFilterSettings {
4481    extern_methods!(
4482        /// Initialize a newly-allocated NEFilterSettings object with a set of filtering rules and a default filter action to takke if none
4483        /// of the rules match.
4484        ///
4485        /// Parameter `rules`: An NSArray containing an ordered list of NEFilterRule objects. The maximum number of rules that this array can contain is 1000.
4486        ///
4487        /// Parameter `defaultAction`: The NEFilterAction to take for flows of network (non-loopback) data that do not match any of the specified rules. The default defaultAction is
4488        /// NEFilterActionFilterData. If defaultAction is NEFilterActionAllow or NEFilterActionDrop, then the rules array must contain at least one NEFilterRule.
4489        /// The default action for loopback traffic is NEFilterActionAllow and cannot be changed. To filter loopback traffic you must include rules in the rules array that specifically match loopback traffic
4490        /// and have an action of NEFilterActionFilterData.
4491        ///
4492        /// Returns: the newly-initialized NEFilterSettings object.
4493        #[unsafe(method(initWithRules:defaultAction:))]
4494        #[unsafe(method_family = init)]
4495        pub unsafe fn initWithRules_defaultAction(
4496            this: Allocated<Self>,
4497            rules: &NSArray<NEFilterRule>,
4498            default_action: NEFilterAction,
4499        ) -> Retained<Self>;
4500
4501        /// An NSArray containing an ordered list of NEFilterRuleObjects. After the NEFilterSettings are applied to the system,
4502        /// each network flow is matched against these rules in order, and the NEFilterAction of the first rule that matches is taken:
4503        /// NEFilterActionAllow: Allow the flow of data to proceed on its journey through the networking stack without consulting this provider.
4504        /// NEFilterActionDrop: Drop the flow without consulting this provider.
4505        /// NEFilterActionFilterData: Call this provider's handleNewFlow: method with the flow.
4506        #[unsafe(method(rules))]
4507        #[unsafe(method_family = none)]
4508        pub unsafe fn rules(&self) -> Retained<NSArray<NEFilterRule>>;
4509
4510        /// An NEFilterAction containing the default action to take for flows of network data that do not match any of the specified rules.
4511        #[unsafe(method(defaultAction))]
4512        #[unsafe(method_family = none)]
4513        pub unsafe fn defaultAction(&self) -> NEFilterAction;
4514    );
4515}
4516
4517/// Methods declared on superclass `NSObject`.
4518impl NEFilterSettings {
4519    extern_methods!(
4520        #[unsafe(method(init))]
4521        #[unsafe(method_family = init)]
4522        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4523
4524        #[unsafe(method(new))]
4525        #[unsafe(method_family = new)]
4526        pub unsafe fn new() -> Retained<Self>;
4527    );
4528}
4529
4530extern_class!(
4531    /// The NEFlowMetaData class declares the programmatic interface for an object that contains extra information about a flow.
4532    ///
4533    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neflowmetadata?language=objc)
4534    #[unsafe(super(NSObject))]
4535    #[derive(Debug, PartialEq, Eq, Hash)]
4536    pub struct NEFlowMetaData;
4537);
4538
4539extern_conformance!(
4540    unsafe impl NSCoding for NEFlowMetaData {}
4541);
4542
4543extern_conformance!(
4544    unsafe impl NSCopying for NEFlowMetaData {}
4545);
4546
4547unsafe impl CopyingHelper for NEFlowMetaData {
4548    type Result = Self;
4549}
4550
4551extern_conformance!(
4552    unsafe impl NSObjectProtocol for NEFlowMetaData {}
4553);
4554
4555extern_conformance!(
4556    unsafe impl NSSecureCoding for NEFlowMetaData {}
4557);
4558
4559impl NEFlowMetaData {
4560    extern_methods!(
4561        /// A byte string that uniquely identifies the binary for each build of the source application of the flow. The data object may be empty in cases where the flow originates from a system process.
4562        #[unsafe(method(sourceAppUniqueIdentifier))]
4563        #[unsafe(method_family = none)]
4564        pub unsafe fn sourceAppUniqueIdentifier(&self) -> Retained<NSData>;
4565
4566        /// A string containing the signing identifier (almost always equivalent to the bundle identifier) of the source app of the flow. The string may be empty in cases where the flow originates from a system process.
4567        #[unsafe(method(sourceAppSigningIdentifier))]
4568        #[unsafe(method_family = none)]
4569        pub unsafe fn sourceAppSigningIdentifier(&self) -> Retained<NSString>;
4570
4571        /// Audit token of the source application of the flow.
4572        #[unsafe(method(sourceAppAuditToken))]
4573        #[unsafe(method_family = none)]
4574        pub unsafe fn sourceAppAuditToken(&self) -> Option<Retained<NSData>>;
4575
4576        /// The identifier of the content filter flow corresponding to this flow.
4577        #[unsafe(method(filterFlowIdentifier))]
4578        #[unsafe(method_family = none)]
4579        pub unsafe fn filterFlowIdentifier(&self) -> Option<Retained<NSUUID>>;
4580    );
4581}
4582
4583/// Methods declared on superclass `NSObject`.
4584impl NEFlowMetaData {
4585    extern_methods!(
4586        #[unsafe(method(init))]
4587        #[unsafe(method_family = init)]
4588        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4589
4590        #[unsafe(method(new))]
4591        #[unsafe(method_family = new)]
4592        pub unsafe fn new() -> Retained<Self>;
4593    );
4594}
4595
4596/// Wi-Fi network security type
4597///
4598/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspotnetworksecuritytype?language=objc)
4599// NS_ENUM
4600#[repr(transparent)]
4601#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
4602pub struct NEHotspotNetworkSecurityType(pub NSInteger);
4603impl NEHotspotNetworkSecurityType {
4604    #[doc(alias = "NEHotspotNetworkSecurityTypeOpen")]
4605    pub const Open: Self = Self(0);
4606    #[doc(alias = "NEHotspotNetworkSecurityTypeWEP")]
4607    pub const WEP: Self = Self(1);
4608    #[doc(alias = "NEHotspotNetworkSecurityTypePersonal")]
4609    pub const Personal: Self = Self(2);
4610    #[doc(alias = "NEHotspotNetworkSecurityTypeEnterprise")]
4611    pub const Enterprise: Self = Self(3);
4612    #[doc(alias = "NEHotspotNetworkSecurityTypeUnknown")]
4613    pub const Unknown: Self = Self(4);
4614}
4615
4616unsafe impl Encode for NEHotspotNetworkSecurityType {
4617    const ENCODING: Encoding = NSInteger::ENCODING;
4618}
4619
4620unsafe impl RefEncode for NEHotspotNetworkSecurityType {
4621    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
4622}
4623
4624extern_class!(
4625    /// The NEHotspotNetwork class provides a class method to get the SSID and BSSID of
4626    /// the current Wi-Fi network.
4627    ///
4628    /// NEHotspotNetwork is part of NetworkExtension.framework
4629    ///
4630    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspotnetwork?language=objc)
4631    #[unsafe(super(NSObject))]
4632    #[derive(Debug, PartialEq, Eq, Hash)]
4633    pub struct NEHotspotNetwork;
4634);
4635
4636extern_conformance!(
4637    unsafe impl NSObjectProtocol for NEHotspotNetwork {}
4638);
4639
4640impl NEHotspotNetwork {
4641    extern_methods!(
4642        /// The SSID of the Wi-Fi network.
4643        #[unsafe(method(SSID))]
4644        #[unsafe(method_family = none)]
4645        pub unsafe fn SSID(&self) -> Retained<NSString>;
4646
4647        /// The BSSID of the Wi-Fi network.
4648        #[unsafe(method(BSSID))]
4649        #[unsafe(method_family = none)]
4650        pub unsafe fn BSSID(&self) -> Retained<NSString>;
4651
4652        /// The security type of the Wi-Fi network.
4653        #[unsafe(method(securityType))]
4654        #[unsafe(method_family = none)]
4655        pub unsafe fn securityType(&self) -> NEHotspotNetworkSecurityType;
4656
4657        #[cfg(feature = "block2")]
4658        /// This method returns SSID, BSSID and security type of the current Wi-Fi network when the
4659        /// requesting application meets one of following 4 requirements -.
4660        /// 1. application is using CoreLocation API and has user's authorization to access precise location.
4661        /// 2. application has used NEHotspotConfiguration API to configure the current Wi-Fi network.
4662        /// 3. application has active VPN configurations installed.
4663        /// 4. application has active NEDNSSettingsManager configuration installed.
4664        /// An application will receive nil if it fails to meet any of the above 4 requirements.
4665        /// An application will receive nil if does not have the "com.apple.developer.networking.wifi-info" entitlement.
4666        ///
4667        /// Parameter `completionHandler`: A block that will be executed when current Wi-Fi network details are
4668        /// obtained from the system. The NEHotspotNetwork object passed to this block will be nil if the requesting
4669        /// application fails to meet above requirements, non-nil otherwise. NEHotspotNetwork object contains only valid
4670        /// SSID, BSSID and security type values, when the block is passed non-nil object.This block is executed on application's
4671        /// main queue.
4672        #[unsafe(method(fetchCurrentWithCompletionHandler:))]
4673        #[unsafe(method_family = none)]
4674        pub unsafe fn fetchCurrentWithCompletionHandler(
4675            completion_handler: &block2::DynBlock<dyn Fn(*mut NEHotspotNetwork)>,
4676        );
4677    );
4678}
4679
4680/// Methods declared on superclass `NSObject`.
4681impl NEHotspotNetwork {
4682    extern_methods!(
4683        #[unsafe(method(init))]
4684        #[unsafe(method_family = init)]
4685        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4686
4687        #[unsafe(method(new))]
4688        #[unsafe(method_family = new)]
4689        pub unsafe fn new() -> Retained<Self>;
4690    );
4691}
4692
4693/// The type of the NEHotspotHelperCommand object.
4694///
4695/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspothelpercommandtype?language=objc)
4696// NS_ENUM
4697#[repr(transparent)]
4698#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
4699pub struct NEHotspotHelperCommandType(pub NSInteger);
4700impl NEHotspotHelperCommandType {
4701    #[doc(alias = "kNEHotspotHelperCommandTypeNone")]
4702    pub const None: Self = Self(0);
4703    #[doc(alias = "kNEHotspotHelperCommandTypeFilterScanList")]
4704    pub const FilterScanList: Self = Self(1);
4705    #[doc(alias = "kNEHotspotHelperCommandTypeEvaluate")]
4706    pub const Evaluate: Self = Self(2);
4707    #[doc(alias = "kNEHotspotHelperCommandTypeAuthenticate")]
4708    pub const Authenticate: Self = Self(3);
4709    #[doc(alias = "kNEHotspotHelperCommandTypePresentUI")]
4710    pub const PresentUI: Self = Self(4);
4711    #[doc(alias = "kNEHotspotHelperCommandTypeMaintain")]
4712    pub const Maintain: Self = Self(5);
4713    #[doc(alias = "kNEHotspotHelperCommandTypeLogoff")]
4714    pub const Logoff: Self = Self(6);
4715}
4716
4717unsafe impl Encode for NEHotspotHelperCommandType {
4718    const ENCODING: Encoding = NSInteger::ENCODING;
4719}
4720
4721unsafe impl RefEncode for NEHotspotHelperCommandType {
4722    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
4723}
4724
4725/// The result of processing the NEHotspotHelperCommand.
4726///
4727/// The HotspotHelper provides the result of
4728/// processing the NEHotspotHelperCommand when it instantiates
4729/// its NEHotspotHelperResponse.
4730///
4731///
4732///
4733/// interaction. This result is only valid in response to a command with type
4734/// kNEHotspotHelperCommandTypeAuthenticate.
4735///
4736/// recognize the command type.
4737///
4738/// authentication again. This result is only valid in response to a
4739/// command with type kNEHotspotHelperCommandTypeMaintain.
4740///
4741/// authenticate, the helper determined that it can't perform the
4742/// authentication. This result is only valid in response to commands of type
4743/// kNEHotspotHelperCommandTypeAuthenticate and
4744/// kNEHotspotHelperCommandTypePresentUI.
4745///
4746/// it is temporarily unable to perform the authentication.
4747/// This result is only valid in response to commands of type
4748/// kNEHotspotHelperCommandTypeAuthenticate and
4749/// kNEHotspotHelperCommandTypePresentUI.
4750///
4751/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspothelperresult?language=objc)
4752// NS_ENUM
4753#[repr(transparent)]
4754#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
4755pub struct NEHotspotHelperResult(pub NSInteger);
4756impl NEHotspotHelperResult {
4757    #[doc(alias = "kNEHotspotHelperResultSuccess")]
4758    pub const Success: Self = Self(0);
4759    #[doc(alias = "kNEHotspotHelperResultFailure")]
4760    pub const Failure: Self = Self(1);
4761    #[doc(alias = "kNEHotspotHelperResultUIRequired")]
4762    pub const UIRequired: Self = Self(2);
4763    #[doc(alias = "kNEHotspotHelperResultCommandNotRecognized")]
4764    pub const CommandNotRecognized: Self = Self(3);
4765    #[doc(alias = "kNEHotspotHelperResultAuthenticationRequired")]
4766    pub const AuthenticationRequired: Self = Self(4);
4767    #[doc(alias = "kNEHotspotHelperResultUnsupportedNetwork")]
4768    pub const UnsupportedNetwork: Self = Self(5);
4769    #[doc(alias = "kNEHotspotHelperResultTemporaryFailure")]
4770    pub const TemporaryFailure: Self = Self(6);
4771}
4772
4773unsafe impl Encode for NEHotspotHelperResult {
4774    const ENCODING: Encoding = NSInteger::ENCODING;
4775}
4776
4777unsafe impl RefEncode for NEHotspotHelperResult {
4778    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
4779}
4780
4781/// The HotspotHelper's confidence in its ability to handle the network.
4782///
4783/// The HotspotHelper indicates its confidence in being able to handle the
4784/// given hotspot network.
4785///
4786/// the network.
4787///
4788/// in being able to handle the network.
4789///
4790/// in being able to handle the network.
4791///
4792/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspothelperconfidence?language=objc)
4793// NS_ENUM
4794#[repr(transparent)]
4795#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
4796pub struct NEHotspotHelperConfidence(pub NSInteger);
4797impl NEHotspotHelperConfidence {
4798    #[doc(alias = "kNEHotspotHelperConfidenceNone")]
4799    pub const None: Self = Self(0);
4800    #[doc(alias = "kNEHotspotHelperConfidenceLow")]
4801    pub const Low: Self = Self(1);
4802    #[doc(alias = "kNEHotspotHelperConfidenceHigh")]
4803    pub const High: Self = Self(2);
4804}
4805
4806unsafe impl Encode for NEHotspotHelperConfidence {
4807    const ENCODING: Encoding = NSInteger::ENCODING;
4808}
4809
4810unsafe impl RefEncode for NEHotspotHelperConfidence {
4811    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
4812}
4813
4814/// HotspotHelper.
4815/// Extends NEHotspotNetwork class to support conveying information about the
4816/// network to the HotspotHelper. When the HotspotHelper is asked to evaluate
4817/// the current network or filter the Wi-Fi scan list, it annotates the NEHotspotNetwork
4818/// via the setConfidence method.
4819impl NEHotspotNetwork {
4820    extern_methods!(
4821        /// The signal strength for the Wi-Fi network. The value lies within
4822        /// the range 0.0 (weak/no signal) to 1.0 (strong signal).
4823        #[unsafe(method(signalStrength))]
4824        #[unsafe(method_family = none)]
4825        pub unsafe fn signalStrength(&self) -> c_double;
4826
4827        /// Indicates whether the network is secure
4828        #[unsafe(method(isSecure))]
4829        #[unsafe(method_family = none)]
4830        pub unsafe fn isSecure(&self) -> bool;
4831
4832        /// Indicates whether the network was joined automatically
4833        /// (YES) or joined by the user (NO).
4834        #[unsafe(method(didAutoJoin))]
4835        #[unsafe(method_family = none)]
4836        pub unsafe fn didAutoJoin(&self) -> bool;
4837
4838        /// Indicates whether the network was just joined. Useful in the
4839        /// Maintaining state to differentiate whether the Maintain command
4840        /// is for the initial join, or the subsequent periodic callback.
4841        #[unsafe(method(didJustJoin))]
4842        #[unsafe(method_family = none)]
4843        pub unsafe fn didJustJoin(&self) -> bool;
4844
4845        /// Indicates whether the HotspotHelper is the chosen helper for
4846        /// the network. The NEHotspotNetwork must have been instantiated via a
4847        /// call to the +[NEHotspotHelper supportedNetworkInterfaces] method. This
4848        /// is useful to restore state after the HotspotHelper application is quit
4849        /// and restarted.
4850        #[unsafe(method(isChosenHelper))]
4851        #[unsafe(method_family = none)]
4852        pub unsafe fn isChosenHelper(&self) -> bool;
4853
4854        /// Indicate the confidence in being able to handle the network.
4855        ///
4856        /// Use this method to indicate the confidence in being able to
4857        /// successfully authenticate to the given network. Used in the response
4858        /// to the kNEHotspotHelperCommandTypeEvaluate and
4859        /// kNEHotspotHelperCommandTypeFilterScanList commands.
4860        #[unsafe(method(setConfidence:))]
4861        #[unsafe(method_family = none)]
4862        pub unsafe fn setConfidence(&self, confidence: NEHotspotHelperConfidence);
4863
4864        /// Provide the password for a secure network
4865        ///
4866        /// The HotspotHelper may set a password for a secure network. The format
4867        /// password string must adhere to IEEE 802.11 guidelines appropriate for
4868        /// the particular security scheme.
4869        ///
4870        /// Used only in the response to the kNEHotspotHelperCommandTypeFilterScanList
4871        /// command.
4872        #[unsafe(method(setPassword:))]
4873        #[unsafe(method_family = none)]
4874        pub unsafe fn setPassword(&self, password: &NSString);
4875    );
4876}
4877
4878extern_class!(
4879    /// An NEHotspotHelperCommand object is provided to the helper's
4880    /// command handler block. The HotspotHelper processes the command
4881    /// instantiates an NEHotspotHelperResponse object, sets the annotated
4882    /// network or networkList (Evaluate/FilterScanList only),
4883    /// then delivers it.
4884    ///
4885    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspothelpercommand?language=objc)
4886    #[unsafe(super(NSObject))]
4887    #[derive(Debug, PartialEq, Eq, Hash)]
4888    pub struct NEHotspotHelperCommand;
4889);
4890
4891extern_conformance!(
4892    unsafe impl NSObjectProtocol for NEHotspotHelperCommand {}
4893);
4894
4895impl NEHotspotHelperCommand {
4896    extern_methods!(
4897        /// The type of the command.
4898        #[unsafe(method(commandType))]
4899        #[unsafe(method_family = none)]
4900        pub unsafe fn commandType(&self) -> NEHotspotHelperCommandType;
4901
4902        /// The network associated with the command. May be nil.
4903        #[unsafe(method(network))]
4904        #[unsafe(method_family = none)]
4905        pub unsafe fn network(&self) -> Option<Retained<NEHotspotNetwork>>;
4906
4907        /// The list of networks associated with a command. Will be nil unless
4908        /// the command type is kNEHotspotHelperCommandTypeFilterScanList.
4909        /// This property returns an NSArray of NEHotspotNetwork.
4910        #[unsafe(method(networkList))]
4911        #[unsafe(method_family = none)]
4912        pub unsafe fn networkList(&self) -> Option<Retained<NSArray<NEHotspotNetwork>>>;
4913
4914        /// Create a response to the command.
4915        ///
4916        /// Instantiate an NEHotspotHelperResponse for the command.
4917        ///
4918        /// Returns: NEHotspotHelperResponse with the specified result.
4919        #[unsafe(method(createResponse:))]
4920        #[unsafe(method_family = none)]
4921        pub unsafe fn createResponse(
4922            &self,
4923            result: NEHotspotHelperResult,
4924        ) -> Retained<NEHotspotHelperResponse>;
4925
4926        /// Create a new TCP connection over the interface associated with the command.
4927        ///
4928        /// Instantiate an NWTCPConnection to the specified endpoint
4929        /// bound to the network interface associated with the command.
4930        ///
4931        /// Returns: non-nil NWTCPConnection object if successful, nil otherwise
4932        #[deprecated = "Use the `interface` property with `nw_parameters_require_interface`"]
4933        #[unsafe(method(createTCPConnection:))]
4934        #[unsafe(method_family = none)]
4935        pub unsafe fn createTCPConnection(
4936            &self,
4937            endpoint: &NWEndpoint,
4938        ) -> Retained<NWTCPConnection>;
4939
4940        /// Create a new UDP session over the interface associated with the command.
4941        ///
4942        /// Instantiate an NWUDPSession to the specified endpoint
4943        /// bound to the network interface associated with the command.
4944        ///
4945        /// Returns: non-nil NWUDPSession object if successful, nil otherwise
4946        #[deprecated = "Use the `interface` property with `nw_parameters_require_interface`"]
4947        #[unsafe(method(createUDPSession:))]
4948        #[unsafe(method_family = none)]
4949        pub unsafe fn createUDPSession(&self, endpoint: &NWEndpoint) -> Retained<NWUDPSession>;
4950    );
4951}
4952
4953/// Methods declared on superclass `NSObject`.
4954impl NEHotspotHelperCommand {
4955    extern_methods!(
4956        #[unsafe(method(init))]
4957        #[unsafe(method_family = init)]
4958        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4959
4960        #[unsafe(method(new))]
4961        #[unsafe(method_family = new)]
4962        pub unsafe fn new() -> Retained<Self>;
4963    );
4964}
4965
4966extern_class!(
4967    /// The HotspotHelper creates an NEHotspotHelperResponse object to provide
4968    /// the results of running the corresponding NEHotspotHelperCommand.
4969    ///
4970    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspothelperresponse?language=objc)
4971    #[unsafe(super(NSObject))]
4972    #[derive(Debug, PartialEq, Eq, Hash)]
4973    pub struct NEHotspotHelperResponse;
4974);
4975
4976extern_conformance!(
4977    unsafe impl NSObjectProtocol for NEHotspotHelperResponse {}
4978);
4979
4980impl NEHotspotHelperResponse {
4981    extern_methods!(
4982        /// Set the network that conveys the confidence level.
4983        ///
4984        /// Provide the annotated NEHotspotNetwork object in the response to the
4985        /// kNEHotspotHelperCommandTypeEvaluate command. The helper sets the
4986        /// confidence in the network object to indicate its ability to handle
4987        /// the current network.
4988        #[unsafe(method(setNetwork:))]
4989        #[unsafe(method_family = none)]
4990        pub unsafe fn setNetwork(&self, network: &NEHotspotNetwork);
4991
4992        /// Set the list of handled networks.
4993        ///
4994        /// Provide an NSArray of annotated NEHotspotNetwork objects in response
4995        /// to the kNEHotspotHelperCommandTypeFilterScanList command.
4996        /// The helper provides the list of network objects that it is capable of
4997        /// handling with at least low confidence. Networks that it has no
4998        /// confidence in handling should not be specified.
4999        #[unsafe(method(setNetworkList:))]
5000        #[unsafe(method_family = none)]
5001        pub unsafe fn setNetworkList(&self, network_list: &NSArray<NEHotspotNetwork>);
5002
5003        /// Delivers the response to the command.
5004        ///
5005        /// Deliver the NEHotspotHelperResponse to the HotspotHelper infrastructure.
5006        #[unsafe(method(deliver))]
5007        #[unsafe(method_family = none)]
5008        pub unsafe fn deliver(&self);
5009    );
5010}
5011
5012/// Methods declared on superclass `NSObject`.
5013impl NEHotspotHelperResponse {
5014    extern_methods!(
5015        #[unsafe(method(init))]
5016        #[unsafe(method_family = init)]
5017        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5018
5019        #[unsafe(method(new))]
5020        #[unsafe(method_family = new)]
5021        pub unsafe fn new() -> Retained<Self>;
5022    );
5023}
5024
5025/// The type definition for the HotspotHelper's command handler block.
5026///
5027/// The application provides a block of this type when it
5028/// invokes the +[NEHotspotHelper registerWithOptions:queue:handler] method.
5029/// The block is invoked every time there is a command to be processed.
5030///
5031/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspothelperhandler?language=objc)
5032#[cfg(feature = "block2")]
5033pub type NEHotspotHelperHandler = *mut block2::DynBlock<dyn Fn(NonNull<NEHotspotHelperCommand>)>;
5034
5035extern_class!(
5036    /// The NEHotspotHelper class allows an application to register itself as a
5037    /// HotspotHelper.
5038    ///
5039    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspothelper?language=objc)
5040    #[unsafe(super(NSObject))]
5041    #[derive(Debug, PartialEq, Eq, Hash)]
5042    pub struct NEHotspotHelper;
5043);
5044
5045extern_conformance!(
5046    unsafe impl NSObjectProtocol for NEHotspotHelper {}
5047);
5048
5049impl NEHotspotHelper {
5050    extern_methods!(
5051        #[cfg(all(feature = "block2", feature = "dispatch2"))]
5052        /// Register the application as a HotspotHelper.
5053        ///
5054        /// Once this API is invoked successfully, the application becomes
5055        /// eligible to be launched in the background and participate in
5056        /// various hotspot related functions.
5057        ///
5058        /// This function should be called once when the application starts up.
5059        /// Invoking it again will have no effect and result in FALSE being returned.
5060        ///
5061        /// The 'options' dictionary may be nil, or contain the single property
5062        /// kNEHotspotHelperOptionDisplayName.
5063        ///
5064        ///
5065        /// Parameter `options`: If not nil, 'options' is an NSDictionary containing
5066        /// kNEHotspotHelperOption* keys (currently just
5067        /// kNEHotspotHelperOptionDisplayName).
5068        ///
5069        /// Parameter `queue`: The dispatch_queue_t to invoke the handle block on.
5070        ///
5071        /// Parameter `handler`: The NEHotspotHelperHandler block to execute to process
5072        /// helper commands.
5073        ///
5074        /// Returns: YES if the registration was successful, NO otherwise.
5075        ///
5076        /// Note: Notes
5077        ///
5078        /// Note: 1
5079        /// The application's Info.plist MUST include a UIBackgroundModes array
5080        /// containing 'network-authentication'.
5081        ///
5082        /// Note: 2
5083        /// The application MUST set 'com.apple.developer.networking.HotspotHelper'
5084        /// as one of its entitlements. The value of the entitlement is a boolean
5085        /// value true.
5086        #[unsafe(method(registerWithOptions:queue:handler:))]
5087        #[unsafe(method_family = none)]
5088        pub unsafe fn registerWithOptions_queue_handler(
5089            options: Option<&NSDictionary<NSString, NSObject>>,
5090            queue: &DispatchQueue,
5091            handler: NEHotspotHelperHandler,
5092        ) -> bool;
5093
5094        /// Terminate the authentication session.
5095        ///
5096        /// The application invokes this method when it wants to logoff from the
5097        /// current network. Invoking this method causes an NEHotspotHelperCommand
5098        /// of type kNEHotspotHelperCommandTypeLogoff to be issued to the application's
5099        /// 'handler' block (see +[NEHotspotHelper registerWithOptions:queue:handler]).
5100        ///
5101        /// 'network' must correspond to the currently associated Wi-Fi network
5102        /// i.e. it must have come from the NEHotspotHelperCommand's 'network' property
5103        /// or from the +[NEHotspotHelper supportedInterfaces] method.
5104        ///
5105        /// Returns: YES if the logoff command was successfully queued, NO otherwise.
5106        ///
5107        /// Note: Notes
5108        ///
5109        /// Note: 1
5110        /// The application MUST NOT actually logoff from the network until it
5111        /// receives the command to logoff.
5112        ///
5113        /// Note: 2
5114        /// After the application invokes -[NEHotspotHelperResponse deliver] indicating
5115        /// kNEHotspotHelperResultSuccess, the Wi-Fi network is disassociated.
5116        #[unsafe(method(logoff:))]
5117        #[unsafe(method_family = none)]
5118        pub unsafe fn logoff(network: &NEHotspotNetwork) -> bool;
5119
5120        /// Return the list of network interfaces managed by the
5121        /// HotspotHelper infrastructure.
5122        ///
5123        /// Each network interface is represented by an NEHotspotNetwork object.
5124        /// Currently, the returned array contains exactly one NEHotspotNetwork
5125        /// object representing the Wi-Fi interface.
5126        ///
5127        /// The main purpose of this method is to allow a HotspotHelper to provide
5128        /// accurate status in its UI at times when it has not been given a command
5129        /// to process. This method coupled with -[NEHotspotNetwork isChosenHelper]
5130        /// allows the application to know whether it is the one that is handling
5131        /// the current network.
5132        ///
5133        /// Returns: nil if no network interfaces are being managed,
5134        /// non-nil NSArray of NEHotspotNetwork objects otherwise.
5135        #[unsafe(method(supportedNetworkInterfaces))]
5136        #[unsafe(method_family = none)]
5137        pub unsafe fn supportedNetworkInterfaces() -> Option<Retained<NSArray>>;
5138    );
5139}
5140
5141/// Methods declared on superclass `NSObject`.
5142impl NEHotspotHelper {
5143    extern_methods!(
5144        #[unsafe(method(init))]
5145        #[unsafe(method_family = init)]
5146        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5147
5148        #[unsafe(method(new))]
5149        #[unsafe(method_family = new)]
5150        pub unsafe fn new() -> Retained<Self>;
5151    );
5152}
5153
5154mod private_NSMutableURLRequestNEHotspotHelper {
5155    pub trait Sealed {}
5156}
5157
5158/// Category "NEHotspotHelper" on [`NSMutableURLRequest`].
5159/// Extend NSMutableURLRequest to include a method to bind the
5160/// request to the network interface associated with the specified
5161/// NEHotspotHelperCommand object.
5162#[doc(alias = "NEHotspotHelper")]
5163pub unsafe trait NSMutableURLRequestNEHotspotHelper:
5164    ClassType + Sized + private_NSMutableURLRequestNEHotspotHelper::Sealed
5165{
5166    extern_methods!(
5167        /// Binds the NSMutableURLRequest to the network interface associated with
5168        /// the NEHotspotHelperCommand object.
5169        #[unsafe(method(bindToHotspotHelperCommand:))]
5170        #[unsafe(method_family = none)]
5171        unsafe fn bindToHotspotHelperCommand(&self, command: &NEHotspotHelperCommand);
5172    );
5173}
5174
5175impl private_NSMutableURLRequestNEHotspotHelper::Sealed for NSMutableURLRequest {}
5176unsafe impl NSMutableURLRequestNEHotspotHelper for NSMutableURLRequest {}
5177
5178/// EAP Type.
5179///
5180/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspotconfigurationeaptype?language=objc)
5181// NS_ENUM
5182#[repr(transparent)]
5183#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
5184pub struct NEHotspotConfigurationEAPType(pub NSInteger);
5185impl NEHotspotConfigurationEAPType {
5186    #[doc(alias = "NEHotspotConfigurationEAPTypeEAPTLS")]
5187    pub const EAPTLS: Self = Self(13);
5188    #[doc(alias = "NEHotspotConfigurationEAPTypeEAPTTLS")]
5189    pub const EAPTTLS: Self = Self(21);
5190    #[doc(alias = "NEHotspotConfigurationEAPTypeEAPPEAP")]
5191    pub const EAPPEAP: Self = Self(25);
5192    #[doc(alias = "NEHotspotConfigurationEAPTypeEAPFAST")]
5193    pub const EAPFAST: Self = Self(43);
5194}
5195
5196unsafe impl Encode for NEHotspotConfigurationEAPType {
5197    const ENCODING: Encoding = NSInteger::ENCODING;
5198}
5199
5200unsafe impl RefEncode for NEHotspotConfigurationEAPType {
5201    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
5202}
5203
5204/// TTLS Inner Authentication Type.
5205///
5206/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspotconfigurationttlsinnerauthenticationtype?language=objc)
5207// NS_ENUM
5208#[repr(transparent)]
5209#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
5210pub struct NEHotspotConfigurationTTLSInnerAuthenticationType(pub NSInteger);
5211impl NEHotspotConfigurationTTLSInnerAuthenticationType {
5212    #[doc(alias = "NEHotspotConfigurationEAPTTLSInnerAuthenticationPAP")]
5213    pub const EAPTTLSInnerAuthenticationPAP: Self = Self(0);
5214    #[doc(alias = "NEHotspotConfigurationEAPTTLSInnerAuthenticationCHAP")]
5215    pub const EAPTTLSInnerAuthenticationCHAP: Self = Self(1);
5216    #[doc(alias = "NEHotspotConfigurationEAPTTLSInnerAuthenticationMSCHAP")]
5217    pub const EAPTTLSInnerAuthenticationMSCHAP: Self = Self(2);
5218    #[doc(alias = "NEHotspotConfigurationEAPTTLSInnerAuthenticationMSCHAPv2")]
5219    pub const EAPTTLSInnerAuthenticationMSCHAPv2: Self = Self(3);
5220    #[doc(alias = "NEHotspotConfigurationEAPTTLSInnerAuthenticationEAP")]
5221    pub const EAPTTLSInnerAuthenticationEAP: Self = Self(4);
5222}
5223
5224unsafe impl Encode for NEHotspotConfigurationTTLSInnerAuthenticationType {
5225    const ENCODING: Encoding = NSInteger::ENCODING;
5226}
5227
5228unsafe impl RefEncode for NEHotspotConfigurationTTLSInnerAuthenticationType {
5229    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
5230}
5231
5232/// TLS version to use during TLS handshke.
5233///
5234/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspotconfigurationeaptlsversion?language=objc)
5235// NS_ENUM
5236#[repr(transparent)]
5237#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
5238pub struct NEHotspotConfigurationEAPTLSVersion(pub NSInteger);
5239impl NEHotspotConfigurationEAPTLSVersion {
5240    #[doc(alias = "NEHotspotConfigurationEAPTLSVersion_1_0")]
5241    pub const Version_1_0: Self = Self(0);
5242    #[doc(alias = "NEHotspotConfigurationEAPTLSVersion_1_1")]
5243    pub const Version_1_1: Self = Self(1);
5244    #[doc(alias = "NEHotspotConfigurationEAPTLSVersion_1_2")]
5245    pub const Version_1_2: Self = Self(2);
5246}
5247
5248unsafe impl Encode for NEHotspotConfigurationEAPTLSVersion {
5249    const ENCODING: Encoding = NSInteger::ENCODING;
5250}
5251
5252unsafe impl RefEncode for NEHotspotConfigurationEAPTLSVersion {
5253    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
5254}
5255
5256extern_class!(
5257    /// NEHotspotHS20Settings class provides a set of properties that are required
5258    /// to discover and negotiate Hotspot 2.0 Wi-Fi networks.
5259    ///
5260    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspoths20settings?language=objc)
5261    #[unsafe(super(NSObject))]
5262    #[derive(Debug, PartialEq, Eq, Hash)]
5263    pub struct NEHotspotHS20Settings;
5264);
5265
5266extern_conformance!(
5267    unsafe impl NSCoding for NEHotspotHS20Settings {}
5268);
5269
5270extern_conformance!(
5271    unsafe impl NSCopying for NEHotspotHS20Settings {}
5272);
5273
5274unsafe impl CopyingHelper for NEHotspotHS20Settings {
5275    type Result = Self;
5276}
5277
5278extern_conformance!(
5279    unsafe impl NSObjectProtocol for NEHotspotHS20Settings {}
5280);
5281
5282extern_conformance!(
5283    unsafe impl NSSecureCoding for NEHotspotHS20Settings {}
5284);
5285
5286impl NEHotspotHS20Settings {
5287    extern_methods!(
5288        /// Domain Name of Legacy Hotspot or Hotspot 2.0 Wi-Fi Network.
5289        /// This Domain Name is used for Wi-Fi Hotspot 2.0 negotiation.
5290        #[unsafe(method(domainName))]
5291        #[unsafe(method_family = none)]
5292        pub unsafe fn domainName(&self) -> Retained<NSString>;
5293
5294        /// If set to YES, allows connection to networks of roaming service
5295        /// providers. Defaults to NO.
5296        #[unsafe(method(isRoamingEnabled))]
5297        #[unsafe(method_family = none)]
5298        pub unsafe fn isRoamingEnabled(&self) -> bool;
5299
5300        /// Setter for [`isRoamingEnabled`][Self::isRoamingEnabled].
5301        #[unsafe(method(setRoamingEnabled:))]
5302        #[unsafe(method_family = none)]
5303        pub unsafe fn setRoamingEnabled(&self, roaming_enabled: bool);
5304
5305        /// Array of Roaming Consortium Organization Identifiers used
5306        /// for Wi-Fi Hotspot 2.0 negotiation.
5307        #[unsafe(method(roamingConsortiumOIs))]
5308        #[unsafe(method_family = none)]
5309        pub unsafe fn roamingConsortiumOIs(&self) -> Retained<NSArray<NSString>>;
5310
5311        /// Setter for [`roamingConsortiumOIs`][Self::roamingConsortiumOIs].
5312        #[unsafe(method(setRoamingConsortiumOIs:))]
5313        #[unsafe(method_family = none)]
5314        pub unsafe fn setRoamingConsortiumOIs(&self, roaming_consortium_o_is: &NSArray<NSString>);
5315
5316        /// Array of Network Access Identifier Realm names used for
5317        /// Wi-Fi Hotspot 2.0 negotiation.
5318        #[unsafe(method(naiRealmNames))]
5319        #[unsafe(method_family = none)]
5320        pub unsafe fn naiRealmNames(&self) -> Retained<NSArray<NSString>>;
5321
5322        /// Setter for [`naiRealmNames`][Self::naiRealmNames].
5323        #[unsafe(method(setNaiRealmNames:))]
5324        #[unsafe(method_family = none)]
5325        pub unsafe fn setNaiRealmNames(&self, nai_realm_names: &NSArray<NSString>);
5326
5327        /// Array of Mobile Country Code (MCC)/Mobile Network Code (MNC)
5328        /// pairs used for Wi-Fi Hotspot 2.0 negotiation. Each string must contain
5329        /// exactly six digits.
5330        #[unsafe(method(MCCAndMNCs))]
5331        #[unsafe(method_family = none)]
5332        pub unsafe fn MCCAndMNCs(&self) -> Retained<NSArray<NSString>>;
5333
5334        /// Setter for [`MCCAndMNCs`][Self::MCCAndMNCs].
5335        #[unsafe(method(setMCCAndMNCs:))]
5336        #[unsafe(method_family = none)]
5337        pub unsafe fn setMCCAndMNCs(&self, mcc_and_mn_cs: &NSArray<NSString>);
5338
5339        /// A designated initializer to instantiate a new NEHotspotHSSettings object.
5340        /// This initializer is used to configure Legacy Hotspot or HS2.0 Wi-Fi Networks.
5341        ///
5342        ///
5343        /// Parameter `domainName`: The domain name of HS2.0 Wi-Fi Network
5344        ///
5345        /// Parameter `roamingEnabled`: If YES, allows connections to networks of roaming service providers.
5346        #[unsafe(method(initWithDomainName:roamingEnabled:))]
5347        #[unsafe(method_family = init)]
5348        pub unsafe fn initWithDomainName_roamingEnabled(
5349            this: Allocated<Self>,
5350            domain_name: &NSString,
5351            roaming_enabled: bool,
5352        ) -> Retained<Self>;
5353    );
5354}
5355
5356/// Methods declared on superclass `NSObject`.
5357impl NEHotspotHS20Settings {
5358    extern_methods!(
5359        #[unsafe(method(init))]
5360        #[unsafe(method_family = init)]
5361        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5362
5363        #[unsafe(method(new))]
5364        #[unsafe(method_family = new)]
5365        pub unsafe fn new() -> Retained<Self>;
5366    );
5367}
5368
5369extern_class!(
5370    /// NEHotspotEAPSettings class provides a set of properties that are required
5371    /// to configure a WPA/WPA2 Enterprise or Hotspot 2.0 Wi-Fi networks.
5372    ///
5373    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspoteapsettings?language=objc)
5374    #[unsafe(super(NSObject))]
5375    #[derive(Debug, PartialEq, Eq, Hash)]
5376    pub struct NEHotspotEAPSettings;
5377);
5378
5379extern_conformance!(
5380    unsafe impl NSCoding for NEHotspotEAPSettings {}
5381);
5382
5383extern_conformance!(
5384    unsafe impl NSCopying for NEHotspotEAPSettings {}
5385);
5386
5387unsafe impl CopyingHelper for NEHotspotEAPSettings {
5388    type Result = Self;
5389}
5390
5391extern_conformance!(
5392    unsafe impl NSObjectProtocol for NEHotspotEAPSettings {}
5393);
5394
5395extern_conformance!(
5396    unsafe impl NSSecureCoding for NEHotspotEAPSettings {}
5397);
5398
5399impl NEHotspotEAPSettings {
5400    extern_methods!(
5401        /// Array of supported EAP Types. Refer to NEHotspotConfigurationEAPType
5402        /// for valid values.
5403        #[unsafe(method(supportedEAPTypes))]
5404        #[unsafe(method_family = none)]
5405        pub unsafe fn supportedEAPTypes(&self) -> Retained<NSArray<NSNumber>>;
5406
5407        /// Setter for [`supportedEAPTypes`][Self::supportedEAPTypes].
5408        #[unsafe(method(setSupportedEAPTypes:))]
5409        #[unsafe(method_family = none)]
5410        pub unsafe fn setSupportedEAPTypes(&self, supported_eap_types: &NSArray<NSNumber>);
5411
5412        /// A UTF-8 encoded string containing username component of the user authentication
5413        /// credentials. Length of this property must be between 1 and 253 characters.
5414        #[unsafe(method(username))]
5415        #[unsafe(method_family = none)]
5416        pub unsafe fn username(&self) -> Retained<NSString>;
5417
5418        /// Setter for [`username`][Self::username].
5419        #[unsafe(method(setUsername:))]
5420        #[unsafe(method_family = none)]
5421        pub unsafe fn setUsername(&self, username: &NSString);
5422
5423        /// Identity string to be used in EAP-Response/Identity of the outer phase. This key is only
5424        /// relevant to TTLS, PEAP, and EAP-FAST.
5425        #[unsafe(method(outerIdentity))]
5426        #[unsafe(method_family = none)]
5427        pub unsafe fn outerIdentity(&self) -> Retained<NSString>;
5428
5429        /// Setter for [`outerIdentity`][Self::outerIdentity].
5430        #[unsafe(method(setOuterIdentity:))]
5431        #[unsafe(method_family = none)]
5432        pub unsafe fn setOuterIdentity(&self, outer_identity: &NSString);
5433
5434        /// Specifies the inner authentication used by the TTLS module.
5435        /// Possible values are PAP, CHAP, MSCHAP, MSCHAPv2, and EAP. Defaults to EAP.
5436        #[unsafe(method(ttlsInnerAuthenticationType))]
5437        #[unsafe(method_family = none)]
5438        pub unsafe fn ttlsInnerAuthenticationType(
5439            &self,
5440        ) -> NEHotspotConfigurationTTLSInnerAuthenticationType;
5441
5442        /// Setter for [`ttlsInnerAuthenticationType`][Self::ttlsInnerAuthenticationType].
5443        #[unsafe(method(setTtlsInnerAuthenticationType:))]
5444        #[unsafe(method_family = none)]
5445        pub unsafe fn setTtlsInnerAuthenticationType(
5446            &self,
5447            ttls_inner_authentication_type: NEHotspotConfigurationTTLSInnerAuthenticationType,
5448        );
5449
5450        /// The password component of the 802.1X authentication credential.
5451        /// Length of this property must be between 1 and 64 characters.
5452        #[unsafe(method(password))]
5453        #[unsafe(method_family = none)]
5454        pub unsafe fn password(&self) -> Retained<NSString>;
5455
5456        /// Setter for [`password`][Self::password].
5457        #[unsafe(method(setPassword:))]
5458        #[unsafe(method_family = none)]
5459        pub unsafe fn setPassword(&self, password: &NSString);
5460
5461        /// Array of server certificate common names that will be used to verify server's certificate.
5462        /// The string could have wildcards to specify the name, such as "*.mycompany.net". If a server presents
5463        /// a certificate with DNSName or Common Name that isn't in this list, it won't be trusted.
5464        #[unsafe(method(trustedServerNames))]
5465        #[unsafe(method_family = none)]
5466        pub unsafe fn trustedServerNames(&self) -> Retained<NSArray<NSString>>;
5467
5468        /// Setter for [`trustedServerNames`][Self::trustedServerNames].
5469        #[unsafe(method(setTrustedServerNames:))]
5470        #[unsafe(method_family = none)]
5471        pub unsafe fn setTrustedServerNames(&self, trusted_server_names: &NSArray<NSString>);
5472
5473        /// If YES, supports two-factor authentication for EAP-TTLS, PEAP, or EAP-FAST.
5474        /// If NO, allows for zero-factor authentication for EAP-TLS. The default is YES for EAP-TLS,
5475        /// and NO for other EAP types.
5476        #[unsafe(method(isTLSClientCertificateRequired))]
5477        #[unsafe(method_family = none)]
5478        pub unsafe fn isTLSClientCertificateRequired(&self) -> bool;
5479
5480        /// Setter for [`isTLSClientCertificateRequired`][Self::isTLSClientCertificateRequired].
5481        #[unsafe(method(setTlsClientCertificateRequired:))]
5482        #[unsafe(method_family = none)]
5483        pub unsafe fn setTlsClientCertificateRequired(&self, tls_client_certificate_required: bool);
5484
5485        /// TLS version to use during the TLS handshake.
5486        /// Default value is NEHotspotConfigurationEAPTLSVersion_1_2.
5487        #[unsafe(method(preferredTLSVersion))]
5488        #[unsafe(method_family = none)]
5489        pub unsafe fn preferredTLSVersion(&self) -> NEHotspotConfigurationEAPTLSVersion;
5490
5491        /// Setter for [`preferredTLSVersion`][Self::preferredTLSVersion].
5492        #[unsafe(method(setPreferredTLSVersion:))]
5493        #[unsafe(method_family = none)]
5494        pub unsafe fn setPreferredTLSVersion(
5495            &self,
5496            preferred_tls_version: NEHotspotConfigurationEAPTLSVersion,
5497        );
5498
5499        #[cfg(feature = "objc2-security")]
5500        /// Setter to configure the EAP peer identity. The application needs to store
5501        /// this identity in keychain access group "$(TeamIdentifierPrefix)com.apple.networkextensionsharing".
5502        /// The API uses SecItemCopyMatching to obtain persistent reference for this identity from application's
5503        /// keychain and uses that at the time of EAP authentication.
5504        /// This property is mandatory when EAP-TLS is desired or tlsClientCertificateRequired is set to YES.
5505        ///
5506        ///
5507        /// Parameter `identity`: The identity of the EAP Peer. This is a SecIdentityRef object that contains
5508        /// a SecKeyRef object and an associated SecCertificateRef object.
5509        ///
5510        /// Returns: returns NO if the parameter is not an object of SecIdentityRef type or if the persistent reference
5511        /// is not found in the application's keychain else returns YES.
5512        #[unsafe(method(setIdentity:))]
5513        #[unsafe(method_family = none)]
5514        pub unsafe fn setIdentity(&self, identity: &SecIdentity) -> bool;
5515
5516        /// Setter to configure an array of trusted server certificates used for trust evaluation of
5517        /// the server certificate.
5518        ///
5519        ///
5520        /// Parameter `certificates`: Each value in the array is a SecCertificateRef object. Application needs to store
5521        /// the certificates in keychain access group "$(TeamIdentifierPrefix)com.apple.networkextensionsharing".
5522        /// The API uses SecItemCopyMatching to obtain persistent reference for each certificate from application's
5523        /// keychain and uses that at the time os EAP authentication.
5524        /// Number of elements in the array cannot be more than 10.
5525        ///
5526        ///
5527        /// Returns: returns NO if any element in the array is not an object of type SecCertificateRef or if API
5528        /// fails to find persistent reference for each element from the application's keychain else return YES.
5529        #[unsafe(method(setTrustedServerCertificates:))]
5530        #[unsafe(method_family = none)]
5531        pub unsafe fn setTrustedServerCertificates(&self, certificates: &NSArray) -> bool;
5532    );
5533}
5534
5535/// Methods declared on superclass `NSObject`.
5536impl NEHotspotEAPSettings {
5537    extern_methods!(
5538        #[unsafe(method(init))]
5539        #[unsafe(method_family = init)]
5540        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5541
5542        #[unsafe(method(new))]
5543        #[unsafe(method_family = new)]
5544        pub unsafe fn new() -> Retained<Self>;
5545    );
5546}
5547
5548extern_class!(
5549    /// The NEHotspotConfiguration class represents set of properties that are required
5550    /// to configure a Wi-Fi Network.
5551    ///
5552    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspotconfiguration?language=objc)
5553    #[unsafe(super(NSObject))]
5554    #[derive(Debug, PartialEq, Eq, Hash)]
5555    pub struct NEHotspotConfiguration;
5556);
5557
5558extern_conformance!(
5559    unsafe impl NSCoding for NEHotspotConfiguration {}
5560);
5561
5562extern_conformance!(
5563    unsafe impl NSCopying for NEHotspotConfiguration {}
5564);
5565
5566unsafe impl CopyingHelper for NEHotspotConfiguration {
5567    type Result = Self;
5568}
5569
5570extern_conformance!(
5571    unsafe impl NSObjectProtocol for NEHotspotConfiguration {}
5572);
5573
5574extern_conformance!(
5575    unsafe impl NSSecureCoding for NEHotspotConfiguration {}
5576);
5577
5578impl NEHotspotConfiguration {
5579    extern_methods!(
5580        /// SSID of the Wi-Fi Network.
5581        #[unsafe(method(SSID))]
5582        #[unsafe(method_family = none)]
5583        pub unsafe fn SSID(&self) -> Retained<NSString>;
5584
5585        /// Prefix string of SSID of the Wi-Fi Network.
5586        #[unsafe(method(SSIDPrefix))]
5587        #[unsafe(method_family = none)]
5588        pub unsafe fn SSIDPrefix(&self) -> Retained<NSString>;
5589
5590        /// if set to YES the configuration will not be persisted. Default is NO.
5591        #[unsafe(method(joinOnce))]
5592        #[unsafe(method_family = none)]
5593        pub unsafe fn joinOnce(&self) -> bool;
5594
5595        /// Setter for [`joinOnce`][Self::joinOnce].
5596        #[unsafe(method(setJoinOnce:))]
5597        #[unsafe(method_family = none)]
5598        pub unsafe fn setJoinOnce(&self, join_once: bool);
5599
5600        /// The lifetime of the configuration in days. The configuration is stored for the
5601        /// number of days specified by this property. The minimum value is 1 day and maximum value is 365 days.
5602        /// A configuration does not get deleted automatically if this property is not set or set to an invalid value.
5603        /// This property does not apply to Enterprise and HS2.0 networks.
5604        #[unsafe(method(lifeTimeInDays))]
5605        #[unsafe(method_family = none)]
5606        pub unsafe fn lifeTimeInDays(&self) -> Retained<NSNumber>;
5607
5608        /// Setter for [`lifeTimeInDays`][Self::lifeTimeInDays].
5609        #[unsafe(method(setLifeTimeInDays:))]
5610        #[unsafe(method_family = none)]
5611        pub unsafe fn setLifeTimeInDays(&self, life_time_in_days: &NSNumber);
5612
5613        /// if set to YES the system will perform active scan of the SSID. Default is NO.
5614        #[unsafe(method(hidden))]
5615        #[unsafe(method_family = none)]
5616        pub unsafe fn hidden(&self) -> bool;
5617
5618        /// Setter for [`hidden`][Self::hidden].
5619        #[unsafe(method(setHidden:))]
5620        #[unsafe(method_family = none)]
5621        pub unsafe fn setHidden(&self, hidden: bool);
5622
5623        /// A designated initializer to instantiate a new NEHotspotConfiguration object.
5624        /// This initializer is used to configure open Wi-Fi Networks.
5625        ///
5626        ///
5627        /// Parameter `SSID`: The SSID of the open Wi-Fi Network.
5628        /// Length of SSID must be between 1 and 32 characters.
5629        #[unsafe(method(initWithSSID:))]
5630        #[unsafe(method_family = init)]
5631        pub unsafe fn initWithSSID(this: Allocated<Self>, ssid: &NSString) -> Retained<Self>;
5632
5633        /// A designated initializer to instantiate a new NEHotspotConfiguration object.
5634        /// This initializer is used configure either WEP or WPA/WPA2 Personal Wi-Fi Networks.
5635        ///
5636        ///
5637        /// Parameter `SSID`: The SSID of the WEP or WPA/WPA2 Personal Wi-Fi Network
5638        ///
5639        /// Parameter `passphrase`: The passphrase credential.
5640        /// For WPA/WPA2 Personal networks: between 8 and 63 characters.
5641        /// For Static WEP(64bit)  : 10 Hex Digits
5642        /// For Static WEP(128bit) : 26 Hex Digits
5643        ///
5644        /// Parameter `isWEP`: YES specifies WEP Wi-Fi Network else WPA/WPA2 Personal Wi-Fi Network
5645        #[unsafe(method(initWithSSID:passphrase:isWEP:))]
5646        #[unsafe(method_family = init)]
5647        pub unsafe fn initWithSSID_passphrase_isWEP(
5648            this: Allocated<Self>,
5649            ssid: &NSString,
5650            passphrase: &NSString,
5651            is_wep: bool,
5652        ) -> Retained<Self>;
5653
5654        /// A designated initializer to instantiate a new NEHotspotConfiguration object.
5655        /// This initializer is used configure WPA/WPA2 Enterprise Wi-Fi Networks.
5656        ///
5657        ///
5658        /// Parameter `SSID`: The SSID of WPA/WPA2 Enterprise Wi-Fi Network
5659        ///
5660        /// Parameter `eapSettings`: EAP configuration
5661        #[unsafe(method(initWithSSID:eapSettings:))]
5662        #[unsafe(method_family = init)]
5663        pub unsafe fn initWithSSID_eapSettings(
5664            this: Allocated<Self>,
5665            ssid: &NSString,
5666            eap_settings: &NEHotspotEAPSettings,
5667        ) -> Retained<Self>;
5668
5669        /// A designated initializer to instantiate a new NEHotspotConfiguration object.
5670        /// This initializer is used configure HS2.0 Wi-Fi Networks.
5671        ///
5672        ///
5673        /// Parameter `hs20Settings`: Hotspot 2.0 configuration
5674        ///
5675        /// Parameter `eapSettings`: EAP configuration
5676        #[unsafe(method(initWithHS20Settings:eapSettings:))]
5677        #[unsafe(method_family = init)]
5678        pub unsafe fn initWithHS20Settings_eapSettings(
5679            this: Allocated<Self>,
5680            hs20_settings: &NEHotspotHS20Settings,
5681            eap_settings: &NEHotspotEAPSettings,
5682        ) -> Retained<Self>;
5683
5684        /// A designated initializer to instantiate a new NEHotspotConfiguration object.
5685        /// This initializer is used to configure open Wi-Fi Networks.
5686        ///
5687        ///
5688        /// Parameter `SSIDPrefix`: The prefix string of SSID of the open Wi-Fi Network.
5689        /// Length of SSIDPrefix must be between 3 and 32 characters.
5690        #[unsafe(method(initWithSSIDPrefix:))]
5691        #[unsafe(method_family = init)]
5692        pub unsafe fn initWithSSIDPrefix(
5693            this: Allocated<Self>,
5694            ssid_prefix: &NSString,
5695        ) -> Retained<Self>;
5696
5697        /// A designated initializer to instantiate a new NEHotspotConfiguration object.
5698        /// This initializer is used configure either WEP or WPA/WPA2 Personal Wi-Fi Networks.
5699        ///
5700        ///
5701        /// Parameter `SSIDPrefix`: The prefix string of SSID of the WEP or WPA/WPA2 Personal Wi-Fi Network.
5702        /// Length of SSIDPrefix must be between 3 and 32 characters.
5703        ///
5704        /// Parameter `passphrase`: The passphrase credential.
5705        /// For WPA/WPA2 Personal networks: between 8 and 63 characters.
5706        /// For Static WEP(64bit)  : 10 Hex Digits
5707        /// For Static WEP(128bit) : 26 Hex Digits
5708        ///
5709        /// Parameter `isWEP`: YES specifies WEP Wi-Fi Network else WPA/WPA2 Personal Wi-Fi Network
5710        #[unsafe(method(initWithSSIDPrefix:passphrase:isWEP:))]
5711        #[unsafe(method_family = init)]
5712        pub unsafe fn initWithSSIDPrefix_passphrase_isWEP(
5713            this: Allocated<Self>,
5714            ssid_prefix: &NSString,
5715            passphrase: &NSString,
5716            is_wep: bool,
5717        ) -> Retained<Self>;
5718    );
5719}
5720
5721/// Methods declared on superclass `NSObject`.
5722impl NEHotspotConfiguration {
5723    extern_methods!(
5724        #[unsafe(method(init))]
5725        #[unsafe(method_family = init)]
5726        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5727
5728        #[unsafe(method(new))]
5729        #[unsafe(method_family = new)]
5730        pub unsafe fn new() -> Retained<Self>;
5731    );
5732}
5733
5734extern "C" {
5735    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspotconfigurationerrordomain?language=objc)
5736    pub static NEHotspotConfigurationErrorDomain: &'static NSString;
5737}
5738
5739/// Hotspot Configuration error codes
5740///
5741/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspotconfigurationerror?language=objc)
5742// NS_ENUM
5743#[repr(transparent)]
5744#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
5745pub struct NEHotspotConfigurationError(pub NSInteger);
5746impl NEHotspotConfigurationError {
5747    #[doc(alias = "NEHotspotConfigurationErrorInvalid")]
5748    pub const Invalid: Self = Self(0);
5749    #[doc(alias = "NEHotspotConfigurationErrorInvalidSSID")]
5750    pub const InvalidSSID: Self = Self(1);
5751    #[doc(alias = "NEHotspotConfigurationErrorInvalidWPAPassphrase")]
5752    pub const InvalidWPAPassphrase: Self = Self(2);
5753    #[doc(alias = "NEHotspotConfigurationErrorInvalidWEPPassphrase")]
5754    pub const InvalidWEPPassphrase: Self = Self(3);
5755    #[doc(alias = "NEHotspotConfigurationErrorInvalidEAPSettings")]
5756    pub const InvalidEAPSettings: Self = Self(4);
5757    #[doc(alias = "NEHotspotConfigurationErrorInvalidHS20Settings")]
5758    pub const InvalidHS20Settings: Self = Self(5);
5759    #[doc(alias = "NEHotspotConfigurationErrorInvalidHS20DomainName")]
5760    pub const InvalidHS20DomainName: Self = Self(6);
5761    #[doc(alias = "NEHotspotConfigurationErrorUserDenied")]
5762    pub const UserDenied: Self = Self(7);
5763    #[doc(alias = "NEHotspotConfigurationErrorInternal")]
5764    pub const Internal: Self = Self(8);
5765    #[doc(alias = "NEHotspotConfigurationErrorPending")]
5766    pub const Pending: Self = Self(9);
5767    #[doc(alias = "NEHotspotConfigurationErrorSystemConfiguration")]
5768    pub const SystemConfiguration: Self = Self(10);
5769    #[doc(alias = "NEHotspotConfigurationErrorUnknown")]
5770    pub const Unknown: Self = Self(11);
5771    #[doc(alias = "NEHotspotConfigurationErrorJoinOnceNotSupported")]
5772    pub const JoinOnceNotSupported: Self = Self(12);
5773    #[doc(alias = "NEHotspotConfigurationErrorAlreadyAssociated")]
5774    pub const AlreadyAssociated: Self = Self(13);
5775    #[doc(alias = "NEHotspotConfigurationErrorApplicationIsNotInForeground")]
5776    pub const ApplicationIsNotInForeground: Self = Self(14);
5777    #[doc(alias = "NEHotspotConfigurationErrorInvalidSSIDPrefix")]
5778    pub const InvalidSSIDPrefix: Self = Self(15);
5779    #[doc(alias = "NEHotspotConfigurationErrorUserUnauthorized")]
5780    pub const UserUnauthorized: Self = Self(16);
5781    #[doc(alias = "NEHotspotConfigurationErrorSystemDenied")]
5782    pub const SystemDenied: Self = Self(17);
5783}
5784
5785unsafe impl Encode for NEHotspotConfigurationError {
5786    const ENCODING: Encoding = NSInteger::ENCODING;
5787}
5788
5789unsafe impl RefEncode for NEHotspotConfigurationError {
5790    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
5791}
5792
5793extern_class!(
5794    /// The NEHotspotConfigurationManager class allows an application to
5795    /// Add/Update/Remove Wi-Fi Network Configuraton.
5796    ///
5797    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspotconfigurationmanager?language=objc)
5798    #[unsafe(super(NSObject))]
5799    #[derive(Debug, PartialEq, Eq, Hash)]
5800    pub struct NEHotspotConfigurationManager;
5801);
5802
5803extern_conformance!(
5804    unsafe impl NSObjectProtocol for NEHotspotConfigurationManager {}
5805);
5806
5807impl NEHotspotConfigurationManager {
5808    extern_methods!(
5809        #[unsafe(method(sharedManager))]
5810        #[unsafe(method_family = none)]
5811        pub unsafe fn sharedManager() -> Retained<NEHotspotConfigurationManager>;
5812
5813        #[cfg(feature = "block2")]
5814        /// This function adds or updates a Wi-Fi network configuration.
5815        ///
5816        /// Parameter `configuration`: NEHotspotConfiguration object containing the Wi-Fi network configuration.
5817        ///
5818        /// Parameter `completionHandler`: A block that will be called when add/update operation is completed.
5819        /// Pass nil if application does not intend to receive the result.
5820        /// The NSError passed to this block will be nil if the configuration is successfully stored, non-nil otherwise.
5821        /// If the configuration is found invalid or API encounters some other error then completionHandler is called
5822        /// with instance of NSError containing appropriate error code. This API attempts to join the Wi-Fi network
5823        /// if the configuration is successfully added or updated and the network is found nearby.
5824        #[unsafe(method(applyConfiguration:completionHandler:))]
5825        #[unsafe(method_family = none)]
5826        pub unsafe fn applyConfiguration_completionHandler(
5827            &self,
5828            configuration: &NEHotspotConfiguration,
5829            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
5830        );
5831
5832        /// This function removes Wi-Fi configuration.
5833        /// If the joinOnce property was set to YES, invoking this method will disassociate from the Wi-Fi network
5834        /// after the configuration is removed.
5835        ///
5836        /// Parameter `SSID`: Wi-Fi SSID for which the configuration is to be deleted.
5837        #[unsafe(method(removeConfigurationForSSID:))]
5838        #[unsafe(method_family = none)]
5839        pub unsafe fn removeConfigurationForSSID(&self, ssid: &NSString);
5840
5841        /// This function removes Wi-Fi configuration.
5842        ///
5843        /// Parameter `domainName`: HS2.0 domainName for which the configuration is to be deleted.
5844        #[unsafe(method(removeConfigurationForHS20DomainName:))]
5845        #[unsafe(method_family = none)]
5846        pub unsafe fn removeConfigurationForHS20DomainName(&self, domain_name: &NSString);
5847
5848        #[cfg(feature = "block2")]
5849        /// This function returns array of SSIDs and HS2.0 Domain Names that the calling application has configured.
5850        /// It returns nil if there are no networks configurred by the calling application.
5851        #[unsafe(method(getConfiguredSSIDsWithCompletionHandler:))]
5852        #[unsafe(method_family = none)]
5853        pub unsafe fn getConfiguredSSIDsWithCompletionHandler(
5854            &self,
5855            completion_handler: &block2::DynBlock<dyn Fn(NonNull<NSArray<NSString>>)>,
5856        );
5857    );
5858}
5859
5860/// Methods declared on superclass `NSObject`.
5861impl NEHotspotConfigurationManager {
5862    extern_methods!(
5863        #[unsafe(method(init))]
5864        #[unsafe(method_family = init)]
5865        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5866
5867        #[unsafe(method(new))]
5868        #[unsafe(method_family = new)]
5869        pub unsafe fn new() -> Retained<Self>;
5870    );
5871}
5872
5873extern_class!(
5874    /// The NEIPv4Settings class declares the programmatic interface for an object that contains IPv4 settings.
5875    ///
5876    /// Instances of this class are thread safe.
5877    ///
5878    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neipv4settings?language=objc)
5879    #[unsafe(super(NSObject))]
5880    #[derive(Debug, PartialEq, Eq, Hash)]
5881    pub struct NEIPv4Settings;
5882);
5883
5884extern_conformance!(
5885    unsafe impl NSCoding for NEIPv4Settings {}
5886);
5887
5888extern_conformance!(
5889    unsafe impl NSCopying for NEIPv4Settings {}
5890);
5891
5892unsafe impl CopyingHelper for NEIPv4Settings {
5893    type Result = Self;
5894}
5895
5896extern_conformance!(
5897    unsafe impl NSObjectProtocol for NEIPv4Settings {}
5898);
5899
5900extern_conformance!(
5901    unsafe impl NSSecureCoding for NEIPv4Settings {}
5902);
5903
5904impl NEIPv4Settings {
5905    extern_methods!(
5906        /// Initialize a newly-allocated NEIPv4Settings object.
5907        ///
5908        /// Parameter `addresses`: An array of IPv4 addresses represented as dotted decimal strings.
5909        ///
5910        /// Parameter `subnetMasks`: An array of IPv4 subnet masks represented as dotted decimal strings.
5911        ///
5912        /// Returns: The initialized object.
5913        #[unsafe(method(initWithAddresses:subnetMasks:))]
5914        #[unsafe(method_family = init)]
5915        pub unsafe fn initWithAddresses_subnetMasks(
5916            this: Allocated<Self>,
5917            addresses: &NSArray<NSString>,
5918            subnet_masks: &NSArray<NSString>,
5919        ) -> Retained<Self>;
5920
5921        /// Create a NEIPv4Settings object that will obtain IP addresses and netmasks using DHCP.
5922        ///
5923        /// Returns: The initialized object.
5924        #[unsafe(method(settingsWithAutomaticAddressing))]
5925        #[unsafe(method_family = none)]
5926        pub unsafe fn settingsWithAutomaticAddressing() -> Retained<Self>;
5927
5928        /// An array of IPv4 addresses represented as dotted decimal strings. These addresses will be set on the virtual interface used by the VPN tunnel.
5929        #[unsafe(method(addresses))]
5930        #[unsafe(method_family = none)]
5931        pub unsafe fn addresses(&self) -> Retained<NSArray<NSString>>;
5932
5933        /// An array of IPv4 subnet masks represented as dotted decimal strings. These subnet masks will be set along with their corresponding addresses from the addresses array on the virtual interface used by the VPN tunnel.
5934        #[unsafe(method(subnetMasks))]
5935        #[unsafe(method_family = none)]
5936        pub unsafe fn subnetMasks(&self) -> Retained<NSArray<NSString>>;
5937
5938        /// The address of the next-hop gateway router represented as a dotted decimal string. This property is ignored for TUN interfaces.
5939        #[unsafe(method(router))]
5940        #[unsafe(method_family = none)]
5941        pub unsafe fn router(&self) -> Option<Retained<NSString>>;
5942
5943        /// Setter for [`router`][Self::router].
5944        #[unsafe(method(setRouter:))]
5945        #[unsafe(method_family = none)]
5946        pub unsafe fn setRouter(&self, router: Option<&NSString>);
5947
5948        /// An array of NEIPv4Route objects. Traffic matching these routes will be routed through the virtual interface used by the VPN tunnel.
5949        #[unsafe(method(includedRoutes))]
5950        #[unsafe(method_family = none)]
5951        pub unsafe fn includedRoutes(&self) -> Option<Retained<NSArray<NEIPv4Route>>>;
5952
5953        /// Setter for [`includedRoutes`][Self::includedRoutes].
5954        #[unsafe(method(setIncludedRoutes:))]
5955        #[unsafe(method_family = none)]
5956        pub unsafe fn setIncludedRoutes(&self, included_routes: Option<&NSArray<NEIPv4Route>>);
5957
5958        /// An array of NEIPv4Route objects. Traffic matching these routes will be routed through the current primary physical interface of the device.
5959        #[unsafe(method(excludedRoutes))]
5960        #[unsafe(method_family = none)]
5961        pub unsafe fn excludedRoutes(&self) -> Option<Retained<NSArray<NEIPv4Route>>>;
5962
5963        /// Setter for [`excludedRoutes`][Self::excludedRoutes].
5964        #[unsafe(method(setExcludedRoutes:))]
5965        #[unsafe(method_family = none)]
5966        pub unsafe fn setExcludedRoutes(&self, excluded_routes: Option<&NSArray<NEIPv4Route>>);
5967    );
5968}
5969
5970/// Methods declared on superclass `NSObject`.
5971impl NEIPv4Settings {
5972    extern_methods!(
5973        #[unsafe(method(init))]
5974        #[unsafe(method_family = init)]
5975        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5976
5977        #[unsafe(method(new))]
5978        #[unsafe(method_family = new)]
5979        pub unsafe fn new() -> Retained<Self>;
5980    );
5981}
5982
5983extern_class!(
5984    /// The NEIPv4Route class declares the programmatic interface for an object that contains settings for an IPv4 route.
5985    ///
5986    /// Instances of this class are thread safe.
5987    ///
5988    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neipv4route?language=objc)
5989    #[unsafe(super(NSObject))]
5990    #[derive(Debug, PartialEq, Eq, Hash)]
5991    pub struct NEIPv4Route;
5992);
5993
5994extern_conformance!(
5995    unsafe impl NSCoding for NEIPv4Route {}
5996);
5997
5998extern_conformance!(
5999    unsafe impl NSCopying for NEIPv4Route {}
6000);
6001
6002unsafe impl CopyingHelper for NEIPv4Route {
6003    type Result = Self;
6004}
6005
6006extern_conformance!(
6007    unsafe impl NSObjectProtocol for NEIPv4Route {}
6008);
6009
6010extern_conformance!(
6011    unsafe impl NSSecureCoding for NEIPv4Route {}
6012);
6013
6014impl NEIPv4Route {
6015    extern_methods!(
6016        /// Initialize a newly-allocated NEIPv4Route.
6017        ///
6018        /// Parameter `address`: The IPv4 address of the destination network.
6019        ///
6020        /// Parameter `subnetMask`: The subnet mask of the destination network.
6021        ///
6022        /// Returns: The initialized NEIPv4Route.
6023        #[unsafe(method(initWithDestinationAddress:subnetMask:))]
6024        #[unsafe(method_family = init)]
6025        pub unsafe fn initWithDestinationAddress_subnetMask(
6026            this: Allocated<Self>,
6027            address: &NSString,
6028            subnet_mask: &NSString,
6029        ) -> Retained<Self>;
6030
6031        /// An IPv4 address represented as a dotted decimal string.
6032        #[unsafe(method(destinationAddress))]
6033        #[unsafe(method_family = none)]
6034        pub unsafe fn destinationAddress(&self) -> Retained<NSString>;
6035
6036        /// An IPv4 subnet mask represented as a dotted decimal string. This mask in combination with the destinationAddress property is used to determine the destination network of the route.
6037        #[unsafe(method(destinationSubnetMask))]
6038        #[unsafe(method_family = none)]
6039        pub unsafe fn destinationSubnetMask(&self) -> Retained<NSString>;
6040
6041        /// The IPv4 address of the route's gateway. If this property is nil then the route's gateway will be set to the tunnel's virtual interface.
6042        #[unsafe(method(gatewayAddress))]
6043        #[unsafe(method_family = none)]
6044        pub unsafe fn gatewayAddress(&self) -> Option<Retained<NSString>>;
6045
6046        /// Setter for [`gatewayAddress`][Self::gatewayAddress].
6047        #[unsafe(method(setGatewayAddress:))]
6048        #[unsafe(method_family = none)]
6049        pub unsafe fn setGatewayAddress(&self, gateway_address: Option<&NSString>);
6050
6051        /// Returns: A route object that represents the IPv4 default route.
6052        #[unsafe(method(defaultRoute))]
6053        #[unsafe(method_family = none)]
6054        pub unsafe fn defaultRoute() -> Retained<NEIPv4Route>;
6055    );
6056}
6057
6058/// Methods declared on superclass `NSObject`.
6059impl NEIPv4Route {
6060    extern_methods!(
6061        #[unsafe(method(init))]
6062        #[unsafe(method_family = init)]
6063        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6064
6065        #[unsafe(method(new))]
6066        #[unsafe(method_family = new)]
6067        pub unsafe fn new() -> Retained<Self>;
6068    );
6069}
6070
6071extern_class!(
6072    /// The NEIPv6Settings class declares the programmatic interface for an object that contains IPv6 settings.
6073    ///
6074    /// Instances of this class are thread safe.
6075    ///
6076    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neipv6settings?language=objc)
6077    #[unsafe(super(NSObject))]
6078    #[derive(Debug, PartialEq, Eq, Hash)]
6079    pub struct NEIPv6Settings;
6080);
6081
6082extern_conformance!(
6083    unsafe impl NSCoding for NEIPv6Settings {}
6084);
6085
6086extern_conformance!(
6087    unsafe impl NSCopying for NEIPv6Settings {}
6088);
6089
6090unsafe impl CopyingHelper for NEIPv6Settings {
6091    type Result = Self;
6092}
6093
6094extern_conformance!(
6095    unsafe impl NSObjectProtocol for NEIPv6Settings {}
6096);
6097
6098extern_conformance!(
6099    unsafe impl NSSecureCoding for NEIPv6Settings {}
6100);
6101
6102impl NEIPv6Settings {
6103    extern_methods!(
6104        /// Initialize a newly-allocated NEIPv6Settings object.
6105        ///
6106        /// Parameter `addresses`: An array of IPv6 addresses represented as dotted decimal strings.
6107        ///
6108        /// Parameter `networkPrefixLengths`: An array of NSNumber objects each containing the length in bits of the network prefix of the corresponding address in the addresses parameter.
6109        ///
6110        /// Returns: The initialized object.
6111        #[unsafe(method(initWithAddresses:networkPrefixLengths:))]
6112        #[unsafe(method_family = init)]
6113        pub unsafe fn initWithAddresses_networkPrefixLengths(
6114            this: Allocated<Self>,
6115            addresses: &NSArray<NSString>,
6116            network_prefix_lengths: &NSArray<NSNumber>,
6117        ) -> Retained<Self>;
6118
6119        /// Create a NEIPv6Settings object that will obtain IP addresses and netmasks automatically.
6120        #[unsafe(method(settingsWithAutomaticAddressing))]
6121        #[unsafe(method_family = none)]
6122        pub unsafe fn settingsWithAutomaticAddressing() -> Retained<Self>;
6123
6124        /// Create a NEIPv6Settings object that will only use link-local IPv6 addresses.
6125        #[unsafe(method(settingsWithLinkLocalAddressing))]
6126        #[unsafe(method_family = none)]
6127        pub unsafe fn settingsWithLinkLocalAddressing() -> Retained<Self>;
6128
6129        /// An array of IPv6 addresses represented strings. These addresses will be set on the virtual interface used by the VPN tunnel.
6130        #[unsafe(method(addresses))]
6131        #[unsafe(method_family = none)]
6132        pub unsafe fn addresses(&self) -> Retained<NSArray<NSString>>;
6133
6134        /// An array of NSNumber objects each representing the length in bits of the network prefix of the corresponding address in the addresses property.
6135        #[unsafe(method(networkPrefixLengths))]
6136        #[unsafe(method_family = none)]
6137        pub unsafe fn networkPrefixLengths(&self) -> Retained<NSArray<NSNumber>>;
6138
6139        /// An array of NEIPv6Route objects. Traffic matching these routes will be routed through the virtual interface used by the VPN tunnel.
6140        #[unsafe(method(includedRoutes))]
6141        #[unsafe(method_family = none)]
6142        pub unsafe fn includedRoutes(&self) -> Option<Retained<NSArray<NEIPv6Route>>>;
6143
6144        /// Setter for [`includedRoutes`][Self::includedRoutes].
6145        #[unsafe(method(setIncludedRoutes:))]
6146        #[unsafe(method_family = none)]
6147        pub unsafe fn setIncludedRoutes(&self, included_routes: Option<&NSArray<NEIPv6Route>>);
6148
6149        /// An array of NEIPv6Route objects. Traffic matching these routes will be routed through the current primary physical interface of the device.
6150        #[unsafe(method(excludedRoutes))]
6151        #[unsafe(method_family = none)]
6152        pub unsafe fn excludedRoutes(&self) -> Option<Retained<NSArray<NEIPv6Route>>>;
6153
6154        /// Setter for [`excludedRoutes`][Self::excludedRoutes].
6155        #[unsafe(method(setExcludedRoutes:))]
6156        #[unsafe(method_family = none)]
6157        pub unsafe fn setExcludedRoutes(&self, excluded_routes: Option<&NSArray<NEIPv6Route>>);
6158    );
6159}
6160
6161/// Methods declared on superclass `NSObject`.
6162impl NEIPv6Settings {
6163    extern_methods!(
6164        #[unsafe(method(init))]
6165        #[unsafe(method_family = init)]
6166        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6167
6168        #[unsafe(method(new))]
6169        #[unsafe(method_family = new)]
6170        pub unsafe fn new() -> Retained<Self>;
6171    );
6172}
6173
6174extern_class!(
6175    /// The NEIPv6Route class declares the programmatic interface for an object that contains settings for an IPv6 route.
6176    ///
6177    /// Instances of this class are thread safe.
6178    ///
6179    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neipv6route?language=objc)
6180    #[unsafe(super(NSObject))]
6181    #[derive(Debug, PartialEq, Eq, Hash)]
6182    pub struct NEIPv6Route;
6183);
6184
6185extern_conformance!(
6186    unsafe impl NSCoding for NEIPv6Route {}
6187);
6188
6189extern_conformance!(
6190    unsafe impl NSCopying for NEIPv6Route {}
6191);
6192
6193unsafe impl CopyingHelper for NEIPv6Route {
6194    type Result = Self;
6195}
6196
6197extern_conformance!(
6198    unsafe impl NSObjectProtocol for NEIPv6Route {}
6199);
6200
6201extern_conformance!(
6202    unsafe impl NSSecureCoding for NEIPv6Route {}
6203);
6204
6205impl NEIPv6Route {
6206    extern_methods!(
6207        /// Initialize a newly-allocated NEIPv6Route.
6208        ///
6209        /// Parameter `address`: The IPv6 address of the destination network.
6210        ///
6211        /// Parameter `networkPrefixLength`: A number containing the length in bits of the network prefix of the destination network.
6212        ///
6213        /// Returns: The initialized NEIPv6Route.
6214        #[unsafe(method(initWithDestinationAddress:networkPrefixLength:))]
6215        #[unsafe(method_family = init)]
6216        pub unsafe fn initWithDestinationAddress_networkPrefixLength(
6217            this: Allocated<Self>,
6218            address: &NSString,
6219            network_prefix_length: &NSNumber,
6220        ) -> Retained<Self>;
6221
6222        /// An IPv6 address represented as a string.
6223        #[unsafe(method(destinationAddress))]
6224        #[unsafe(method_family = none)]
6225        pub unsafe fn destinationAddress(&self) -> Retained<NSString>;
6226
6227        /// A number containing the length in bits of the network prefix of the destination network. This prefix in combination with the destinationAddress property is used to determine the destination network of the route.
6228        #[unsafe(method(destinationNetworkPrefixLength))]
6229        #[unsafe(method_family = none)]
6230        pub unsafe fn destinationNetworkPrefixLength(&self) -> Retained<NSNumber>;
6231
6232        /// The IPv6 address of the route's gateway. If this property is nil then the route's gateway will be set to the tunnel's virtual interface.
6233        #[unsafe(method(gatewayAddress))]
6234        #[unsafe(method_family = none)]
6235        pub unsafe fn gatewayAddress(&self) -> Option<Retained<NSString>>;
6236
6237        /// Setter for [`gatewayAddress`][Self::gatewayAddress].
6238        #[unsafe(method(setGatewayAddress:))]
6239        #[unsafe(method_family = none)]
6240        pub unsafe fn setGatewayAddress(&self, gateway_address: Option<&NSString>);
6241
6242        /// Returns: A route object that represents the IPv6 default route.
6243        #[unsafe(method(defaultRoute))]
6244        #[unsafe(method_family = none)]
6245        pub unsafe fn defaultRoute() -> Retained<NEIPv6Route>;
6246    );
6247}
6248
6249/// Methods declared on superclass `NSObject`.
6250impl NEIPv6Route {
6251    extern_methods!(
6252        #[unsafe(method(init))]
6253        #[unsafe(method_family = init)]
6254        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6255
6256        #[unsafe(method(new))]
6257        #[unsafe(method_family = new)]
6258        pub unsafe fn new() -> Retained<Self>;
6259    );
6260}
6261
6262extern_class!(
6263    /// The NETunnelNetworkSettings class declares the programmatic interface for an object that contains network settings.
6264    ///
6265    /// NETunnelNetworkSettings is used by NETunnelProviders to communicate the desired network settings for the tunnel to the framework. The framework takes care of applying the contained settings to the system.
6266    ///
6267    /// Instances of this class are thread safe.
6268    ///
6269    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netunnelnetworksettings?language=objc)
6270    #[unsafe(super(NSObject))]
6271    #[derive(Debug, PartialEq, Eq, Hash)]
6272    pub struct NETunnelNetworkSettings;
6273);
6274
6275extern_conformance!(
6276    unsafe impl NSCoding for NETunnelNetworkSettings {}
6277);
6278
6279extern_conformance!(
6280    unsafe impl NSCopying for NETunnelNetworkSettings {}
6281);
6282
6283unsafe impl CopyingHelper for NETunnelNetworkSettings {
6284    type Result = Self;
6285}
6286
6287extern_conformance!(
6288    unsafe impl NSObjectProtocol for NETunnelNetworkSettings {}
6289);
6290
6291extern_conformance!(
6292    unsafe impl NSSecureCoding for NETunnelNetworkSettings {}
6293);
6294
6295impl NETunnelNetworkSettings {
6296    extern_methods!(
6297        /// This function initializes a newly-allocated NETunnelNetworkSettings object with a given tunnel remote address.
6298        ///
6299        /// Parameter `address`: The address of the remote endpoint that is providing the tunnel service.
6300        #[unsafe(method(initWithTunnelRemoteAddress:))]
6301        #[unsafe(method_family = init)]
6302        pub unsafe fn initWithTunnelRemoteAddress(
6303            this: Allocated<Self>,
6304            address: &NSString,
6305        ) -> Retained<Self>;
6306
6307        /// A string containing the IP address of the remote endpoint that is providing the tunnel service.
6308        #[unsafe(method(tunnelRemoteAddress))]
6309        #[unsafe(method_family = none)]
6310        pub unsafe fn tunnelRemoteAddress(&self) -> Retained<NSString>;
6311
6312        /// An NEDNSSettings object that contains the desired tunnel DNS settings.
6313        #[unsafe(method(DNSSettings))]
6314        #[unsafe(method_family = none)]
6315        pub unsafe fn DNSSettings(&self) -> Option<Retained<NEDNSSettings>>;
6316
6317        /// Setter for [`DNSSettings`][Self::DNSSettings].
6318        #[unsafe(method(setDNSSettings:))]
6319        #[unsafe(method_family = none)]
6320        pub unsafe fn setDNSSettings(&self, dns_settings: Option<&NEDNSSettings>);
6321
6322        /// An NEProxySettings object that contains the desired tunnel proxy settings.
6323        #[unsafe(method(proxySettings))]
6324        #[unsafe(method_family = none)]
6325        pub unsafe fn proxySettings(&self) -> Option<Retained<NEProxySettings>>;
6326
6327        /// Setter for [`proxySettings`][Self::proxySettings].
6328        #[unsafe(method(setProxySettings:))]
6329        #[unsafe(method_family = none)]
6330        pub unsafe fn setProxySettings(&self, proxy_settings: Option<&NEProxySettings>);
6331    );
6332}
6333
6334/// Methods declared on superclass `NSObject`.
6335impl NETunnelNetworkSettings {
6336    extern_methods!(
6337        #[unsafe(method(init))]
6338        #[unsafe(method_family = init)]
6339        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6340
6341        #[unsafe(method(new))]
6342        #[unsafe(method_family = new)]
6343        pub unsafe fn new() -> Retained<Self>;
6344    );
6345}
6346
6347extern_class!(
6348    /// The NEPacketTunnelNetworkSettings class declares the programmatic interface for an object that contains IP network settings.
6349    ///
6350    /// NEPacketTunnelNetworkSettings is used by NEPacketTunnelProviders to communicate the desired IP network settings for the packet tunnel to the framework. The framework takes care of applying the contained settings to the system.
6351    ///
6352    /// Instances of this class are thread safe.
6353    ///
6354    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nepackettunnelnetworksettings?language=objc)
6355    #[unsafe(super(NETunnelNetworkSettings, NSObject))]
6356    #[derive(Debug, PartialEq, Eq, Hash)]
6357    pub struct NEPacketTunnelNetworkSettings;
6358);
6359
6360extern_conformance!(
6361    unsafe impl NSCoding for NEPacketTunnelNetworkSettings {}
6362);
6363
6364extern_conformance!(
6365    unsafe impl NSCopying for NEPacketTunnelNetworkSettings {}
6366);
6367
6368unsafe impl CopyingHelper for NEPacketTunnelNetworkSettings {
6369    type Result = Self;
6370}
6371
6372extern_conformance!(
6373    unsafe impl NSObjectProtocol for NEPacketTunnelNetworkSettings {}
6374);
6375
6376extern_conformance!(
6377    unsafe impl NSSecureCoding for NEPacketTunnelNetworkSettings {}
6378);
6379
6380impl NEPacketTunnelNetworkSettings {
6381    extern_methods!(
6382        /// An NEIPv4Settings object that contains the desired tunnel IPv4 settings.
6383        #[unsafe(method(IPv4Settings))]
6384        #[unsafe(method_family = none)]
6385        pub unsafe fn IPv4Settings(&self) -> Option<Retained<NEIPv4Settings>>;
6386
6387        /// Setter for [`IPv4Settings`][Self::IPv4Settings].
6388        #[unsafe(method(setIPv4Settings:))]
6389        #[unsafe(method_family = none)]
6390        pub unsafe fn setIPv4Settings(&self, i_pv4_settings: Option<&NEIPv4Settings>);
6391
6392        /// An NEIPv6Settings object that contains the desired tunnel IPv6 settings.
6393        #[unsafe(method(IPv6Settings))]
6394        #[unsafe(method_family = none)]
6395        pub unsafe fn IPv6Settings(&self) -> Option<Retained<NEIPv6Settings>>;
6396
6397        /// Setter for [`IPv6Settings`][Self::IPv6Settings].
6398        #[unsafe(method(setIPv6Settings:))]
6399        #[unsafe(method_family = none)]
6400        pub unsafe fn setIPv6Settings(&self, i_pv6_settings: Option<&NEIPv6Settings>);
6401
6402        /// An NSNumber object containing the number of bytes of overhead appended to each outbound packet through the tunnel. The MTU for the TUN interface is computed by subtracting this value from the MTU of the primary physical interface.
6403        #[unsafe(method(tunnelOverheadBytes))]
6404        #[unsafe(method_family = none)]
6405        pub unsafe fn tunnelOverheadBytes(&self) -> Option<Retained<NSNumber>>;
6406
6407        /// Setter for [`tunnelOverheadBytes`][Self::tunnelOverheadBytes].
6408        #[unsafe(method(setTunnelOverheadBytes:))]
6409        #[unsafe(method_family = none)]
6410        pub unsafe fn setTunnelOverheadBytes(&self, tunnel_overhead_bytes: Option<&NSNumber>);
6411
6412        /// An NSNumber object containing the Maximum Transmission Unit (MTU) size in bytes to assign to the TUN interface. If this property is set, the tunnelOverheadBytes property is ignored.
6413        #[unsafe(method(MTU))]
6414        #[unsafe(method_family = none)]
6415        pub unsafe fn MTU(&self) -> Option<Retained<NSNumber>>;
6416
6417        /// Setter for [`MTU`][Self::MTU].
6418        #[unsafe(method(setMTU:))]
6419        #[unsafe(method_family = none)]
6420        pub unsafe fn setMTU(&self, mtu: Option<&NSNumber>);
6421    );
6422}
6423
6424/// Methods declared on superclass `NETunnelNetworkSettings`.
6425impl NEPacketTunnelNetworkSettings {
6426    extern_methods!(
6427        /// This function initializes a newly-allocated NETunnelNetworkSettings object with a given tunnel remote address.
6428        ///
6429        /// Parameter `address`: The address of the remote endpoint that is providing the tunnel service.
6430        #[unsafe(method(initWithTunnelRemoteAddress:))]
6431        #[unsafe(method_family = init)]
6432        pub unsafe fn initWithTunnelRemoteAddress(
6433            this: Allocated<Self>,
6434            address: &NSString,
6435        ) -> Retained<Self>;
6436    );
6437}
6438
6439/// Methods declared on superclass `NSObject`.
6440impl NEPacketTunnelNetworkSettings {
6441    extern_methods!(
6442        #[unsafe(method(init))]
6443        #[unsafe(method_family = init)]
6444        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6445
6446        #[unsafe(method(new))]
6447        #[unsafe(method_family = new)]
6448        pub unsafe fn new() -> Retained<Self>;
6449    );
6450}
6451
6452extern_class!(
6453    /// The NEEthernetTunnelNetworkSettings class declares the programmatic interface for an object that contains network settings.
6454    ///
6455    /// NEEthernetTunnelNetworkSettings is used by NEEthernetTunnelProviders to communicate the desired network settings for the packet tunnel to the framework. The framework takes care of applying the contained settings to the system.
6456    ///
6457    /// Instances of this class are thread safe.
6458    ///
6459    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neethernettunnelnetworksettings?language=objc)
6460    #[unsafe(super(NEPacketTunnelNetworkSettings, NETunnelNetworkSettings, NSObject))]
6461    #[derive(Debug, PartialEq, Eq, Hash)]
6462    pub struct NEEthernetTunnelNetworkSettings;
6463);
6464
6465extern_conformance!(
6466    unsafe impl NSCoding for NEEthernetTunnelNetworkSettings {}
6467);
6468
6469extern_conformance!(
6470    unsafe impl NSCopying for NEEthernetTunnelNetworkSettings {}
6471);
6472
6473unsafe impl CopyingHelper for NEEthernetTunnelNetworkSettings {
6474    type Result = Self;
6475}
6476
6477extern_conformance!(
6478    unsafe impl NSObjectProtocol for NEEthernetTunnelNetworkSettings {}
6479);
6480
6481extern_conformance!(
6482    unsafe impl NSSecureCoding for NEEthernetTunnelNetworkSettings {}
6483);
6484
6485impl NEEthernetTunnelNetworkSettings {
6486    extern_methods!(
6487        /// This function initializes a newly-allocated NEEthernetTunnelNetworkSettings object with a given tunnel remote address and MAC address.
6488        ///
6489        /// Parameter `address`: The address of the remote endpoint that is providing the tunnel service.
6490        ///
6491        /// Parameter `ethernetAddress`: The ethernet address to be assigned to the tunnel interface. This string should be in the format "xx:xx:xx:xx:xx:xx", where each xx is a hexidecimal number between 0 and ff.
6492        ///
6493        /// Parameter `mtu`: The MTU (Maxium Transmission Unit) in bytes to be assigned to the tunnel interface.
6494        #[unsafe(method(initWithTunnelRemoteAddress:ethernetAddress:mtu:))]
6495        #[unsafe(method_family = init)]
6496        pub unsafe fn initWithTunnelRemoteAddress_ethernetAddress_mtu(
6497            this: Allocated<Self>,
6498            address: &NSString,
6499            ethernet_address: &NSString,
6500            mtu: NSInteger,
6501        ) -> Retained<Self>;
6502
6503        /// An NSString object containing the ethernet address of the tunnel interface.
6504        #[unsafe(method(ethernetAddress))]
6505        #[unsafe(method_family = none)]
6506        pub unsafe fn ethernetAddress(&self) -> Retained<NSString>;
6507    );
6508}
6509
6510/// Methods declared on superclass `NETunnelNetworkSettings`.
6511impl NEEthernetTunnelNetworkSettings {
6512    extern_methods!(
6513        /// This function initializes a newly-allocated NETunnelNetworkSettings object with a given tunnel remote address.
6514        ///
6515        /// Parameter `address`: The address of the remote endpoint that is providing the tunnel service.
6516        #[unsafe(method(initWithTunnelRemoteAddress:))]
6517        #[unsafe(method_family = init)]
6518        pub unsafe fn initWithTunnelRemoteAddress(
6519            this: Allocated<Self>,
6520            address: &NSString,
6521        ) -> Retained<Self>;
6522    );
6523}
6524
6525/// Methods declared on superclass `NSObject`.
6526impl NEEthernetTunnelNetworkSettings {
6527    extern_methods!(
6528        #[unsafe(method(init))]
6529        #[unsafe(method_family = init)]
6530        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6531
6532        #[unsafe(method(new))]
6533        #[unsafe(method_family = new)]
6534        pub unsafe fn new() -> Retained<Self>;
6535    );
6536}
6537
6538extern_class!(
6539    /// The NEPacketTunnelProvider class declares the programmatic interface of an object that implements the client side of a custom IP packet tunneling protocol.
6540    ///
6541    /// NEPacketTunnelProvider is part of NetworkExtension.framework.
6542    ///
6543    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nepackettunnelprovider?language=objc)
6544    #[unsafe(super(NETunnelProvider, NEProvider, NSObject))]
6545    #[derive(Debug, PartialEq, Eq, Hash)]
6546    pub struct NEPacketTunnelProvider;
6547);
6548
6549extern_conformance!(
6550    unsafe impl NSObjectProtocol for NEPacketTunnelProvider {}
6551);
6552
6553impl NEPacketTunnelProvider {
6554    extern_methods!(
6555        #[cfg(feature = "block2")]
6556        /// This function is called by the framework when a new tunnel is being created. Subclasses must override this method to perform whatever steps are necessary to establish the tunnel.
6557        ///
6558        /// Parameter `options`: A dictionary containing keys and values passed by the provider's containing app. If the containing app did not start the tunnel then this parameter will be nil.
6559        ///
6560        /// Parameter `completionHandler`: A block that must be called when the process of starting the tunnel is complete. If the tunnel cannot be established then the subclass' implementation of this method must pass a non-nil NSError object to this block. A value of nil passed to the completion handler indicates that the tunnel was successfully established.
6561        #[unsafe(method(startTunnelWithOptions:completionHandler:))]
6562        #[unsafe(method_family = none)]
6563        pub unsafe fn startTunnelWithOptions_completionHandler(
6564            &self,
6565            options: Option<&NSDictionary<NSString, NSObject>>,
6566            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
6567        );
6568
6569        #[cfg(feature = "block2")]
6570        /// This function is called by the framework when the tunnel is being destroyed. Subclasses must override this method to perform whatever steps are necessary to tear down the tunnel.
6571        ///
6572        /// Parameter `reason`: An NEProviderStopReason indicating why the tunnel is being stopped.
6573        ///
6574        /// Parameter `completionHandler`: A block that must be called when the tunnel is completely torn down.
6575        #[unsafe(method(stopTunnelWithReason:completionHandler:))]
6576        #[unsafe(method_family = none)]
6577        pub unsafe fn stopTunnelWithReason_completionHandler(
6578            &self,
6579            reason: NEProviderStopReason,
6580            completion_handler: &block2::DynBlock<dyn Fn()>,
6581        );
6582
6583        /// This function is called by tunnel provider implementations to initiate tunnel destruction when a network error is encountered that renders the tunnel no longer viable. Subclasses should not override this method.
6584        ///
6585        /// Parameter `error`: An NSError object containing details about the error that the tunnel provider implementation encountered.
6586        #[unsafe(method(cancelTunnelWithError:))]
6587        #[unsafe(method_family = none)]
6588        pub unsafe fn cancelTunnelWithError(&self, error: Option<&NSError>);
6589
6590        /// An NEPacketFlow object that the tunnel provider implementation should use to receive packets from the network stack and inject packets into the network stack. Every time the tunnel is started the packet flow object is in an initialized state and must be explicitly opened before any packets can be received or injected.
6591        #[unsafe(method(packetFlow))]
6592        #[unsafe(method_family = none)]
6593        pub unsafe fn packetFlow(&self) -> Retained<NEPacketTunnelFlow>;
6594
6595        /// This function can be called by subclass implementations to create a TCP connection to a given network endpoint, through the tunnel established by the provider. This function should not be overridden by subclasses.
6596        ///
6597        /// Parameter `remoteEndpoint`: An NWEndpoint object that specifies the remote network endpoint to connect to.
6598        ///
6599        /// Parameter `enableTLS`: A flag indicating if a TLS session should be negotiated on the connection.
6600        ///
6601        /// Parameter `TLSParameters`: A set of optional TLS parameters. Only valid if enableTLS is YES. If TLSParameters is nil, the default system parameters will be used for TLS negotiation.
6602        ///
6603        /// Parameter `delegate`: An object to use as the connection delegate. This object should conform to the NWTCPConnectionAuthenticationDelegate protocol.
6604        ///
6605        /// Returns: An NWTCPConnection object.
6606        #[deprecated = "Use the `virtualInterface` property with `nw_parameters_require_interface`"]
6607        #[unsafe(method(createTCPConnectionThroughTunnelToEndpoint:enableTLS:TLSParameters:delegate:))]
6608        #[unsafe(method_family = none)]
6609        pub unsafe fn createTCPConnectionThroughTunnelToEndpoint_enableTLS_TLSParameters_delegate(
6610            &self,
6611            remote_endpoint: &NWEndpoint,
6612            enable_tls: bool,
6613            tls_parameters: Option<&NWTLSParameters>,
6614            delegate: Option<&AnyObject>,
6615        ) -> Retained<NWTCPConnection>;
6616
6617        /// This function can be called by subclass implementations to create a UDP session between a local network endpoint and a remote network endpoint, through the tunnel established by the provider. This function should not be overridden by subclasses.
6618        ///
6619        /// Parameter `remoteEndpoint`: An NWEndpoint object that specifies the remote endpoint to which UDP datagrams will be sent by the UDP session.
6620        ///
6621        /// Parameter `localEndpoint`: An NWHostEndpoint object that specifies the local IP address endpoint to use as the source endpoint of the UDP session.
6622        ///
6623        /// Returns: An NWUDPSession object.
6624        #[deprecated = "Use the `virtualInterface` property with `nw_parameters_require_interface`"]
6625        #[unsafe(method(createUDPSessionThroughTunnelToEndpoint:fromEndpoint:))]
6626        #[unsafe(method_family = none)]
6627        pub unsafe fn createUDPSessionThroughTunnelToEndpoint_fromEndpoint(
6628            &self,
6629            remote_endpoint: &NWEndpoint,
6630            local_endpoint: Option<&NWHostEndpoint>,
6631        ) -> Retained<NWUDPSession>;
6632    );
6633}
6634
6635/// Methods declared on superclass `NSObject`.
6636impl NEPacketTunnelProvider {
6637    extern_methods!(
6638        #[unsafe(method(init))]
6639        #[unsafe(method_family = init)]
6640        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6641
6642        #[unsafe(method(new))]
6643        #[unsafe(method_family = new)]
6644        pub unsafe fn new() -> Retained<Self>;
6645    );
6646}
6647
6648extern_class!(
6649    /// The NEEthernetTunnelProvider class declares the programmatic interface of an object that implements the client side of a custom link-layer packet tunneling protocol.
6650    ///
6651    /// NEEthernetTunnelProvider is part of NetworkExtension.framework.
6652    ///
6653    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neethernettunnelprovider?language=objc)
6654    #[unsafe(super(NEPacketTunnelProvider, NETunnelProvider, NEProvider, NSObject))]
6655    #[derive(Debug, PartialEq, Eq, Hash)]
6656    pub struct NEEthernetTunnelProvider;
6657);
6658
6659extern_conformance!(
6660    unsafe impl NSObjectProtocol for NEEthernetTunnelProvider {}
6661);
6662
6663impl NEEthernetTunnelProvider {
6664    extern_methods!();
6665}
6666
6667/// Methods declared on superclass `NSObject`.
6668impl NEEthernetTunnelProvider {
6669    extern_methods!(
6670        #[unsafe(method(init))]
6671        #[unsafe(method_family = init)]
6672        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6673
6674        #[unsafe(method(new))]
6675        #[unsafe(method_family = new)]
6676        pub unsafe fn new() -> Retained<Self>;
6677    );
6678}
6679
6680/// On Demand rule actions
6681///
6682/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neondemandruleaction?language=objc)
6683// NS_ENUM
6684#[repr(transparent)]
6685#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
6686pub struct NEOnDemandRuleAction(pub NSInteger);
6687impl NEOnDemandRuleAction {
6688    #[doc(alias = "NEOnDemandRuleActionConnect")]
6689    pub const Connect: Self = Self(1);
6690    #[doc(alias = "NEOnDemandRuleActionDisconnect")]
6691    pub const Disconnect: Self = Self(2);
6692    #[doc(alias = "NEOnDemandRuleActionEvaluateConnection")]
6693    pub const EvaluateConnection: Self = Self(3);
6694    #[doc(alias = "NEOnDemandRuleActionIgnore")]
6695    pub const Ignore: Self = Self(4);
6696}
6697
6698unsafe impl Encode for NEOnDemandRuleAction {
6699    const ENCODING: Encoding = NSInteger::ENCODING;
6700}
6701
6702unsafe impl RefEncode for NEOnDemandRuleAction {
6703    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
6704}
6705
6706/// On Demand rule network interface types
6707///
6708/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neondemandruleinterfacetype?language=objc)
6709// NS_ENUM
6710#[repr(transparent)]
6711#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
6712pub struct NEOnDemandRuleInterfaceType(pub NSInteger);
6713impl NEOnDemandRuleInterfaceType {
6714    #[doc(alias = "NEOnDemandRuleInterfaceTypeAny")]
6715    pub const Any: Self = Self(0);
6716    #[doc(alias = "NEOnDemandRuleInterfaceTypeEthernet")]
6717    pub const Ethernet: Self = Self(1);
6718    #[doc(alias = "NEOnDemandRuleInterfaceTypeWiFi")]
6719    pub const WiFi: Self = Self(2);
6720    #[doc(alias = "NEOnDemandRuleInterfaceTypeCellular")]
6721    pub const Cellular: Self = Self(3);
6722}
6723
6724unsafe impl Encode for NEOnDemandRuleInterfaceType {
6725    const ENCODING: Encoding = NSInteger::ENCODING;
6726}
6727
6728unsafe impl RefEncode for NEOnDemandRuleInterfaceType {
6729    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
6730}
6731
6732extern_class!(
6733    /// The NEOnDemandRule class declares the programmatic interface for an object that defines an On Demand rule.
6734    ///
6735    /// NEOnDemandRule is an abstract base class from which other action-specific rule classes are derived.
6736    ///
6737    /// Instances of this class are thread safe.
6738    ///
6739    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neondemandrule?language=objc)
6740    #[unsafe(super(NSObject))]
6741    #[derive(Debug, PartialEq, Eq, Hash)]
6742    pub struct NEOnDemandRule;
6743);
6744
6745extern_conformance!(
6746    unsafe impl NSCoding for NEOnDemandRule {}
6747);
6748
6749extern_conformance!(
6750    unsafe impl NSCopying for NEOnDemandRule {}
6751);
6752
6753unsafe impl CopyingHelper for NEOnDemandRule {
6754    type Result = Self;
6755}
6756
6757extern_conformance!(
6758    unsafe impl NSObjectProtocol for NEOnDemandRule {}
6759);
6760
6761extern_conformance!(
6762    unsafe impl NSSecureCoding for NEOnDemandRule {}
6763);
6764
6765impl NEOnDemandRule {
6766    extern_methods!(
6767        /// The rule's action
6768        #[unsafe(method(action))]
6769        #[unsafe(method_family = none)]
6770        pub unsafe fn action(&self) -> NEOnDemandRuleAction;
6771
6772        /// An array of NSString objects. If the current default search domain is equal to one of the strings in this array and all of the other conditions in the rule match, then the rule matches. If this property is nil (the default), then the current default search domain does not factor into the rule match.
6773        #[unsafe(method(DNSSearchDomainMatch))]
6774        #[unsafe(method_family = none)]
6775        pub unsafe fn DNSSearchDomainMatch(&self) -> Option<Retained<NSArray<NSString>>>;
6776
6777        /// Setter for [`DNSSearchDomainMatch`][Self::DNSSearchDomainMatch].
6778        #[unsafe(method(setDNSSearchDomainMatch:))]
6779        #[unsafe(method_family = none)]
6780        pub unsafe fn setDNSSearchDomainMatch(
6781            &self,
6782            dns_search_domain_match: Option<&NSArray<NSString>>,
6783        );
6784
6785        /// An array of DNS server IP addresses represented as NSString objects. If each of the current default DNS servers is equal to one of the strings in this array and all of the other conditions in the rule match, then the rule matches. If this property is nil (the default), then the default DNS servers do not factor into the rule match.
6786        #[unsafe(method(DNSServerAddressMatch))]
6787        #[unsafe(method_family = none)]
6788        pub unsafe fn DNSServerAddressMatch(&self) -> Option<Retained<NSArray<NSString>>>;
6789
6790        /// Setter for [`DNSServerAddressMatch`][Self::DNSServerAddressMatch].
6791        #[unsafe(method(setDNSServerAddressMatch:))]
6792        #[unsafe(method_family = none)]
6793        pub unsafe fn setDNSServerAddressMatch(
6794            &self,
6795            dns_server_address_match: Option<&NSArray<NSString>>,
6796        );
6797
6798        /// The type of interface that this rule matches. If the current primary network interface is of this type and all of the other conditions in the rule match, then the rule matches. If this property is 0 (the default), then the current primary interface type does not factor into the rule match.
6799        #[unsafe(method(interfaceTypeMatch))]
6800        #[unsafe(method_family = none)]
6801        pub unsafe fn interfaceTypeMatch(&self) -> NEOnDemandRuleInterfaceType;
6802
6803        /// Setter for [`interfaceTypeMatch`][Self::interfaceTypeMatch].
6804        #[unsafe(method(setInterfaceTypeMatch:))]
6805        #[unsafe(method_family = none)]
6806        pub unsafe fn setInterfaceTypeMatch(
6807            &self,
6808            interface_type_match: NEOnDemandRuleInterfaceType,
6809        );
6810
6811        /// An array of NSString objects. If the Service Set Identifier (SSID) of the current primary connected network matches one of the strings in this array and all of the other conditions in the rule match, then the rule matches. If this property is nil (the default), then the current primary connected network SSID does not factor into the rule match.
6812        #[unsafe(method(SSIDMatch))]
6813        #[unsafe(method_family = none)]
6814        pub unsafe fn SSIDMatch(&self) -> Option<Retained<NSArray<NSString>>>;
6815
6816        /// Setter for [`SSIDMatch`][Self::SSIDMatch].
6817        #[unsafe(method(setSSIDMatch:))]
6818        #[unsafe(method_family = none)]
6819        pub unsafe fn setSSIDMatch(&self, ssid_match: Option<&NSArray<NSString>>);
6820
6821        /// An HTTP or HTTPS URL. If a request sent to this URL results in a HTTP 200 OK response and all of the other conditions in the rule match, then then rule matches. If this property is nil (the default), then an HTTP request does not factor into the rule match.
6822        #[unsafe(method(probeURL))]
6823        #[unsafe(method_family = none)]
6824        pub unsafe fn probeURL(&self) -> Option<Retained<NSURL>>;
6825
6826        /// Setter for [`probeURL`][Self::probeURL].
6827        #[unsafe(method(setProbeURL:))]
6828        #[unsafe(method_family = none)]
6829        pub unsafe fn setProbeURL(&self, probe_url: Option<&NSURL>);
6830    );
6831}
6832
6833/// Methods declared on superclass `NSObject`.
6834impl NEOnDemandRule {
6835    extern_methods!(
6836        #[unsafe(method(init))]
6837        #[unsafe(method_family = init)]
6838        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6839
6840        #[unsafe(method(new))]
6841        #[unsafe(method_family = new)]
6842        pub unsafe fn new() -> Retained<Self>;
6843    );
6844}
6845
6846extern_class!(
6847    /// The NEOnDemandRuleConnect class declares the programmatic interface for an object that defines an On Demand rule with the "Connect" action.
6848    ///
6849    /// When rules of this class match, the VPN connection is started whenever an application running on the system opens a network connection.
6850    ///
6851    /// Instances of this class are thread safe.
6852    ///
6853    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neondemandruleconnect?language=objc)
6854    #[unsafe(super(NEOnDemandRule, NSObject))]
6855    #[derive(Debug, PartialEq, Eq, Hash)]
6856    pub struct NEOnDemandRuleConnect;
6857);
6858
6859extern_conformance!(
6860    unsafe impl NSCoding for NEOnDemandRuleConnect {}
6861);
6862
6863extern_conformance!(
6864    unsafe impl NSCopying for NEOnDemandRuleConnect {}
6865);
6866
6867unsafe impl CopyingHelper for NEOnDemandRuleConnect {
6868    type Result = Self;
6869}
6870
6871extern_conformance!(
6872    unsafe impl NSObjectProtocol for NEOnDemandRuleConnect {}
6873);
6874
6875extern_conformance!(
6876    unsafe impl NSSecureCoding for NEOnDemandRuleConnect {}
6877);
6878
6879impl NEOnDemandRuleConnect {
6880    extern_methods!();
6881}
6882
6883/// Methods declared on superclass `NSObject`.
6884impl NEOnDemandRuleConnect {
6885    extern_methods!(
6886        #[unsafe(method(init))]
6887        #[unsafe(method_family = init)]
6888        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6889
6890        #[unsafe(method(new))]
6891        #[unsafe(method_family = new)]
6892        pub unsafe fn new() -> Retained<Self>;
6893    );
6894}
6895
6896extern_class!(
6897    /// The NEOnDemandRuleDisconnect class declares the programmatic interface for an object that defines an On Demand rule with the "Disconnect" action.
6898    ///
6899    /// When rules of this class match, the VPN connection is not started, and the VPN connection is disconnected if it is not currently disconnected.
6900    ///
6901    /// Instances of this class are thread safe.
6902    ///
6903    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neondemandruledisconnect?language=objc)
6904    #[unsafe(super(NEOnDemandRule, NSObject))]
6905    #[derive(Debug, PartialEq, Eq, Hash)]
6906    pub struct NEOnDemandRuleDisconnect;
6907);
6908
6909extern_conformance!(
6910    unsafe impl NSCoding for NEOnDemandRuleDisconnect {}
6911);
6912
6913extern_conformance!(
6914    unsafe impl NSCopying for NEOnDemandRuleDisconnect {}
6915);
6916
6917unsafe impl CopyingHelper for NEOnDemandRuleDisconnect {
6918    type Result = Self;
6919}
6920
6921extern_conformance!(
6922    unsafe impl NSObjectProtocol for NEOnDemandRuleDisconnect {}
6923);
6924
6925extern_conformance!(
6926    unsafe impl NSSecureCoding for NEOnDemandRuleDisconnect {}
6927);
6928
6929impl NEOnDemandRuleDisconnect {
6930    extern_methods!();
6931}
6932
6933/// Methods declared on superclass `NSObject`.
6934impl NEOnDemandRuleDisconnect {
6935    extern_methods!(
6936        #[unsafe(method(init))]
6937        #[unsafe(method_family = init)]
6938        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6939
6940        #[unsafe(method(new))]
6941        #[unsafe(method_family = new)]
6942        pub unsafe fn new() -> Retained<Self>;
6943    );
6944}
6945
6946extern_class!(
6947    /// The NEOnDemandRuleIgnore class declares the programmatic interface for an object that defines an On Demand rule with the "Ignore" action.
6948    ///
6949    /// When rules of this class match, the VPN connection is not started, and the current status of the VPN connection is left unchanged.
6950    ///
6951    /// Instances of this class are thread safe.
6952    ///
6953    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neondemandruleignore?language=objc)
6954    #[unsafe(super(NEOnDemandRule, NSObject))]
6955    #[derive(Debug, PartialEq, Eq, Hash)]
6956    pub struct NEOnDemandRuleIgnore;
6957);
6958
6959extern_conformance!(
6960    unsafe impl NSCoding for NEOnDemandRuleIgnore {}
6961);
6962
6963extern_conformance!(
6964    unsafe impl NSCopying for NEOnDemandRuleIgnore {}
6965);
6966
6967unsafe impl CopyingHelper for NEOnDemandRuleIgnore {
6968    type Result = Self;
6969}
6970
6971extern_conformance!(
6972    unsafe impl NSObjectProtocol for NEOnDemandRuleIgnore {}
6973);
6974
6975extern_conformance!(
6976    unsafe impl NSSecureCoding for NEOnDemandRuleIgnore {}
6977);
6978
6979impl NEOnDemandRuleIgnore {
6980    extern_methods!();
6981}
6982
6983/// Methods declared on superclass `NSObject`.
6984impl NEOnDemandRuleIgnore {
6985    extern_methods!(
6986        #[unsafe(method(init))]
6987        #[unsafe(method_family = init)]
6988        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6989
6990        #[unsafe(method(new))]
6991        #[unsafe(method_family = new)]
6992        pub unsafe fn new() -> Retained<Self>;
6993    );
6994}
6995
6996extern_class!(
6997    /// The NEOnDemandRuleEvaluateConnection class declares the programmatic interface for an object that defines an On Demand rule with the "Evaluate Connection" action.
6998    ///
6999    /// When rules of this class match, the properties of the network connection being established are matched against a set of connection rules. The action of the matched rule (if any) is used to determine whether or not the VPN will be started.
7000    ///
7001    /// Instances of this class are thread safe.
7002    ///
7003    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neondemandruleevaluateconnection?language=objc)
7004    #[unsafe(super(NEOnDemandRule, NSObject))]
7005    #[derive(Debug, PartialEq, Eq, Hash)]
7006    pub struct NEOnDemandRuleEvaluateConnection;
7007);
7008
7009extern_conformance!(
7010    unsafe impl NSCoding for NEOnDemandRuleEvaluateConnection {}
7011);
7012
7013extern_conformance!(
7014    unsafe impl NSCopying for NEOnDemandRuleEvaluateConnection {}
7015);
7016
7017unsafe impl CopyingHelper for NEOnDemandRuleEvaluateConnection {
7018    type Result = Self;
7019}
7020
7021extern_conformance!(
7022    unsafe impl NSObjectProtocol for NEOnDemandRuleEvaluateConnection {}
7023);
7024
7025extern_conformance!(
7026    unsafe impl NSSecureCoding for NEOnDemandRuleEvaluateConnection {}
7027);
7028
7029impl NEOnDemandRuleEvaluateConnection {
7030    extern_methods!(
7031        /// An array of NEEvaluateConnectionRule objects. Each NEEvaluateConnectionRule object is evaluated in order against the properties of the network connection being established.
7032        #[unsafe(method(connectionRules))]
7033        #[unsafe(method_family = none)]
7034        pub unsafe fn connectionRules(&self)
7035            -> Option<Retained<NSArray<NEEvaluateConnectionRule>>>;
7036
7037        /// Setter for [`connectionRules`][Self::connectionRules].
7038        #[unsafe(method(setConnectionRules:))]
7039        #[unsafe(method_family = none)]
7040        pub unsafe fn setConnectionRules(
7041            &self,
7042            connection_rules: Option<&NSArray<NEEvaluateConnectionRule>>,
7043        );
7044    );
7045}
7046
7047/// Methods declared on superclass `NSObject`.
7048impl NEOnDemandRuleEvaluateConnection {
7049    extern_methods!(
7050        #[unsafe(method(init))]
7051        #[unsafe(method_family = init)]
7052        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7053
7054        #[unsafe(method(new))]
7055        #[unsafe(method_family = new)]
7056        pub unsafe fn new() -> Retained<Self>;
7057    );
7058}
7059
7060/// Evaluate Connection rule actions
7061///
7062/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neevaluateconnectionruleaction?language=objc)
7063// NS_ENUM
7064#[repr(transparent)]
7065#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
7066pub struct NEEvaluateConnectionRuleAction(pub NSInteger);
7067impl NEEvaluateConnectionRuleAction {
7068    #[doc(alias = "NEEvaluateConnectionRuleActionConnectIfNeeded")]
7069    pub const ConnectIfNeeded: Self = Self(1);
7070    #[doc(alias = "NEEvaluateConnectionRuleActionNeverConnect")]
7071    pub const NeverConnect: Self = Self(2);
7072}
7073
7074unsafe impl Encode for NEEvaluateConnectionRuleAction {
7075    const ENCODING: Encoding = NSInteger::ENCODING;
7076}
7077
7078unsafe impl RefEncode for NEEvaluateConnectionRuleAction {
7079    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
7080}
7081
7082extern_class!(
7083    /// The NEEvaluateConnectionRule class declares the programmatic interface for an object that associates properties of network connections with an action.
7084    ///
7085    /// Instances of this class are thread safe.
7086    ///
7087    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neevaluateconnectionrule?language=objc)
7088    #[unsafe(super(NSObject))]
7089    #[derive(Debug, PartialEq, Eq, Hash)]
7090    pub struct NEEvaluateConnectionRule;
7091);
7092
7093extern_conformance!(
7094    unsafe impl NSCoding for NEEvaluateConnectionRule {}
7095);
7096
7097extern_conformance!(
7098    unsafe impl NSCopying for NEEvaluateConnectionRule {}
7099);
7100
7101unsafe impl CopyingHelper for NEEvaluateConnectionRule {
7102    type Result = Self;
7103}
7104
7105extern_conformance!(
7106    unsafe impl NSObjectProtocol for NEEvaluateConnectionRule {}
7107);
7108
7109extern_conformance!(
7110    unsafe impl NSSecureCoding for NEEvaluateConnectionRule {}
7111);
7112
7113impl NEEvaluateConnectionRule {
7114    extern_methods!(
7115        /// Initialize an NEEvaluateConnectionRule instance with a list of destination host domains and an action
7116        #[unsafe(method(initWithMatchDomains:andAction:))]
7117        #[unsafe(method_family = init)]
7118        pub unsafe fn initWithMatchDomains_andAction(
7119            this: Allocated<Self>,
7120            domains: &NSArray<NSString>,
7121            action: NEEvaluateConnectionRuleAction,
7122        ) -> Retained<Self>;
7123
7124        /// The action to take if the properties of the network connection being established match the rule.
7125        #[unsafe(method(action))]
7126        #[unsafe(method_family = none)]
7127        pub unsafe fn action(&self) -> NEEvaluateConnectionRuleAction;
7128
7129        /// An array of NSString objects. If the host name of the destination of the network connection being established shares a suffix with one of the strings in this array, then the rule matches.
7130        #[unsafe(method(matchDomains))]
7131        #[unsafe(method_family = none)]
7132        pub unsafe fn matchDomains(&self) -> Retained<NSArray<NSString>>;
7133
7134        /// An array of NSString objects. If the rule matches the connection being established and the action is NEEvaluateConnectionRuleActionConnectIfNeeded, the DNS servers specified in this array are used to resolve the host name of the destination while evaluating connectivity to the destination. If the resolution fails for any reason, the VPN is started.
7135        #[unsafe(method(useDNSServers))]
7136        #[unsafe(method_family = none)]
7137        pub unsafe fn useDNSServers(&self) -> Option<Retained<NSArray<NSString>>>;
7138
7139        /// Setter for [`useDNSServers`][Self::useDNSServers].
7140        #[unsafe(method(setUseDNSServers:))]
7141        #[unsafe(method_family = none)]
7142        pub unsafe fn setUseDNSServers(&self, use_dns_servers: Option<&NSArray<NSString>>);
7143
7144        /// An HTTP or HTTPS URL. If the rule matches the connection being established and the action is NEEvaluateConnectionRuleActionConnectIfNeeded and a request sent to this URL results in a response with an HTTP response code other than 200, then the VPN is started.
7145        #[unsafe(method(probeURL))]
7146        #[unsafe(method_family = none)]
7147        pub unsafe fn probeURL(&self) -> Option<Retained<NSURL>>;
7148
7149        /// Setter for [`probeURL`][Self::probeURL].
7150        #[unsafe(method(setProbeURL:))]
7151        #[unsafe(method_family = none)]
7152        pub unsafe fn setProbeURL(&self, probe_url: Option<&NSURL>);
7153    );
7154}
7155
7156/// Methods declared on superclass `NSObject`.
7157impl NEEvaluateConnectionRule {
7158    extern_methods!(
7159        #[unsafe(method(init))]
7160        #[unsafe(method_family = init)]
7161        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7162
7163        #[unsafe(method(new))]
7164        #[unsafe(method_family = new)]
7165        pub unsafe fn new() -> Retained<Self>;
7166    );
7167}
7168
7169extern_class!(
7170    /// An NEPacket object represents the data, protocol family, and metadata associated with an IP packet.
7171    /// These packets are used to read and write on an NEPacketTunnelFlow.
7172    ///
7173    /// NEPacket is part of NetworkExtension.framework
7174    ///
7175    /// Instances of this class are thread safe.
7176    ///
7177    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nepacket?language=objc)
7178    #[unsafe(super(NSObject))]
7179    #[derive(Debug, PartialEq, Eq, Hash)]
7180    pub struct NEPacket;
7181);
7182
7183extern_conformance!(
7184    unsafe impl NSCoding for NEPacket {}
7185);
7186
7187extern_conformance!(
7188    unsafe impl NSCopying for NEPacket {}
7189);
7190
7191unsafe impl CopyingHelper for NEPacket {
7192    type Result = Self;
7193}
7194
7195extern_conformance!(
7196    unsafe impl NSObjectProtocol for NEPacket {}
7197);
7198
7199extern_conformance!(
7200    unsafe impl NSSecureCoding for NEPacket {}
7201);
7202
7203impl NEPacket {
7204    extern_methods!(
7205        #[cfg(feature = "libc")]
7206        /// Initializes a new NEPacket object with data and protocol family.
7207        ///
7208        /// Parameter `data`: The content of the packet.
7209        ///
7210        /// Parameter `protocolFamily`: The protocol family of the packet (such as AF_INET or AF_INET6).
7211        #[unsafe(method(initWithData:protocolFamily:))]
7212        #[unsafe(method_family = init)]
7213        pub unsafe fn initWithData_protocolFamily(
7214            this: Allocated<Self>,
7215            data: &NSData,
7216            protocol_family: libc::sa_family_t,
7217        ) -> Retained<Self>;
7218
7219        /// The data content of the packet.
7220        #[unsafe(method(data))]
7221        #[unsafe(method_family = none)]
7222        pub unsafe fn data(&self) -> Retained<NSData>;
7223
7224        #[cfg(feature = "libc")]
7225        /// The protocol family of the packet (such as AF_INET or AF_INET6).
7226        #[unsafe(method(protocolFamily))]
7227        #[unsafe(method_family = none)]
7228        pub unsafe fn protocolFamily(&self) -> libc::sa_family_t;
7229
7230        /// The direction of the packet.
7231        #[unsafe(method(direction))]
7232        #[unsafe(method_family = none)]
7233        pub unsafe fn direction(&self) -> NETrafficDirection;
7234
7235        /// Metadata about the source application and flow for this packet.
7236        /// This property will only be non-nil when the routing method for the NEPacketTunnelProvider
7237        /// is NETunnelProviderRoutingMethodSourceApplication.
7238        #[unsafe(method(metadata))]
7239        #[unsafe(method_family = none)]
7240        pub unsafe fn metadata(&self) -> Option<Retained<NEFlowMetaData>>;
7241    );
7242}
7243
7244/// Methods declared on superclass `NSObject`.
7245impl NEPacket {
7246    extern_methods!(
7247        #[unsafe(method(init))]
7248        #[unsafe(method_family = init)]
7249        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7250
7251        #[unsafe(method(new))]
7252        #[unsafe(method_family = new)]
7253        pub unsafe fn new() -> Retained<Self>;
7254    );
7255}
7256
7257extern_class!(
7258    /// The NEPacketTunnelFlow class declares the programmatic interface of an object that is used by NEPacketTunnelProvider implementations to tunnel IP packets.
7259    ///
7260    /// NEPacketTunnelFlow is part of NetworkExtension.framework
7261    ///
7262    /// Instances of this class are thread safe.
7263    ///
7264    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nepackettunnelflow?language=objc)
7265    #[unsafe(super(NSObject))]
7266    #[derive(Debug, PartialEq, Eq, Hash)]
7267    pub struct NEPacketTunnelFlow;
7268);
7269
7270extern_conformance!(
7271    unsafe impl NSObjectProtocol for NEPacketTunnelFlow {}
7272);
7273
7274impl NEPacketTunnelFlow {
7275    extern_methods!(
7276        #[cfg(feature = "block2")]
7277        /// Read available IP packets from the flow.
7278        ///
7279        /// Parameter `completionHandler`: A block that will be executed to handle the packets. This block takes an array of NSData objects and an array of NSNumber objects. The NSData and NSNumber in corresponding indicies in the array represent one packet. If after handling the packets the caller wants to read more packets then the caller must call this method again.
7280        #[unsafe(method(readPacketsWithCompletionHandler:))]
7281        #[unsafe(method_family = none)]
7282        pub unsafe fn readPacketsWithCompletionHandler(
7283            &self,
7284            completion_handler: &block2::DynBlock<
7285                dyn Fn(NonNull<NSArray<NSData>>, NonNull<NSArray<NSNumber>>),
7286            >,
7287        );
7288
7289        /// Write multiple IP packets to the flow.
7290        ///
7291        /// Parameter `packets`: An array of NSData objects, each containing packet data to be written.
7292        ///
7293        /// Parameter `protocols`: An array of NSNumber objects. Each number contains the protocol of the packet in the corresponding index in the packets array.
7294        #[unsafe(method(writePackets:withProtocols:))]
7295        #[unsafe(method_family = none)]
7296        pub unsafe fn writePackets_withProtocols(
7297            &self,
7298            packets: &NSArray<NSData>,
7299            protocols: &NSArray<NSNumber>,
7300        ) -> bool;
7301
7302        #[cfg(feature = "block2")]
7303        /// Read available IP packets from the flow.
7304        ///
7305        /// Parameter `completionHandler`: A block that will be executed to handle the packets. This block takes an array of NEPacket objects. If after handling the packets the caller wants to read more packets then the caller must call this method again.
7306        #[unsafe(method(readPacketObjectsWithCompletionHandler:))]
7307        #[unsafe(method_family = none)]
7308        pub unsafe fn readPacketObjectsWithCompletionHandler(
7309            &self,
7310            completion_handler: &block2::DynBlock<dyn Fn(NonNull<NSArray<NEPacket>>)>,
7311        );
7312
7313        /// Write multiple IP packets to the flow.
7314        ///
7315        /// Parameter `packets`: An array of NEPacket objects, each containing packet data and protocol family to be written.
7316        #[unsafe(method(writePacketObjects:))]
7317        #[unsafe(method_family = none)]
7318        pub unsafe fn writePacketObjects(&self, packets: &NSArray<NEPacket>) -> bool;
7319    );
7320}
7321
7322/// Methods declared on superclass `NSObject`.
7323impl NEPacketTunnelFlow {
7324    extern_methods!(
7325        #[unsafe(method(init))]
7326        #[unsafe(method_family = init)]
7327        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7328
7329        #[unsafe(method(new))]
7330        #[unsafe(method_family = new)]
7331        pub unsafe fn new() -> Retained<Self>;
7332    );
7333}
7334
7335extern_class!(
7336    /// The NERelay class declares the programmatic interface of an object that
7337    /// manages the details of a relay's configuration, such as authentication and URL details.
7338    ///
7339    /// Instances of this class are thread safe.
7340    ///
7341    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nerelay?language=objc)
7342    #[unsafe(super(NSObject))]
7343    #[derive(Debug, PartialEq, Eq, Hash)]
7344    pub struct NERelay;
7345);
7346
7347extern_conformance!(
7348    unsafe impl NSCoding for NERelay {}
7349);
7350
7351extern_conformance!(
7352    unsafe impl NSCopying for NERelay {}
7353);
7354
7355unsafe impl CopyingHelper for NERelay {
7356    type Result = Self;
7357}
7358
7359extern_conformance!(
7360    unsafe impl NSObjectProtocol for NERelay {}
7361);
7362
7363extern_conformance!(
7364    unsafe impl NSSecureCoding for NERelay {}
7365);
7366
7367impl NERelay {
7368    extern_methods!(
7369        /// The URL of the relay accessible over HTTP/3.
7370        #[unsafe(method(HTTP3RelayURL))]
7371        #[unsafe(method_family = none)]
7372        pub unsafe fn HTTP3RelayURL(&self) -> Option<Retained<NSURL>>;
7373
7374        /// Setter for [`HTTP3RelayURL`][Self::HTTP3RelayURL].
7375        #[unsafe(method(setHTTP3RelayURL:))]
7376        #[unsafe(method_family = none)]
7377        pub unsafe fn setHTTP3RelayURL(&self, http3_relay_url: Option<&NSURL>);
7378
7379        /// The URL of the relay accessible over HTTP/2.
7380        #[unsafe(method(HTTP2RelayURL))]
7381        #[unsafe(method_family = none)]
7382        pub unsafe fn HTTP2RelayURL(&self) -> Option<Retained<NSURL>>;
7383
7384        /// Setter for [`HTTP2RelayURL`][Self::HTTP2RelayURL].
7385        #[unsafe(method(setHTTP2RelayURL:))]
7386        #[unsafe(method_family = none)]
7387        pub unsafe fn setHTTP2RelayURL(&self, http2_relay_url: Option<&NSURL>);
7388
7389        /// The URL of a DNS-over-HTTPS (DoH) resolver accessible via the relay.
7390        #[unsafe(method(dnsOverHTTPSURL))]
7391        #[unsafe(method_family = none)]
7392        pub unsafe fn dnsOverHTTPSURL(&self) -> Option<Retained<NSURL>>;
7393
7394        /// Setter for [`dnsOverHTTPSURL`][Self::dnsOverHTTPSURL].
7395        #[unsafe(method(setDnsOverHTTPSURL:))]
7396        #[unsafe(method_family = none)]
7397        pub unsafe fn setDnsOverHTTPSURL(&self, dns_over_httpsurl: Option<&NSURL>);
7398
7399        /// An IPv4 address prefix (such as "192.0.2.0/24") that will be used to synthesize
7400        /// DNS answers for apps that use `getaddrinfo()` to resolve domains included in `matchDomains`
7401        #[unsafe(method(syntheticDNSAnswerIPv4Prefix))]
7402        #[unsafe(method_family = none)]
7403        pub unsafe fn syntheticDNSAnswerIPv4Prefix(&self) -> Option<Retained<NSString>>;
7404
7405        /// Setter for [`syntheticDNSAnswerIPv4Prefix`][Self::syntheticDNSAnswerIPv4Prefix].
7406        #[unsafe(method(setSyntheticDNSAnswerIPv4Prefix:))]
7407        #[unsafe(method_family = none)]
7408        pub unsafe fn setSyntheticDNSAnswerIPv4Prefix(
7409            &self,
7410            synthetic_dns_answer_i_pv4_prefix: Option<&NSString>,
7411        );
7412
7413        /// An IPv6 address prefix (such as "2001:DB8::/32") that will be used to synthesize
7414        /// DNS answers for apps that use `getaddrinfo()` to resolve domains included in `matchDomains`
7415        #[unsafe(method(syntheticDNSAnswerIPv6Prefix))]
7416        #[unsafe(method_family = none)]
7417        pub unsafe fn syntheticDNSAnswerIPv6Prefix(&self) -> Option<Retained<NSString>>;
7418
7419        /// Setter for [`syntheticDNSAnswerIPv6Prefix`][Self::syntheticDNSAnswerIPv6Prefix].
7420        #[unsafe(method(setSyntheticDNSAnswerIPv6Prefix:))]
7421        #[unsafe(method_family = none)]
7422        pub unsafe fn setSyntheticDNSAnswerIPv6Prefix(
7423            &self,
7424            synthetic_dns_answer_i_pv6_prefix: Option<&NSString>,
7425        );
7426
7427        /// Additional HTTP header field names and values to be added to all relay requests.
7428        #[unsafe(method(additionalHTTPHeaderFields))]
7429        #[unsafe(method_family = none)]
7430        pub unsafe fn additionalHTTPHeaderFields(
7431            &self,
7432        ) -> Retained<NSDictionary<NSString, NSString>>;
7433
7434        /// Setter for [`additionalHTTPHeaderFields`][Self::additionalHTTPHeaderFields].
7435        #[unsafe(method(setAdditionalHTTPHeaderFields:))]
7436        #[unsafe(method_family = none)]
7437        pub unsafe fn setAdditionalHTTPHeaderFields(
7438            &self,
7439            additional_http_header_fields: &NSDictionary<NSString, NSString>,
7440        );
7441
7442        /// TLS 1.3 raw public keys to use to authenticate the relay servers.
7443        #[unsafe(method(rawPublicKeys))]
7444        #[unsafe(method_family = none)]
7445        pub unsafe fn rawPublicKeys(&self) -> Option<Retained<NSArray<NSData>>>;
7446
7447        /// Setter for [`rawPublicKeys`][Self::rawPublicKeys].
7448        #[unsafe(method(setRawPublicKeys:))]
7449        #[unsafe(method_family = none)]
7450        pub unsafe fn setRawPublicKeys(&self, raw_public_keys: Option<&NSArray<NSData>>);
7451
7452        /// The PKCS12 data for the relay client authentication. The value is a NSData in PKCS12 format.
7453        #[unsafe(method(identityData))]
7454        #[unsafe(method_family = none)]
7455        pub unsafe fn identityData(&self) -> Option<Retained<NSData>>;
7456
7457        /// Setter for [`identityData`][Self::identityData].
7458        #[unsafe(method(setIdentityData:))]
7459        #[unsafe(method_family = none)]
7460        pub unsafe fn setIdentityData(&self, identity_data: Option<&NSData>);
7461
7462        /// The password to be used to decrypt the PKCS12 identity data.
7463        #[unsafe(method(identityDataPassword))]
7464        #[unsafe(method_family = none)]
7465        pub unsafe fn identityDataPassword(&self) -> Option<Retained<NSString>>;
7466
7467        /// Setter for [`identityDataPassword`][Self::identityDataPassword].
7468        #[unsafe(method(setIdentityDataPassword:))]
7469        #[unsafe(method_family = none)]
7470        pub unsafe fn setIdentityDataPassword(&self, identity_data_password: Option<&NSString>);
7471    );
7472}
7473
7474/// Methods declared on superclass `NSObject`.
7475impl NERelay {
7476    extern_methods!(
7477        #[unsafe(method(init))]
7478        #[unsafe(method_family = init)]
7479        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7480
7481        #[unsafe(method(new))]
7482        #[unsafe(method_family = new)]
7483        pub unsafe fn new() -> Retained<Self>;
7484    );
7485}
7486
7487/// NERelay Manager error codes
7488///
7489/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nerelaymanagererror?language=objc)
7490// NS_ENUM
7491#[repr(transparent)]
7492#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
7493pub struct NERelayManagerError(pub NSInteger);
7494impl NERelayManagerError {
7495    #[doc(alias = "NERelayManagerErrorConfigurationInvalid")]
7496    pub const ConfigurationInvalid: Self = Self(1);
7497    #[doc(alias = "NERelayManagerErrorConfigurationDisabled")]
7498    pub const ConfigurationDisabled: Self = Self(2);
7499    #[doc(alias = "NERelayManagerErrorConfigurationStale")]
7500    pub const ConfigurationStale: Self = Self(3);
7501    #[doc(alias = "NERelayManagerErrorConfigurationCannotBeRemoved")]
7502    pub const ConfigurationCannotBeRemoved: Self = Self(4);
7503}
7504
7505unsafe impl Encode for NERelayManagerError {
7506    const ENCODING: Encoding = NSInteger::ENCODING;
7507}
7508
7509unsafe impl RefEncode for NERelayManagerError {
7510    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
7511}
7512
7513extern "C" {
7514    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nerelayerrordomain?language=objc)
7515    pub static NERelayErrorDomain: &'static NSString;
7516}
7517
7518/// NERelay Manager error codes detected by the client while trying to use this relay
7519///
7520/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nerelaymanagerclienterror?language=objc)
7521// NS_ENUM
7522#[repr(transparent)]
7523#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
7524pub struct NERelayManagerClientError(pub NSInteger);
7525impl NERelayManagerClientError {
7526    #[doc(alias = "NERelayManagerClientErrorNone")]
7527    pub const None: Self = Self(1);
7528    #[doc(alias = "NERelayManagerClientErrorDNSFailed")]
7529    pub const DNSFailed: Self = Self(2);
7530    #[doc(alias = "NERelayManagerClientErrorServerUnreachable")]
7531    pub const ServerUnreachable: Self = Self(3);
7532    #[doc(alias = "NERelayManagerClientErrorServerDisconnected")]
7533    pub const ServerDisconnected: Self = Self(4);
7534    #[doc(alias = "NERelayManagerClientErrorCertificateMissing")]
7535    pub const CertificateMissing: Self = Self(5);
7536    #[doc(alias = "NERelayManagerClientErrorCertificateInvalid")]
7537    pub const CertificateInvalid: Self = Self(6);
7538    #[doc(alias = "NERelayManagerClientErrorCertificateExpired")]
7539    pub const CertificateExpired: Self = Self(7);
7540    #[doc(alias = "NERelayManagerClientErrorServerCertificateInvalid")]
7541    pub const ServerCertificateInvalid: Self = Self(8);
7542    #[doc(alias = "NERelayManagerClientErrorServerCertificateExpired")]
7543    pub const ServerCertificateExpired: Self = Self(9);
7544    #[doc(alias = "NERelayManagerClientErrorOther")]
7545    pub const Other: Self = Self(10);
7546}
7547
7548unsafe impl Encode for NERelayManagerClientError {
7549    const ENCODING: Encoding = NSInteger::ENCODING;
7550}
7551
7552unsafe impl RefEncode for NERelayManagerClientError {
7553    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
7554}
7555
7556extern "C" {
7557    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nerelayclienterrordomain?language=objc)
7558    pub static NERelayClientErrorDomain: &'static NSString;
7559}
7560
7561extern "C" {
7562    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nerelayconfigurationdidchangenotification?language=objc)
7563    pub static NERelayConfigurationDidChangeNotification: &'static NSString;
7564}
7565
7566extern_class!(
7567    /// The NERelayManager class declares the programmatic interface for an object that manages relay configurations.
7568    ///
7569    /// NERelayManager declares methods and properties for configuring and controlling relay settings on the system.
7570    ///
7571    /// Instances of this class are thread safe.
7572    ///
7573    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nerelaymanager?language=objc)
7574    #[unsafe(super(NSObject))]
7575    #[derive(Debug, PartialEq, Eq, Hash)]
7576    pub struct NERelayManager;
7577);
7578
7579extern_conformance!(
7580    unsafe impl NSObjectProtocol for NERelayManager {}
7581);
7582
7583impl NERelayManager {
7584    extern_methods!(
7585        /// Returns: The singleton NERelayManager object for the calling process.
7586        #[unsafe(method(sharedManager))]
7587        #[unsafe(method_family = none)]
7588        pub unsafe fn sharedManager() -> Retained<NERelayManager>;
7589
7590        #[cfg(feature = "block2")]
7591        /// This function loads the current relay configuration from the caller's relay preferences.
7592        ///
7593        /// Parameter `completionHandler`: A block that will be called when the load operation is completed. The NSError passed to this block will be nil if the load operation succeeded, non-nil otherwise.
7594        #[unsafe(method(loadFromPreferencesWithCompletionHandler:))]
7595        #[unsafe(method_family = none)]
7596        pub unsafe fn loadFromPreferencesWithCompletionHandler(
7597            &self,
7598            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
7599        );
7600
7601        #[cfg(feature = "block2")]
7602        /// This function removes the relay configuration from the caller's relay preferences. If the relay is enabled, the relay becomes disabled.
7603        ///
7604        /// Parameter `completionHandler`: A block that will be called when the remove operation is completed. The NSError passed to this block will be nil if the remove operation succeeded, non-nil otherwise.
7605        #[unsafe(method(removeFromPreferencesWithCompletionHandler:))]
7606        #[unsafe(method_family = none)]
7607        pub unsafe fn removeFromPreferencesWithCompletionHandler(
7608            &self,
7609            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
7610        );
7611
7612        #[cfg(feature = "block2")]
7613        /// This function saves the relay configuration in the caller's relay preferences. If the relay are enabled, they will become active.
7614        ///
7615        /// Parameter `completionHandler`: A block that will be called when the save operation is completed. The NSError passed to this block will be nil if the save operation succeeded, non-nil otherwise.
7616        #[unsafe(method(saveToPreferencesWithCompletionHandler:))]
7617        #[unsafe(method_family = none)]
7618        pub unsafe fn saveToPreferencesWithCompletionHandler(
7619            &self,
7620            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
7621        );
7622
7623        #[cfg(feature = "block2")]
7624        /// This function will get errors that the client detected while using this relay configuration within the specified time period.  Errors will be from the NERelayClientErrorDomain and the NERelayManagerClientErrorNone value will be set for successful connections.
7625        ///
7626        /// Parameter `seconds`: A NSTimeInterval that specifies how many seconds to report errors for.  The maximum supported value is 24 hours and any larger values will be automatically reduced to 24 hours.
7627        ///
7628        /// Parameter `completionHandler`: A block that will be called when once the errors have been collected. The NSArray will contain a list of NERelayManagerClientError values detected within the last number of seconds as specified by the "seconds" parameter.  The values will be ordered from the error most recently detected to the oldest.  The error value of NERelayManagerClientErrorNone indicates the last successful use of the relay without error.  The NSArray will be empty if there are no values detected within the specified time period or nil if there was a problem in retrieving the errors.
7629        #[unsafe(method(getLastClientErrors:completionHandler:))]
7630        #[unsafe(method_family = none)]
7631        pub unsafe fn getLastClientErrors_completionHandler(
7632            &self,
7633            seconds: NSTimeInterval,
7634            completion_handler: &block2::DynBlock<dyn Fn(*mut NSArray<NSError>)>,
7635        );
7636
7637        /// A string containing a description of the relay.
7638        #[unsafe(method(localizedDescription))]
7639        #[unsafe(method_family = none)]
7640        pub unsafe fn localizedDescription(&self) -> Option<Retained<NSString>>;
7641
7642        /// Setter for [`localizedDescription`][Self::localizedDescription].
7643        #[unsafe(method(setLocalizedDescription:))]
7644        #[unsafe(method_family = none)]
7645        pub unsafe fn setLocalizedDescription(&self, localized_description: Option<&NSString>);
7646
7647        /// Toggles the enabled status of the relay.
7648        #[unsafe(method(isEnabled))]
7649        #[unsafe(method_family = none)]
7650        pub unsafe fn isEnabled(&self) -> bool;
7651
7652        /// Setter for [`isEnabled`][Self::isEnabled].
7653        #[unsafe(method(setEnabled:))]
7654        #[unsafe(method_family = none)]
7655        pub unsafe fn setEnabled(&self, enabled: bool);
7656
7657        /// Determines if the user will have the ability to enable and disable the relay
7658        #[unsafe(method(isUIToggleEnabled))]
7659        #[unsafe(method_family = none)]
7660        pub unsafe fn isUIToggleEnabled(&self) -> bool;
7661
7662        /// Setter for [`isUIToggleEnabled`][Self::isUIToggleEnabled].
7663        #[unsafe(method(setUIToggleEnabled:))]
7664        #[unsafe(method_family = none)]
7665        pub unsafe fn setUIToggleEnabled(&self, ui_toggle_enabled: bool);
7666
7667        /// An array of relay configurations describing one or more relay hops.
7668        #[unsafe(method(relays))]
7669        #[unsafe(method_family = none)]
7670        pub unsafe fn relays(&self) -> Option<Retained<NSArray<NERelay>>>;
7671
7672        /// Setter for [`relays`][Self::relays].
7673        #[unsafe(method(setRelays:))]
7674        #[unsafe(method_family = none)]
7675        pub unsafe fn setRelays(&self, relays: Option<&NSArray<NERelay>>);
7676
7677        /// An array of strings containing domain names. If this property is non-nil, the relay will be used to access hosts within the specified domains. If this and the match FQDNs property is nil, the relay will be used for all domains.
7678        #[unsafe(method(matchDomains))]
7679        #[unsafe(method_family = none)]
7680        pub unsafe fn matchDomains(&self) -> Option<Retained<NSArray<NSString>>>;
7681
7682        /// Setter for [`matchDomains`][Self::matchDomains].
7683        #[unsafe(method(setMatchDomains:))]
7684        #[unsafe(method_family = none)]
7685        pub unsafe fn setMatchDomains(&self, match_domains: Option<&NSArray<NSString>>);
7686
7687        /// An array of strings containing Fully Qualified Domain Names (FQDNs). If this property is non-nil, the relay will be used to access the specified hosts.  If this and the matchDomains property is nil, the relay will be used for all domains.
7688        #[unsafe(method(matchFQDNs))]
7689        #[unsafe(method_family = none)]
7690        pub unsafe fn matchFQDNs(&self) -> Option<Retained<NSArray<NSString>>>;
7691
7692        /// Setter for [`matchFQDNs`][Self::matchFQDNs].
7693        #[unsafe(method(setMatchFQDNs:))]
7694        #[unsafe(method_family = none)]
7695        pub unsafe fn setMatchFQDNs(&self, match_fqd_ns: Option<&NSArray<NSString>>);
7696
7697        /// An array of strings containing domain names. If the destination host name of a connection shares a suffix with one of these strings then the relay will not be used.
7698        #[unsafe(method(excludedDomains))]
7699        #[unsafe(method_family = none)]
7700        pub unsafe fn excludedDomains(&self) -> Option<Retained<NSArray<NSString>>>;
7701
7702        /// Setter for [`excludedDomains`][Self::excludedDomains].
7703        #[unsafe(method(setExcludedDomains:))]
7704        #[unsafe(method_family = none)]
7705        pub unsafe fn setExcludedDomains(&self, excluded_domains: Option<&NSArray<NSString>>);
7706
7707        /// An array of strings containing Fully Qualified Domain Names (FQDNs). If the destination host matches one of these strings then the relay will not be used.  An excluded FQDN takes priority over the matchDomain property.  This means the relay will not be used if the hostname matches an FQDN in this array even if the matchDomains contains a domain that would have been considered a match.
7708        #[unsafe(method(excludedFQDNs))]
7709        #[unsafe(method_family = none)]
7710        pub unsafe fn excludedFQDNs(&self) -> Option<Retained<NSArray<NSString>>>;
7711
7712        /// Setter for [`excludedFQDNs`][Self::excludedFQDNs].
7713        #[unsafe(method(setExcludedFQDNs:))]
7714        #[unsafe(method_family = none)]
7715        pub unsafe fn setExcludedFQDNs(&self, excluded_fqd_ns: Option<&NSArray<NSString>>);
7716
7717        /// An array of NEOnDemandRule objects. If nil, the associated relay will always apply. If non-nil, the array describes the networks on which the relay should be used or not.
7718        #[unsafe(method(onDemandRules))]
7719        #[unsafe(method_family = none)]
7720        pub unsafe fn onDemandRules(&self) -> Option<Retained<NSArray<NEOnDemandRule>>>;
7721
7722        /// Setter for [`onDemandRules`][Self::onDemandRules].
7723        #[unsafe(method(setOnDemandRules:))]
7724        #[unsafe(method_family = none)]
7725        pub unsafe fn setOnDemandRules(&self, on_demand_rules: Option<&NSArray<NEOnDemandRule>>);
7726
7727        #[cfg(feature = "block2")]
7728        /// This function asynchronously reads all of the NERelay configurations created by the calling app that have previously been saved to disk and returns them as NERelayManager objects.
7729        ///
7730        /// Parameter `completionHandler`: A block that takes an array NERelayManager objects. The array passed to the block may be empty if no NERelay configurations were successfully read from the disk.  The NSError passed to this block will be nil if the load operation succeeded, non-nil otherwise.
7731        #[unsafe(method(loadAllManagersFromPreferencesWithCompletionHandler:))]
7732        #[unsafe(method_family = none)]
7733        pub unsafe fn loadAllManagersFromPreferencesWithCompletionHandler(
7734            completion_handler: &block2::DynBlock<
7735                dyn Fn(NonNull<NSArray<NERelayManager>>, *mut NSError),
7736            >,
7737        );
7738    );
7739}
7740
7741/// Methods declared on superclass `NSObject`.
7742impl NERelayManager {
7743    extern_methods!(
7744        #[unsafe(method(init))]
7745        #[unsafe(method_family = init)]
7746        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7747
7748        #[unsafe(method(new))]
7749        #[unsafe(method_family = new)]
7750        pub unsafe fn new() -> Retained<Self>;
7751    );
7752}
7753
7754extern_class!(
7755    /// The NETransparentProxyManager class declares the programmatic interface for an object that is used to configure and control transparent proxies provided by NEAppProxyProviders.
7756    ///
7757    /// Instances of this class are thread safe.
7758    ///
7759    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netransparentproxymanager?language=objc)
7760    #[unsafe(super(NEVPNManager, NSObject))]
7761    #[derive(Debug, PartialEq, Eq, Hash)]
7762    pub struct NETransparentProxyManager;
7763);
7764
7765extern_conformance!(
7766    unsafe impl NSObjectProtocol for NETransparentProxyManager {}
7767);
7768
7769impl NETransparentProxyManager {
7770    extern_methods!(
7771        #[cfg(feature = "block2")]
7772        /// This function asynchronously reads all of the transparent proxy configurations associated with the calling app that have previously been saved to disk and returns them as NETransparentProxyManager objects.
7773        ///
7774        /// Parameter `completionHandler`: A block that takes an array NETransparentProxyManager objects. The array passed to the block may be empty if no transparent proxy configurations were successfully read from the disk.  The NSError passed to this block will be nil if the load operation succeeded, non-nil otherwise.
7775        #[unsafe(method(loadAllFromPreferencesWithCompletionHandler:))]
7776        #[unsafe(method_family = none)]
7777        pub unsafe fn loadAllFromPreferencesWithCompletionHandler(
7778            completion_handler: &block2::DynBlock<
7779                dyn Fn(*mut NSArray<NETransparentProxyManager>, *mut NSError),
7780            >,
7781        );
7782    );
7783}
7784
7785/// Methods declared on superclass `NSObject`.
7786impl NETransparentProxyManager {
7787    extern_methods!(
7788        #[unsafe(method(init))]
7789        #[unsafe(method_family = init)]
7790        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7791
7792        #[unsafe(method(new))]
7793        #[unsafe(method_family = new)]
7794        pub unsafe fn new() -> Retained<Self>;
7795    );
7796}
7797
7798extern_class!(
7799    /// The NETransparentProxyNetworkSettings class declares the programmatic interface for an object that contains network settings.
7800    ///
7801    /// NETransparentProxyNetworkSettings is used by NEAppProxyProviders to communicate the desired network settings for the proxy to the framework. The framework takes care of applying the contained settings to the system.
7802    ///
7803    /// Instances of this class are thread safe.
7804    ///
7805    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netransparentproxynetworksettings?language=objc)
7806    #[unsafe(super(NETunnelNetworkSettings, NSObject))]
7807    #[derive(Debug, PartialEq, Eq, Hash)]
7808    pub struct NETransparentProxyNetworkSettings;
7809);
7810
7811extern_conformance!(
7812    unsafe impl NSCoding for NETransparentProxyNetworkSettings {}
7813);
7814
7815extern_conformance!(
7816    unsafe impl NSCopying for NETransparentProxyNetworkSettings {}
7817);
7818
7819unsafe impl CopyingHelper for NETransparentProxyNetworkSettings {
7820    type Result = Self;
7821}
7822
7823extern_conformance!(
7824    unsafe impl NSObjectProtocol for NETransparentProxyNetworkSettings {}
7825);
7826
7827extern_conformance!(
7828    unsafe impl NSSecureCoding for NETransparentProxyNetworkSettings {}
7829);
7830
7831impl NETransparentProxyNetworkSettings {
7832    extern_methods!(
7833        /// An array of NENetworkRule objects that collectively specify the traffic that will be routed through the transparent proxy. The following restrictions
7834        /// apply to each NENetworkRule in this list:
7835        /// Restrictions for rules with an address endpoint:
7836        /// If the port string of the endpoint is "0" or is the empty string, then the address of the endpoint must be a non-wildcard address (i.e. "0.0.0.0" or "::").
7837        /// If the address is a wildcard address (i.e. "0.0.0.0" or "::"), then the port string of the endpoint must be non-empty and must not be "0".
7838        /// A port string of "53" is not allowed. Destination Domain-based rules must be used to match DNS traffic.
7839        /// The matchLocalNetwork property must be nil.
7840        /// The matchDirection property must be NETrafficDirectionOutbound.
7841        #[unsafe(method(includedNetworkRules))]
7842        #[unsafe(method_family = none)]
7843        pub unsafe fn includedNetworkRules(&self) -> Option<Retained<NSArray<NENetworkRule>>>;
7844
7845        /// Setter for [`includedNetworkRules`][Self::includedNetworkRules].
7846        #[unsafe(method(setIncludedNetworkRules:))]
7847        #[unsafe(method_family = none)]
7848        pub unsafe fn setIncludedNetworkRules(
7849            &self,
7850            included_network_rules: Option<&NSArray<NENetworkRule>>,
7851        );
7852
7853        /// An array of NENetworkRule objects that collectively specify the traffic that will not be routed through the transparent proxy. The following restrictions
7854        /// apply to each NENetworkRule in this list:
7855        /// Restrictions for rules with an address endpoint:
7856        /// If the port string of the endpoint is "0" or is the empty string, then the address of the endpoint must be a non-wildcard address (i.e. "0.0.0.0" or "::").
7857        /// If the address is a wildcard address (i.e. "0.0.0.0" or "::"), then the port string of the endpoint must be non-empty and must not be "0".
7858        /// A port string of "53" is not allowed. Destination Domain-based rules must be used to match DNS traffic.
7859        /// The matchLocalNetwork property must be nil.
7860        /// The matchDirection property must be NETrafficDirectionOutbound.
7861        #[unsafe(method(excludedNetworkRules))]
7862        #[unsafe(method_family = none)]
7863        pub unsafe fn excludedNetworkRules(&self) -> Option<Retained<NSArray<NENetworkRule>>>;
7864
7865        /// Setter for [`excludedNetworkRules`][Self::excludedNetworkRules].
7866        #[unsafe(method(setExcludedNetworkRules:))]
7867        #[unsafe(method_family = none)]
7868        pub unsafe fn setExcludedNetworkRules(
7869            &self,
7870            excluded_network_rules: Option<&NSArray<NENetworkRule>>,
7871        );
7872    );
7873}
7874
7875/// Methods declared on superclass `NETunnelNetworkSettings`.
7876impl NETransparentProxyNetworkSettings {
7877    extern_methods!(
7878        /// This function initializes a newly-allocated NETunnelNetworkSettings object with a given tunnel remote address.
7879        ///
7880        /// Parameter `address`: The address of the remote endpoint that is providing the tunnel service.
7881        #[unsafe(method(initWithTunnelRemoteAddress:))]
7882        #[unsafe(method_family = init)]
7883        pub unsafe fn initWithTunnelRemoteAddress(
7884            this: Allocated<Self>,
7885            address: &NSString,
7886        ) -> Retained<Self>;
7887    );
7888}
7889
7890/// Methods declared on superclass `NSObject`.
7891impl NETransparentProxyNetworkSettings {
7892    extern_methods!(
7893        #[unsafe(method(init))]
7894        #[unsafe(method_family = init)]
7895        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7896
7897        #[unsafe(method(new))]
7898        #[unsafe(method_family = new)]
7899        pub unsafe fn new() -> Retained<Self>;
7900    );
7901}
7902
7903extern_class!(
7904    /// The NETransparentProxyProvider class declares the programmatic interface for an object that implements the client side of a custom transparent network proxy solution.
7905    /// The NETransparentProxyProvider class has the following behavior differences from its super class NEAppProxyProvider:
7906    /// - Returning NO from handleNewFlow: and handleNewUDPFlow:initialRemoteEndpoint: causes the flow to proceed to communicate directly with the flow's ultimate destination, instead of closing the flow with a "Connection Refused" error.
7907    /// - NEDNSSettings and NEProxySettings specified within NETransparentProxyNetworkSettings are ignored. Flows that match the includedNetworkRules within NETransparentProxyNetworkSettings will use the same DNS and proxy settings that other flows on the system are currently using.
7908    /// - Flows that are created using a "connect by name" API (such as Network.framework or NSURLSession) that match the includedNetworkRules will not bypass DNS resolution.
7909    ///
7910    /// NETransparentProxyProvider is part of NetworkExtension.framework
7911    ///
7912    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netransparentproxyprovider?language=objc)
7913    #[unsafe(super(NEAppProxyProvider, NETunnelProvider, NEProvider, NSObject))]
7914    #[derive(Debug, PartialEq, Eq, Hash)]
7915    pub struct NETransparentProxyProvider;
7916);
7917
7918extern_conformance!(
7919    unsafe impl NSObjectProtocol for NETransparentProxyProvider {}
7920);
7921
7922impl NETransparentProxyProvider {
7923    extern_methods!();
7924}
7925
7926/// Methods declared on superclass `NSObject`.
7927impl NETransparentProxyProvider {
7928    extern_methods!(
7929        #[unsafe(method(init))]
7930        #[unsafe(method_family = init)]
7931        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7932
7933        #[unsafe(method(new))]
7934        #[unsafe(method_family = new)]
7935        pub unsafe fn new() -> Retained<Self>;
7936    );
7937}
7938
7939/// VPN status codes
7940///
7941/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnstatus?language=objc)
7942// NS_ENUM
7943#[repr(transparent)]
7944#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
7945pub struct NEVPNStatus(pub NSInteger);
7946impl NEVPNStatus {
7947    #[doc(alias = "NEVPNStatusInvalid")]
7948    pub const Invalid: Self = Self(0);
7949    #[doc(alias = "NEVPNStatusDisconnected")]
7950    pub const Disconnected: Self = Self(1);
7951    #[doc(alias = "NEVPNStatusConnecting")]
7952    pub const Connecting: Self = Self(2);
7953    #[doc(alias = "NEVPNStatusConnected")]
7954    pub const Connected: Self = Self(3);
7955    #[doc(alias = "NEVPNStatusReasserting")]
7956    pub const Reasserting: Self = Self(4);
7957    #[doc(alias = "NEVPNStatusDisconnecting")]
7958    pub const Disconnecting: Self = Self(5);
7959}
7960
7961unsafe impl Encode for NEVPNStatus {
7962    const ENCODING: Encoding = NSInteger::ENCODING;
7963}
7964
7965unsafe impl RefEncode for NEVPNStatus {
7966    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
7967}
7968
7969extern "C" {
7970    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnstatusdidchangenotification?language=objc)
7971    pub static NEVPNStatusDidChangeNotification: &'static NSString;
7972}
7973
7974extern "C" {
7975    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnconnectionstartoptionusername?language=objc)
7976    pub static NEVPNConnectionStartOptionUsername: &'static NSString;
7977}
7978
7979extern "C" {
7980    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnconnectionstartoptionpassword?language=objc)
7981    pub static NEVPNConnectionStartOptionPassword: &'static NSString;
7982}
7983
7984/// VPN error codes
7985///
7986/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnconnectionerror?language=objc)
7987// NS_ENUM
7988#[repr(transparent)]
7989#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
7990pub struct NEVPNConnectionError(pub NSInteger);
7991impl NEVPNConnectionError {
7992    #[doc(alias = "NEVPNConnectionErrorOverslept")]
7993    pub const Overslept: Self = Self(1);
7994    #[doc(alias = "NEVPNConnectionErrorNoNetworkAvailable")]
7995    pub const NoNetworkAvailable: Self = Self(2);
7996    /// way that the VPN connection could not be maintained.
7997    #[doc(alias = "NEVPNConnectionErrorUnrecoverableNetworkChange")]
7998    pub const UnrecoverableNetworkChange: Self = Self(3);
7999    #[doc(alias = "NEVPNConnectionErrorConfigurationFailed")]
8000    pub const ConfigurationFailed: Self = Self(4);
8001    #[doc(alias = "NEVPNConnectionErrorServerAddressResolutionFailed")]
8002    pub const ServerAddressResolutionFailed: Self = Self(5);
8003    #[doc(alias = "NEVPNConnectionErrorServerNotResponding")]
8004    pub const ServerNotResponding: Self = Self(6);
8005    #[doc(alias = "NEVPNConnectionErrorServerDead")]
8006    pub const ServerDead: Self = Self(7);
8007    #[doc(alias = "NEVPNConnectionErrorAuthenticationFailed")]
8008    pub const AuthenticationFailed: Self = Self(8);
8009    #[doc(alias = "NEVPNConnectionErrorClientCertificateInvalid")]
8010    pub const ClientCertificateInvalid: Self = Self(9);
8011    #[doc(alias = "NEVPNConnectionErrorClientCertificateNotYetValid")]
8012    pub const ClientCertificateNotYetValid: Self = Self(10);
8013    #[doc(alias = "NEVPNConnectionErrorClientCertificateExpired")]
8014    pub const ClientCertificateExpired: Self = Self(11);
8015    #[doc(alias = "NEVPNConnectionErrorPluginFailed")]
8016    pub const PluginFailed: Self = Self(12);
8017    #[doc(alias = "NEVPNConnectionErrorConfigurationNotFound")]
8018    pub const ConfigurationNotFound: Self = Self(13);
8019    #[doc(alias = "NEVPNConnectionErrorPluginDisabled")]
8020    pub const PluginDisabled: Self = Self(14);
8021    #[doc(alias = "NEVPNConnectionErrorNegotiationFailed")]
8022    pub const NegotiationFailed: Self = Self(15);
8023    #[doc(alias = "NEVPNConnectionErrorServerDisconnected")]
8024    pub const ServerDisconnected: Self = Self(16);
8025    #[doc(alias = "NEVPNConnectionErrorServerCertificateInvalid")]
8026    pub const ServerCertificateInvalid: Self = Self(17);
8027    #[doc(alias = "NEVPNConnectionErrorServerCertificateNotYetValid")]
8028    pub const ServerCertificateNotYetValid: Self = Self(18);
8029    #[doc(alias = "NEVPNConnectionErrorServerCertificateExpired")]
8030    pub const ServerCertificateExpired: Self = Self(19);
8031}
8032
8033unsafe impl Encode for NEVPNConnectionError {
8034    const ENCODING: Encoding = NSInteger::ENCODING;
8035}
8036
8037unsafe impl RefEncode for NEVPNConnectionError {
8038    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
8039}
8040
8041extern "C" {
8042    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnconnectionerrordomain?language=objc)
8043    pub static NEVPNConnectionErrorDomain: &'static NSString;
8044}
8045
8046extern_class!(
8047    /// The NEVPNConnection class declares the programmatic interface for an object that manages VPN connections.
8048    ///
8049    /// Instances of this class are thread safe.
8050    ///
8051    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnconnection?language=objc)
8052    #[unsafe(super(NSObject))]
8053    #[derive(Debug, PartialEq, Eq, Hash)]
8054    pub struct NEVPNConnection;
8055);
8056
8057extern_conformance!(
8058    unsafe impl NSObjectProtocol for NEVPNConnection {}
8059);
8060
8061impl NEVPNConnection {
8062    extern_methods!(
8063        /// This function is used to start the VPN tunnel using the current VPN configuration. The VPN tunnel connection process is started and this function returns immediately.
8064        ///
8065        /// Parameter `error`: If the VPN tunnel was started successfully, this parameter is set to nil. Otherwise this parameter is set to the error that occurred. Possible errors include:
8066        /// 1. NEVPNErrorConfigurationInvalid
8067        /// 2. NEVPNErrorConfigurationDisabled
8068        ///
8069        /// Returns: YES if the VPN tunnel was started successfully, NO if an error occurred.
8070        #[unsafe(method(startVPNTunnelAndReturnError:_))]
8071        #[unsafe(method_family = none)]
8072        pub unsafe fn startVPNTunnelAndReturnError(&self) -> Result<(), Retained<NSError>>;
8073
8074        /// This function is used to start the VPN tunnel using the current VPN configuration. The VPN tunnel connection process is started and this function returns immediately.
8075        ///
8076        /// Parameter `options`: A dictionary that will be passed to the tunnel provider during the process of starting the tunnel.
8077        /// If not nil, 'options' is an NSDictionary may contain the following keys
8078        /// NEVPNConnectionStartOptionUsername
8079        /// NEVPNConnectionStartOptionPassword
8080        ///
8081        /// Parameter `error`: If the VPN tunnel was started successfully, this parameter is set to nil. Otherwise this parameter is set to the error that occurred. Possible errors include:
8082        /// 1. NEVPNErrorConfigurationInvalid
8083        /// 2. NEVPNErrorConfigurationDisabled
8084        ///
8085        /// Returns: YES if the VPN tunnel was started successfully, NO if an error occurred.
8086        #[unsafe(method(startVPNTunnelWithOptions:andReturnError:_))]
8087        #[unsafe(method_family = none)]
8088        pub unsafe fn startVPNTunnelWithOptions_andReturnError(
8089            &self,
8090            options: Option<&NSDictionary<NSString, NSObject>>,
8091        ) -> Result<(), Retained<NSError>>;
8092
8093        /// This function is used to stop the VPN tunnel. The VPN tunnel disconnect process is started and this function returns immediately.
8094        #[unsafe(method(stopVPNTunnel))]
8095        #[unsafe(method_family = none)]
8096        pub unsafe fn stopVPNTunnel(&self);
8097
8098        #[cfg(feature = "block2")]
8099        /// Retrive the most recent error that caused the VPN to disconnect. If the error was generated by the VPN system (including the IPsec client) then the error will be in the NEVPNConnectionErrorDomain error domain. If the error was generated by a tunnel provider app extension then the error will be the NSError that the provider passed when disconnecting the tunnel.
8100        ///
8101        /// Parameter `handler`: A block which takes an optional NSError that will be called when the error is obtained.
8102        #[unsafe(method(fetchLastDisconnectErrorWithCompletionHandler:))]
8103        #[unsafe(method_family = none)]
8104        pub unsafe fn fetchLastDisconnectErrorWithCompletionHandler(
8105            &self,
8106            handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
8107        );
8108
8109        /// The current status of the VPN.
8110        #[unsafe(method(status))]
8111        #[unsafe(method_family = none)]
8112        pub unsafe fn status(&self) -> NEVPNStatus;
8113
8114        /// The date and time when the connection status changed to NEVPNStatusConnected. This property is nil if the connection is not fully established.
8115        #[unsafe(method(connectedDate))]
8116        #[unsafe(method_family = none)]
8117        pub unsafe fn connectedDate(&self) -> Option<Retained<NSDate>>;
8118
8119        /// The NEVPNManager associated with this NEVPNConnection.
8120        #[unsafe(method(manager))]
8121        #[unsafe(method_family = none)]
8122        pub unsafe fn manager(&self) -> Retained<NEVPNManager>;
8123    );
8124}
8125
8126/// Methods declared on superclass `NSObject`.
8127impl NEVPNConnection {
8128    extern_methods!(
8129        #[unsafe(method(init))]
8130        #[unsafe(method_family = init)]
8131        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8132
8133        #[unsafe(method(new))]
8134        #[unsafe(method_family = new)]
8135        pub unsafe fn new() -> Retained<Self>;
8136    );
8137}
8138
8139extern_class!(
8140    /// This file declares the NETunnelProviderSession API. The NETunnelProviderSession API is used to control network tunnel services provided by NETunnelProvider implementations.
8141    ///
8142    /// This API is part of NetworkExtension.framework.
8143    ///
8144    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netunnelprovidersession?language=objc)
8145    #[unsafe(super(NEVPNConnection, NSObject))]
8146    #[derive(Debug, PartialEq, Eq, Hash)]
8147    pub struct NETunnelProviderSession;
8148);
8149
8150extern_conformance!(
8151    unsafe impl NSObjectProtocol for NETunnelProviderSession {}
8152);
8153
8154impl NETunnelProviderSession {
8155    extern_methods!(
8156        /// This function is used to start the tunnel using the configuration associated with this connection object. The tunnel connection process is started and this function returns immediately.
8157        ///
8158        /// Parameter `options`: A dictionary that will be passed as-is to the tunnel provider during the process of starting the tunnel.
8159        ///
8160        /// Parameter `error`: If the tunnel was started successfully, this parameter is set to nil. Otherwise this parameter is set to the error that occurred. Possible errors include:
8161        /// 1. NEVPNErrorConfigurationInvalid
8162        /// 2. NEVPNErrorConfigurationDisabled
8163        ///
8164        /// Returns: YES if the tunnel was started successfully, NO if an error occurred.
8165        #[unsafe(method(startTunnelWithOptions:andReturnError:_))]
8166        #[unsafe(method_family = none)]
8167        pub unsafe fn startTunnelWithOptions_andReturnError(
8168            &self,
8169            options: Option<&NSDictionary<NSString, AnyObject>>,
8170        ) -> Result<(), Retained<NSError>>;
8171
8172        /// This function is used to stop the tunnel. The tunnel disconnect process is started and this function returns immediately.
8173        #[unsafe(method(stopTunnel))]
8174        #[unsafe(method_family = none)]
8175        pub unsafe fn stopTunnel(&self);
8176
8177        #[cfg(feature = "block2")]
8178        /// This function sends a message to the NETunnelProvider and provides a way to receive a response.
8179        ///
8180        /// Parameter `messageData`: An NSData object containing the message to be sent.
8181        ///
8182        /// Parameter `error`: If the message was sent successfully, this parameter is set to nil. Otherwise this parameter is set to the error that occurred. Possible errors include:
8183        /// 1. NEVPNErrorConfigurationInvalid
8184        /// 2. NEVPNErrorConfigurationDisabled
8185        ///
8186        /// Parameter `responseHandler`: A block that handles the response. Can be set to nil if no response is expected.
8187        ///
8188        /// Returns: YES if the message was sent successfully, NO if an error occurred.
8189        #[unsafe(method(sendProviderMessage:returnError:responseHandler:))]
8190        #[unsafe(method_family = none)]
8191        pub unsafe fn sendProviderMessage_returnError_responseHandler(
8192            &self,
8193            message_data: &NSData,
8194            error: Option<&mut Option<Retained<NSError>>>,
8195            response_handler: Option<&block2::DynBlock<dyn Fn(*mut NSData)>>,
8196        ) -> bool;
8197    );
8198}
8199
8200/// Methods declared on superclass `NSObject`.
8201impl NETunnelProviderSession {
8202    extern_methods!(
8203        #[unsafe(method(init))]
8204        #[unsafe(method_family = init)]
8205        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8206
8207        #[unsafe(method(new))]
8208        #[unsafe(method_family = new)]
8209        pub unsafe fn new() -> Retained<Self>;
8210    );
8211}
8212
8213extern_class!(
8214    /// The NETunnelProviderProtocol class declares the programmatic interface for an object that contains NETunnelProvider-specific configuration settings.
8215    ///
8216    /// Instances of this class are thread safe.
8217    ///
8218    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netunnelproviderprotocol?language=objc)
8219    #[unsafe(super(NEVPNProtocol, NSObject))]
8220    #[derive(Debug, PartialEq, Eq, Hash)]
8221    pub struct NETunnelProviderProtocol;
8222);
8223
8224extern_conformance!(
8225    unsafe impl NSCoding for NETunnelProviderProtocol {}
8226);
8227
8228extern_conformance!(
8229    unsafe impl NSCopying for NETunnelProviderProtocol {}
8230);
8231
8232unsafe impl CopyingHelper for NETunnelProviderProtocol {
8233    type Result = Self;
8234}
8235
8236extern_conformance!(
8237    unsafe impl NSObjectProtocol for NETunnelProviderProtocol {}
8238);
8239
8240extern_conformance!(
8241    unsafe impl NSSecureCoding for NETunnelProviderProtocol {}
8242);
8243
8244impl NETunnelProviderProtocol {
8245    extern_methods!(
8246        /// A dictionary containing NETunnelProvider vendor-specific configuration parameters. This dictionary is passed as-is to NETunnelProviders when a tunnel is started.
8247        #[unsafe(method(providerConfiguration))]
8248        #[unsafe(method_family = none)]
8249        pub unsafe fn providerConfiguration(
8250            &self,
8251        ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
8252
8253        /// Setter for [`providerConfiguration`][Self::providerConfiguration].
8254        #[unsafe(method(setProviderConfiguration:))]
8255        #[unsafe(method_family = none)]
8256        pub unsafe fn setProviderConfiguration(
8257            &self,
8258            provider_configuration: Option<&NSDictionary<NSString, AnyObject>>,
8259        );
8260
8261        /// A string containing the bundle identifier of the NETunnelProvider to be used by this configuration.
8262        #[unsafe(method(providerBundleIdentifier))]
8263        #[unsafe(method_family = none)]
8264        pub unsafe fn providerBundleIdentifier(&self) -> Option<Retained<NSString>>;
8265
8266        /// Setter for [`providerBundleIdentifier`][Self::providerBundleIdentifier].
8267        #[unsafe(method(setProviderBundleIdentifier:))]
8268        #[unsafe(method_family = none)]
8269        pub unsafe fn setProviderBundleIdentifier(
8270            &self,
8271            provider_bundle_identifier: Option<&NSString>,
8272        );
8273    );
8274}
8275
8276/// Methods declared on superclass `NSObject`.
8277impl NETunnelProviderProtocol {
8278    extern_methods!(
8279        #[unsafe(method(init))]
8280        #[unsafe(method_family = init)]
8281        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8282
8283        #[unsafe(method(new))]
8284        #[unsafe(method_family = new)]
8285        pub unsafe fn new() -> Retained<Self>;
8286    );
8287}
8288
8289/// Internet Key Exchange (IKE) authentication methods used to authenticate with the IPSec server.
8290///
8291/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnikeauthenticationmethod?language=objc)
8292// NS_ENUM
8293#[repr(transparent)]
8294#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
8295pub struct NEVPNIKEAuthenticationMethod(pub NSInteger);
8296impl NEVPNIKEAuthenticationMethod {
8297    #[doc(alias = "NEVPNIKEAuthenticationMethodNone")]
8298    pub const None: Self = Self(0);
8299    #[doc(alias = "NEVPNIKEAuthenticationMethodCertificate")]
8300    pub const Certificate: Self = Self(1);
8301    #[doc(alias = "NEVPNIKEAuthenticationMethodSharedSecret")]
8302    pub const SharedSecret: Self = Self(2);
8303}
8304
8305unsafe impl Encode for NEVPNIKEAuthenticationMethod {
8306    const ENCODING: Encoding = NSInteger::ENCODING;
8307}
8308
8309unsafe impl RefEncode for NEVPNIKEAuthenticationMethod {
8310    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
8311}
8312
8313extern_class!(
8314    /// The NEVPNProtocolIPSec class declares the programmatic interface of an object that manages the IPSec-specific portion of a VPN configuration.
8315    ///
8316    /// Instances of this class use IKE version 1 for key negotiation.
8317    ///
8318    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnprotocolipsec?language=objc)
8319    #[unsafe(super(NEVPNProtocol, NSObject))]
8320    #[derive(Debug, PartialEq, Eq, Hash)]
8321    pub struct NEVPNProtocolIPSec;
8322);
8323
8324extern_conformance!(
8325    unsafe impl NSCoding for NEVPNProtocolIPSec {}
8326);
8327
8328extern_conformance!(
8329    unsafe impl NSCopying for NEVPNProtocolIPSec {}
8330);
8331
8332unsafe impl CopyingHelper for NEVPNProtocolIPSec {
8333    type Result = Self;
8334}
8335
8336extern_conformance!(
8337    unsafe impl NSObjectProtocol for NEVPNProtocolIPSec {}
8338);
8339
8340extern_conformance!(
8341    unsafe impl NSSecureCoding for NEVPNProtocolIPSec {}
8342);
8343
8344impl NEVPNProtocolIPSec {
8345    extern_methods!(
8346        /// The method used to authenticate with the IPSec server. Note that if this property is set to NEVPNIKEAuthenticationMethodNone, extended authentication will still be negotiated if useExtendedAuthentication is set to YES.
8347        #[unsafe(method(authenticationMethod))]
8348        #[unsafe(method_family = none)]
8349        pub unsafe fn authenticationMethod(&self) -> NEVPNIKEAuthenticationMethod;
8350
8351        /// Setter for [`authenticationMethod`][Self::authenticationMethod].
8352        #[unsafe(method(setAuthenticationMethod:))]
8353        #[unsafe(method_family = none)]
8354        pub unsafe fn setAuthenticationMethod(
8355            &self,
8356            authentication_method: NEVPNIKEAuthenticationMethod,
8357        );
8358
8359        /// A flag indicating if extended authentication will be negotiated. This authentication is in addition to the IKE authentication used to authenticate the endpoints of the IKE session.
8360        /// For IKE version 1, when this flag is set X-Auth authentication will be negotiated as part of the IKE session, using the username and password properties as the credential.
8361        /// For IKE version 2, when this flag is set EAP authentication will be negotiated as part of the IKE session, using the username, password, and/or identity properties as the credential depending on which EAP method the server requires.
8362        #[unsafe(method(useExtendedAuthentication))]
8363        #[unsafe(method_family = none)]
8364        pub unsafe fn useExtendedAuthentication(&self) -> bool;
8365
8366        /// Setter for [`useExtendedAuthentication`][Self::useExtendedAuthentication].
8367        #[unsafe(method(setUseExtendedAuthentication:))]
8368        #[unsafe(method_family = none)]
8369        pub unsafe fn setUseExtendedAuthentication(&self, use_extended_authentication: bool);
8370
8371        /// A persistent reference to a keychain item of class kSecClassGenericPassword containing the IKE shared secret.
8372        #[unsafe(method(sharedSecretReference))]
8373        #[unsafe(method_family = none)]
8374        pub unsafe fn sharedSecretReference(&self) -> Option<Retained<NSData>>;
8375
8376        /// Setter for [`sharedSecretReference`][Self::sharedSecretReference].
8377        #[unsafe(method(setSharedSecretReference:))]
8378        #[unsafe(method_family = none)]
8379        pub unsafe fn setSharedSecretReference(&self, shared_secret_reference: Option<&NSData>);
8380
8381        /// A string identifying the local IPSec endpoint for authentication purposes.
8382        #[unsafe(method(localIdentifier))]
8383        #[unsafe(method_family = none)]
8384        pub unsafe fn localIdentifier(&self) -> Option<Retained<NSString>>;
8385
8386        /// Setter for [`localIdentifier`][Self::localIdentifier].
8387        #[unsafe(method(setLocalIdentifier:))]
8388        #[unsafe(method_family = none)]
8389        pub unsafe fn setLocalIdentifier(&self, local_identifier: Option<&NSString>);
8390
8391        /// A string identifying the remote IPSec endpoint for authentication purposes.
8392        #[unsafe(method(remoteIdentifier))]
8393        #[unsafe(method_family = none)]
8394        pub unsafe fn remoteIdentifier(&self) -> Option<Retained<NSString>>;
8395
8396        /// Setter for [`remoteIdentifier`][Self::remoteIdentifier].
8397        #[unsafe(method(setRemoteIdentifier:))]
8398        #[unsafe(method_family = none)]
8399        pub unsafe fn setRemoteIdentifier(&self, remote_identifier: Option<&NSString>);
8400    );
8401}
8402
8403/// Methods declared on superclass `NSObject`.
8404impl NEVPNProtocolIPSec {
8405    extern_methods!(
8406        #[unsafe(method(init))]
8407        #[unsafe(method_family = init)]
8408        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8409
8410        #[unsafe(method(new))]
8411        #[unsafe(method_family = new)]
8412        pub unsafe fn new() -> Retained<Self>;
8413    );
8414}
8415
8416/// IKEv2 Encryption Algorithms
8417///
8418/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnikev2encryptionalgorithm?language=objc)
8419// NS_ENUM
8420#[repr(transparent)]
8421#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
8422pub struct NEVPNIKEv2EncryptionAlgorithm(pub NSInteger);
8423impl NEVPNIKEv2EncryptionAlgorithm {
8424    #[doc(alias = "NEVPNIKEv2EncryptionAlgorithmDES")]
8425    #[deprecated = "Use an encryption algorithm with 256-bit keys instead"]
8426    pub const AlgorithmDES: Self = Self(1);
8427    #[doc(alias = "NEVPNIKEv2EncryptionAlgorithm3DES")]
8428    #[deprecated = "Use an encryption algorithm with 256-bit keys instead"]
8429    pub const Algorithm3DES: Self = Self(2);
8430    #[doc(alias = "NEVPNIKEv2EncryptionAlgorithmAES128")]
8431    #[deprecated = "Use an encryption algorithm with 256-bit keys instead"]
8432    pub const AlgorithmAES128: Self = Self(3);
8433    #[doc(alias = "NEVPNIKEv2EncryptionAlgorithmAES256")]
8434    pub const AlgorithmAES256: Self = Self(4);
8435    #[doc(alias = "NEVPNIKEv2EncryptionAlgorithmAES128GCM")]
8436    #[deprecated = "Use an encryption algorithm with 256-bit keys instead"]
8437    pub const AlgorithmAES128GCM: Self = Self(5);
8438    #[doc(alias = "NEVPNIKEv2EncryptionAlgorithmAES256GCM")]
8439    pub const AlgorithmAES256GCM: Self = Self(6);
8440    #[doc(alias = "NEVPNIKEv2EncryptionAlgorithmChaCha20Poly1305")]
8441    pub const AlgorithmChaCha20Poly1305: Self = Self(7);
8442}
8443
8444unsafe impl Encode for NEVPNIKEv2EncryptionAlgorithm {
8445    const ENCODING: Encoding = NSInteger::ENCODING;
8446}
8447
8448unsafe impl RefEncode for NEVPNIKEv2EncryptionAlgorithm {
8449    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
8450}
8451
8452/// IKEv2 Integrity Algorithms
8453///
8454/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnikev2integrityalgorithm?language=objc)
8455// NS_ENUM
8456#[repr(transparent)]
8457#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
8458pub struct NEVPNIKEv2IntegrityAlgorithm(pub NSInteger);
8459impl NEVPNIKEv2IntegrityAlgorithm {
8460    #[doc(alias = "NEVPNIKEv2IntegrityAlgorithmSHA96")]
8461    #[deprecated = "Use SHA-2 for integrity protection instead"]
8462    pub const SHA96: Self = Self(1);
8463    #[doc(alias = "NEVPNIKEv2IntegrityAlgorithmSHA160")]
8464    #[deprecated = "Use SHA-2 for integrity protection instead"]
8465    pub const SHA160: Self = Self(2);
8466    #[doc(alias = "NEVPNIKEv2IntegrityAlgorithmSHA256")]
8467    pub const SHA256: Self = Self(3);
8468    #[doc(alias = "NEVPNIKEv2IntegrityAlgorithmSHA384")]
8469    pub const SHA384: Self = Self(4);
8470    #[doc(alias = "NEVPNIKEv2IntegrityAlgorithmSHA512")]
8471    pub const SHA512: Self = Self(5);
8472}
8473
8474unsafe impl Encode for NEVPNIKEv2IntegrityAlgorithm {
8475    const ENCODING: Encoding = NSInteger::ENCODING;
8476}
8477
8478unsafe impl RefEncode for NEVPNIKEv2IntegrityAlgorithm {
8479    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
8480}
8481
8482/// IKEv2 Dead Peer Detection Rates
8483///
8484/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnikev2deadpeerdetectionrate?language=objc)
8485// NS_ENUM
8486#[repr(transparent)]
8487#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
8488pub struct NEVPNIKEv2DeadPeerDetectionRate(pub NSInteger);
8489impl NEVPNIKEv2DeadPeerDetectionRate {
8490    #[doc(alias = "NEVPNIKEv2DeadPeerDetectionRateNone")]
8491    pub const None: Self = Self(0);
8492    #[doc(alias = "NEVPNIKEv2DeadPeerDetectionRateLow")]
8493    pub const Low: Self = Self(1);
8494    #[doc(alias = "NEVPNIKEv2DeadPeerDetectionRateMedium")]
8495    pub const Medium: Self = Self(2);
8496    #[doc(alias = "NEVPNIKEv2DeadPeerDetectionRateHigh")]
8497    pub const High: Self = Self(3);
8498}
8499
8500unsafe impl Encode for NEVPNIKEv2DeadPeerDetectionRate {
8501    const ENCODING: Encoding = NSInteger::ENCODING;
8502}
8503
8504unsafe impl RefEncode for NEVPNIKEv2DeadPeerDetectionRate {
8505    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
8506}
8507
8508/// IKEv2 Diffie Hellman groups
8509///
8510/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnikev2diffiehellmangroup?language=objc)
8511// NS_ENUM
8512#[repr(transparent)]
8513#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
8514pub struct NEVPNIKEv2DiffieHellmanGroup(pub NSInteger);
8515impl NEVPNIKEv2DiffieHellmanGroup {
8516    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroupInvalid")]
8517    pub const GroupInvalid: Self = Self(0);
8518    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup1")]
8519    #[deprecated = "Use Diffie Hellman group 14 or greater instead"]
8520    pub const Group1: Self = Self(1);
8521    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup2")]
8522    #[deprecated = "Use Diffie Hellman group 14 or greater instead"]
8523    pub const Group2: Self = Self(2);
8524    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup5")]
8525    #[deprecated = "Use Diffie Hellman group 14 or greater instead"]
8526    pub const Group5: Self = Self(5);
8527    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup14")]
8528    pub const Group14: Self = Self(14);
8529    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup15")]
8530    pub const Group15: Self = Self(15);
8531    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup16")]
8532    pub const Group16: Self = Self(16);
8533    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup17")]
8534    pub const Group17: Self = Self(17);
8535    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup18")]
8536    pub const Group18: Self = Self(18);
8537    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup19")]
8538    pub const Group19: Self = Self(19);
8539    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup20")]
8540    pub const Group20: Self = Self(20);
8541    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup21")]
8542    pub const Group21: Self = Self(21);
8543    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup31")]
8544    pub const Group31: Self = Self(31);
8545    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup32")]
8546    pub const Group32: Self = Self(32);
8547}
8548
8549unsafe impl Encode for NEVPNIKEv2DiffieHellmanGroup {
8550    const ENCODING: Encoding = NSInteger::ENCODING;
8551}
8552
8553unsafe impl RefEncode for NEVPNIKEv2DiffieHellmanGroup {
8554    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
8555}
8556
8557/// IKEv2 Certificate types
8558///
8559/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnikev2certificatetype?language=objc)
8560// NS_ENUM
8561#[repr(transparent)]
8562#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
8563pub struct NEVPNIKEv2CertificateType(pub NSInteger);
8564impl NEVPNIKEv2CertificateType {
8565    #[doc(alias = "NEVPNIKEv2CertificateTypeRSA")]
8566    pub const RSA: Self = Self(1);
8567    #[doc(alias = "NEVPNIKEv2CertificateTypeECDSA256")]
8568    pub const ECDSA256: Self = Self(2);
8569    #[doc(alias = "NEVPNIKEv2CertificateTypeECDSA384")]
8570    pub const ECDSA384: Self = Self(3);
8571    #[doc(alias = "NEVPNIKEv2CertificateTypeECDSA521")]
8572    pub const ECDSA521: Self = Self(4);
8573    #[doc(alias = "NEVPNIKEv2CertificateTypeEd25519")]
8574    pub const Ed25519: Self = Self(5);
8575    #[doc(alias = "NEVPNIKEv2CertificateTypeRSAPSS")]
8576    pub const RSAPSS: Self = Self(6);
8577}
8578
8579unsafe impl Encode for NEVPNIKEv2CertificateType {
8580    const ENCODING: Encoding = NSInteger::ENCODING;
8581}
8582
8583unsafe impl RefEncode for NEVPNIKEv2CertificateType {
8584    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
8585}
8586
8587/// TLS Versions for use in EAP-TLS
8588///
8589/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnikev2tlsversion?language=objc)
8590// NS_ENUM
8591#[repr(transparent)]
8592#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
8593pub struct NEVPNIKEv2TLSVersion(pub NSInteger);
8594impl NEVPNIKEv2TLSVersion {
8595    #[doc(alias = "NEVPNIKEv2TLSVersionDefault")]
8596    pub const VersionDefault: Self = Self(0);
8597    #[doc(alias = "NEVPNIKEv2TLSVersion1_0")]
8598    pub const Version1_0: Self = Self(1);
8599    #[doc(alias = "NEVPNIKEv2TLSVersion1_1")]
8600    pub const Version1_1: Self = Self(2);
8601    #[doc(alias = "NEVPNIKEv2TLSVersion1_2")]
8602    pub const Version1_2: Self = Self(3);
8603}
8604
8605unsafe impl Encode for NEVPNIKEv2TLSVersion {
8606    const ENCODING: Encoding = NSInteger::ENCODING;
8607}
8608
8609unsafe impl RefEncode for NEVPNIKEv2TLSVersion {
8610    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
8611}
8612
8613extern_class!(
8614    /// The NEVPNIKEv2SecurityAssociationParameters class declares the programmatic interface of an object that manages parameters for an IPSec Security Association
8615    ///
8616    /// Instances of this class are thread safe.
8617    ///
8618    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnikev2securityassociationparameters?language=objc)
8619    #[unsafe(super(NSObject))]
8620    #[derive(Debug, PartialEq, Eq, Hash)]
8621    pub struct NEVPNIKEv2SecurityAssociationParameters;
8622);
8623
8624extern_conformance!(
8625    unsafe impl NSCoding for NEVPNIKEv2SecurityAssociationParameters {}
8626);
8627
8628extern_conformance!(
8629    unsafe impl NSCopying for NEVPNIKEv2SecurityAssociationParameters {}
8630);
8631
8632unsafe impl CopyingHelper for NEVPNIKEv2SecurityAssociationParameters {
8633    type Result = Self;
8634}
8635
8636extern_conformance!(
8637    unsafe impl NSObjectProtocol for NEVPNIKEv2SecurityAssociationParameters {}
8638);
8639
8640extern_conformance!(
8641    unsafe impl NSSecureCoding for NEVPNIKEv2SecurityAssociationParameters {}
8642);
8643
8644impl NEVPNIKEv2SecurityAssociationParameters {
8645    extern_methods!(
8646        /// The algorithm used by the Security Association to encrypt and decrypt data. On macOS and iOS, the default is NEVPNIKEv2EncryptionAlgorithmAES256 starting in macOS 11 and iOS 14.
8647        /// Prior to that the default was NEVPNIKEv2EncryptionAlgorithm3DES. On tvOS, the default is NEVPNIKEv2EncryptionAlgorithmAES256GCM.
8648        #[unsafe(method(encryptionAlgorithm))]
8649        #[unsafe(method_family = none)]
8650        pub unsafe fn encryptionAlgorithm(&self) -> NEVPNIKEv2EncryptionAlgorithm;
8651
8652        /// Setter for [`encryptionAlgorithm`][Self::encryptionAlgorithm].
8653        #[unsafe(method(setEncryptionAlgorithm:))]
8654        #[unsafe(method_family = none)]
8655        pub unsafe fn setEncryptionAlgorithm(
8656            &self,
8657            encryption_algorithm: NEVPNIKEv2EncryptionAlgorithm,
8658        );
8659
8660        /// The algorithm used by the Security Association to verify the integrity of data.  The IKE psedo-random function algorithm will be inferred based on the integrity algorithm.
8661        /// Default is NEVPNIKEv2IntegrityAlgorithmSHA256 starting in macOS 11, iOS 14, and tvOS 17.  Prior to that the default was NEVPNIKEv2IntegrityAlgorithmSHA96.
8662        #[unsafe(method(integrityAlgorithm))]
8663        #[unsafe(method_family = none)]
8664        pub unsafe fn integrityAlgorithm(&self) -> NEVPNIKEv2IntegrityAlgorithm;
8665
8666        /// Setter for [`integrityAlgorithm`][Self::integrityAlgorithm].
8667        #[unsafe(method(setIntegrityAlgorithm:))]
8668        #[unsafe(method_family = none)]
8669        pub unsafe fn setIntegrityAlgorithm(
8670            &self,
8671            integrity_algorithm: NEVPNIKEv2IntegrityAlgorithm,
8672        );
8673
8674        /// The Diffie Hellman group used by the Security Association. Default is NEVPNIKEv2DiffieHellmanGroup14 starting in macOS 11, iOS 14, and tvOS 17. Prior to that the default was NEVPNIKEv2DiffieHellmanGroup2.
8675        #[unsafe(method(diffieHellmanGroup))]
8676        #[unsafe(method_family = none)]
8677        pub unsafe fn diffieHellmanGroup(&self) -> NEVPNIKEv2DiffieHellmanGroup;
8678
8679        /// Setter for [`diffieHellmanGroup`][Self::diffieHellmanGroup].
8680        #[unsafe(method(setDiffieHellmanGroup:))]
8681        #[unsafe(method_family = none)]
8682        pub unsafe fn setDiffieHellmanGroup(
8683            &self,
8684            diffie_hellman_group: NEVPNIKEv2DiffieHellmanGroup,
8685        );
8686
8687        /// The life time of the Security Association, in minutes. Default is 60 for IKE Security Associations, and 30 for Child Security Associations. Before the lifetime is reached, IKEv2 will attempt to rekey the Security Association to maintain the connection.
8688        #[unsafe(method(lifetimeMinutes))]
8689        #[unsafe(method_family = none)]
8690        pub unsafe fn lifetimeMinutes(&self) -> i32;
8691
8692        /// Setter for [`lifetimeMinutes`][Self::lifetimeMinutes].
8693        #[unsafe(method(setLifetimeMinutes:))]
8694        #[unsafe(method_family = none)]
8695        pub unsafe fn setLifetimeMinutes(&self, lifetime_minutes: i32);
8696    );
8697}
8698
8699/// Methods declared on superclass `NSObject`.
8700impl NEVPNIKEv2SecurityAssociationParameters {
8701    extern_methods!(
8702        #[unsafe(method(init))]
8703        #[unsafe(method_family = init)]
8704        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8705
8706        #[unsafe(method(new))]
8707        #[unsafe(method_family = new)]
8708        pub unsafe fn new() -> Retained<Self>;
8709    );
8710}
8711
8712extern_class!(
8713    /// The NEVPNIKEv2PPKConfiguration class declares the programmatic interface of an object that manages parameters for a Post-quantum Pre-shared Key (PPK)
8714    ///
8715    /// Instances of this class conform to RFC 8784.
8716    /// Instances of this class are thread safe.
8717    ///
8718    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnikev2ppkconfiguration?language=objc)
8719    #[unsafe(super(NSObject))]
8720    #[derive(Debug, PartialEq, Eq, Hash)]
8721    pub struct NEVPNIKEv2PPKConfiguration;
8722);
8723
8724extern_conformance!(
8725    unsafe impl NSCopying for NEVPNIKEv2PPKConfiguration {}
8726);
8727
8728unsafe impl CopyingHelper for NEVPNIKEv2PPKConfiguration {
8729    type Result = Self;
8730}
8731
8732extern_conformance!(
8733    unsafe impl NSObjectProtocol for NEVPNIKEv2PPKConfiguration {}
8734);
8735
8736impl NEVPNIKEv2PPKConfiguration {
8737    extern_methods!(
8738        /// Initialize a newly-allocated NEVPNIKEv2PPKConfiguration object.
8739        ///
8740        /// Parameter `identifier`: The identifier for the PPK.
8741        ///
8742        /// Parameter `keychainReference`: A persistent reference to a keychain item of class kSecClassGenericPassword containing the PPK.
8743        #[unsafe(method(initWithIdentifier:keychainReference:))]
8744        #[unsafe(method_family = init)]
8745        pub unsafe fn initWithIdentifier_keychainReference(
8746            this: Allocated<Self>,
8747            identifier: &NSString,
8748            keychain_reference: &NSData,
8749        ) -> Retained<Self>;
8750
8751        /// The identifer for the PPK.
8752        #[unsafe(method(identifier))]
8753        #[unsafe(method_family = none)]
8754        pub unsafe fn identifier(&self) -> Retained<NSString>;
8755
8756        /// A persistent reference to a keychain item of class kSecClassGenericPassword containing the PPK.
8757        #[unsafe(method(keychainReference))]
8758        #[unsafe(method_family = none)]
8759        pub unsafe fn keychainReference(&self) -> Retained<NSData>;
8760
8761        /// Boolean indicating whether use of the PPK is mandatory or not. Default is YES.
8762        #[unsafe(method(isMandatory))]
8763        #[unsafe(method_family = none)]
8764        pub unsafe fn isMandatory(&self) -> bool;
8765
8766        /// Setter for [`isMandatory`][Self::isMandatory].
8767        #[unsafe(method(setIsMandatory:))]
8768        #[unsafe(method_family = none)]
8769        pub unsafe fn setIsMandatory(&self, is_mandatory: bool);
8770    );
8771}
8772
8773/// Methods declared on superclass `NSObject`.
8774impl NEVPNIKEv2PPKConfiguration {
8775    extern_methods!(
8776        #[unsafe(method(init))]
8777        #[unsafe(method_family = init)]
8778        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8779
8780        #[unsafe(method(new))]
8781        #[unsafe(method_family = new)]
8782        pub unsafe fn new() -> Retained<Self>;
8783    );
8784}
8785
8786extern_class!(
8787    /// The NEVPNProtocolIKEv2 class declares the programmatic interface of an object that manages the IKEv2-specific portion of a VPN configuration.
8788    ///
8789    /// Instances of this class use IKE version 2 for key negotiation.
8790    /// Instances of this class are thread safe.
8791    ///
8792    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnprotocolikev2?language=objc)
8793    #[unsafe(super(NEVPNProtocolIPSec, NEVPNProtocol, NSObject))]
8794    #[derive(Debug, PartialEq, Eq, Hash)]
8795    pub struct NEVPNProtocolIKEv2;
8796);
8797
8798extern_conformance!(
8799    unsafe impl NSCoding for NEVPNProtocolIKEv2 {}
8800);
8801
8802extern_conformance!(
8803    unsafe impl NSCopying for NEVPNProtocolIKEv2 {}
8804);
8805
8806unsafe impl CopyingHelper for NEVPNProtocolIKEv2 {
8807    type Result = Self;
8808}
8809
8810extern_conformance!(
8811    unsafe impl NSObjectProtocol for NEVPNProtocolIKEv2 {}
8812);
8813
8814extern_conformance!(
8815    unsafe impl NSSecureCoding for NEVPNProtocolIKEv2 {}
8816);
8817
8818impl NEVPNProtocolIKEv2 {
8819    extern_methods!(
8820        /// How frequently the IKEv2 client will run the dead peer detection algorithm.  Default is NEVPNIKEv2DeadPeerDetectionRateMedium.
8821        #[unsafe(method(deadPeerDetectionRate))]
8822        #[unsafe(method_family = none)]
8823        pub unsafe fn deadPeerDetectionRate(&self) -> NEVPNIKEv2DeadPeerDetectionRate;
8824
8825        /// Setter for [`deadPeerDetectionRate`][Self::deadPeerDetectionRate].
8826        #[unsafe(method(setDeadPeerDetectionRate:))]
8827        #[unsafe(method_family = none)]
8828        pub unsafe fn setDeadPeerDetectionRate(
8829            &self,
8830            dead_peer_detection_rate: NEVPNIKEv2DeadPeerDetectionRate,
8831        );
8832
8833        /// A string containing the Subject Common Name field of the Certificate Authority certificate that issued the IKEv2 server's certificate.
8834        #[unsafe(method(serverCertificateIssuerCommonName))]
8835        #[unsafe(method_family = none)]
8836        pub unsafe fn serverCertificateIssuerCommonName(&self) -> Option<Retained<NSString>>;
8837
8838        /// Setter for [`serverCertificateIssuerCommonName`][Self::serverCertificateIssuerCommonName].
8839        #[unsafe(method(setServerCertificateIssuerCommonName:))]
8840        #[unsafe(method_family = none)]
8841        pub unsafe fn setServerCertificateIssuerCommonName(
8842            &self,
8843            server_certificate_issuer_common_name: Option<&NSString>,
8844        );
8845
8846        /// A string containing the value to verify in the IKEv2 server certificate's Subject Common Name field.
8847        #[unsafe(method(serverCertificateCommonName))]
8848        #[unsafe(method_family = none)]
8849        pub unsafe fn serverCertificateCommonName(&self) -> Option<Retained<NSString>>;
8850
8851        /// Setter for [`serverCertificateCommonName`][Self::serverCertificateCommonName].
8852        #[unsafe(method(setServerCertificateCommonName:))]
8853        #[unsafe(method_family = none)]
8854        pub unsafe fn setServerCertificateCommonName(
8855            &self,
8856            server_certificate_common_name: Option<&NSString>,
8857        );
8858
8859        /// contains the type of certificate if an certificate is configured.  Default is RSA.
8860        #[unsafe(method(certificateType))]
8861        #[unsafe(method_family = none)]
8862        pub unsafe fn certificateType(&self) -> NEVPNIKEv2CertificateType;
8863
8864        /// Setter for [`certificateType`][Self::certificateType].
8865        #[unsafe(method(setCertificateType:))]
8866        #[unsafe(method_family = none)]
8867        pub unsafe fn setCertificateType(&self, certificate_type: NEVPNIKEv2CertificateType);
8868
8869        /// Boolean indicating if client should use INTERNAL_IP4_SUBNET / INTERNAL_IP6_SUBNET attributes.  Default is False.
8870        #[unsafe(method(useConfigurationAttributeInternalIPSubnet))]
8871        #[unsafe(method_family = none)]
8872        pub unsafe fn useConfigurationAttributeInternalIPSubnet(&self) -> bool;
8873
8874        /// Setter for [`useConfigurationAttributeInternalIPSubnet`][Self::useConfigurationAttributeInternalIPSubnet].
8875        #[unsafe(method(setUseConfigurationAttributeInternalIPSubnet:))]
8876        #[unsafe(method_family = none)]
8877        pub unsafe fn setUseConfigurationAttributeInternalIPSubnet(
8878            &self,
8879            use_configuration_attribute_internal_ip_subnet: bool,
8880        );
8881
8882        /// Parameters for the IKE SA
8883        #[unsafe(method(IKESecurityAssociationParameters))]
8884        #[unsafe(method_family = none)]
8885        pub unsafe fn IKESecurityAssociationParameters(
8886            &self,
8887        ) -> Retained<NEVPNIKEv2SecurityAssociationParameters>;
8888
8889        /// Parameters for the child SA
8890        #[unsafe(method(childSecurityAssociationParameters))]
8891        #[unsafe(method_family = none)]
8892        pub unsafe fn childSecurityAssociationParameters(
8893            &self,
8894        ) -> Retained<NEVPNIKEv2SecurityAssociationParameters>;
8895
8896        /// Disable MOBIKE negotiation. Default is NO.
8897        #[unsafe(method(disableMOBIKE))]
8898        #[unsafe(method_family = none)]
8899        pub unsafe fn disableMOBIKE(&self) -> bool;
8900
8901        /// Setter for [`disableMOBIKE`][Self::disableMOBIKE].
8902        #[unsafe(method(setDisableMOBIKE:))]
8903        #[unsafe(method_family = none)]
8904        pub unsafe fn setDisableMOBIKE(&self, disable_mobike: bool);
8905
8906        /// Disable Server Redirect. Default is NO.
8907        #[unsafe(method(disableRedirect))]
8908        #[unsafe(method_family = none)]
8909        pub unsafe fn disableRedirect(&self) -> bool;
8910
8911        /// Setter for [`disableRedirect`][Self::disableRedirect].
8912        #[unsafe(method(setDisableRedirect:))]
8913        #[unsafe(method_family = none)]
8914        pub unsafe fn setDisableRedirect(&self, disable_redirect: bool);
8915
8916        /// Enable Perfect Forward Secrecy. Default is NO.
8917        #[unsafe(method(enablePFS))]
8918        #[unsafe(method_family = none)]
8919        pub unsafe fn enablePFS(&self) -> bool;
8920
8921        /// Setter for [`enablePFS`][Self::enablePFS].
8922        #[unsafe(method(setEnablePFS:))]
8923        #[unsafe(method_family = none)]
8924        pub unsafe fn setEnablePFS(&self, enable_pfs: bool);
8925
8926        /// Enable certificate revocation check. Default is NO.
8927        #[unsafe(method(enableRevocationCheck))]
8928        #[unsafe(method_family = none)]
8929        pub unsafe fn enableRevocationCheck(&self) -> bool;
8930
8931        /// Setter for [`enableRevocationCheck`][Self::enableRevocationCheck].
8932        #[unsafe(method(setEnableRevocationCheck:))]
8933        #[unsafe(method_family = none)]
8934        pub unsafe fn setEnableRevocationCheck(&self, enable_revocation_check: bool);
8935
8936        /// Require positive certificate revocation check response for peer certificate validation to pass. Default is NO.
8937        #[unsafe(method(strictRevocationCheck))]
8938        #[unsafe(method_family = none)]
8939        pub unsafe fn strictRevocationCheck(&self) -> bool;
8940
8941        /// Setter for [`strictRevocationCheck`][Self::strictRevocationCheck].
8942        #[unsafe(method(setStrictRevocationCheck:))]
8943        #[unsafe(method_family = none)]
8944        pub unsafe fn setStrictRevocationCheck(&self, strict_revocation_check: bool);
8945
8946        /// Sets a minimum TLS version to allow for EAP-TLS authentication. Default is NEVPNIKEv2TLSVersionDefault.
8947        #[unsafe(method(minimumTLSVersion))]
8948        #[unsafe(method_family = none)]
8949        pub unsafe fn minimumTLSVersion(&self) -> NEVPNIKEv2TLSVersion;
8950
8951        /// Setter for [`minimumTLSVersion`][Self::minimumTLSVersion].
8952        #[unsafe(method(setMinimumTLSVersion:))]
8953        #[unsafe(method_family = none)]
8954        pub unsafe fn setMinimumTLSVersion(&self, minimum_tls_version: NEVPNIKEv2TLSVersion);
8955
8956        /// Sets a maximum TLS version to allow for EAP-TLS authentication. Default is NEVPNIKEv2TLSVersionDefault.
8957        #[unsafe(method(maximumTLSVersion))]
8958        #[unsafe(method_family = none)]
8959        pub unsafe fn maximumTLSVersion(&self) -> NEVPNIKEv2TLSVersion;
8960
8961        /// Setter for [`maximumTLSVersion`][Self::maximumTLSVersion].
8962        #[unsafe(method(setMaximumTLSVersion:))]
8963        #[unsafe(method_family = none)]
8964        pub unsafe fn setMaximumTLSVersion(&self, maximum_tls_version: NEVPNIKEv2TLSVersion);
8965
8966        /// Enable Fallback is used to support Wi-Fi Assist. Wi-Fi Assist allows connections for foreground apps to switch over
8967        /// to Cellular Data when WiFi connectivity is poor. By setting the EnableFallback key, the device will bring up a tunnel over
8968        /// Cellular Data to carry traffic that is eligible for Wi-Fi Assist and also requires VPN. Enabling fallback requires that the
8969        /// server support multiple tunnels for a single user. Default is NO.
8970        #[unsafe(method(enableFallback))]
8971        #[unsafe(method_family = none)]
8972        pub unsafe fn enableFallback(&self) -> bool;
8973
8974        /// Setter for [`enableFallback`][Self::enableFallback].
8975        #[unsafe(method(setEnableFallback:))]
8976        #[unsafe(method_family = none)]
8977        pub unsafe fn setEnableFallback(&self, enable_fallback: bool);
8978
8979        /// Maximum Transmission Unit (MTU) size in bytes to assign to the tunnel interface.
8980        #[unsafe(method(mtu))]
8981        #[unsafe(method_family = none)]
8982        pub unsafe fn mtu(&self) -> NSUInteger;
8983
8984        /// Setter for [`mtu`][Self::mtu].
8985        #[unsafe(method(setMtu:))]
8986        #[unsafe(method_family = none)]
8987        pub unsafe fn setMtu(&self, mtu: NSUInteger);
8988
8989        /// Configuration for the use of a Post-quantum Pre-shared Key (PPK).
8990        #[unsafe(method(ppkConfiguration))]
8991        #[unsafe(method_family = none)]
8992        pub unsafe fn ppkConfiguration(&self) -> Option<Retained<NEVPNIKEv2PPKConfiguration>>;
8993
8994        /// Setter for [`ppkConfiguration`][Self::ppkConfiguration].
8995        #[unsafe(method(setPpkConfiguration:))]
8996        #[unsafe(method_family = none)]
8997        pub unsafe fn setPpkConfiguration(
8998            &self,
8999            ppk_configuration: Option<&NEVPNIKEv2PPKConfiguration>,
9000        );
9001    );
9002}
9003
9004/// Methods declared on superclass `NSObject`.
9005impl NEVPNProtocolIKEv2 {
9006    extern_methods!(
9007        #[unsafe(method(init))]
9008        #[unsafe(method_family = init)]
9009        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9010
9011        #[unsafe(method(new))]
9012        #[unsafe(method_family = new)]
9013        pub unsafe fn new() -> Retained<Self>;
9014    );
9015}
9016
9017extern "C" {
9018    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/neapppusherrordomain?language=objc)
9019    pub static NEAppPushErrorDomain: &'static NSErrorDomain;
9020}
9021
9022/// App Push Manager error codes
9023///
9024/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neapppushmanagererror?language=objc)
9025#[repr(transparent)]
9026#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
9027pub struct NEAppPushManagerError(pub NSInteger);
9028impl NEAppPushManagerError {
9029    #[doc(alias = "NEAppPushManagerErrorConfigurationInvalid")]
9030    pub const ConfigurationInvalid: Self = Self(1);
9031    #[doc(alias = "NEAppPushManagerErrorConfigurationNotLoaded")]
9032    pub const ConfigurationNotLoaded: Self = Self(2);
9033    #[doc(alias = "NEAppPushManagerErrorInternalError")]
9034    pub const InternalError: Self = Self(3);
9035    #[doc(alias = "NEAppPushManagerErrorInactiveSession")]
9036    pub const InactiveSession: Self = Self(4);
9037}
9038
9039unsafe impl Encode for NEAppPushManagerError {
9040    const ENCODING: Encoding = NSInteger::ENCODING;
9041}
9042
9043unsafe impl RefEncode for NEAppPushManagerError {
9044    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
9045}
9046
9047extern_class!(
9048    /// The NEPrivateLTENetwork class declares an object that contains the parameters of a private LTE network.
9049    ///
9050    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neprivateltenetwork?language=objc)
9051    #[unsafe(super(NSObject))]
9052    #[derive(Debug, PartialEq, Eq, Hash)]
9053    pub struct NEPrivateLTENetwork;
9054);
9055
9056extern_conformance!(
9057    unsafe impl NSCoding for NEPrivateLTENetwork {}
9058);
9059
9060extern_conformance!(
9061    unsafe impl NSCopying for NEPrivateLTENetwork {}
9062);
9063
9064unsafe impl CopyingHelper for NEPrivateLTENetwork {
9065    type Result = Self;
9066}
9067
9068extern_conformance!(
9069    unsafe impl NSObjectProtocol for NEPrivateLTENetwork {}
9070);
9071
9072extern_conformance!(
9073    unsafe impl NSSecureCoding for NEPrivateLTENetwork {}
9074);
9075
9076impl NEPrivateLTENetwork {
9077    extern_methods!(
9078        /// Mobile Country Code of the private LTE network.
9079        #[unsafe(method(mobileCountryCode))]
9080        #[unsafe(method_family = none)]
9081        pub unsafe fn mobileCountryCode(&self) -> Retained<NSString>;
9082
9083        /// Setter for [`mobileCountryCode`][Self::mobileCountryCode].
9084        #[unsafe(method(setMobileCountryCode:))]
9085        #[unsafe(method_family = none)]
9086        pub unsafe fn setMobileCountryCode(&self, mobile_country_code: &NSString);
9087
9088        /// Mobile Network Code of the private LTE network.
9089        #[unsafe(method(mobileNetworkCode))]
9090        #[unsafe(method_family = none)]
9091        pub unsafe fn mobileNetworkCode(&self) -> Retained<NSString>;
9092
9093        /// Setter for [`mobileNetworkCode`][Self::mobileNetworkCode].
9094        #[unsafe(method(setMobileNetworkCode:))]
9095        #[unsafe(method_family = none)]
9096        pub unsafe fn setMobileNetworkCode(&self, mobile_network_code: &NSString);
9097
9098        /// Tracking Area Code of the private LTE network. This property is only applicable for band 48 private LTE networks.
9099        #[unsafe(method(trackingAreaCode))]
9100        #[unsafe(method_family = none)]
9101        pub unsafe fn trackingAreaCode(&self) -> Option<Retained<NSString>>;
9102
9103        /// Setter for [`trackingAreaCode`][Self::trackingAreaCode].
9104        #[unsafe(method(setTrackingAreaCode:))]
9105        #[unsafe(method_family = none)]
9106        pub unsafe fn setTrackingAreaCode(&self, tracking_area_code: Option<&NSString>);
9107    );
9108}
9109
9110/// Methods declared on superclass `NSObject`.
9111impl NEPrivateLTENetwork {
9112    extern_methods!(
9113        #[unsafe(method(init))]
9114        #[unsafe(method_family = init)]
9115        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9116
9117        #[unsafe(method(new))]
9118        #[unsafe(method_family = new)]
9119        pub unsafe fn new() -> Retained<Self>;
9120    );
9121}
9122
9123extern_class!(
9124    /// The NEAppPushManager class declares a programmatic interface to configure NEAppPushProvider.
9125    ///
9126    /// NEAppPushManager declares methods and properties for configuring and managing life cycle of app push provider.
9127    ///
9128    /// Instances of this class are thread safe.
9129    ///
9130    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neapppushmanager?language=objc)
9131    #[unsafe(super(NSObject))]
9132    #[derive(Debug, PartialEq, Eq, Hash)]
9133    pub struct NEAppPushManager;
9134);
9135
9136extern_conformance!(
9137    unsafe impl NSObjectProtocol for NEAppPushManager {}
9138);
9139
9140impl NEAppPushManager {
9141    extern_methods!(
9142        /// An array of Wi-Fi SSID strings. If the SSID string of current Wi-Fi network matches with one of these strings then the NEAppPushProvider
9143        /// is started. The upper limit of number of SSIDs is 10.
9144        #[unsafe(method(matchSSIDs))]
9145        #[unsafe(method_family = none)]
9146        pub unsafe fn matchSSIDs(&self) -> Retained<NSArray<NSString>>;
9147
9148        /// Setter for [`matchSSIDs`][Self::matchSSIDs].
9149        #[unsafe(method(setMatchSSIDs:))]
9150        #[unsafe(method_family = none)]
9151        pub unsafe fn setMatchSSIDs(&self, match_ssi_ds: &NSArray<NSString>);
9152
9153        /// An array of NEPrivateLTENetwork objects. If the properties of current private LTE network match with properties of one of these NEPrivateLTENetwork objects then the
9154        /// NEAppPushProvider is started. The upper limit of number of private LTE networks is 10. For private LTE networks that are not band 48, the device must be supervised in order to perform the match
9155        #[unsafe(method(matchPrivateLTENetworks))]
9156        #[unsafe(method_family = none)]
9157        pub unsafe fn matchPrivateLTENetworks(&self) -> Retained<NSArray<NEPrivateLTENetwork>>;
9158
9159        /// Setter for [`matchPrivateLTENetworks`][Self::matchPrivateLTENetworks].
9160        #[unsafe(method(setMatchPrivateLTENetworks:))]
9161        #[unsafe(method_family = none)]
9162        pub unsafe fn setMatchPrivateLTENetworks(
9163            &self,
9164            match_private_lte_networks: &NSArray<NEPrivateLTENetwork>,
9165        );
9166
9167        /// A dictionary containing vendor-specific key-value pairs, where the data type of values must be one of the data types supported by property list. Values of user defined data
9168        /// type are not supported. This dictionary is passed as-is to NEAppPushProvider when is it is started or notified for other specified reasons.
9169        #[unsafe(method(providerConfiguration))]
9170        #[unsafe(method_family = none)]
9171        pub unsafe fn providerConfiguration(&self) -> Retained<NSDictionary<NSString, AnyObject>>;
9172
9173        /// Setter for [`providerConfiguration`][Self::providerConfiguration].
9174        #[unsafe(method(setProviderConfiguration:))]
9175        #[unsafe(method_family = none)]
9176        pub unsafe fn setProviderConfiguration(
9177            &self,
9178            provider_configuration: &NSDictionary<NSString, AnyObject>,
9179        );
9180
9181        /// A string containing the bundle identifier of the NEAppPushProvider.
9182        #[unsafe(method(providerBundleIdentifier))]
9183        #[unsafe(method_family = none)]
9184        pub unsafe fn providerBundleIdentifier(&self) -> Option<Retained<NSString>>;
9185
9186        /// Setter for [`providerBundleIdentifier`][Self::providerBundleIdentifier].
9187        #[unsafe(method(setProviderBundleIdentifier:))]
9188        #[unsafe(method_family = none)]
9189        pub unsafe fn setProviderBundleIdentifier(
9190            &self,
9191            provider_bundle_identifier: Option<&NSString>,
9192        );
9193
9194        /// An instance of type NEAppPushDelegate that is required to receive incoming call informarion from the provider.
9195        #[unsafe(method(delegate))]
9196        #[unsafe(method_family = none)]
9197        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NEAppPushDelegate>>>;
9198
9199        /// This is a [weak property][objc2::topics::weak_property].
9200        /// Setter for [`delegate`][Self::delegate].
9201        #[unsafe(method(setDelegate:))]
9202        #[unsafe(method_family = none)]
9203        pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NEAppPushDelegate>>);
9204
9205        #[cfg(feature = "block2")]
9206        /// This class method asynchronously reads all of the saved configurations and returns them as an array of NEAppPushManager objects.
9207        ///
9208        /// Parameter `completionHandler`: A block that takes an array of NEAppPushManager objects. The array passed to the block may be empty if no configurations
9209        /// were successfully read from the disk. The NSError object passed to this block will be nil if the load operation succeeded, non-nil otherwise.
9210        #[unsafe(method(loadAllFromPreferencesWithCompletionHandler:))]
9211        #[unsafe(method_family = none)]
9212        pub unsafe fn loadAllFromPreferencesWithCompletionHandler(
9213            completion_handler: &block2::DynBlock<
9214                dyn Fn(*mut NSArray<NEAppPushManager>, *mut NSError),
9215            >,
9216        );
9217
9218        #[cfg(feature = "block2")]
9219        /// This method loads the saved configuration from the persistent store.
9220        ///
9221        /// Parameter `completionHandler`: A block that will be called when the load operation is completed. The NSError object passed to this block will be nil if the load operation succeeded, non-nil otherwise.
9222        #[unsafe(method(loadFromPreferencesWithCompletionHandler:))]
9223        #[unsafe(method_family = none)]
9224        pub unsafe fn loadFromPreferencesWithCompletionHandler(
9225            &self,
9226            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
9227        );
9228
9229        #[cfg(feature = "block2")]
9230        /// This method removes the configuration from the persistent store.
9231        ///
9232        /// Parameter `completionHandler`: A block that will be called when the remove operation is completed. The NSError object passed to this block will be nil if the remove operation succeeded, non-nil otherwise.
9233        #[unsafe(method(removeFromPreferencesWithCompletionHandler:))]
9234        #[unsafe(method_family = none)]
9235        pub unsafe fn removeFromPreferencesWithCompletionHandler(
9236            &self,
9237            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
9238        );
9239
9240        #[cfg(feature = "block2")]
9241        /// This method saves the configuration in the persistent store.
9242        ///
9243        /// Parameter `completionHandler`: A block that will be called when the save operation is completed. The NSError object passed to this block will be nil if the save operation succeeded, non-nil otherwise.
9244        #[unsafe(method(saveToPreferencesWithCompletionHandler:))]
9245        #[unsafe(method_family = none)]
9246        pub unsafe fn saveToPreferencesWithCompletionHandler(
9247            &self,
9248            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
9249        );
9250
9251        /// A string containing a description of the app push manager.
9252        #[unsafe(method(localizedDescription))]
9253        #[unsafe(method_family = none)]
9254        pub unsafe fn localizedDescription(&self) -> Option<Retained<NSString>>;
9255
9256        /// Setter for [`localizedDescription`][Self::localizedDescription].
9257        #[unsafe(method(setLocalizedDescription:))]
9258        #[unsafe(method_family = none)]
9259        pub unsafe fn setLocalizedDescription(&self, localized_description: Option<&NSString>);
9260
9261        /// Toggles the enabled status of the configuration. This property will be set to NO when the same app saves another configuration that overlaps with this configuration.
9262        #[unsafe(method(isEnabled))]
9263        #[unsafe(method_family = none)]
9264        pub unsafe fn isEnabled(&self) -> bool;
9265
9266        /// Setter for [`isEnabled`][Self::isEnabled].
9267        #[unsafe(method(setEnabled:))]
9268        #[unsafe(method_family = none)]
9269        pub unsafe fn setEnabled(&self, enabled: bool);
9270
9271        /// If set to YES, it indicates the associated configuration is in use. Use KVO to watch for changes.
9272        #[unsafe(method(isActive))]
9273        #[unsafe(method_family = none)]
9274        pub unsafe fn isActive(&self) -> bool;
9275    );
9276}
9277
9278/// Methods declared on superclass `NSObject`.
9279impl NEAppPushManager {
9280    extern_methods!(
9281        #[unsafe(method(init))]
9282        #[unsafe(method_family = init)]
9283        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9284
9285        #[unsafe(method(new))]
9286        #[unsafe(method_family = new)]
9287        pub unsafe fn new() -> Retained<Self>;
9288    );
9289}
9290
9291extern_protocol!(
9292    /// Delegate for NEAppPushManager.
9293    ///
9294    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neapppushdelegate?language=objc)
9295    pub unsafe trait NEAppPushDelegate: NSObjectProtocol {
9296        /// This delegate method is called when the provider reports incoming call using reportIncomingCommunicationWithUserInfo method.
9297        ///
9298        /// Parameter `userInfo`: A dictionary of custom information that the provider passes to reportIncomingCommunicationWithUserInfo method.
9299        #[unsafe(method(appPushManager:didReceiveIncomingCallWithUserInfo:))]
9300        #[unsafe(method_family = none)]
9301        unsafe fn appPushManager_didReceiveIncomingCallWithUserInfo(
9302            &self,
9303            manager: &NEAppPushManager,
9304            user_info: &NSDictionary,
9305        );
9306    }
9307);
9308
9309extern_class!(
9310    /// The NEAppPushProvider class declares a programmatic interface to manage a life cycle of app push provider. It also allows the provider to handle outgoing
9311    /// communication message from the containing app, and pass incoming call message to the containing app.
9312    /// NEAppPushProvider is part of NetworkExtension.framework
9313    ///
9314    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neapppushprovider?language=objc)
9315    #[unsafe(super(NEProvider, NSObject))]
9316    #[derive(Debug, PartialEq, Eq, Hash)]
9317    pub struct NEAppPushProvider;
9318);
9319
9320extern_conformance!(
9321    unsafe impl NSObjectProtocol for NEAppPushProvider {}
9322);
9323
9324impl NEAppPushProvider {
9325    extern_methods!(
9326        /// A dictionary containing current vendor-specific configuration parameters. This dictionary is provided by NEAppPushManager. Use KVO to watch for changes.
9327        #[unsafe(method(providerConfiguration))]
9328        #[unsafe(method_family = none)]
9329        pub unsafe fn providerConfiguration(
9330            &self,
9331        ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
9332
9333        #[cfg(feature = "block2")]
9334        /// This method is called by the framework when the provider is started. Subclasses must override this method to create a connection with its server.
9335        ///
9336        /// Parameter `completionHandler`: A block that must be called when the provider establishes a connection with the server. If the providers fails to create a connection,
9337        /// the subclass' implementation of this method must pass a non-nil NSError object to this block. A value of nil passed to the completion handler indicates that the connection
9338        /// was successfully created.
9339        #[deprecated]
9340        #[unsafe(method(startWithCompletionHandler:))]
9341        #[unsafe(method_family = none)]
9342        pub unsafe fn startWithCompletionHandler(
9343            &self,
9344            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
9345        );
9346
9347        /// This method is called by the framework when the provider is started. Subclasses must override this method to create a connection with its server.
9348        #[unsafe(method(start))]
9349        #[unsafe(method_family = none)]
9350        pub unsafe fn start(&self);
9351
9352        #[cfg(feature = "block2")]
9353        /// This method is called by the framework when the app push provider needs to be stopped. Subclasses must override this method to perform necessary tasks.
9354        ///
9355        /// Parameter `reason`: An NEProviderStopReason indicating why the provider was stopped.
9356        ///
9357        /// Parameter `completionHandler`: A block that must be called when the provider is completely stopped.
9358        #[unsafe(method(stopWithReason:completionHandler:))]
9359        #[unsafe(method_family = none)]
9360        pub unsafe fn stopWithReason_completionHandler(
9361            &self,
9362            reason: NEProviderStopReason,
9363            completion_handler: &block2::DynBlock<dyn Fn()>,
9364        );
9365
9366        /// This function is called by the provider when it determines incoming call on the conection.
9367        ///
9368        /// Parameter `userInfo`: A dictionary of custom information associated with the incoming call. This dictionary is passed to containg app as-is.
9369        #[unsafe(method(reportIncomingCallWithUserInfo:))]
9370        #[unsafe(method_family = none)]
9371        pub unsafe fn reportIncomingCallWithUserInfo(&self, user_info: &NSDictionary);
9372
9373        /// This function is called by the provider when it receives a Push to Talk message on the connection.
9374        ///
9375        /// Parameter `userInfo`: A dictionary of custom information associated with the Push to Talk message, such as the active remote participant. This dictionary is passed to the PTChannelManagerDelegate of the containing app if the user is joined to a Push to Talk channel.
9376        #[unsafe(method(reportPushToTalkMessageWithUserInfo:))]
9377        #[unsafe(method_family = none)]
9378        pub unsafe fn reportPushToTalkMessageWithUserInfo(&self, user_info: &NSDictionary);
9379
9380        /// This method is called by the framework periodically after every 60 seconds. Subclasses must override this method to perform necessary tasks.
9381        #[unsafe(method(handleTimerEvent))]
9382        #[unsafe(method_family = none)]
9383        pub unsafe fn handleTimerEvent(&self);
9384    );
9385}
9386
9387/// Methods declared on superclass `NSObject`.
9388impl NEAppPushProvider {
9389    extern_methods!(
9390        #[unsafe(method(init))]
9391        #[unsafe(method_family = init)]
9392        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9393
9394        #[unsafe(method(new))]
9395        #[unsafe(method_family = new)]
9396        pub unsafe fn new() -> Retained<Self>;
9397    );
9398}
9399
9400extern_class!(
9401    /// NWEndpoint is a generic class to represent network endpoints, such as a port on a remote server.
9402    ///
9403    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwendpoint?language=objc)
9404    #[unsafe(super(NSObject))]
9405    #[derive(Debug, PartialEq, Eq, Hash)]
9406    #[deprecated = "Use nw_endpoint_t in Network framework instead, see deprecation notice in <NetworkExtension/NWEndpoint.h>"]
9407    pub struct NWEndpoint;
9408);
9409
9410extern_conformance!(
9411    unsafe impl NSCoding for NWEndpoint {}
9412);
9413
9414extern_conformance!(
9415    unsafe impl NSCopying for NWEndpoint {}
9416);
9417
9418unsafe impl CopyingHelper for NWEndpoint {
9419    type Result = Self;
9420}
9421
9422extern_conformance!(
9423    unsafe impl NSObjectProtocol for NWEndpoint {}
9424);
9425
9426extern_conformance!(
9427    unsafe impl NSSecureCoding for NWEndpoint {}
9428);
9429
9430impl NWEndpoint {
9431    extern_methods!();
9432}
9433
9434/// Methods declared on superclass `NSObject`.
9435impl NWEndpoint {
9436    extern_methods!(
9437        #[unsafe(method(init))]
9438        #[unsafe(method_family = init)]
9439        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9440
9441        #[unsafe(method(new))]
9442        #[unsafe(method_family = new)]
9443        pub unsafe fn new() -> Retained<Self>;
9444    );
9445}
9446
9447extern_class!(
9448    /// NWHostEndpoint is a subclass of NWEndpoint. It represents an endpoint backed by a
9449    /// hostname and port. Note that a hostname string may be an IP or IPv6 address.
9450    ///
9451    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwhostendpoint?language=objc)
9452    #[unsafe(super(NWEndpoint, NSObject))]
9453    #[derive(Debug, PartialEq, Eq, Hash)]
9454    #[deprecated = "Use `nw_endpoint_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWHostEndpoint.h>"]
9455    pub struct NWHostEndpoint;
9456);
9457
9458extern_conformance!(
9459    unsafe impl NSCoding for NWHostEndpoint {}
9460);
9461
9462extern_conformance!(
9463    unsafe impl NSCopying for NWHostEndpoint {}
9464);
9465
9466unsafe impl CopyingHelper for NWHostEndpoint {
9467    type Result = Self;
9468}
9469
9470extern_conformance!(
9471    unsafe impl NSObjectProtocol for NWHostEndpoint {}
9472);
9473
9474extern_conformance!(
9475    unsafe impl NSSecureCoding for NWHostEndpoint {}
9476);
9477
9478impl NWHostEndpoint {
9479    extern_methods!(
9480        /// Parameter `hostname`: A string representation of the hostname or address, such as www.apple.com or 10.0.0.1.
9481        ///
9482        /// Parameter `port`: A string containing the port on the host, such as 80.
9483        ///
9484        /// Returns: An initialized NWHostEndpoint object.
9485        #[deprecated = "Use `nw_endpoint_create_host` in Network framework instead, see deprecation notice in <NetworkExtension/NWHostEndpoint.h>"]
9486        #[unsafe(method(endpointWithHostname:port:))]
9487        #[unsafe(method_family = none)]
9488        pub unsafe fn endpointWithHostname_port(
9489            hostname: &NSString,
9490            port: &NSString,
9491        ) -> Retained<Self>;
9492
9493        /// The endpoint's hostname.
9494        #[deprecated = "Use `nw_endpoint_get_hostname` in Network framework instead, see deprecation notice in <NetworkExtension/NWHostEndpoint.h>"]
9495        #[unsafe(method(hostname))]
9496        #[unsafe(method_family = none)]
9497        pub unsafe fn hostname(&self) -> Retained<NSString>;
9498
9499        /// The endpoint's port.
9500        #[deprecated = "Use `nw_endpoint_get_port` in Network framework instead, see deprecation notice in <NetworkExtension/NWHostEndpoint.h>"]
9501        #[unsafe(method(port))]
9502        #[unsafe(method_family = none)]
9503        pub unsafe fn port(&self) -> Retained<NSString>;
9504    );
9505}
9506
9507/// Methods declared on superclass `NSObject`.
9508impl NWHostEndpoint {
9509    extern_methods!(
9510        #[unsafe(method(init))]
9511        #[unsafe(method_family = init)]
9512        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9513
9514        #[unsafe(method(new))]
9515        #[unsafe(method_family = new)]
9516        pub unsafe fn new() -> Retained<Self>;
9517    );
9518}
9519
9520extern_class!(
9521    /// NWBonjourServiceEndpoint is a subclass of NWEndpoint. It represents an endpoint
9522    /// backed by a Bonjour service, specified with a name, type, and domain. For example, the
9523    /// Bonjour service MyMusicStudio._music._tcp.local. has the name "MyMusicStudio",
9524    /// the type "_music._tcp", and the domain "local".
9525    ///
9526    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwbonjourserviceendpoint?language=objc)
9527    #[unsafe(super(NWEndpoint, NSObject))]
9528    #[derive(Debug, PartialEq, Eq, Hash)]
9529    #[deprecated = "Use `nw_endpoint_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWBonjourServiceEndpoint.h>"]
9530    pub struct NWBonjourServiceEndpoint;
9531);
9532
9533extern_conformance!(
9534    unsafe impl NSCoding for NWBonjourServiceEndpoint {}
9535);
9536
9537extern_conformance!(
9538    unsafe impl NSCopying for NWBonjourServiceEndpoint {}
9539);
9540
9541unsafe impl CopyingHelper for NWBonjourServiceEndpoint {
9542    type Result = Self;
9543}
9544
9545extern_conformance!(
9546    unsafe impl NSObjectProtocol for NWBonjourServiceEndpoint {}
9547);
9548
9549extern_conformance!(
9550    unsafe impl NSSecureCoding for NWBonjourServiceEndpoint {}
9551);
9552
9553impl NWBonjourServiceEndpoint {
9554    extern_methods!(
9555        /// Parameter `name`: The Bonjour service name.
9556        ///
9557        /// Parameter `type`: The Bonjour service type.
9558        ///
9559        /// Parameter `domain`: The Bonjour service domain.
9560        ///
9561        /// Returns: An initialized NWBonjourServiceEndpoint object.
9562        #[deprecated = "Use `nw_endpoint_create_bonjour_service` in Network framework instead, see deprecation notice in <NetworkExtension/NWBonjourServiceEndpoint.h>"]
9563        #[unsafe(method(endpointWithName:type:domain:))]
9564        #[unsafe(method_family = none)]
9565        pub unsafe fn endpointWithName_type_domain(
9566            name: &NSString,
9567            r#type: &NSString,
9568            domain: &NSString,
9569        ) -> Retained<Self>;
9570
9571        /// The endpoint's Bonjour service name.
9572        #[deprecated = "Use `nw_endpoint_get_bonjour_service_name` in Network framework instead, see deprecation notice in <NetworkExtension/NWBonjourServiceEndpoint.h>"]
9573        #[unsafe(method(name))]
9574        #[unsafe(method_family = none)]
9575        pub unsafe fn name(&self) -> Retained<NSString>;
9576
9577        /// The endpoint's Bonjour service type.
9578        #[deprecated = "Use `nw_endpoint_get_bonjour_service_type` in Network framework instead, see deprecation notice in <NetworkExtension/NWBonjourServiceEndpoint.h>"]
9579        #[unsafe(method(type))]
9580        #[unsafe(method_family = none)]
9581        pub unsafe fn r#type(&self) -> Retained<NSString>;
9582
9583        /// The endpoint's Bonjour service domain.
9584        #[deprecated = "Use `nw_endpoint_get_bonjour_service_domain` in Network framework instead, see deprecation notice in <NetworkExtension/NWBonjourServiceEndpoint.h>"]
9585        #[unsafe(method(domain))]
9586        #[unsafe(method_family = none)]
9587        pub unsafe fn domain(&self) -> Retained<NSString>;
9588    );
9589}
9590
9591/// Methods declared on superclass `NSObject`.
9592impl NWBonjourServiceEndpoint {
9593    extern_methods!(
9594        #[unsafe(method(init))]
9595        #[unsafe(method_family = init)]
9596        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9597
9598        #[unsafe(method(new))]
9599        #[unsafe(method_family = new)]
9600        pub unsafe fn new() -> Retained<Self>;
9601    );
9602}
9603
9604/// Path status values
9605///
9606/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwpathstatus?language=objc)
9607// NS_ENUM
9608#[deprecated = "Use `nw_path_status_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWPath.h>"]
9609#[repr(transparent)]
9610#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
9611pub struct NWPathStatus(pub NSInteger);
9612impl NWPathStatus {
9613    #[doc(alias = "NWPathStatusInvalid")]
9614    #[deprecated = "Use `nw_path_status_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWPath.h>"]
9615    pub const Invalid: Self = Self(0);
9616    #[doc(alias = "NWPathStatusSatisfied")]
9617    #[deprecated = "Use `nw_path_status_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWPath.h>"]
9618    pub const Satisfied: Self = Self(1);
9619    #[doc(alias = "NWPathStatusUnsatisfied")]
9620    #[deprecated = "Use `nw_path_status_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWPath.h>"]
9621    pub const Unsatisfied: Self = Self(2);
9622    /// a connection attempt.
9623    #[doc(alias = "NWPathStatusSatisfiable")]
9624    #[deprecated = "Use `nw_path_status_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWPath.h>"]
9625    pub const Satisfiable: Self = Self(3);
9626}
9627
9628unsafe impl Encode for NWPathStatus {
9629    const ENCODING: Encoding = NSInteger::ENCODING;
9630}
9631
9632unsafe impl RefEncode for NWPathStatus {
9633    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
9634}
9635
9636extern_class!(
9637    /// A network path, represented with NWPath, expresses the viability status and
9638    /// properties of the path that a networking connection will take on the device. For example,
9639    /// if the path status is NWPathStatusSatisfied, then a connection could use that path.
9640    ///
9641    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwpath?language=objc)
9642    #[unsafe(super(NSObject))]
9643    #[derive(Debug, PartialEq, Eq, Hash)]
9644    #[deprecated = "Use `nw_path_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWPath.h>"]
9645    pub struct NWPath;
9646);
9647
9648extern_conformance!(
9649    unsafe impl NSObjectProtocol for NWPath {}
9650);
9651
9652impl NWPath {
9653    extern_methods!(
9654        /// The evaluated NWPathStatus of the NWPath.
9655        #[deprecated = "Use `nw_path_get_status` in Network framework instead, see deprecation notice in <NetworkExtension/NWPath.h>"]
9656        #[unsafe(method(status))]
9657        #[unsafe(method_family = none)]
9658        pub unsafe fn status(&self) -> NWPathStatus;
9659
9660        /// Returns YES if the path is considered expensive, as when using a cellular data plan.
9661        #[deprecated = "Use `nw_path_is_expensive` in Network framework instead, see deprecation notice in <NetworkExtension/NWPath.h>"]
9662        #[unsafe(method(isExpensive))]
9663        #[unsafe(method_family = none)]
9664        pub unsafe fn isExpensive(&self) -> bool;
9665
9666        /// Returns YES if the path is considered constrained, as when it is in save data mode.
9667        #[deprecated = "Use `nw_path_is_constrained` in Network framework instead, see deprecation notice in <NetworkExtension/NWPath.h>"]
9668        #[unsafe(method(isConstrained))]
9669        #[unsafe(method_family = none)]
9670        pub unsafe fn isConstrained(&self) -> bool;
9671
9672        /// Parameter `path`: An NWPath object to compare.
9673        ///
9674        /// Returns: YES if the two path objects have the same content, NO otherwise.
9675        #[deprecated = "Use `nw_path_is_equal` in Network framework instead, see deprecation notice in <NetworkExtension/NWPath.h>"]
9676        #[unsafe(method(isEqualToPath:))]
9677        #[unsafe(method_family = none)]
9678        pub unsafe fn isEqualToPath(&self, path: &NWPath) -> bool;
9679    );
9680}
9681
9682/// Methods declared on superclass `NSObject`.
9683impl NWPath {
9684    extern_methods!(
9685        #[unsafe(method(init))]
9686        #[unsafe(method_family = init)]
9687        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9688
9689        #[unsafe(method(new))]
9690        #[unsafe(method_family = new)]
9691        pub unsafe fn new() -> Retained<Self>;
9692    );
9693}
9694
9695/// Defined connection states. New types may be defined in the future.
9696///
9697/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwtcpconnectionstate?language=objc)
9698// NS_ENUM
9699#[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9700#[repr(transparent)]
9701#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
9702pub struct NWTCPConnectionState(pub NSInteger);
9703impl NWTCPConnectionState {
9704    #[doc(alias = "NWTCPConnectionStateInvalid")]
9705    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9706    pub const Invalid: Self = Self(0);
9707    #[doc(alias = "NWTCPConnectionStateConnecting")]
9708    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9709    pub const Connecting: Self = Self(1);
9710    /// waiting for better condition(s) before trying again.
9711    #[doc(alias = "NWTCPConnectionStateWaiting")]
9712    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9713    pub const Waiting: Self = Self(2);
9714    /// to transfer data. If TLS is in use, the TLS handshake would have finished when the connection
9715    /// is in this state.
9716    #[doc(alias = "NWTCPConnectionStateConnected")]
9717    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9718    pub const Connected: Self = Self(3);
9719    /// possible to transfer data. The application should call cancellation method to clean up resources
9720    /// when the connection is in this state.
9721    #[doc(alias = "NWTCPConnectionStateDisconnected")]
9722    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9723    pub const Disconnected: Self = Self(4);
9724    /// the cancellation method.
9725    #[doc(alias = "NWTCPConnectionStateCancelled")]
9726    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9727    pub const Cancelled: Self = Self(5);
9728}
9729
9730unsafe impl Encode for NWTCPConnectionState {
9731    const ENCODING: Encoding = NSInteger::ENCODING;
9732}
9733
9734unsafe impl RefEncode for NWTCPConnectionState {
9735    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
9736}
9737
9738extern_class!(
9739    /// Establish TCP connections to an endpoint, and send and receive data on the TCP connection.
9740    ///
9741    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwtcpconnection?language=objc)
9742    #[unsafe(super(NSObject))]
9743    #[derive(Debug, PartialEq, Eq, Hash)]
9744    #[deprecated = "Use `nw_connection_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9745    pub struct NWTCPConnection;
9746);
9747
9748extern_conformance!(
9749    unsafe impl NSObjectProtocol for NWTCPConnection {}
9750);
9751
9752impl NWTCPConnection {
9753    extern_methods!(
9754        /// This convenience initializer can be used to create a new connection that would only
9755        /// be connected if there exists a better path (as determined by the system) to the destination
9756        /// endpoint of the original connection. It will be initialized using the same destination endpoint
9757        /// and set of parameters from the original connection.
9758        ///
9759        /// If the original connection becomes disconnected or cancelled, the new "upgrade" connection
9760        /// would automatically be considered better.
9761        ///
9762        /// The caller should create an NWTCPConnection and watch for the hasBetterPath property.
9763        /// When this property is YES, the caller should attempt to create a new upgrade
9764        /// connection, with the goal to start transferring data on the new better path as soon as
9765        /// possible to reduce power and potentially monetary cost. When the new upgrade connection
9766        /// becomes connected and when the caller wraps up the previous caller session on
9767        /// the original connection, the caller can start using the new upgrade connection and
9768        /// tear down the original one.
9769        ///
9770        ///
9771        /// Parameter `connection`: The original connection from which the caller will upgrade
9772        ///
9773        /// Returns: An initialized NWTCPConnection
9774        #[deprecated = "Use `nw_connection_create` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9775        #[unsafe(method(initWithUpgradeForConnection:))]
9776        #[unsafe(method_family = init)]
9777        pub unsafe fn initWithUpgradeForConnection(
9778            this: Allocated<Self>,
9779            connection: &NWTCPConnection,
9780        ) -> Retained<Self>;
9781
9782        /// The status of the connection. Use KVO to watch this property to get updates.
9783        #[deprecated = "Use `nw_connection_set_state_changed_handler` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9784        #[unsafe(method(state))]
9785        #[unsafe(method_family = none)]
9786        pub unsafe fn state(&self) -> NWTCPConnectionState;
9787
9788        /// YES if the connection can read and write data, NO otherwise. Use KVO to watch this property.
9789        #[deprecated = "Use `nw_connection_set_viability_changed_handler` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9790        #[unsafe(method(isViable))]
9791        #[unsafe(method_family = none)]
9792        pub unsafe fn isViable(&self) -> bool;
9793
9794        /// YES if the system determines there is a better path the destination can be reached if
9795        /// the caller creates a new connection using the same endpoint and parameters. This can
9796        /// be done using the convenience upgrade initializer method.
9797        /// Use KVO to watch this property to get updates.
9798        #[deprecated = "Use `nw_connection_set_better_path_available_handler` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9799        #[unsafe(method(hasBetterPath))]
9800        #[unsafe(method_family = none)]
9801        pub unsafe fn hasBetterPath(&self) -> bool;
9802
9803        /// The destination endpoint with which this connection was created.
9804        #[deprecated = "Use `nw_connection_copy_endpoint` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9805        #[unsafe(method(endpoint))]
9806        #[unsafe(method_family = none)]
9807        pub unsafe fn endpoint(&self) -> Retained<NWEndpoint>;
9808
9809        /// The network path over which the connection was established. The caller can query
9810        /// additional properties from the NWPath object for more information.
9811        ///
9812        /// Note that this contains a snapshot of information at the time of connection establishment
9813        /// for this connection only. As a result, some underlying properties might change in time and
9814        /// might not reflect the path for other connections that might be established at different times.
9815        #[deprecated = "Use `nw_connection_copy_current_path` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9816        #[unsafe(method(connectedPath))]
9817        #[unsafe(method_family = none)]
9818        pub unsafe fn connectedPath(&self) -> Option<Retained<NWPath>>;
9819
9820        /// The IP address endpoint from which the connection was connected.
9821        #[deprecated = "Use `nw_path_copy_effective_local_endpoint` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9822        #[unsafe(method(localAddress))]
9823        #[unsafe(method_family = none)]
9824        pub unsafe fn localAddress(&self) -> Option<Retained<NWEndpoint>>;
9825
9826        /// The IP address endpoint to which the connection was connected.
9827        #[deprecated = "Use `nw_path_copy_effective_remote_endpoint` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9828        #[unsafe(method(remoteAddress))]
9829        #[unsafe(method_family = none)]
9830        pub unsafe fn remoteAddress(&self) -> Option<Retained<NWEndpoint>>;
9831
9832        /// When the connection is connected to a Bonjour service endpoint, the TXT record associated
9833        /// with the Bonjour service is available via this property. Beware that the value comes from
9834        /// the network. Care must be taken when parsing this potentially malicious value.
9835        #[deprecated = "Use `nw_endpoint_copy_txt_record` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9836        #[unsafe(method(txtRecord))]
9837        #[unsafe(method_family = none)]
9838        pub unsafe fn txtRecord(&self) -> Option<Retained<NSData>>;
9839
9840        /// The connection-wide error property indicates any fatal error that occurred while
9841        /// processing the connection or performing data reading or writing.
9842        #[deprecated = "Use `nw_connection_set_state_changed_handler` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9843        #[unsafe(method(error))]
9844        #[unsafe(method_family = none)]
9845        pub unsafe fn error(&self) -> Option<Retained<NSError>>;
9846
9847        /// Cancel the connection. This will clean up the resources associated with this object
9848        /// and transition this object to NWTCPConnectionStateCancelled state.
9849        #[deprecated = "Use `nw_connection_cancel` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9850        #[unsafe(method(cancel))]
9851        #[unsafe(method_family = none)]
9852        pub unsafe fn cancel(&self);
9853
9854        #[cfg(feature = "block2")]
9855        /// Read "length" number of bytes. See readMinimumLength:maximumLength:completionHandler:
9856        /// for a complete discussion of the callback behavior.
9857        ///
9858        /// Parameter `length`: The exact number of bytes the application wants to read
9859        ///
9860        /// Parameter `completion`: The completion handler to be invoked when there is data to read or an error occurred
9861        #[deprecated = "Use `nw_connection_receive` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9862        #[unsafe(method(readLength:completionHandler:))]
9863        #[unsafe(method_family = none)]
9864        pub unsafe fn readLength_completionHandler(
9865            &self,
9866            length: NSUInteger,
9867            completion: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
9868        );
9869
9870        #[cfg(feature = "block2")]
9871        /// Read the requested range of bytes. The completion handler will be invoked when:
9872        /// - Exactly "length" number of bytes have been read. 'data' will be non-nil.
9873        ///
9874        /// - Fewer than "length" number of bytes, including 0 bytes, have been read, and the connection's
9875        /// read side has been closed. 'data' might be nil, depending on whether there was any data to be
9876        /// read when the connection's read side was closed.
9877        ///
9878        /// - Some fatal error has occurred, and 'data' will be nil.
9879        ///
9880        /// To know when to schedule a read again, check for the condition whether an error has occurred.
9881        ///
9882        /// For better performance, the caller should pick the effective minimum and maximum lengths.
9883        /// For example, if the caller absolutely needs a specific number of bytes before it can
9884        /// make any progress, use that value as the minimum. The maximum bytes can be the upperbound
9885        /// that the caller wants to read. Typically, the minimum length can be the caller
9886        /// protocol fixed-size header and the maximum length can be the maximum size of the payload or
9887        /// the size of the current read buffer.
9888        ///
9889        ///
9890        /// Parameter `minimum`: The minimum number of bytes the caller wants to read
9891        ///
9892        /// Parameter `maximum`: The maximum number of bytes the caller wants to read
9893        ///
9894        /// Parameter `completion`: The completion handler to be invoked when there is data to read or an error occurred
9895        #[deprecated = "Use `nw_connection_receive` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9896        #[unsafe(method(readMinimumLength:maximumLength:completionHandler:))]
9897        #[unsafe(method_family = none)]
9898        pub unsafe fn readMinimumLength_maximumLength_completionHandler(
9899            &self,
9900            minimum: NSUInteger,
9901            maximum: NSUInteger,
9902            completion: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
9903        );
9904
9905        #[cfg(feature = "block2")]
9906        /// Write the given data object content. Callers should wait until the completionHandler is executed
9907        /// before issuing another write.
9908        ///
9909        /// Parameter `data`: The data object whose content will be written
9910        ///
9911        /// Parameter `completion`: The completion handler to be invoked when the data content has been written or an error has occurred.
9912        /// If the error is nil, the write succeeded and the caller can write more data.
9913        #[deprecated = "Use `nw_connection_send` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9914        #[unsafe(method(write:completionHandler:))]
9915        #[unsafe(method_family = none)]
9916        pub unsafe fn write_completionHandler(
9917            &self,
9918            data: &NSData,
9919            completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
9920        );
9921
9922        /// Close this connection's write side such that further write requests won't succeed.
9923        /// Note that this has the effect of closing the read side of the peer connection.
9924        /// When the connection's read side and write side are closed, the connection is considered
9925        /// disconnected and will transition to the appropriate state.
9926        #[deprecated = "Use `nw_connection_send` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9927        #[unsafe(method(writeClose))]
9928        #[unsafe(method_family = none)]
9929        pub unsafe fn writeClose(&self);
9930    );
9931}
9932
9933/// Methods declared on superclass `NSObject`.
9934impl NWTCPConnection {
9935    extern_methods!(
9936        #[unsafe(method(init))]
9937        #[unsafe(method_family = init)]
9938        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9939
9940        #[unsafe(method(new))]
9941        #[unsafe(method_family = new)]
9942        pub unsafe fn new() -> Retained<Self>;
9943    );
9944}
9945
9946extern_protocol!(
9947    /// Allows the caller to take custom actions on some connection events.
9948    ///
9949    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwtcpconnectionauthenticationdelegate?language=objc)
9950    #[deprecated = "Use `sec_protocol_options_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9951    pub unsafe trait NWTCPConnectionAuthenticationDelegate: NSObjectProtocol {
9952        /// The caller can implement this optional protocol method to decide whether it
9953        /// wants to provide the identity for this connection for authentication. If this delegate
9954        /// method is not implemented, the return value will default to YES if
9955        /// provideIdentityForConnection:completionHandler: is implemented.
9956        ///
9957        /// Parameter `connection`: The connection sending this message
9958        ///
9959        /// Returns: YES to provide the identity for this connection, in which case, the delegate method
9960        /// provideIdentityForConnection:completionHandler: will be called.
9961        #[deprecated = "Use `sec_protocol_options_set_challenge_block` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9962        #[optional]
9963        #[unsafe(method(shouldProvideIdentityForConnection:))]
9964        #[unsafe(method_family = none)]
9965        unsafe fn shouldProvideIdentityForConnection(&self, connection: &NWTCPConnection) -> bool;
9966
9967        #[cfg(all(feature = "block2", feature = "objc2-security"))]
9968        /// The caller can implement this optional protocol method to provide the identity
9969        /// and an optional certificate chain to be used for authentication.
9970        ///
9971        /// Parameter `connection`: The connection sending this message
9972        ///
9973        /// Parameter `completion`: The completion handler for passing identity and certificate chain to the connection.
9974        /// The "identity" argument is required and must not be nil. The "certificateChain" argument is optional,
9975        /// and is an array of one or more SecCertificateRef objects. The certificate chain must contain objects
9976        /// of type SecCertificateRef only. If the certificate chain is set, it will be used. Otherwise, the leaf
9977        /// certificate will be extracted from the SecIdentityRef object and will be used for authentication.
9978        ///
9979        /// The caller is responsible for keeping the argument object(s) alive for the duration of the
9980        /// completion handler invocation.
9981        #[deprecated = "Use `sec_protocol_options_set_challenge_block` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9982        #[optional]
9983        #[unsafe(method(provideIdentityForConnection:completionHandler:))]
9984        #[unsafe(method_family = none)]
9985        unsafe fn provideIdentityForConnection_completionHandler(
9986            &self,
9987            connection: &NWTCPConnection,
9988            completion: &block2::DynBlock<
9989                dyn Fn(NonNull<SecIdentity>, NonNull<NSArray<AnyObject>>),
9990            >,
9991        );
9992
9993        /// The caller can implement this optional protocol method to decide whether it
9994        /// wants to take over the default trust evaluation for this connection. If this delegate method
9995        /// is not implemented, the return value will default to YES if
9996        /// provideIdentityForConnection:completionHandler: is implemented.
9997        ///
9998        /// Parameter `connection`: The connection sending this message
9999        ///
10000        /// Returns: YES to take over the default trust evaluation, in which case, the delegate method
10001        /// evaluateTrustForConnection:peerCertificateChain:completionHandler: will be called.
10002        #[deprecated = "Use `sec_protocol_options_set_verify_block` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
10003        #[optional]
10004        #[unsafe(method(shouldEvaluateTrustForConnection:))]
10005        #[unsafe(method_family = none)]
10006        unsafe fn shouldEvaluateTrustForConnection(&self, connection: &NWTCPConnection) -> bool;
10007
10008        #[cfg(all(feature = "block2", feature = "objc2-security"))]
10009        /// The caller can implement this optional protocol method to set up custom policies
10010        /// for peer certificate trust evaluation. If the delegate method is implemented, the caller
10011        /// is responsible for creating and setting up the SecTrustRef object and passing it to the
10012        /// completion handler. Otherwise, the default trust evaluation policy is used for the connection.
10013        ///
10014        /// Parameter `connection`: The connection sending this message
10015        ///
10016        /// Parameter `peerCertificateChain`: The peer certificate chain
10017        ///
10018        /// Parameter `completion`: The completion handler for passing the SecTrustRef object to the connection.
10019        /// The SecTrustRef object "trust" is required and must not be nil. It will be evaluated using
10020        /// SecTrustEvaluate() if necessary. The caller is responsible for keeping the argument object
10021        /// alive for the duration of the completion handler invocation.
10022        #[deprecated = "Use `sec_protocol_options_set_verify_block` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
10023        #[optional]
10024        #[unsafe(method(evaluateTrustForConnection:peerCertificateChain:completionHandler:))]
10025        #[unsafe(method_family = none)]
10026        unsafe fn evaluateTrustForConnection_peerCertificateChain_completionHandler(
10027            &self,
10028            connection: &NWTCPConnection,
10029            peer_certificate_chain: &NSArray<AnyObject>,
10030            completion: &block2::DynBlock<dyn Fn(NonNull<SecTrust>)>,
10031        );
10032    }
10033);
10034
10035/// UDP session state values
10036///
10037/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwudpsessionstate?language=objc)
10038// NS_ENUM
10039#[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
10040#[repr(transparent)]
10041#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
10042pub struct NWUDPSessionState(pub NSInteger);
10043impl NWUDPSessionState {
10044    #[doc(alias = "NWUDPSessionStateInvalid")]
10045    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
10046    pub const Invalid: Self = Self(0);
10047    /// attempting to make the session ready.
10048    #[doc(alias = "NWUDPSessionStateWaiting")]
10049    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
10050    pub const Waiting: Self = Self(1);
10051    #[doc(alias = "NWUDPSessionStatePreparing")]
10052    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
10053    pub const Preparing: Self = Self(2);
10054    #[doc(alias = "NWUDPSessionStateReady")]
10055    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
10056    pub const Ready: Self = Self(3);
10057    /// at this time, either due to problems with the path or the client rejecting the
10058    /// endpoints.
10059    #[doc(alias = "NWUDPSessionStateFailed")]
10060    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
10061    pub const Failed: Self = Self(4);
10062    #[doc(alias = "NWUDPSessionStateCancelled")]
10063    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
10064    pub const Cancelled: Self = Self(5);
10065}
10066
10067unsafe impl Encode for NWUDPSessionState {
10068    const ENCODING: Encoding = NSInteger::ENCODING;
10069}
10070
10071unsafe impl RefEncode for NWUDPSessionState {
10072    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
10073}
10074
10075extern_class!(
10076    /// Open UDP datagram sessions to an endpoint, and send and receive datagrams.
10077    ///
10078    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwudpsession?language=objc)
10079    #[unsafe(super(NSObject))]
10080    #[derive(Debug, PartialEq, Eq, Hash)]
10081    #[deprecated = "Use `nw_connection_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
10082    pub struct NWUDPSession;
10083);
10084
10085extern_conformance!(
10086    unsafe impl NSObjectProtocol for NWUDPSession {}
10087);
10088
10089impl NWUDPSession {
10090    extern_methods!(
10091        /// This convenience initializer can be used to create a new session based on the
10092        /// original session's endpoint and parameters.
10093        ///
10094        /// The application should create an NWUDPSession and watch the "hasBetterPath" property.
10095        /// When this property is YES, it should call initWithUpgradeForSession: to create a new
10096        /// session, with the goal to start transferring data on the new better path as soon as
10097        /// possible to reduce power and potentially monetary cost. When the new "upgrade" session
10098        /// becomes ready and when the application wraps up the previous application session on
10099        /// the original session, the application can start using the new "upgrade" session and
10100        /// tear down the original one.
10101        ///
10102        ///
10103        /// Parameter `session`: The original session from which the application will upgrade
10104        ///
10105        /// Returns: An initialized NWUDPSession object.
10106        #[deprecated = "Use `nw_connection_create` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
10107        #[unsafe(method(initWithUpgradeForSession:))]
10108        #[unsafe(method_family = init)]
10109        pub unsafe fn initWithUpgradeForSession(
10110            this: Allocated<Self>,
10111            session: &NWUDPSession,
10112        ) -> Retained<Self>;
10113
10114        /// The current state of the UDP session. If the state is NWUDPSessionStateReady,
10115        /// then the connection is eligible for reading and writing. The state will be
10116        /// NWUDPSessionStateFailed if the endpoint could not be resolved, or all endpoints have been
10117        /// rejected. Use KVO to watch for changes.
10118        #[deprecated = "Use `nw_connection_set_state_changed_handler` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
10119        #[unsafe(method(state))]
10120        #[unsafe(method_family = none)]
10121        pub unsafe fn state(&self) -> NWUDPSessionState;
10122
10123        /// The provided endpoint.
10124        #[deprecated = "Use `nw_connection_copy_endpoint` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
10125        #[unsafe(method(endpoint))]
10126        #[unsafe(method_family = none)]
10127        pub unsafe fn endpoint(&self) -> Retained<NWEndpoint>;
10128
10129        /// The currently targeted remote endpoint. Use KVO to watch for changes.
10130        #[deprecated = "Use `nw_connection_copy_current_path` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
10131        #[unsafe(method(resolvedEndpoint))]
10132        #[unsafe(method_family = none)]
10133        pub unsafe fn resolvedEndpoint(&self) -> Option<Retained<NWEndpoint>>;
10134
10135        /// YES if the connection can read and write data, NO otherwise.
10136        /// Use KVO to watch this property.
10137        #[deprecated = "Use `nw_connection_set_viability_changed_handler` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
10138        #[unsafe(method(isViable))]
10139        #[unsafe(method_family = none)]
10140        pub unsafe fn isViable(&self) -> bool;
10141
10142        /// YES if there is another path available that is preferred over the currentPath.
10143        /// To take advantage of this path, create a new UDPSession. Use KVO to watch for changes.
10144        #[deprecated = "Use `nw_connection_set_better_path_available_handler` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
10145        #[unsafe(method(hasBetterPath))]
10146        #[unsafe(method_family = none)]
10147        pub unsafe fn hasBetterPath(&self) -> bool;
10148
10149        /// The current evaluated path for the resolvedEndpoint. Use KVO to watch for changes.
10150        #[deprecated = "Use `nw_connection_copy_current_path` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
10151        #[unsafe(method(currentPath))]
10152        #[unsafe(method_family = none)]
10153        pub unsafe fn currentPath(&self) -> Option<Retained<NWPath>>;
10154
10155        /// Mark the current value of resolvedEndpoint as unusable, and try to switch to the
10156        /// next available endpoint. This should be used when the caller has attempted to communicate
10157        /// with the current resolvedEndpoint, and the caller has determined that it is unusable. If
10158        /// there are no other resolved endpoints, the session will move to the failed state.
10159        #[deprecated = "Use `nw_connection_cancel_current_endpoint` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
10160        #[unsafe(method(tryNextResolvedEndpoint))]
10161        #[unsafe(method_family = none)]
10162        pub unsafe fn tryNextResolvedEndpoint(&self);
10163
10164        /// The maximum size of a datagram to be written currently. If a datagram is written
10165        /// with a longer length, the datagram may be fragmented or encounter an error. Note that this
10166        /// value is not guaranteed to be the maximum datagram length for end-to-end communication
10167        /// across the network. Use KVO to watch for changes.
10168        #[deprecated = "Use `nw_connection_get_maximum_datagram_size` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
10169        #[unsafe(method(maximumDatagramLength))]
10170        #[unsafe(method_family = none)]
10171        pub unsafe fn maximumDatagramLength(&self) -> NSUInteger;
10172
10173        #[cfg(feature = "block2")]
10174        /// Set a read handler for datagrams. Reads will be scheduled by the system, so this
10175        /// method only needs to be called once for a session.
10176        ///
10177        /// Parameter `handler`: A handler called when datagrams have been read, or when an error has occurred.
10178        ///
10179        /// Parameter `maxDatagrams`: The maximum number of datagrams to send to the handler.
10180        #[deprecated = "Use `nw_connection_receive` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
10181        #[unsafe(method(setReadHandler:maxDatagrams:))]
10182        #[unsafe(method_family = none)]
10183        pub unsafe fn setReadHandler_maxDatagrams(
10184            &self,
10185            handler: &block2::DynBlock<dyn Fn(*mut NSArray<NSData>, *mut NSError)>,
10186            max_datagrams: NSUInteger,
10187        );
10188
10189        #[cfg(feature = "block2")]
10190        /// Write multiple datagrams. Callers should wait until the completionHandler is executed
10191        /// before issuing another write.
10192        ///
10193        /// Parameter `datagramArray`: An NSArray of NSData objects, containing the ordered list datagrams to write.
10194        ///
10195        /// Parameter `completionHandler`: A handler called when the write request has either succeeded or failed.
10196        #[deprecated = "Use `nw_connection_send` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
10197        #[unsafe(method(writeMultipleDatagrams:completionHandler:))]
10198        #[unsafe(method_family = none)]
10199        pub unsafe fn writeMultipleDatagrams_completionHandler(
10200            &self,
10201            datagram_array: &NSArray<NSData>,
10202            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
10203        );
10204
10205        #[cfg(feature = "block2")]
10206        /// Write a single datagram. Callers should wait until the completionHandler is executed
10207        /// before issuing another write.
10208        ///
10209        /// Parameter `datagram`: An NSData containing the datagram to write.
10210        ///
10211        /// Parameter `completionHandler`: A handler called when the write request has either succeeded or failed.
10212        #[deprecated = "Use `nw_connection_send` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
10213        #[unsafe(method(writeDatagram:completionHandler:))]
10214        #[unsafe(method_family = none)]
10215        pub unsafe fn writeDatagram_completionHandler(
10216            &self,
10217            datagram: &NSData,
10218            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
10219        );
10220
10221        /// Move into the NWUDPSessionStateCancelled state. The connection will be terminated,
10222        /// and all handlers will be cancelled.
10223        #[deprecated = "Use `nw_connection_cancel` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
10224        #[unsafe(method(cancel))]
10225        #[unsafe(method_family = none)]
10226        pub unsafe fn cancel(&self);
10227    );
10228}
10229
10230/// Methods declared on superclass `NSObject`.
10231impl NWUDPSession {
10232    extern_methods!(
10233        #[unsafe(method(init))]
10234        #[unsafe(method_family = init)]
10235        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
10236
10237        #[unsafe(method(new))]
10238        #[unsafe(method_family = new)]
10239        pub unsafe fn new() -> Retained<Self>;
10240    );
10241}
10242
10243extern_class!(
10244    /// DEPRECATION NOTICE
10245    ///
10246    /// NW object wrappers are hidden in Swift 6. To continue accessing them, you
10247    /// can prepend double underscores to the symbol name.
10248    ///
10249    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwtlsparameters?language=objc)
10250    #[unsafe(super(NSObject))]
10251    #[derive(Debug, PartialEq, Eq, Hash)]
10252    #[deprecated = "Use `sec_protocol_options_t` in Security framework instead, see deprecation notice in <NetworkExtension/NWTLSParameters.h>"]
10253    pub struct NWTLSParameters;
10254);
10255
10256extern_conformance!(
10257    unsafe impl NSObjectProtocol for NWTLSParameters {}
10258);
10259
10260impl NWTLSParameters {
10261    extern_methods!(
10262        /// The session ID for the associated connection, used for TLS session resumption.
10263        /// This property is optional when using TLS.
10264        #[deprecated = "Use `sec_protocol_options_set_tls_resumption_enabled` in Security framework instead, see deprecation notice in <NetworkExtension/NWTLSParameters.h>"]
10265        #[unsafe(method(TLSSessionID))]
10266        #[unsafe(method_family = none)]
10267        pub unsafe fn TLSSessionID(&self) -> Option<Retained<NSData>>;
10268
10269        /// Setter for [`TLSSessionID`][Self::TLSSessionID].
10270        #[deprecated = "Use `sec_protocol_options_set_tls_resumption_enabled` in Security framework instead, see deprecation notice in <NetworkExtension/NWTLSParameters.h>"]
10271        #[unsafe(method(setTLSSessionID:))]
10272        #[unsafe(method_family = none)]
10273        pub unsafe fn setTLSSessionID(&self, tls_session_id: Option<&NSData>);
10274
10275        /// The set of allowed cipher suites, as defined in
10276        /// <Security
10277        /// /CipherSuite.h>.
10278        /// If set to nil, the default cipher suites will be used.
10279        #[deprecated = "Use `sec_protocol_options_append_tls_ciphersuite` in Security framework instead, see deprecation notice in <NetworkExtension/NWTLSParameters.h>"]
10280        #[unsafe(method(SSLCipherSuites))]
10281        #[unsafe(method_family = none)]
10282        pub unsafe fn SSLCipherSuites(&self) -> Option<Retained<NSSet<NSNumber>>>;
10283
10284        /// Setter for [`SSLCipherSuites`][Self::SSLCipherSuites].
10285        #[deprecated = "Use `sec_protocol_options_append_tls_ciphersuite` in Security framework instead, see deprecation notice in <NetworkExtension/NWTLSParameters.h>"]
10286        #[unsafe(method(setSSLCipherSuites:))]
10287        #[unsafe(method_family = none)]
10288        pub unsafe fn setSSLCipherSuites(&self, ssl_cipher_suites: Option<&NSSet<NSNumber>>);
10289
10290        /// The minimum allowed SSLProtocol value. as defined in
10291        /// <Security
10292        /// /SecureTransport.h>.
10293        /// If set, the SSL handshake will not accept any protocol version older than the minimum.
10294        #[deprecated = "Use `sec_protocol_options_set_min_tls_protocol_version` in Security framework instead, see deprecation notice in <NetworkExtension/NWTLSParameters.h>"]
10295        #[unsafe(method(minimumSSLProtocolVersion))]
10296        #[unsafe(method_family = none)]
10297        pub unsafe fn minimumSSLProtocolVersion(&self) -> NSUInteger;
10298
10299        /// Setter for [`minimumSSLProtocolVersion`][Self::minimumSSLProtocolVersion].
10300        #[deprecated = "Use `sec_protocol_options_set_min_tls_protocol_version` in Security framework instead, see deprecation notice in <NetworkExtension/NWTLSParameters.h>"]
10301        #[unsafe(method(setMinimumSSLProtocolVersion:))]
10302        #[unsafe(method_family = none)]
10303        pub unsafe fn setMinimumSSLProtocolVersion(&self, minimum_ssl_protocol_version: NSUInteger);
10304
10305        /// The maximum allowed SSLProtocol value. as defined in
10306        /// <Security
10307        /// /SecureTransport.h>.
10308        /// If set, the SSL handshake will not accept any protocol version newer than the maximum.
10309        /// This property should be used with caution, since it may limit the use of preferred
10310        /// SSL protocols.
10311        #[deprecated = "Use `sec_protocol_options_set_max_tls_protocol_version` in Security framework instead, see deprecation notice in <NetworkExtension/NWTLSParameters.h>"]
10312        #[unsafe(method(maximumSSLProtocolVersion))]
10313        #[unsafe(method_family = none)]
10314        pub unsafe fn maximumSSLProtocolVersion(&self) -> NSUInteger;
10315
10316        /// Setter for [`maximumSSLProtocolVersion`][Self::maximumSSLProtocolVersion].
10317        #[deprecated = "Use `sec_protocol_options_set_max_tls_protocol_version` in Security framework instead, see deprecation notice in <NetworkExtension/NWTLSParameters.h>"]
10318        #[unsafe(method(setMaximumSSLProtocolVersion:))]
10319        #[unsafe(method_family = none)]
10320        pub unsafe fn setMaximumSSLProtocolVersion(&self, maximum_ssl_protocol_version: NSUInteger);
10321    );
10322}
10323
10324/// Methods declared on superclass `NSObject`.
10325impl NWTLSParameters {
10326    extern_methods!(
10327        #[unsafe(method(init))]
10328        #[unsafe(method_family = init)]
10329        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
10330
10331        #[unsafe(method(new))]
10332        #[unsafe(method_family = new)]
10333        pub unsafe fn new() -> Retained<Self>;
10334    );
10335}