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;
26use objc2::__framework_prelude::*;
27use objc2_foundation::*;
28#[cfg(feature = "objc2-security")]
29use objc2_security::*;
30
31use crate::*;
32
33/// Flow error codes
34///
35/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neappproxyflowerror?language=objc)
36// NS_ENUM
37#[repr(transparent)]
38#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
39pub struct NEAppProxyFlowError(pub NSInteger);
40impl NEAppProxyFlowError {
41    #[doc(alias = "NEAppProxyFlowErrorNotConnected")]
42    pub const NotConnected: Self = Self(1);
43    #[doc(alias = "NEAppProxyFlowErrorPeerReset")]
44    pub const PeerReset: Self = Self(2);
45    #[doc(alias = "NEAppProxyFlowErrorHostUnreachable")]
46    pub const HostUnreachable: Self = Self(3);
47    #[doc(alias = "NEAppProxyFlowErrorInvalidArgument")]
48    pub const InvalidArgument: Self = Self(4);
49    #[doc(alias = "NEAppProxyFlowErrorAborted")]
50    pub const Aborted: Self = Self(5);
51    #[doc(alias = "NEAppProxyFlowErrorRefused")]
52    pub const Refused: Self = Self(6);
53    #[doc(alias = "NEAppProxyFlowErrorTimedOut")]
54    pub const TimedOut: Self = Self(7);
55    #[doc(alias = "NEAppProxyFlowErrorInternal")]
56    pub const Internal: Self = Self(8);
57    #[doc(alias = "NEAppProxyFlowErrorDatagramTooLarge")]
58    pub const DatagramTooLarge: Self = Self(9);
59    #[doc(alias = "NEAppProxyFlowErrorReadAlreadyPending")]
60    pub const ReadAlreadyPending: Self = Self(10);
61}
62
63unsafe impl Encode for NEAppProxyFlowError {
64    const ENCODING: Encoding = NSInteger::ENCODING;
65}
66
67unsafe impl RefEncode for NEAppProxyFlowError {
68    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
69}
70
71extern "C" {
72    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/neappproxyerrordomain?language=objc)
73    pub static NEAppProxyErrorDomain: &'static NSString;
74}
75
76extern_class!(
77    /// The NEAppProxyFlow class is an abstract base class that declares the programmatic interface for a flow of network data.
78    ///
79    /// NEAppProxyFlow is part of NetworkExtension.framework.
80    ///
81    /// Instances of this class are thread safe.
82    ///
83    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neappproxyflow?language=objc)
84    #[unsafe(super(NSObject))]
85    #[derive(Debug, PartialEq, Eq, Hash)]
86    pub struct NEAppProxyFlow;
87);
88
89unsafe impl NSObjectProtocol for NEAppProxyFlow {}
90
91impl NEAppProxyFlow {
92    extern_methods!(
93        #[cfg(feature = "block2")]
94        /// This function is used by an NEProvider implementation to indicate that it is ready to handle flow data.
95        ///
96        /// 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.
97        ///
98        /// 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.
99        #[deprecated]
100        #[unsafe(method(openWithLocalEndpoint:completionHandler:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn openWithLocalEndpoint_completionHandler(
103            &self,
104            local_endpoint: Option<&NWHostEndpoint>,
105            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
106        );
107
108        /// This function is used by an NEProvider implementation to indicate that it does not want to receive any more data from the flow.
109        ///
110        /// Parameter `error`: An error in NEAppProxyErrorDomain that should be passed to the flow's source application.
111        #[unsafe(method(closeReadWithError:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn closeReadWithError(&self, error: Option<&NSError>);
114
115        /// This functions is used by an NEProvider implementation to indicate that it does not have any more data to write to the flow.
116        ///
117        /// Parameter `error`: An error in NEAppProxyErrorDomain that should be passed to the flow's source application.
118        #[unsafe(method(closeWriteWithError:))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn closeWriteWithError(&self, error: Option<&NSError>);
121
122        /// An NEFlowMetaData object containing meta data for the flow.
123        #[unsafe(method(metaData))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn metaData(&self) -> Retained<NEFlowMetaData>;
126
127        /// 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
128        /// remote hostname.
129        #[unsafe(method(remoteHostname))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn remoteHostname(&self) -> Option<Retained<NSString>>;
132
133        /// YES if the flow was bound by the application to a specific interface (contained in the networkInterface property), NO otherwise.
134        #[unsafe(method(isBound))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn isBound(&self) -> bool;
137    );
138}
139
140/// Methods declared on superclass `NSObject`.
141impl NEAppProxyFlow {
142    extern_methods!(
143        #[unsafe(method(init))]
144        #[unsafe(method_family = init)]
145        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
146
147        #[unsafe(method(new))]
148        #[unsafe(method_family = new)]
149        pub unsafe fn new() -> Retained<Self>;
150    );
151}
152
153/// Provider stop reasons
154///
155/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neproviderstopreason?language=objc)
156// NS_ENUM
157#[repr(transparent)]
158#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
159pub struct NEProviderStopReason(pub NSInteger);
160impl NEProviderStopReason {
161    #[doc(alias = "NEProviderStopReasonNone")]
162    pub const None: Self = Self(0);
163    #[doc(alias = "NEProviderStopReasonUserInitiated")]
164    pub const UserInitiated: Self = Self(1);
165    #[doc(alias = "NEProviderStopReasonProviderFailed")]
166    pub const ProviderFailed: Self = Self(2);
167    #[doc(alias = "NEProviderStopReasonNoNetworkAvailable")]
168    pub const NoNetworkAvailable: Self = Self(3);
169    #[doc(alias = "NEProviderStopReasonUnrecoverableNetworkChange")]
170    pub const UnrecoverableNetworkChange: Self = Self(4);
171    #[doc(alias = "NEProviderStopReasonProviderDisabled")]
172    pub const ProviderDisabled: Self = Self(5);
173    #[doc(alias = "NEProviderStopReasonAuthenticationCanceled")]
174    pub const AuthenticationCanceled: Self = Self(6);
175    #[doc(alias = "NEProviderStopReasonConfigurationFailed")]
176    pub const ConfigurationFailed: Self = Self(7);
177    #[doc(alias = "NEProviderStopReasonIdleTimeout")]
178    pub const IdleTimeout: Self = Self(8);
179    #[doc(alias = "NEProviderStopReasonConfigurationDisabled")]
180    pub const ConfigurationDisabled: Self = Self(9);
181    #[doc(alias = "NEProviderStopReasonConfigurationRemoved")]
182    pub const ConfigurationRemoved: Self = Self(10);
183    #[doc(alias = "NEProviderStopReasonSuperceded")]
184    pub const Superceded: Self = Self(11);
185    #[doc(alias = "NEProviderStopReasonUserLogout")]
186    pub const UserLogout: Self = Self(12);
187    #[doc(alias = "NEProviderStopReasonUserSwitch")]
188    pub const UserSwitch: Self = Self(13);
189    #[doc(alias = "NEProviderStopReasonConnectionFailed")]
190    pub const ConnectionFailed: Self = Self(14);
191    #[doc(alias = "NEProviderStopReasonSleep")]
192    pub const Sleep: Self = Self(15);
193    #[doc(alias = "NEProviderStopReasonAppUpdate")]
194    pub const AppUpdate: Self = Self(16);
195    #[doc(alias = "NEProviderStopReasonInternalError")]
196    pub const InternalError: Self = Self(17);
197}
198
199unsafe impl Encode for NEProviderStopReason {
200    const ENCODING: Encoding = NSInteger::ENCODING;
201}
202
203unsafe impl RefEncode for NEProviderStopReason {
204    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
205}
206
207extern_class!(
208    /// The NEProvider class declares the programmatic interface that is common for all Network Extension providers.
209    ///
210    /// See the sub classes of NEProvider for more details. Developers of Network Extension providers should create sub classes of the sub classes of NEProvider.
211    ///
212    /// Instances of this class are thread safe.
213    ///
214    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neprovider?language=objc)
215    #[unsafe(super(NSObject))]
216    #[derive(Debug, PartialEq, Eq, Hash)]
217    pub struct NEProvider;
218);
219
220unsafe impl NSObjectProtocol for NEProvider {}
221
222impl NEProvider {
223    extern_methods!(
224        #[cfg(feature = "block2")]
225        /// 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.
226        ///
227        /// Parameter `completionHandler`: When the method is finished handling the sleep event it must execute this completion handler.
228        #[unsafe(method(sleepWithCompletionHandler:))]
229        #[unsafe(method_family = none)]
230        pub unsafe fn sleepWithCompletionHandler(
231            &self,
232            completion_handler: &block2::Block<dyn Fn()>,
233        );
234
235        /// 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.
236        #[unsafe(method(wake))]
237        #[unsafe(method_family = none)]
238        pub unsafe fn wake(&self);
239
240        /// 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.
241        ///
242        /// Parameter `remoteEndpoint`: An NWEndpoint object that specifies the remote network endpoint to connect to.
243        ///
244        /// Parameter `enableTLS`: A flag indicating if a TLS session should be negotiated on the connection.
245        ///
246        /// 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.
247        ///
248        /// Parameter `delegate`: An object to use as the connections delegate. This object should conform to the NWTCPConnectionAuthenticationDelegate protocol.
249        ///
250        /// Returns: An NWTCPConnection object.
251        #[deprecated = "Use nw_connection_t in Network framework instead"]
252        #[unsafe(method(createTCPConnectionToEndpoint:enableTLS:TLSParameters:delegate:))]
253        #[unsafe(method_family = none)]
254        pub unsafe fn createTCPConnectionToEndpoint_enableTLS_TLSParameters_delegate(
255            &self,
256            remote_endpoint: &NWEndpoint,
257            enable_tls: bool,
258            tls_parameters: Option<&NWTLSParameters>,
259            delegate: Option<&AnyObject>,
260        ) -> Retained<NWTCPConnection>;
261
262        /// 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.
263        ///
264        /// Parameter `remoteEndpoint`: An NWEndpoint object that specifies the remote endpoint to which UDP datagrams will be sent by the UDP session.
265        ///
266        /// Parameter `localEndpoint`: An NWHostEndpoint object that specifies the local IP address endpoint to use as the source endpoint of the UDP session.
267        ///
268        /// Returns: An NWUDPSession object.
269        #[deprecated = "Use nw_connection_t in Network framework instead"]
270        #[unsafe(method(createUDPSessionToEndpoint:fromEndpoint:))]
271        #[unsafe(method_family = none)]
272        pub unsafe fn createUDPSessionToEndpoint_fromEndpoint(
273            &self,
274            remote_endpoint: &NWEndpoint,
275            local_endpoint: Option<&NWHostEndpoint>,
276        ) -> Retained<NWUDPSession>;
277
278        #[cfg(feature = "block2")]
279        /// This method can be called by subclass implementations to display a message to the user.
280        ///
281        /// Parameter `message`: The message to be displayed.
282        ///
283        /// 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.
284        #[deprecated]
285        #[unsafe(method(displayMessage:completionHandler:))]
286        #[unsafe(method_family = none)]
287        pub unsafe fn displayMessage_completionHandler(
288            &self,
289            message: &NSString,
290            completion_handler: &block2::Block<dyn Fn(Bool)>,
291        );
292
293        /// Start the Network Extension machinery in a system extension (.system bundle). This class method will cause the calling system extension to start handling
294        /// requests from nesessionmanager to instantiate appropriate NEProvider sub-class instances. The system extension must declare a mapping of Network Extension extension points to
295        /// NEProvider sub-class instances in its Info.plist:
296        /// Key: NetworkExtension
297        /// Type: Dictionary containing information about the NetworkExtension capabilities of the system extension.
298        ///
299        /// Key: NEProviderClasses
300        /// Type: Dictionary mapping NetworkExtension extension point identifiers to NEProvider sub-classes
301        ///
302        /// Example:
303        ///
304        /// <key
305        /// >NetworkExtension
306        /// </key
307        /// >
308        /// <dict
309        /// >
310        /// <key
311        /// >NEProviderClasses
312        /// </key
313        /// >
314        /// <dict
315        /// >
316        /// <key
317        /// >com.apple.networkextension.app-proxy
318        /// </key
319        /// >
320        /// <string
321        /// >$(PRODUCT_MODULE_NAME).AppProxyProvider
322        /// </string
323        /// >
324        /// <key
325        /// >com.apple.networkextension.filter-data
326        /// </key
327        /// >
328        /// <string
329        /// >$(PRODUCT_MODULE_NAME).FilterDataProvider
330        /// </string
331        /// >
332        /// </dict
333        /// >
334        /// </dict
335        /// >
336        ///
337        /// This method should be called as early as possible after the system extension starts.
338        #[unsafe(method(startSystemExtensionMode))]
339        #[unsafe(method_family = none)]
340        pub unsafe fn startSystemExtensionMode();
341
342        /// The current default path for connections created by the provider. Use KVO to watch for network changes.
343        #[deprecated = "Use nw_path_monitor_t in Network framework instead"]
344        #[unsafe(method(defaultPath))]
345        #[unsafe(method_family = none)]
346        pub unsafe fn defaultPath(&self) -> Option<Retained<NWPath>>;
347    );
348}
349
350/// Methods declared on superclass `NSObject`.
351impl NEProvider {
352    extern_methods!(
353        #[unsafe(method(init))]
354        #[unsafe(method_family = init)]
355        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
356
357        #[unsafe(method(new))]
358        #[unsafe(method_family = new)]
359        pub unsafe fn new() -> Retained<Self>;
360    );
361}
362
363/// Tunnel Provider error codes
364///
365/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netunnelprovidererror?language=objc)
366// NS_ENUM
367#[repr(transparent)]
368#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
369pub struct NETunnelProviderError(pub NSInteger);
370impl NETunnelProviderError {
371    #[doc(alias = "NETunnelProviderErrorNetworkSettingsInvalid")]
372    pub const NetworkSettingsInvalid: Self = Self(1);
373    #[doc(alias = "NETunnelProviderErrorNetworkSettingsCanceled")]
374    pub const NetworkSettingsCanceled: Self = Self(2);
375    #[doc(alias = "NETunnelProviderErrorNetworkSettingsFailed")]
376    pub const NetworkSettingsFailed: Self = Self(3);
377}
378
379unsafe impl Encode for NETunnelProviderError {
380    const ENCODING: Encoding = NSInteger::ENCODING;
381}
382
383unsafe impl RefEncode for NETunnelProviderError {
384    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
385}
386
387/// Network traffic routing methods.
388///
389/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netunnelproviderroutingmethod?language=objc)
390// NS_ENUM
391#[repr(transparent)]
392#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
393pub struct NETunnelProviderRoutingMethod(pub NSInteger);
394impl NETunnelProviderRoutingMethod {
395    #[doc(alias = "NETunnelProviderRoutingMethodDestinationIP")]
396    pub const DestinationIP: Self = Self(1);
397    #[doc(alias = "NETunnelProviderRoutingMethodSourceApplication")]
398    pub const SourceApplication: Self = Self(2);
399    #[doc(alias = "NETunnelProviderRoutingMethodNetworkRule")]
400    pub const NetworkRule: Self = Self(3);
401}
402
403unsafe impl Encode for NETunnelProviderRoutingMethod {
404    const ENCODING: Encoding = NSInteger::ENCODING;
405}
406
407unsafe impl RefEncode for NETunnelProviderRoutingMethod {
408    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
409}
410
411extern "C" {
412    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/netunnelprovidererrordomain?language=objc)
413    pub static NETunnelProviderErrorDomain: &'static NSString;
414}
415
416extern_class!(
417    /// The NETunnelProvider class declares the programmatic interface for an object that provides a network tunnel service.
418    ///
419    /// Instances of this class are thread safe.
420    ///
421    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netunnelprovider?language=objc)
422    #[unsafe(super(NEProvider, NSObject))]
423    #[derive(Debug, PartialEq, Eq, Hash)]
424    pub struct NETunnelProvider;
425);
426
427unsafe impl NSObjectProtocol for NETunnelProvider {}
428
429impl NETunnelProvider {
430    extern_methods!(
431        #[cfg(feature = "block2")]
432        /// 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.
433        ///
434        /// Parameter `messageData`: An NSData object containing the message sent by the container app.
435        ///
436        /// 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.
437        #[unsafe(method(handleAppMessage:completionHandler:))]
438        #[unsafe(method_family = none)]
439        pub unsafe fn handleAppMessage_completionHandler(
440            &self,
441            message_data: &NSData,
442            completion_handler: Option<&block2::Block<dyn Fn(*mut NSData)>>,
443        );
444
445        #[cfg(feature = "block2")]
446        /// 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.
447        ///
448        /// Parameter `tunnelNetworkSettings`: An NETunnelNetworkSettings object containing all of the desired network settings for the tunnel. Pass nil to clear out the current network settings.
449        ///
450        /// 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.
451        #[unsafe(method(setTunnelNetworkSettings:completionHandler:))]
452        #[unsafe(method_family = none)]
453        pub unsafe fn setTunnelNetworkSettings_completionHandler(
454            &self,
455            tunnel_network_settings: Option<&NETunnelNetworkSettings>,
456            completion_handler: Option<&block2::Block<dyn Fn(*mut NSError)>>,
457        );
458
459        /// 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.
460        #[unsafe(method(protocolConfiguration))]
461        #[unsafe(method_family = none)]
462        pub unsafe fn protocolConfiguration(&self) -> Retained<NEVPNProtocol>;
463
464        /// 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.
465        #[unsafe(method(appRules))]
466        #[unsafe(method_family = none)]
467        pub unsafe fn appRules(&self) -> Option<Retained<NSArray<NEAppRule>>>;
468
469        /// The method by which network traffic is routed to the tunnel. The default is NETunnelProviderRoutingMethodDestinationIP.
470        #[unsafe(method(routingMethod))]
471        #[unsafe(method_family = none)]
472        pub unsafe fn routingMethod(&self) -> NETunnelProviderRoutingMethod;
473
474        /// 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.
475        #[unsafe(method(reasserting))]
476        #[unsafe(method_family = none)]
477        pub unsafe fn reasserting(&self) -> bool;
478
479        /// Setter for [`reasserting`][Self::reasserting].
480        #[unsafe(method(setReasserting:))]
481        #[unsafe(method_family = none)]
482        pub unsafe fn setReasserting(&self, reasserting: bool);
483    );
484}
485
486/// Methods declared on superclass `NSObject`.
487impl NETunnelProvider {
488    extern_methods!(
489        #[unsafe(method(init))]
490        #[unsafe(method_family = init)]
491        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
492
493        #[unsafe(method(new))]
494        #[unsafe(method_family = new)]
495        pub unsafe fn new() -> Retained<Self>;
496    );
497}
498
499extern_class!(
500    /// The NEAppProxyProvider class declares the programmatic interface for an object that implements the client side of a custom network proxy solution.
501    ///
502    /// NEAppProxyProvider is part of NetworkExtension.framework
503    ///
504    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neappproxyprovider?language=objc)
505    #[unsafe(super(NETunnelProvider, NEProvider, NSObject))]
506    #[derive(Debug, PartialEq, Eq, Hash)]
507    pub struct NEAppProxyProvider;
508);
509
510unsafe impl NSObjectProtocol for NEAppProxyProvider {}
511
512impl NEAppProxyProvider {
513    extern_methods!(
514        #[cfg(feature = "block2")]
515        /// 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.
516        ///
517        /// 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.
518        ///
519        /// 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.
520        #[unsafe(method(startProxyWithOptions:completionHandler:))]
521        #[unsafe(method_family = none)]
522        pub unsafe fn startProxyWithOptions_completionHandler(
523            &self,
524            options: Option<&NSDictionary<NSString, AnyObject>>,
525            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
526        );
527
528        #[cfg(feature = "block2")]
529        /// 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.
530        ///
531        /// Parameter `reason`: An NEProviderStopReason indicating why the proxy is being stopped.
532        ///
533        /// Parameter `completionHandler`: A block that must be called when the proxy is completely stopped.
534        #[unsafe(method(stopProxyWithReason:completionHandler:))]
535        #[unsafe(method_family = none)]
536        pub unsafe fn stopProxyWithReason_completionHandler(
537            &self,
538            reason: NEProviderStopReason,
539            completion_handler: &block2::Block<dyn Fn()>,
540        );
541
542        /// 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.
543        ///
544        /// Parameter `error`: An NSError object containing details about the error that the proxy provider implementation encountered.
545        #[unsafe(method(cancelProxyWithError:))]
546        #[unsafe(method_family = none)]
547        pub unsafe fn cancelProxyWithError(&self, error: Option<&NSError>);
548
549        /// 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.
550        ///
551        /// Parameter `flow`: The new flow
552        ///
553        /// 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.
554        #[unsafe(method(handleNewFlow:))]
555        #[unsafe(method_family = none)]
556        pub unsafe fn handleNewFlow(&self, flow: &NEAppProxyFlow) -> bool;
557
558        /// 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
559        /// 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
560        /// 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.
561        /// In this case the proxy implementation is responsible for retaining the NEAppProxyUDPFlow object.
562        /// The default implementation of this method calls -[NEAppProxyProvider handleNewFlow:] and returns its result.
563        ///
564        /// Parameter `flow`: The new UDP flow
565        ///
566        /// Parameter `remoteEndpoint`: The initial remote endpoint provided by the proxied app when the flow was opened.
567        ///
568        /// 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.
569        #[deprecated]
570        #[unsafe(method(handleNewUDPFlow:initialRemoteEndpoint:))]
571        #[unsafe(method_family = none)]
572        pub unsafe fn handleNewUDPFlow_initialRemoteEndpoint(
573            &self,
574            flow: &NEAppProxyUDPFlow,
575            remote_endpoint: &NWEndpoint,
576        ) -> bool;
577    );
578}
579
580/// Methods declared on superclass `NSObject`.
581impl NEAppProxyProvider {
582    extern_methods!(
583        #[unsafe(method(init))]
584        #[unsafe(method_family = init)]
585        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
586
587        #[unsafe(method(new))]
588        #[unsafe(method_family = new)]
589        pub unsafe fn new() -> Retained<Self>;
590    );
591}
592
593/// VPN error codes
594///
595/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnerror?language=objc)
596// NS_ENUM
597#[repr(transparent)]
598#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
599pub struct NEVPNError(pub NSInteger);
600impl NEVPNError {
601    #[doc(alias = "NEVPNErrorConfigurationInvalid")]
602    pub const ConfigurationInvalid: Self = Self(1);
603    #[doc(alias = "NEVPNErrorConfigurationDisabled")]
604    pub const ConfigurationDisabled: Self = Self(2);
605    #[doc(alias = "NEVPNErrorConnectionFailed")]
606    pub const ConnectionFailed: Self = Self(3);
607    #[doc(alias = "NEVPNErrorConfigurationStale")]
608    pub const ConfigurationStale: Self = Self(4);
609    #[doc(alias = "NEVPNErrorConfigurationReadWriteFailed")]
610    pub const ConfigurationReadWriteFailed: Self = Self(5);
611    #[doc(alias = "NEVPNErrorConfigurationUnknown")]
612    pub const ConfigurationUnknown: Self = Self(6);
613}
614
615unsafe impl Encode for NEVPNError {
616    const ENCODING: Encoding = NSInteger::ENCODING;
617}
618
619unsafe impl RefEncode for NEVPNError {
620    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
621}
622
623extern "C" {
624    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnerrordomain?language=objc)
625    pub static NEVPNErrorDomain: &'static NSString;
626}
627
628extern "C" {
629    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnconfigurationchangenotification?language=objc)
630    pub static NEVPNConfigurationChangeNotification: &'static NSString;
631}
632
633extern_class!(
634    /// The NEVPNManager class declares the programmatic interface for an object that manages Virtual Private Network (VPN) configurations.
635    ///
636    /// NEVPNManager declares methods and properties for configuring and controlling a VPN.
637    ///
638    /// Instances of this class are thread safe.
639    ///
640    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnmanager?language=objc)
641    #[unsafe(super(NSObject))]
642    #[derive(Debug, PartialEq, Eq, Hash)]
643    pub struct NEVPNManager;
644);
645
646unsafe impl NSObjectProtocol for NEVPNManager {}
647
648impl NEVPNManager {
649    extern_methods!(
650        /// Returns: The singleton NEVPNManager object for the calling process.
651        #[unsafe(method(sharedManager))]
652        #[unsafe(method_family = none)]
653        pub unsafe fn sharedManager() -> Retained<NEVPNManager>;
654
655        #[cfg(feature = "block2")]
656        /// This function loads the current VPN configuration from the caller's VPN preferences.
657        ///
658        /// 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.
659        #[unsafe(method(loadFromPreferencesWithCompletionHandler:))]
660        #[unsafe(method_family = none)]
661        pub unsafe fn loadFromPreferencesWithCompletionHandler(
662            &self,
663            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
664        );
665
666        #[cfg(feature = "block2")]
667        /// 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.
668        ///
669        /// 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.
670        #[unsafe(method(removeFromPreferencesWithCompletionHandler:))]
671        #[unsafe(method_family = none)]
672        pub unsafe fn removeFromPreferencesWithCompletionHandler(
673            &self,
674            completion_handler: Option<&block2::Block<dyn Fn(*mut NSError)>>,
675        );
676
677        #[cfg(feature = "block2")]
678        /// 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.
679        ///
680        ///
681        /// 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.
682        #[unsafe(method(saveToPreferencesWithCompletionHandler:))]
683        #[unsafe(method_family = none)]
684        pub unsafe fn saveToPreferencesWithCompletionHandler(
685            &self,
686            completion_handler: Option<&block2::Block<dyn Fn(*mut NSError)>>,
687        );
688
689        #[cfg(feature = "objc2-security")]
690        /// This function sets an authorization object that can be used to obtain the authorization rights necessary to modify the system VPN configuration.
691        ///
692        /// Parameter `authorization`: The AuthorizationRef to use to obtain rights.
693        #[unsafe(method(setAuthorization:))]
694        #[unsafe(method_family = none)]
695        pub unsafe fn setAuthorization(&self, authorization: AuthorizationRef);
696
697        /// An array of NEOnDemandRule objects.
698        #[unsafe(method(onDemandRules))]
699        #[unsafe(method_family = none)]
700        pub unsafe fn onDemandRules(&self) -> Option<Retained<NSArray<NEOnDemandRule>>>;
701
702        /// Setter for [`onDemandRules`][Self::onDemandRules].
703        #[unsafe(method(setOnDemandRules:))]
704        #[unsafe(method_family = none)]
705        pub unsafe fn setOnDemandRules(&self, on_demand_rules: Option<&NSArray<NEOnDemandRule>>);
706
707        /// Toggles VPN On Demand.
708        #[unsafe(method(isOnDemandEnabled))]
709        #[unsafe(method_family = none)]
710        pub unsafe fn isOnDemandEnabled(&self) -> bool;
711
712        /// Setter for [`isOnDemandEnabled`][Self::isOnDemandEnabled].
713        #[unsafe(method(setOnDemandEnabled:))]
714        #[unsafe(method_family = none)]
715        pub unsafe fn setOnDemandEnabled(&self, on_demand_enabled: bool);
716
717        /// A string containing a description of the VPN.
718        #[unsafe(method(localizedDescription))]
719        #[unsafe(method_family = none)]
720        pub unsafe fn localizedDescription(&self) -> Option<Retained<NSString>>;
721
722        /// Setter for [`localizedDescription`][Self::localizedDescription].
723        #[unsafe(method(setLocalizedDescription:))]
724        #[unsafe(method_family = none)]
725        pub unsafe fn setLocalizedDescription(&self, localized_description: Option<&NSString>);
726
727        /// An NEVPNProtocol object containing the protocol-specific portion of the VPN configuration.
728        #[deprecated]
729        #[unsafe(method(protocol))]
730        #[unsafe(method_family = none)]
731        pub unsafe fn protocol(&self) -> Option<Retained<NEVPNProtocol>>;
732
733        /// Setter for [`protocol`][Self::protocol].
734        #[deprecated]
735        #[unsafe(method(setProtocol:))]
736        #[unsafe(method_family = none)]
737        pub unsafe fn setProtocol(&self, protocol: Option<&NEVPNProtocol>);
738
739        /// An NEVPNProtocol object containing the protocol-specific portion of the VPN configuration.
740        #[unsafe(method(protocolConfiguration))]
741        #[unsafe(method_family = none)]
742        pub unsafe fn protocolConfiguration(&self) -> Option<Retained<NEVPNProtocol>>;
743
744        /// Setter for [`protocolConfiguration`][Self::protocolConfiguration].
745        #[unsafe(method(setProtocolConfiguration:))]
746        #[unsafe(method_family = none)]
747        pub unsafe fn setProtocolConfiguration(
748            &self,
749            protocol_configuration: Option<&NEVPNProtocol>,
750        );
751
752        /// The NEVPNConnection object used for controlling the VPN tunnel.
753        #[unsafe(method(connection))]
754        #[unsafe(method_family = none)]
755        pub unsafe fn connection(&self) -> Retained<NEVPNConnection>;
756
757        /// 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.
758        #[unsafe(method(isEnabled))]
759        #[unsafe(method_family = none)]
760        pub unsafe fn isEnabled(&self) -> bool;
761
762        /// Setter for [`isEnabled`][Self::isEnabled].
763        #[unsafe(method(setEnabled:))]
764        #[unsafe(method_family = none)]
765        pub unsafe fn setEnabled(&self, enabled: bool);
766    );
767}
768
769/// Methods declared on superclass `NSObject`.
770impl NEVPNManager {
771    extern_methods!(
772        #[unsafe(method(init))]
773        #[unsafe(method_family = init)]
774        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
775
776        #[unsafe(method(new))]
777        #[unsafe(method_family = new)]
778        pub unsafe fn new() -> Retained<Self>;
779    );
780}
781
782extern_class!(
783    /// The NETunnelProviderManager class declares the programmatic interface for an object that is used to configure and control network tunnels provided by NETunnelProviders.
784    ///
785    /// Instances of this class are thread safe.
786    ///
787    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netunnelprovidermanager?language=objc)
788    #[unsafe(super(NEVPNManager, NSObject))]
789    #[derive(Debug, PartialEq, Eq, Hash)]
790    pub struct NETunnelProviderManager;
791);
792
793unsafe impl NSObjectProtocol for NETunnelProviderManager {}
794
795impl NETunnelProviderManager {
796    extern_methods!(
797        #[cfg(feature = "block2")]
798        /// 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.
799        ///
800        /// 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.
801        #[unsafe(method(loadAllFromPreferencesWithCompletionHandler:))]
802        #[unsafe(method_family = none)]
803        pub unsafe fn loadAllFromPreferencesWithCompletionHandler(
804            completion_handler: &block2::Block<
805                dyn Fn(*mut NSArray<NETunnelProviderManager>, *mut NSError),
806            >,
807        );
808
809        /// Create a NETunnelProviderManager instance that is used to manage a per-app VPN configuration.
810        #[unsafe(method(forPerAppVPN))]
811        #[unsafe(method_family = none)]
812        pub unsafe fn forPerAppVPN() -> Retained<Self>;
813
814        /// This function returns an array of NEAppRule objects.
815        #[unsafe(method(copyAppRules))]
816        #[unsafe(method_family = copy)]
817        pub unsafe fn copyAppRules(&self) -> Option<Retained<NSArray<NEAppRule>>>;
818
819        /// The method by which network traffic is routed to the tunnel. The default is NETunnelProviderRoutingMethodDestinationIP.
820        #[unsafe(method(routingMethod))]
821        #[unsafe(method_family = none)]
822        pub unsafe fn routingMethod(&self) -> NETunnelProviderRoutingMethod;
823
824        /// 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,
825        /// the web site network traffic is routed through the per-app VPN.
826        #[unsafe(method(safariDomains))]
827        #[unsafe(method_family = none)]
828        pub unsafe fn safariDomains(&self) -> Retained<NSArray<NSString>>;
829
830        /// Setter for [`safariDomains`][Self::safariDomains].
831        #[unsafe(method(setSafariDomains:))]
832        #[unsafe(method_family = none)]
833        pub unsafe fn setSafariDomains(&self, safari_domains: &NSArray<NSString>);
834
835        /// 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
836        /// one of these domains are routed through the per-app VPN.
837        #[unsafe(method(mailDomains))]
838        #[unsafe(method_family = none)]
839        pub unsafe fn mailDomains(&self) -> Retained<NSArray<NSString>>;
840
841        /// Setter for [`mailDomains`][Self::mailDomains].
842        #[unsafe(method(setMailDomains:))]
843        #[unsafe(method_family = none)]
844        pub unsafe fn setMailDomains(&self, mail_domains: &NSArray<NSString>);
845
846        /// 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
847        /// these domains are routed through the per-app VPN.
848        #[unsafe(method(calendarDomains))]
849        #[unsafe(method_family = none)]
850        pub unsafe fn calendarDomains(&self) -> Retained<NSArray<NSString>>;
851
852        /// Setter for [`calendarDomains`][Self::calendarDomains].
853        #[unsafe(method(setCalendarDomains:))]
854        #[unsafe(method_family = none)]
855        pub unsafe fn setCalendarDomains(&self, calendar_domains: &NSArray<NSString>);
856
857        /// 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
858        /// domains are routed through the per-app VPN.
859        #[unsafe(method(contactsDomains))]
860        #[unsafe(method_family = none)]
861        pub unsafe fn contactsDomains(&self) -> Retained<NSArray<NSString>>;
862
863        /// Setter for [`contactsDomains`][Self::contactsDomains].
864        #[unsafe(method(setContactsDomains:))]
865        #[unsafe(method_family = none)]
866        pub unsafe fn setContactsDomains(&self, contacts_domains: &NSArray<NSString>);
867
868        #[unsafe(method(appRules))]
869        #[unsafe(method_family = none)]
870        pub unsafe fn appRules(&self) -> Retained<NSArray<NEAppRule>>;
871
872        /// Setter for [`appRules`][Self::appRules].
873        #[unsafe(method(setAppRules:))]
874        #[unsafe(method_family = none)]
875        pub unsafe fn setAppRules(&self, app_rules: &NSArray<NEAppRule>);
876
877        /// per-app VPN.
878        #[unsafe(method(excludedDomains))]
879        #[unsafe(method_family = none)]
880        pub unsafe fn excludedDomains(&self) -> Retained<NSArray<NSString>>;
881
882        /// Setter for [`excludedDomains`][Self::excludedDomains].
883        #[unsafe(method(setExcludedDomains:))]
884        #[unsafe(method_family = none)]
885        pub unsafe fn setExcludedDomains(&self, excluded_domains: &NSArray<NSString>);
886
887        #[unsafe(method(associatedDomains))]
888        #[unsafe(method_family = none)]
889        pub unsafe fn associatedDomains(&self) -> Retained<NSArray<NSString>>;
890
891        /// Setter for [`associatedDomains`][Self::associatedDomains].
892        #[unsafe(method(setAssociatedDomains:))]
893        #[unsafe(method_family = none)]
894        pub unsafe fn setAssociatedDomains(&self, associated_domains: &NSArray<NSString>);
895    );
896}
897
898/// Methods declared on superclass `NSObject`.
899impl NETunnelProviderManager {
900    extern_methods!(
901        #[unsafe(method(init))]
902        #[unsafe(method_family = init)]
903        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
904
905        #[unsafe(method(new))]
906        #[unsafe(method_family = new)]
907        pub unsafe fn new() -> Retained<Self>;
908    );
909}
910
911extern_class!(
912    /// The NEAppProxyProviderManager class declares the programmatic interface for an object that is used to configure and control network tunnels provided by NEAppProxyProviders.
913    ///
914    /// Instances of this class are thread safe.
915    ///
916    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neappproxyprovidermanager?language=objc)
917    #[unsafe(super(NETunnelProviderManager, NEVPNManager, NSObject))]
918    #[derive(Debug, PartialEq, Eq, Hash)]
919    pub struct NEAppProxyProviderManager;
920);
921
922unsafe impl NSObjectProtocol for NEAppProxyProviderManager {}
923
924impl NEAppProxyProviderManager {
925    extern_methods!(
926        #[cfg(feature = "block2")]
927        /// 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.
928        ///
929        /// 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.
930        #[unsafe(method(loadAllFromPreferencesWithCompletionHandler:))]
931        #[unsafe(method_family = none)]
932        pub unsafe fn loadAllFromPreferencesWithCompletionHandler(
933            completion_handler: &block2::Block<
934                dyn Fn(*mut NSArray<NEAppProxyProviderManager>, *mut NSError),
935            >,
936        );
937    );
938}
939
940/// Methods declared on superclass `NETunnelProviderManager`.
941impl NEAppProxyProviderManager {
942    extern_methods!(
943        /// Create a NETunnelProviderManager instance that is used to manage a per-app VPN configuration.
944        #[unsafe(method(forPerAppVPN))]
945        #[unsafe(method_family = none)]
946        pub unsafe fn forPerAppVPN() -> Retained<Self>;
947    );
948}
949
950/// Methods declared on superclass `NSObject`.
951impl NEAppProxyProviderManager {
952    extern_methods!(
953        #[unsafe(method(init))]
954        #[unsafe(method_family = init)]
955        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
956
957        #[unsafe(method(new))]
958        #[unsafe(method_family = new)]
959        pub unsafe fn new() -> Retained<Self>;
960    );
961}
962
963extern_class!(
964    /// The NEAppProxyTCPFlow class declares the programmatic interface of an object that is used by NEAppProxyProvider implementations to proxy the payload of TCP connections.
965    ///
966    /// NEAppProxyTCPFlow is part of NetworkExtension.framework
967    ///
968    /// Instances of this class are thread safe.
969    ///
970    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neappproxytcpflow?language=objc)
971    #[unsafe(super(NEAppProxyFlow, NSObject))]
972    #[derive(Debug, PartialEq, Eq, Hash)]
973    pub struct NEAppProxyTCPFlow;
974);
975
976unsafe impl NSObjectProtocol for NEAppProxyTCPFlow {}
977
978impl NEAppProxyTCPFlow {
979    extern_methods!(
980        #[cfg(feature = "block2")]
981        /// Read data from the flow.
982        ///
983        /// 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.
984        #[unsafe(method(readDataWithCompletionHandler:))]
985        #[unsafe(method_family = none)]
986        pub unsafe fn readDataWithCompletionHandler(
987            &self,
988            completion_handler: &block2::Block<dyn Fn(*mut NSData, *mut NSError)>,
989        );
990
991        #[cfg(feature = "block2")]
992        /// Write data to the flow.
993        ///
994        /// Parameter `data`: The data to write.
995        ///
996        /// 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.
997        #[unsafe(method(writeData:withCompletionHandler:))]
998        #[unsafe(method_family = none)]
999        pub unsafe fn writeData_withCompletionHandler(
1000            &self,
1001            data: &NSData,
1002            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
1003        );
1004
1005        /// An NWEndpoint object containing information about the intended remote endpoint of the flow.
1006        #[deprecated]
1007        #[unsafe(method(remoteEndpoint))]
1008        #[unsafe(method_family = none)]
1009        pub unsafe fn remoteEndpoint(&self) -> Retained<NWEndpoint>;
1010    );
1011}
1012
1013/// Methods declared on superclass `NSObject`.
1014impl NEAppProxyTCPFlow {
1015    extern_methods!(
1016        #[unsafe(method(init))]
1017        #[unsafe(method_family = init)]
1018        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1019
1020        #[unsafe(method(new))]
1021        #[unsafe(method_family = new)]
1022        pub unsafe fn new() -> Retained<Self>;
1023    );
1024}
1025
1026extern_class!(
1027    /// The NEAppProxyUDPFlow class declares the programmatic interface of an object that is used by NEAppProxyProvider implementations to proxy the payload of UDP datagrams.
1028    ///
1029    /// NEAppProxyUDPFlow is part of NetworkExtension.framework.
1030    ///
1031    /// Instances of this class are thread safe.
1032    ///
1033    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neappproxyudpflow?language=objc)
1034    #[unsafe(super(NEAppProxyFlow, NSObject))]
1035    #[derive(Debug, PartialEq, Eq, Hash)]
1036    pub struct NEAppProxyUDPFlow;
1037);
1038
1039unsafe impl NSObjectProtocol for NEAppProxyUDPFlow {}
1040
1041impl NEAppProxyUDPFlow {
1042    extern_methods!(
1043        #[cfg(feature = "block2")]
1044        /// Read datagrams from the flow.
1045        ///
1046        /// 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.
1047        #[deprecated]
1048        #[unsafe(method(readDatagramsWithCompletionHandler:))]
1049        #[unsafe(method_family = none)]
1050        pub unsafe fn readDatagramsWithCompletionHandler(
1051            &self,
1052            completion_handler: &block2::Block<
1053                dyn Fn(*mut NSArray<NSData>, *mut NSArray<NWEndpoint>, *mut NSError),
1054            >,
1055        );
1056
1057        #[cfg(feature = "block2")]
1058        /// Write datagrams to the flow.
1059        ///
1060        /// Parameter `datagrams`: An array of NSData objects containing the data to be written.
1061        ///
1062        /// Parameter `remoteEndpoints`: The source endpoints of the datagrams.
1063        ///
1064        /// Parameter `completionHandler`: A block that will be executed when the datagrams have been written to the corresponding socket's receive buffer.
1065        #[deprecated]
1066        #[unsafe(method(writeDatagrams:sentByEndpoints:completionHandler:))]
1067        #[unsafe(method_family = none)]
1068        pub unsafe fn writeDatagrams_sentByEndpoints_completionHandler(
1069            &self,
1070            datagrams: &NSArray<NSData>,
1071            remote_endpoints: &NSArray<NWEndpoint>,
1072            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
1073        );
1074
1075        /// An NWEndpoint object containing the local endpoint of the flow's corresponding socket.
1076        #[deprecated]
1077        #[unsafe(method(localEndpoint))]
1078        #[unsafe(method_family = none)]
1079        pub unsafe fn localEndpoint(&self) -> Option<Retained<NWEndpoint>>;
1080    );
1081}
1082
1083/// Methods declared on superclass `NSObject`.
1084impl NEAppProxyUDPFlow {
1085    extern_methods!(
1086        #[unsafe(method(init))]
1087        #[unsafe(method_family = init)]
1088        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1089
1090        #[unsafe(method(new))]
1091        #[unsafe(method_family = new)]
1092        pub unsafe fn new() -> Retained<Self>;
1093    );
1094}
1095
1096extern_class!(
1097    /// 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.
1098    ///
1099    /// NEAppRule is used in the context of a Network Extension configuration to specify what traffic should be made available to the Network Extension.
1100    ///
1101    /// Instances of this class are thread safe.
1102    ///
1103    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neapprule?language=objc)
1104    #[unsafe(super(NSObject))]
1105    #[derive(Debug, PartialEq, Eq, Hash)]
1106    pub struct NEAppRule;
1107);
1108
1109unsafe impl NSCoding for NEAppRule {}
1110
1111unsafe impl NSCopying for NEAppRule {}
1112
1113unsafe impl CopyingHelper for NEAppRule {
1114    type Result = Self;
1115}
1116
1117unsafe impl NSObjectProtocol for NEAppRule {}
1118
1119unsafe impl NSSecureCoding for NEAppRule {}
1120
1121impl NEAppRule {
1122    extern_methods!(
1123        /// Initializes a newly-allocated NEAppRule object.
1124        ///
1125        /// Parameter `signingIdentifier`: The signing identifier of the executable that matches the rule.
1126        #[unsafe(method(initWithSigningIdentifier:))]
1127        #[unsafe(method_family = init)]
1128        pub unsafe fn initWithSigningIdentifier(
1129            this: Allocated<Self>,
1130            signing_identifier: &NSString,
1131        ) -> Retained<Self>;
1132
1133        /// Initializes a newly-allocated NEAppRule object.
1134        ///
1135        /// Parameter `signingIdentifier`: The signing identifier of the executable that matches the rule.
1136        ///
1137        /// Parameter `designatedRequirement`: The designated requirement of the executable that matches the rule.
1138        #[unsafe(method(initWithSigningIdentifier:designatedRequirement:))]
1139        #[unsafe(method_family = init)]
1140        pub unsafe fn initWithSigningIdentifier_designatedRequirement(
1141            this: Allocated<Self>,
1142            signing_identifier: &NSString,
1143            designated_requirement: &NSString,
1144        ) -> Retained<Self>;
1145
1146        /// 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.
1147        #[unsafe(method(matchSigningIdentifier))]
1148        #[unsafe(method_family = none)]
1149        pub unsafe fn matchSigningIdentifier(&self) -> Retained<NSString>;
1150
1151        /// 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.
1152        #[unsafe(method(matchDesignatedRequirement))]
1153        #[unsafe(method_family = none)]
1154        pub unsafe fn matchDesignatedRequirement(&self) -> Retained<NSString>;
1155
1156        /// 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.
1157        #[unsafe(method(matchPath))]
1158        #[unsafe(method_family = none)]
1159        pub unsafe fn matchPath(&self) -> Option<Retained<NSString>>;
1160
1161        /// Setter for [`matchPath`][Self::matchPath].
1162        #[unsafe(method(setMatchPath:))]
1163        #[unsafe(method_family = none)]
1164        pub unsafe fn setMatchPath(&self, match_path: Option<&NSString>);
1165
1166        /// 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.
1167        #[unsafe(method(matchDomains))]
1168        #[unsafe(method_family = none)]
1169        pub unsafe fn matchDomains(&self) -> Option<Retained<NSArray>>;
1170
1171        /// Setter for [`matchDomains`][Self::matchDomains].
1172        #[unsafe(method(setMatchDomains:))]
1173        #[unsafe(method_family = none)]
1174        pub unsafe fn setMatchDomains(&self, match_domains: Option<&NSArray>);
1175
1176        /// 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.
1177        /// 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
1178        /// contains an NEAppRule for the "curl" command line tool.
1179        /// 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.
1180        #[unsafe(method(matchTools))]
1181        #[unsafe(method_family = none)]
1182        pub unsafe fn matchTools(&self) -> Option<Retained<NSArray<NEAppRule>>>;
1183
1184        /// Setter for [`matchTools`][Self::matchTools].
1185        #[unsafe(method(setMatchTools:))]
1186        #[unsafe(method_family = none)]
1187        pub unsafe fn setMatchTools(&self, match_tools: Option<&NSArray<NEAppRule>>);
1188    );
1189}
1190
1191/// Methods declared on superclass `NSObject`.
1192impl NEAppRule {
1193    extern_methods!(
1194        #[unsafe(method(init))]
1195        #[unsafe(method_family = init)]
1196        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1197
1198        #[unsafe(method(new))]
1199        #[unsafe(method_family = new)]
1200        pub unsafe fn new() -> Retained<Self>;
1201    );
1202}
1203
1204/// DNS proxy error codes
1205///
1206/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednsproxymanagererror?language=objc)
1207// NS_ENUM
1208#[repr(transparent)]
1209#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1210pub struct NEDNSProxyManagerError(pub NSInteger);
1211impl NEDNSProxyManagerError {
1212    #[doc(alias = "NEDNSProxyManagerErrorConfigurationInvalid")]
1213    pub const ConfigurationInvalid: Self = Self(1);
1214    #[doc(alias = "NEDNSProxyManagerErrorConfigurationDisabled")]
1215    pub const ConfigurationDisabled: Self = Self(2);
1216    #[doc(alias = "NEDNSProxyManagerErrorConfigurationStale")]
1217    pub const ConfigurationStale: Self = Self(3);
1218    #[doc(alias = "NEDNSProxyManagerErrorConfigurationCannotBeRemoved")]
1219    pub const ConfigurationCannotBeRemoved: Self = Self(4);
1220}
1221
1222unsafe impl Encode for NEDNSProxyManagerError {
1223    const ENCODING: Encoding = NSInteger::ENCODING;
1224}
1225
1226unsafe impl RefEncode for NEDNSProxyManagerError {
1227    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1228}
1229
1230extern "C" {
1231    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednsproxyerrordomain?language=objc)
1232    pub static NEDNSProxyErrorDomain: &'static NSString;
1233}
1234
1235extern "C" {
1236    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednsproxyconfigurationdidchangenotification?language=objc)
1237    pub static NEDNSProxyConfigurationDidChangeNotification: &'static NSString;
1238}
1239
1240extern_class!(
1241    /// The NEDNSProxyManager class declares the programmatic interface for an object that manages DNS proxy configurations.
1242    ///
1243    /// NEDNSProxyManager declares methods and properties for configuring and controlling a DNS proxy.
1244    ///
1245    /// Instances of this class are thread safe.
1246    ///
1247    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednsproxymanager?language=objc)
1248    #[unsafe(super(NSObject))]
1249    #[derive(Debug, PartialEq, Eq, Hash)]
1250    pub struct NEDNSProxyManager;
1251);
1252
1253unsafe impl NSObjectProtocol for NEDNSProxyManager {}
1254
1255impl NEDNSProxyManager {
1256    extern_methods!(
1257        /// Returns: The singleton NEDNSProxyManager object for the calling process.
1258        #[unsafe(method(sharedManager))]
1259        #[unsafe(method_family = none)]
1260        pub unsafe fn sharedManager() -> Retained<NEDNSProxyManager>;
1261
1262        #[cfg(feature = "block2")]
1263        /// This function loads the current DNS proxy configuration from the caller's DNS proxy preferences.
1264        ///
1265        /// 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.
1266        #[unsafe(method(loadFromPreferencesWithCompletionHandler:))]
1267        #[unsafe(method_family = none)]
1268        pub unsafe fn loadFromPreferencesWithCompletionHandler(
1269            &self,
1270            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
1271        );
1272
1273        #[cfg(feature = "block2")]
1274        /// 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.
1275        ///
1276        /// 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.
1277        #[unsafe(method(removeFromPreferencesWithCompletionHandler:))]
1278        #[unsafe(method_family = none)]
1279        pub unsafe fn removeFromPreferencesWithCompletionHandler(
1280            &self,
1281            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
1282        );
1283
1284        #[cfg(feature = "block2")]
1285        /// This function saves the DNS proxy configuration in the caller's DNS proxy preferences. If the DNS proxy is enabled, it will become active.
1286        ///
1287        /// 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.
1288        #[unsafe(method(saveToPreferencesWithCompletionHandler:))]
1289        #[unsafe(method_family = none)]
1290        pub unsafe fn saveToPreferencesWithCompletionHandler(
1291            &self,
1292            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
1293        );
1294
1295        /// A string containing a description of the DNS proxy.
1296        #[unsafe(method(localizedDescription))]
1297        #[unsafe(method_family = none)]
1298        pub unsafe fn localizedDescription(&self) -> Option<Retained<NSString>>;
1299
1300        /// Setter for [`localizedDescription`][Self::localizedDescription].
1301        #[unsafe(method(setLocalizedDescription:))]
1302        #[unsafe(method_family = none)]
1303        pub unsafe fn setLocalizedDescription(&self, localized_description: Option<&NSString>);
1304
1305        /// An NEDNSProxyProviderProtocol object containing the provider-specific portion of the DNS proxy configuration.
1306        #[unsafe(method(providerProtocol))]
1307        #[unsafe(method_family = none)]
1308        pub unsafe fn providerProtocol(&self) -> Option<Retained<NEDNSProxyProviderProtocol>>;
1309
1310        /// Setter for [`providerProtocol`][Self::providerProtocol].
1311        #[unsafe(method(setProviderProtocol:))]
1312        #[unsafe(method_family = none)]
1313        pub unsafe fn setProviderProtocol(
1314            &self,
1315            provider_protocol: Option<&NEDNSProxyProviderProtocol>,
1316        );
1317
1318        /// 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.
1319        #[unsafe(method(isEnabled))]
1320        #[unsafe(method_family = none)]
1321        pub unsafe fn isEnabled(&self) -> bool;
1322
1323        /// Setter for [`isEnabled`][Self::isEnabled].
1324        #[unsafe(method(setEnabled:))]
1325        #[unsafe(method_family = none)]
1326        pub unsafe fn setEnabled(&self, enabled: bool);
1327    );
1328}
1329
1330/// Methods declared on superclass `NSObject`.
1331impl NEDNSProxyManager {
1332    extern_methods!(
1333        #[unsafe(method(init))]
1334        #[unsafe(method_family = init)]
1335        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1336
1337        #[unsafe(method(new))]
1338        #[unsafe(method_family = new)]
1339        pub unsafe fn new() -> Retained<Self>;
1340    );
1341}
1342
1343extern_class!(
1344    /// The NEDNSProxyProvider class declares the programmatic interface for an object that implements the client side of a custom DNS proxy solution.
1345    ///
1346    /// NEDNSProxyProvider is part of NetworkExtension.framework
1347    ///
1348    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednsproxyprovider?language=objc)
1349    #[unsafe(super(NEProvider, NSObject))]
1350    #[derive(Debug, PartialEq, Eq, Hash)]
1351    pub struct NEDNSProxyProvider;
1352);
1353
1354unsafe impl NSObjectProtocol for NEDNSProxyProvider {}
1355
1356impl NEDNSProxyProvider {
1357    extern_methods!(
1358        #[cfg(feature = "block2")]
1359        /// 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.
1360        ///
1361        /// 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.
1362        ///
1363        /// 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.
1364        #[unsafe(method(startProxyWithOptions:completionHandler:))]
1365        #[unsafe(method_family = none)]
1366        pub unsafe fn startProxyWithOptions_completionHandler(
1367            &self,
1368            options: Option<&NSDictionary<NSString, AnyObject>>,
1369            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
1370        );
1371
1372        #[cfg(feature = "block2")]
1373        /// 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.
1374        ///
1375        /// Parameter `reason`: An NEProviderStopReason indicating why the proxy is being stopped.
1376        ///
1377        /// Parameter `completionHandler`: A block that must be called when the proxy is completely stopped.
1378        #[unsafe(method(stopProxyWithReason:completionHandler:))]
1379        #[unsafe(method_family = none)]
1380        pub unsafe fn stopProxyWithReason_completionHandler(
1381            &self,
1382            reason: NEProviderStopReason,
1383            completion_handler: &block2::Block<dyn Fn()>,
1384        );
1385
1386        /// 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.
1387        ///
1388        /// Parameter `error`: An NSError object containing details about the error that the proxy provider implementation encountered.
1389        #[unsafe(method(cancelProxyWithError:))]
1390        #[unsafe(method_family = none)]
1391        pub unsafe fn cancelProxyWithError(&self, error: Option<&NSError>);
1392
1393        /// 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.
1394        ///
1395        /// Parameter `flow`: The new flow
1396        ///
1397        /// 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.
1398        #[unsafe(method(handleNewFlow:))]
1399        #[unsafe(method_family = none)]
1400        pub unsafe fn handleNewFlow(&self, flow: &NEAppProxyFlow) -> bool;
1401
1402        /// 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
1403        /// 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
1404        /// 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.
1405        /// In this case the proxy implementation is responsible for retaining the NEAppProxyUDPFlow object.
1406        /// The default implementation of this method calls -[NEAppProxyProvider handleNewFlow:] and returns its result.
1407        ///
1408        /// Parameter `flow`: The new UDP flow
1409        ///
1410        /// Parameter `remoteEndpoint`: The initial remote endpoint provided by the proxied app when the flow was opened.
1411        ///
1412        /// 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.
1413        #[deprecated]
1414        #[unsafe(method(handleNewUDPFlow:initialRemoteEndpoint:))]
1415        #[unsafe(method_family = none)]
1416        pub unsafe fn handleNewUDPFlow_initialRemoteEndpoint(
1417            &self,
1418            flow: &NEAppProxyUDPFlow,
1419            remote_endpoint: &NWEndpoint,
1420        ) -> bool;
1421
1422        /// The current system DNS settings. Use KVO to watch for changes.
1423        #[unsafe(method(systemDNSSettings))]
1424        #[unsafe(method_family = none)]
1425        pub unsafe fn systemDNSSettings(&self) -> Option<Retained<NSArray<NEDNSSettings>>>;
1426    );
1427}
1428
1429/// Methods declared on superclass `NSObject`.
1430impl NEDNSProxyProvider {
1431    extern_methods!(
1432        #[unsafe(method(init))]
1433        #[unsafe(method_family = init)]
1434        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1435
1436        #[unsafe(method(new))]
1437        #[unsafe(method_family = new)]
1438        pub unsafe fn new() -> Retained<Self>;
1439    );
1440}
1441
1442extern_class!(
1443    /// The NEProxyServer class declares the programmatic interface for an object that contains settings for a proxy server.
1444    ///
1445    /// Instances of this class are thread safe.
1446    ///
1447    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neproxyserver?language=objc)
1448    #[unsafe(super(NSObject))]
1449    #[derive(Debug, PartialEq, Eq, Hash)]
1450    pub struct NEProxyServer;
1451);
1452
1453unsafe impl NSCoding for NEProxyServer {}
1454
1455unsafe impl NSCopying for NEProxyServer {}
1456
1457unsafe impl CopyingHelper for NEProxyServer {
1458    type Result = Self;
1459}
1460
1461unsafe impl NSObjectProtocol for NEProxyServer {}
1462
1463unsafe impl NSSecureCoding for NEProxyServer {}
1464
1465impl NEProxyServer {
1466    extern_methods!(
1467        /// This function initializes a newly-allocated NEProxyServer object
1468        ///
1469        /// Parameter `address`: The string representation of the proxy server IP address.
1470        ///
1471        /// Parameter `port`: The TCP port of the proxy server.
1472        #[unsafe(method(initWithAddress:port:))]
1473        #[unsafe(method_family = init)]
1474        pub unsafe fn initWithAddress_port(
1475            this: Allocated<Self>,
1476            address: &NSString,
1477            port: NSInteger,
1478        ) -> Retained<Self>;
1479
1480        /// The string representation of the proxy server IP address.
1481        #[unsafe(method(address))]
1482        #[unsafe(method_family = none)]
1483        pub unsafe fn address(&self) -> Retained<NSString>;
1484
1485        /// The TCP port of the proxy server.
1486        #[unsafe(method(port))]
1487        #[unsafe(method_family = none)]
1488        pub unsafe fn port(&self) -> NSInteger;
1489
1490        /// A flag indicating if the server requires authentication credentials.
1491        #[unsafe(method(authenticationRequired))]
1492        #[unsafe(method_family = none)]
1493        pub unsafe fn authenticationRequired(&self) -> bool;
1494
1495        /// Setter for [`authenticationRequired`][Self::authenticationRequired].
1496        #[unsafe(method(setAuthenticationRequired:))]
1497        #[unsafe(method_family = none)]
1498        pub unsafe fn setAuthenticationRequired(&self, authentication_required: bool);
1499
1500        /// The username portion of the authentication credential to use when communicating with the proxy server.
1501        #[unsafe(method(username))]
1502        #[unsafe(method_family = none)]
1503        pub unsafe fn username(&self) -> Option<Retained<NSString>>;
1504
1505        /// Setter for [`username`][Self::username].
1506        #[unsafe(method(setUsername:))]
1507        #[unsafe(method_family = none)]
1508        pub unsafe fn setUsername(&self, username: Option<&NSString>);
1509
1510        /// 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.
1511        #[unsafe(method(password))]
1512        #[unsafe(method_family = none)]
1513        pub unsafe fn password(&self) -> Option<Retained<NSString>>;
1514
1515        /// Setter for [`password`][Self::password].
1516        #[unsafe(method(setPassword:))]
1517        #[unsafe(method_family = none)]
1518        pub unsafe fn setPassword(&self, password: Option<&NSString>);
1519    );
1520}
1521
1522/// Methods declared on superclass `NSObject`.
1523impl NEProxyServer {
1524    extern_methods!(
1525        #[unsafe(method(init))]
1526        #[unsafe(method_family = init)]
1527        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1528
1529        #[unsafe(method(new))]
1530        #[unsafe(method_family = new)]
1531        pub unsafe fn new() -> Retained<Self>;
1532    );
1533}
1534
1535extern_class!(
1536    /// The NEProxySettings class declares the programmatic interface for an object that contains proxy settings.
1537    ///
1538    /// 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.
1539    ///
1540    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neproxysettings?language=objc)
1541    #[unsafe(super(NSObject))]
1542    #[derive(Debug, PartialEq, Eq, Hash)]
1543    pub struct NEProxySettings;
1544);
1545
1546unsafe impl NSCoding for NEProxySettings {}
1547
1548unsafe impl NSCopying for NEProxySettings {}
1549
1550unsafe impl CopyingHelper for NEProxySettings {
1551    type Result = Self;
1552}
1553
1554unsafe impl NSObjectProtocol for NEProxySettings {}
1555
1556unsafe impl NSSecureCoding for NEProxySettings {}
1557
1558impl NEProxySettings {
1559    extern_methods!(
1560        /// A boolean indicating if proxy auto-configuration is enabled.
1561        #[unsafe(method(autoProxyConfigurationEnabled))]
1562        #[unsafe(method_family = none)]
1563        pub unsafe fn autoProxyConfigurationEnabled(&self) -> bool;
1564
1565        /// Setter for [`autoProxyConfigurationEnabled`][Self::autoProxyConfigurationEnabled].
1566        #[unsafe(method(setAutoProxyConfigurationEnabled:))]
1567        #[unsafe(method_family = none)]
1568        pub unsafe fn setAutoProxyConfigurationEnabled(
1569            &self,
1570            auto_proxy_configuration_enabled: bool,
1571        );
1572
1573        /// A URL specifying where the PAC script is located.
1574        #[unsafe(method(proxyAutoConfigurationURL))]
1575        #[unsafe(method_family = none)]
1576        pub unsafe fn proxyAutoConfigurationURL(&self) -> Option<Retained<NSURL>>;
1577
1578        /// Setter for [`proxyAutoConfigurationURL`][Self::proxyAutoConfigurationURL].
1579        #[unsafe(method(setProxyAutoConfigurationURL:))]
1580        #[unsafe(method_family = none)]
1581        pub unsafe fn setProxyAutoConfigurationURL(
1582            &self,
1583            proxy_auto_configuration_url: Option<&NSURL>,
1584        );
1585
1586        /// A string containing the PAC JavaScript source code.
1587        #[unsafe(method(proxyAutoConfigurationJavaScript))]
1588        #[unsafe(method_family = none)]
1589        pub unsafe fn proxyAutoConfigurationJavaScript(&self) -> Option<Retained<NSString>>;
1590
1591        /// Setter for [`proxyAutoConfigurationJavaScript`][Self::proxyAutoConfigurationJavaScript].
1592        #[unsafe(method(setProxyAutoConfigurationJavaScript:))]
1593        #[unsafe(method_family = none)]
1594        pub unsafe fn setProxyAutoConfigurationJavaScript(
1595            &self,
1596            proxy_auto_configuration_java_script: Option<&NSString>,
1597        );
1598
1599        /// A boolean indicating if the static HTTP proxy is enabled.
1600        #[unsafe(method(HTTPEnabled))]
1601        #[unsafe(method_family = none)]
1602        pub unsafe fn HTTPEnabled(&self) -> bool;
1603
1604        /// Setter for [`HTTPEnabled`][Self::HTTPEnabled].
1605        #[unsafe(method(setHTTPEnabled:))]
1606        #[unsafe(method_family = none)]
1607        pub unsafe fn setHTTPEnabled(&self, http_enabled: bool);
1608
1609        /// A NEProxyServer object containing the HTTP proxy server settings.
1610        #[unsafe(method(HTTPServer))]
1611        #[unsafe(method_family = none)]
1612        pub unsafe fn HTTPServer(&self) -> Option<Retained<NEProxyServer>>;
1613
1614        /// Setter for [`HTTPServer`][Self::HTTPServer].
1615        #[unsafe(method(setHTTPServer:))]
1616        #[unsafe(method_family = none)]
1617        pub unsafe fn setHTTPServer(&self, http_server: Option<&NEProxyServer>);
1618
1619        /// A boolean indicating if the static HTTPS proxy is enabled.
1620        #[unsafe(method(HTTPSEnabled))]
1621        #[unsafe(method_family = none)]
1622        pub unsafe fn HTTPSEnabled(&self) -> bool;
1623
1624        /// Setter for [`HTTPSEnabled`][Self::HTTPSEnabled].
1625        #[unsafe(method(setHTTPSEnabled:))]
1626        #[unsafe(method_family = none)]
1627        pub unsafe fn setHTTPSEnabled(&self, https_enabled: bool);
1628
1629        /// A NEProxyServer object containing the HTTPS proxy server settings.
1630        #[unsafe(method(HTTPSServer))]
1631        #[unsafe(method_family = none)]
1632        pub unsafe fn HTTPSServer(&self) -> Option<Retained<NEProxyServer>>;
1633
1634        /// Setter for [`HTTPSServer`][Self::HTTPSServer].
1635        #[unsafe(method(setHTTPSServer:))]
1636        #[unsafe(method_family = none)]
1637        pub unsafe fn setHTTPSServer(&self, https_server: Option<&NEProxyServer>);
1638
1639        /// A flag indicating if the proxy settings should not be used for network destinations specified using single-label host names.
1640        #[unsafe(method(excludeSimpleHostnames))]
1641        #[unsafe(method_family = none)]
1642        pub unsafe fn excludeSimpleHostnames(&self) -> bool;
1643
1644        /// Setter for [`excludeSimpleHostnames`][Self::excludeSimpleHostnames].
1645        #[unsafe(method(setExcludeSimpleHostnames:))]
1646        #[unsafe(method_family = none)]
1647        pub unsafe fn setExcludeSimpleHostnames(&self, exclude_simple_hostnames: bool);
1648
1649        /// 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.
1650        #[unsafe(method(exceptionList))]
1651        #[unsafe(method_family = none)]
1652        pub unsafe fn exceptionList(&self) -> Option<Retained<NSArray<NSString>>>;
1653
1654        /// Setter for [`exceptionList`][Self::exceptionList].
1655        #[unsafe(method(setExceptionList:))]
1656        #[unsafe(method_family = none)]
1657        pub unsafe fn setExceptionList(&self, exception_list: Option<&NSArray<NSString>>);
1658
1659        /// 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.
1660        #[unsafe(method(matchDomains))]
1661        #[unsafe(method_family = none)]
1662        pub unsafe fn matchDomains(&self) -> Option<Retained<NSArray<NSString>>>;
1663
1664        /// Setter for [`matchDomains`][Self::matchDomains].
1665        #[unsafe(method(setMatchDomains:))]
1666        #[unsafe(method_family = none)]
1667        pub unsafe fn setMatchDomains(&self, match_domains: Option<&NSArray<NSString>>);
1668    );
1669}
1670
1671/// Methods declared on superclass `NSObject`.
1672impl NEProxySettings {
1673    extern_methods!(
1674        #[unsafe(method(init))]
1675        #[unsafe(method_family = init)]
1676        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1677
1678        #[unsafe(method(new))]
1679        #[unsafe(method_family = new)]
1680        pub unsafe fn new() -> Retained<Self>;
1681    );
1682}
1683
1684extern_class!(
1685    /// The NEVPNProtocol class declares the programmatic interface of an object that manages the protocol-specific portion of a VPN configuration.
1686    ///
1687    /// NEVPNProtocol is an abstract base class from which other protocol-specific classes are derived.
1688    ///
1689    /// Instances of this class are thread safe.
1690    ///
1691    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnprotocol?language=objc)
1692    #[unsafe(super(NSObject))]
1693    #[derive(Debug, PartialEq, Eq, Hash)]
1694    pub struct NEVPNProtocol;
1695);
1696
1697unsafe impl NSCoding for NEVPNProtocol {}
1698
1699unsafe impl NSCopying for NEVPNProtocol {}
1700
1701unsafe impl CopyingHelper for NEVPNProtocol {
1702    type Result = Self;
1703}
1704
1705unsafe impl NSObjectProtocol for NEVPNProtocol {}
1706
1707unsafe impl NSSecureCoding for NEVPNProtocol {}
1708
1709impl NEVPNProtocol {
1710    extern_methods!(
1711        /// The VPN server. Depending on the protocol, may be an IP address, host name, or URL.
1712        #[unsafe(method(serverAddress))]
1713        #[unsafe(method_family = none)]
1714        pub unsafe fn serverAddress(&self) -> Option<Retained<NSString>>;
1715
1716        /// Setter for [`serverAddress`][Self::serverAddress].
1717        #[unsafe(method(setServerAddress:))]
1718        #[unsafe(method_family = none)]
1719        pub unsafe fn setServerAddress(&self, server_address: Option<&NSString>);
1720
1721        /// The username component of the VPN authentication credential.
1722        #[unsafe(method(username))]
1723        #[unsafe(method_family = none)]
1724        pub unsafe fn username(&self) -> Option<Retained<NSString>>;
1725
1726        /// Setter for [`username`][Self::username].
1727        #[unsafe(method(setUsername:))]
1728        #[unsafe(method_family = none)]
1729        pub unsafe fn setUsername(&self, username: Option<&NSString>);
1730
1731        /// The password component of the VPN authentication credential. The value is a persistent reference to a keychain item with the kSecClassGenericPassword class.
1732        #[unsafe(method(passwordReference))]
1733        #[unsafe(method_family = none)]
1734        pub unsafe fn passwordReference(&self) -> Option<Retained<NSData>>;
1735
1736        /// Setter for [`passwordReference`][Self::passwordReference].
1737        #[unsafe(method(setPasswordReference:))]
1738        #[unsafe(method_family = none)]
1739        pub unsafe fn setPasswordReference(&self, password_reference: Option<&NSData>);
1740
1741        /// 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.
1742        #[unsafe(method(identityReference))]
1743        #[unsafe(method_family = none)]
1744        pub unsafe fn identityReference(&self) -> Option<Retained<NSData>>;
1745
1746        /// Setter for [`identityReference`][Self::identityReference].
1747        #[unsafe(method(setIdentityReference:))]
1748        #[unsafe(method_family = none)]
1749        pub unsafe fn setIdentityReference(&self, identity_reference: Option<&NSData>);
1750
1751        /// The PKCS12 data for the VPN authentication identity. The value is a NSData in PKCS12 format.
1752        #[unsafe(method(identityData))]
1753        #[unsafe(method_family = none)]
1754        pub unsafe fn identityData(&self) -> Option<Retained<NSData>>;
1755
1756        /// Setter for [`identityData`][Self::identityData].
1757        #[unsafe(method(setIdentityData:))]
1758        #[unsafe(method_family = none)]
1759        pub unsafe fn setIdentityData(&self, identity_data: Option<&NSData>);
1760
1761        /// The password to be used to decrypt the PKCS12 identity data.
1762        #[unsafe(method(identityDataPassword))]
1763        #[unsafe(method_family = none)]
1764        pub unsafe fn identityDataPassword(&self) -> Option<Retained<NSString>>;
1765
1766        /// Setter for [`identityDataPassword`][Self::identityDataPassword].
1767        #[unsafe(method(setIdentityDataPassword:))]
1768        #[unsafe(method_family = none)]
1769        pub unsafe fn setIdentityDataPassword(&self, identity_data_password: Option<&NSString>);
1770
1771        /// If YES, the VPN connection will be disconnected when the device goes to sleep. The default is NO.
1772        #[unsafe(method(disconnectOnSleep))]
1773        #[unsafe(method_family = none)]
1774        pub unsafe fn disconnectOnSleep(&self) -> bool;
1775
1776        /// Setter for [`disconnectOnSleep`][Self::disconnectOnSleep].
1777        #[unsafe(method(setDisconnectOnSleep:))]
1778        #[unsafe(method_family = none)]
1779        pub unsafe fn setDisconnectOnSleep(&self, disconnect_on_sleep: bool);
1780
1781        /// An NEProxySettings object containing the proxy settings to use for connections routed through the tunnel.
1782        #[unsafe(method(proxySettings))]
1783        #[unsafe(method_family = none)]
1784        pub unsafe fn proxySettings(&self) -> Option<Retained<NEProxySettings>>;
1785
1786        /// Setter for [`proxySettings`][Self::proxySettings].
1787        #[unsafe(method(setProxySettings:))]
1788        #[unsafe(method_family = none)]
1789        pub unsafe fn setProxySettings(&self, proxy_settings: Option<&NEProxySettings>);
1790
1791        /// If this property is set to YES then all network traffic is routed through the tunnel, with some exclusions. Several of the exclusions
1792        /// can be controlled with the excludeLocalNetworks, excludeCellularServices, excludeAPNs and excludeDeviceCommunication properties. See the documentation for those properties.
1793        /// The following traffic is always excluded from the tunnel:
1794        /// - Traffic necessary for connecting and maintaining the device's network connection, such as DHCP.
1795        /// - Traffic necessary for connecting to captive networks.
1796        /// - Certain cellular services traffic that is not routable over the internet and is instead directly routed to the cellular network. See the
1797        /// excludeCellularServices property for more details.
1798        /// - Network communication with a companion device such as a watchOS device.
1799        /// The default value of this property is NO.
1800        #[unsafe(method(includeAllNetworks))]
1801        #[unsafe(method_family = none)]
1802        pub unsafe fn includeAllNetworks(&self) -> bool;
1803
1804        /// Setter for [`includeAllNetworks`][Self::includeAllNetworks].
1805        #[unsafe(method(setIncludeAllNetworks:))]
1806        #[unsafe(method_family = none)]
1807        pub unsafe fn setIncludeAllNetworks(&self, include_all_networks: bool);
1808
1809        /// If YES, all traffic destined for local networks will be excluded from the tunnel. The default is NO on macOS and YES on iOS.
1810        #[unsafe(method(excludeLocalNetworks))]
1811        #[unsafe(method_family = none)]
1812        pub unsafe fn excludeLocalNetworks(&self) -> bool;
1813
1814        /// Setter for [`excludeLocalNetworks`][Self::excludeLocalNetworks].
1815        #[unsafe(method(setExcludeLocalNetworks:))]
1816        #[unsafe(method_family = none)]
1817        pub unsafe fn setExcludeLocalNetworks(&self, exclude_local_networks: bool);
1818
1819        /// If includeAllNetworks is set to YES and this property is set to YES, then internet-routable network traffic for cellular services
1820        /// (VoLTE, Wi-Fi Calling, IMS, MMS, Visual Voicemail, etc.) is excluded from the tunnel. Note that some cellular carriers route cellular services traffic
1821        /// directly to the carrier network, bypassing the internet. Such cellular services traffic is always excluded from the tunnel. The default value of this
1822        /// property is YES.
1823        #[unsafe(method(excludeCellularServices))]
1824        #[unsafe(method_family = none)]
1825        pub unsafe fn excludeCellularServices(&self) -> bool;
1826
1827        /// Setter for [`excludeCellularServices`][Self::excludeCellularServices].
1828        #[unsafe(method(setExcludeCellularServices:))]
1829        #[unsafe(method_family = none)]
1830        pub unsafe fn setExcludeCellularServices(&self, exclude_cellular_services: bool);
1831
1832        /// If includeAllNetworks is set to YES and this property is set to YES, then network traffic for the Apple Push Notification service (APNs)
1833        /// is excluded from the tunnel. The default value of this property is YES.
1834        #[unsafe(method(excludeAPNs))]
1835        #[unsafe(method_family = none)]
1836        pub unsafe fn excludeAPNs(&self) -> bool;
1837
1838        /// Setter for [`excludeAPNs`][Self::excludeAPNs].
1839        #[unsafe(method(setExcludeAPNs:))]
1840        #[unsafe(method_family = none)]
1841        pub unsafe fn setExcludeAPNs(&self, exclude_ap_ns: bool);
1842
1843        /// 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
1844        /// 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
1845        /// property is YES.
1846        #[unsafe(method(excludeDeviceCommunication))]
1847        #[unsafe(method_family = none)]
1848        pub unsafe fn excludeDeviceCommunication(&self) -> bool;
1849
1850        /// Setter for [`excludeDeviceCommunication`][Self::excludeDeviceCommunication].
1851        #[unsafe(method(setExcludeDeviceCommunication:))]
1852        #[unsafe(method_family = none)]
1853        pub unsafe fn setExcludeDeviceCommunication(&self, exclude_device_communication: bool);
1854
1855        /// If YES, route rules for this tunnel will take precendence over any locally-defined routes. The default is NO.
1856        #[unsafe(method(enforceRoutes))]
1857        #[unsafe(method_family = none)]
1858        pub unsafe fn enforceRoutes(&self) -> bool;
1859
1860        /// Setter for [`enforceRoutes`][Self::enforceRoutes].
1861        #[unsafe(method(setEnforceRoutes:))]
1862        #[unsafe(method_family = none)]
1863        pub unsafe fn setEnforceRoutes(&self, enforce_routes: bool);
1864
1865        /// Identification string of the associated Cellular slice.  If present, VPN tunnel will be scoped to the associated Cellular slice whenever slice is active.
1866        /// Otherwise, VPN tunnel will fallback onto the primary interface.
1867        #[unsafe(method(sliceUUID))]
1868        #[unsafe(method_family = none)]
1869        pub unsafe fn sliceUUID(&self) -> Option<Retained<NSString>>;
1870
1871        /// Setter for [`sliceUUID`][Self::sliceUUID].
1872        #[unsafe(method(setSliceUUID:))]
1873        #[unsafe(method_family = none)]
1874        pub unsafe fn setSliceUUID(&self, slice_uuid: Option<&NSString>);
1875    );
1876}
1877
1878/// Methods declared on superclass `NSObject`.
1879impl NEVPNProtocol {
1880    extern_methods!(
1881        #[unsafe(method(init))]
1882        #[unsafe(method_family = init)]
1883        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1884
1885        #[unsafe(method(new))]
1886        #[unsafe(method_family = new)]
1887        pub unsafe fn new() -> Retained<Self>;
1888    );
1889}
1890
1891extern_class!(
1892    /// The NEDNSProxyProviderProtocol class declares the programmatic interface for an object that contains NEDNSProxyProvider-specific configuration settings.
1893    ///
1894    /// Instances of this class are thread safe.
1895    ///
1896    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednsproxyproviderprotocol?language=objc)
1897    #[unsafe(super(NEVPNProtocol, NSObject))]
1898    #[derive(Debug, PartialEq, Eq, Hash)]
1899    pub struct NEDNSProxyProviderProtocol;
1900);
1901
1902unsafe impl NSCoding for NEDNSProxyProviderProtocol {}
1903
1904unsafe impl NSCopying for NEDNSProxyProviderProtocol {}
1905
1906unsafe impl CopyingHelper for NEDNSProxyProviderProtocol {
1907    type Result = Self;
1908}
1909
1910unsafe impl NSObjectProtocol for NEDNSProxyProviderProtocol {}
1911
1912unsafe impl NSSecureCoding for NEDNSProxyProviderProtocol {}
1913
1914impl NEDNSProxyProviderProtocol {
1915    extern_methods!(
1916        /// A dictionary containing NEDNSProxyProvider vendor-specific configuration parameters. This dictionary is passed as-is to NEDNSProxyProviders when a DNS proxy is started.
1917        #[unsafe(method(providerConfiguration))]
1918        #[unsafe(method_family = none)]
1919        pub unsafe fn providerConfiguration(
1920            &self,
1921        ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
1922
1923        /// Setter for [`providerConfiguration`][Self::providerConfiguration].
1924        #[unsafe(method(setProviderConfiguration:))]
1925        #[unsafe(method_family = none)]
1926        pub unsafe fn setProviderConfiguration(
1927            &self,
1928            provider_configuration: Option<&NSDictionary<NSString, AnyObject>>,
1929        );
1930
1931        /// A string containing the bundle identifier of the NEDNSProxyProvider to be used by this configuration.
1932        #[unsafe(method(providerBundleIdentifier))]
1933        #[unsafe(method_family = none)]
1934        pub unsafe fn providerBundleIdentifier(&self) -> Option<Retained<NSString>>;
1935
1936        /// Setter for [`providerBundleIdentifier`][Self::providerBundleIdentifier].
1937        #[unsafe(method(setProviderBundleIdentifier:))]
1938        #[unsafe(method_family = none)]
1939        pub unsafe fn setProviderBundleIdentifier(
1940            &self,
1941            provider_bundle_identifier: Option<&NSString>,
1942        );
1943    );
1944}
1945
1946/// Methods declared on superclass `NSObject`.
1947impl NEDNSProxyProviderProtocol {
1948    extern_methods!(
1949        #[unsafe(method(init))]
1950        #[unsafe(method_family = init)]
1951        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1952
1953        #[unsafe(method(new))]
1954        #[unsafe(method_family = new)]
1955        pub unsafe fn new() -> Retained<Self>;
1956    );
1957}
1958
1959/// DNS protocol variants
1960///
1961/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednsprotocol?language=objc)
1962// NS_ENUM
1963#[repr(transparent)]
1964#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1965pub struct NEDNSProtocol(pub NSInteger);
1966impl NEDNSProtocol {
1967    #[doc(alias = "NEDNSProtocolCleartext")]
1968    pub const Cleartext: Self = Self(1);
1969    #[doc(alias = "NEDNSProtocolTLS")]
1970    pub const TLS: Self = Self(2);
1971    #[doc(alias = "NEDNSProtocolHTTPS")]
1972    pub const HTTPS: Self = Self(3);
1973}
1974
1975unsafe impl Encode for NEDNSProtocol {
1976    const ENCODING: Encoding = NSInteger::ENCODING;
1977}
1978
1979unsafe impl RefEncode for NEDNSProtocol {
1980    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1981}
1982
1983extern_class!(
1984    /// The NEDNSSettings class declares the programmatic interface for an object that contains DNS settings.
1985    ///
1986    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednssettings?language=objc)
1987    #[unsafe(super(NSObject))]
1988    #[derive(Debug, PartialEq, Eq, Hash)]
1989    pub struct NEDNSSettings;
1990);
1991
1992unsafe impl NSCoding for NEDNSSettings {}
1993
1994unsafe impl NSCopying for NEDNSSettings {}
1995
1996unsafe impl CopyingHelper for NEDNSSettings {
1997    type Result = Self;
1998}
1999
2000unsafe impl NSObjectProtocol for NEDNSSettings {}
2001
2002unsafe impl NSSecureCoding for NEDNSSettings {}
2003
2004impl NEDNSSettings {
2005    extern_methods!(
2006        /// The DNS protocol used by the settings.
2007        #[unsafe(method(dnsProtocol))]
2008        #[unsafe(method_family = none)]
2009        pub unsafe fn dnsProtocol(&self) -> NEDNSProtocol;
2010
2011        /// Initialize a newly-allocated NEDNSSettings object.
2012        ///
2013        /// Parameter `servers`: An array of DNS server IP address strings.
2014        #[unsafe(method(initWithServers:))]
2015        #[unsafe(method_family = init)]
2016        pub unsafe fn initWithServers(
2017            this: Allocated<Self>,
2018            servers: &NSArray<NSString>,
2019        ) -> Retained<Self>;
2020
2021        /// An array of DNS server address strings.
2022        #[unsafe(method(servers))]
2023        #[unsafe(method_family = none)]
2024        pub unsafe fn servers(&self) -> Retained<NSArray<NSString>>;
2025
2026        /// An array of DNS server search domain strings.
2027        #[unsafe(method(searchDomains))]
2028        #[unsafe(method_family = none)]
2029        pub unsafe fn searchDomains(&self) -> Option<Retained<NSArray<NSString>>>;
2030
2031        /// Setter for [`searchDomains`][Self::searchDomains].
2032        #[unsafe(method(setSearchDomains:))]
2033        #[unsafe(method_family = none)]
2034        pub unsafe fn setSearchDomains(&self, search_domains: Option<&NSArray<NSString>>);
2035
2036        /// A string containing the DNS domain.
2037        #[unsafe(method(domainName))]
2038        #[unsafe(method_family = none)]
2039        pub unsafe fn domainName(&self) -> Option<Retained<NSString>>;
2040
2041        /// Setter for [`domainName`][Self::domainName].
2042        #[unsafe(method(setDomainName:))]
2043        #[unsafe(method_family = none)]
2044        pub unsafe fn setDomainName(&self, domain_name: Option<&NSString>);
2045
2046        /// 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.
2047        #[unsafe(method(matchDomains))]
2048        #[unsafe(method_family = none)]
2049        pub unsafe fn matchDomains(&self) -> Option<Retained<NSArray<NSString>>>;
2050
2051        /// Setter for [`matchDomains`][Self::matchDomains].
2052        #[unsafe(method(setMatchDomains:))]
2053        #[unsafe(method_family = none)]
2054        pub unsafe fn setMatchDomains(&self, match_domains: Option<&NSArray<NSString>>);
2055
2056        /// 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).
2057        #[unsafe(method(matchDomainsNoSearch))]
2058        #[unsafe(method_family = none)]
2059        pub unsafe fn matchDomainsNoSearch(&self) -> bool;
2060
2061        /// Setter for [`matchDomainsNoSearch`][Self::matchDomainsNoSearch].
2062        #[unsafe(method(setMatchDomainsNoSearch:))]
2063        #[unsafe(method_family = none)]
2064        pub unsafe fn setMatchDomainsNoSearch(&self, match_domains_no_search: bool);
2065    );
2066}
2067
2068/// Methods declared on superclass `NSObject`.
2069impl NEDNSSettings {
2070    extern_methods!(
2071        #[unsafe(method(init))]
2072        #[unsafe(method_family = init)]
2073        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2074
2075        #[unsafe(method(new))]
2076        #[unsafe(method_family = new)]
2077        pub unsafe fn new() -> Retained<Self>;
2078    );
2079}
2080
2081extern_class!(
2082    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednsovertlssettings?language=objc)
2083    #[unsafe(super(NEDNSSettings, NSObject))]
2084    #[derive(Debug, PartialEq, Eq, Hash)]
2085    pub struct NEDNSOverTLSSettings;
2086);
2087
2088unsafe impl NSCoding for NEDNSOverTLSSettings {}
2089
2090unsafe impl NSCopying for NEDNSOverTLSSettings {}
2091
2092unsafe impl CopyingHelper for NEDNSOverTLSSettings {
2093    type Result = Self;
2094}
2095
2096unsafe impl NSObjectProtocol for NEDNSOverTLSSettings {}
2097
2098unsafe impl NSSecureCoding for NEDNSOverTLSSettings {}
2099
2100impl NEDNSOverTLSSettings {
2101    extern_methods!(
2102        /// The name of the server to use for TLS certificate validation.
2103        #[unsafe(method(serverName))]
2104        #[unsafe(method_family = none)]
2105        pub unsafe fn serverName(&self) -> Option<Retained<NSString>>;
2106
2107        /// Setter for [`serverName`][Self::serverName].
2108        #[unsafe(method(setServerName:))]
2109        #[unsafe(method_family = none)]
2110        pub unsafe fn setServerName(&self, server_name: Option<&NSString>);
2111
2112        /// The optional certificate identity keychain reference to use as a TLS client certificate.
2113        #[unsafe(method(identityReference))]
2114        #[unsafe(method_family = none)]
2115        pub unsafe fn identityReference(&self) -> Option<Retained<NSData>>;
2116
2117        /// Setter for [`identityReference`][Self::identityReference].
2118        #[unsafe(method(setIdentityReference:))]
2119        #[unsafe(method_family = none)]
2120        pub unsafe fn setIdentityReference(&self, identity_reference: Option<&NSData>);
2121    );
2122}
2123
2124/// Methods declared on superclass `NEDNSSettings`.
2125impl NEDNSOverTLSSettings {
2126    extern_methods!(
2127        /// Initialize a newly-allocated NEDNSSettings object.
2128        ///
2129        /// Parameter `servers`: An array of DNS server IP address strings.
2130        #[unsafe(method(initWithServers:))]
2131        #[unsafe(method_family = init)]
2132        pub unsafe fn initWithServers(
2133            this: Allocated<Self>,
2134            servers: &NSArray<NSString>,
2135        ) -> Retained<Self>;
2136    );
2137}
2138
2139/// Methods declared on superclass `NSObject`.
2140impl NEDNSOverTLSSettings {
2141    extern_methods!(
2142        #[unsafe(method(init))]
2143        #[unsafe(method_family = init)]
2144        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2145
2146        #[unsafe(method(new))]
2147        #[unsafe(method_family = new)]
2148        pub unsafe fn new() -> Retained<Self>;
2149    );
2150}
2151
2152extern_class!(
2153    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednsoverhttpssettings?language=objc)
2154    #[unsafe(super(NEDNSSettings, NSObject))]
2155    #[derive(Debug, PartialEq, Eq, Hash)]
2156    pub struct NEDNSOverHTTPSSettings;
2157);
2158
2159unsafe impl NSCoding for NEDNSOverHTTPSSettings {}
2160
2161unsafe impl NSCopying for NEDNSOverHTTPSSettings {}
2162
2163unsafe impl CopyingHelper for NEDNSOverHTTPSSettings {
2164    type Result = Self;
2165}
2166
2167unsafe impl NSObjectProtocol for NEDNSOverHTTPSSettings {}
2168
2169unsafe impl NSSecureCoding for NEDNSOverHTTPSSettings {}
2170
2171impl NEDNSOverHTTPSSettings {
2172    extern_methods!(
2173        /// 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".
2174        #[unsafe(method(serverURL))]
2175        #[unsafe(method_family = none)]
2176        pub unsafe fn serverURL(&self) -> Option<Retained<NSURL>>;
2177
2178        /// Setter for [`serverURL`][Self::serverURL].
2179        #[unsafe(method(setServerURL:))]
2180        #[unsafe(method_family = none)]
2181        pub unsafe fn setServerURL(&self, server_url: Option<&NSURL>);
2182
2183        /// The optional certificate identity keychain reference to use as a TLS client certificate.
2184        #[unsafe(method(identityReference))]
2185        #[unsafe(method_family = none)]
2186        pub unsafe fn identityReference(&self) -> Option<Retained<NSData>>;
2187
2188        /// Setter for [`identityReference`][Self::identityReference].
2189        #[unsafe(method(setIdentityReference:))]
2190        #[unsafe(method_family = none)]
2191        pub unsafe fn setIdentityReference(&self, identity_reference: Option<&NSData>);
2192    );
2193}
2194
2195/// Methods declared on superclass `NEDNSSettings`.
2196impl NEDNSOverHTTPSSettings {
2197    extern_methods!(
2198        /// Initialize a newly-allocated NEDNSSettings object.
2199        ///
2200        /// Parameter `servers`: An array of DNS server IP address strings.
2201        #[unsafe(method(initWithServers:))]
2202        #[unsafe(method_family = init)]
2203        pub unsafe fn initWithServers(
2204            this: Allocated<Self>,
2205            servers: &NSArray<NSString>,
2206        ) -> Retained<Self>;
2207    );
2208}
2209
2210/// Methods declared on superclass `NSObject`.
2211impl NEDNSOverHTTPSSettings {
2212    extern_methods!(
2213        #[unsafe(method(init))]
2214        #[unsafe(method_family = init)]
2215        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2216
2217        #[unsafe(method(new))]
2218        #[unsafe(method_family = new)]
2219        pub unsafe fn new() -> Retained<Self>;
2220    );
2221}
2222
2223/// DNS Settings Manager error codes
2224///
2225/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednssettingsmanagererror?language=objc)
2226// NS_ENUM
2227#[repr(transparent)]
2228#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2229pub struct NEDNSSettingsManagerError(pub NSInteger);
2230impl NEDNSSettingsManagerError {
2231    #[doc(alias = "NEDNSSettingsManagerErrorConfigurationInvalid")]
2232    pub const ConfigurationInvalid: Self = Self(1);
2233    #[doc(alias = "NEDNSSettingsManagerErrorConfigurationDisabled")]
2234    pub const ConfigurationDisabled: Self = Self(2);
2235    #[doc(alias = "NEDNSSettingsManagerErrorConfigurationStale")]
2236    pub const ConfigurationStale: Self = Self(3);
2237    #[doc(alias = "NEDNSSettingsManagerErrorConfigurationCannotBeRemoved")]
2238    pub const ConfigurationCannotBeRemoved: Self = Self(4);
2239}
2240
2241unsafe impl Encode for NEDNSSettingsManagerError {
2242    const ENCODING: Encoding = NSInteger::ENCODING;
2243}
2244
2245unsafe impl RefEncode for NEDNSSettingsManagerError {
2246    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2247}
2248
2249extern "C" {
2250    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednssettingserrordomain?language=objc)
2251    pub static NEDNSSettingsErrorDomain: &'static NSString;
2252}
2253
2254extern "C" {
2255    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednssettingsconfigurationdidchangenotification?language=objc)
2256    pub static NEDNSSettingsConfigurationDidChangeNotification: &'static NSString;
2257}
2258
2259extern_class!(
2260    /// The NEDNSSettingsManager class declares the programmatic interface for an object that manages DNS settings configurations.
2261    ///
2262    /// NEDNSSettingsManager declares methods and properties for configuring and controlling DNS settings on the system.
2263    ///
2264    /// Instances of this class are thread safe.
2265    ///
2266    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nednssettingsmanager?language=objc)
2267    #[unsafe(super(NSObject))]
2268    #[derive(Debug, PartialEq, Eq, Hash)]
2269    pub struct NEDNSSettingsManager;
2270);
2271
2272unsafe impl NSObjectProtocol for NEDNSSettingsManager {}
2273
2274impl NEDNSSettingsManager {
2275    extern_methods!(
2276        /// Returns: The singleton NEDNSSettingsManager object for the calling process.
2277        #[unsafe(method(sharedManager))]
2278        #[unsafe(method_family = none)]
2279        pub unsafe fn sharedManager() -> Retained<NEDNSSettingsManager>;
2280
2281        #[cfg(feature = "block2")]
2282        /// This function loads the current DNS settings configuration from the caller's DNS settings preferences.
2283        ///
2284        /// 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.
2285        #[unsafe(method(loadFromPreferencesWithCompletionHandler:))]
2286        #[unsafe(method_family = none)]
2287        pub unsafe fn loadFromPreferencesWithCompletionHandler(
2288            &self,
2289            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
2290        );
2291
2292        #[cfg(feature = "block2")]
2293        /// 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.
2294        ///
2295        /// 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.
2296        #[unsafe(method(removeFromPreferencesWithCompletionHandler:))]
2297        #[unsafe(method_family = none)]
2298        pub unsafe fn removeFromPreferencesWithCompletionHandler(
2299            &self,
2300            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
2301        );
2302
2303        #[cfg(feature = "block2")]
2304        /// This function saves the DNS settingsconfiguration in the caller's DNS settings preferences. If the DNS settings are enabled, they will become active.
2305        ///
2306        /// 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.
2307        #[unsafe(method(saveToPreferencesWithCompletionHandler:))]
2308        #[unsafe(method_family = none)]
2309        pub unsafe fn saveToPreferencesWithCompletionHandler(
2310            &self,
2311            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
2312        );
2313
2314        /// A string containing a description of the DNS settings.
2315        #[unsafe(method(localizedDescription))]
2316        #[unsafe(method_family = none)]
2317        pub unsafe fn localizedDescription(&self) -> Option<Retained<NSString>>;
2318
2319        /// Setter for [`localizedDescription`][Self::localizedDescription].
2320        #[unsafe(method(setLocalizedDescription:))]
2321        #[unsafe(method_family = none)]
2322        pub unsafe fn setLocalizedDescription(&self, localized_description: Option<&NSString>);
2323
2324        /// An NEDNSSettings object containing the DNS resolver configuration to apply to the system.
2325        #[unsafe(method(dnsSettings))]
2326        #[unsafe(method_family = none)]
2327        pub unsafe fn dnsSettings(&self) -> Option<Retained<NEDNSSettings>>;
2328
2329        /// Setter for [`dnsSettings`][Self::dnsSettings].
2330        #[unsafe(method(setDnsSettings:))]
2331        #[unsafe(method_family = none)]
2332        pub unsafe fn setDnsSettings(&self, dns_settings: Option<&NEDNSSettings>);
2333
2334        /// 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.
2335        #[unsafe(method(onDemandRules))]
2336        #[unsafe(method_family = none)]
2337        pub unsafe fn onDemandRules(&self) -> Option<Retained<NSArray<NEOnDemandRule>>>;
2338
2339        /// Setter for [`onDemandRules`][Self::onDemandRules].
2340        #[unsafe(method(setOnDemandRules:))]
2341        #[unsafe(method_family = none)]
2342        pub unsafe fn setOnDemandRules(&self, on_demand_rules: Option<&NSArray<NEOnDemandRule>>);
2343
2344        /// Checks the enabled status of the DNS settings. DNS settings must be enabled by the user in Settings or System Preferences.
2345        #[unsafe(method(isEnabled))]
2346        #[unsafe(method_family = none)]
2347        pub unsafe fn isEnabled(&self) -> bool;
2348    );
2349}
2350
2351/// Methods declared on superclass `NSObject`.
2352impl NEDNSSettingsManager {
2353    extern_methods!(
2354        #[unsafe(method(init))]
2355        #[unsafe(method_family = init)]
2356        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2357
2358        #[unsafe(method(new))]
2359        #[unsafe(method_family = new)]
2360        pub unsafe fn new() -> Retained<Self>;
2361    );
2362}
2363
2364/// IP protocols
2365///
2366/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nenetworkruleprotocol?language=objc)
2367// NS_ENUM
2368#[repr(transparent)]
2369#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2370pub struct NENetworkRuleProtocol(pub NSInteger);
2371impl NENetworkRuleProtocol {
2372    #[doc(alias = "NENetworkRuleProtocolAny")]
2373    pub const Any: Self = Self(0);
2374    #[doc(alias = "NENetworkRuleProtocolTCP")]
2375    pub const TCP: Self = Self(1);
2376    #[doc(alias = "NENetworkRuleProtocolUDP")]
2377    pub const UDP: Self = Self(2);
2378}
2379
2380unsafe impl Encode for NENetworkRuleProtocol {
2381    const ENCODING: Encoding = NSInteger::ENCODING;
2382}
2383
2384unsafe impl RefEncode for NENetworkRuleProtocol {
2385    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2386}
2387
2388/// The direction of network traffic
2389///
2390/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netrafficdirection?language=objc)
2391// NS_ENUM
2392#[repr(transparent)]
2393#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2394pub struct NETrafficDirection(pub NSInteger);
2395impl NETrafficDirection {
2396    #[doc(alias = "NETrafficDirectionAny")]
2397    pub const Any: Self = Self(0);
2398    #[doc(alias = "NETrafficDirectionInbound")]
2399    pub const Inbound: Self = Self(1);
2400    #[doc(alias = "NETrafficDirectionOutbound")]
2401    pub const Outbound: Self = Self(2);
2402}
2403
2404unsafe impl Encode for NETrafficDirection {
2405    const ENCODING: Encoding = NSInteger::ENCODING;
2406}
2407
2408unsafe impl RefEncode for NETrafficDirection {
2409    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2410}
2411
2412extern_class!(
2413    /// The NENetworkRule class declares the programmatic interface of an object that contains a specification of a rule that matches the attributes of network traffic.
2414    ///
2415    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nenetworkrule?language=objc)
2416    #[unsafe(super(NSObject))]
2417    #[derive(Debug, PartialEq, Eq, Hash)]
2418    pub struct NENetworkRule;
2419);
2420
2421unsafe impl NSCoding for NENetworkRule {}
2422
2423unsafe impl NSCopying for NENetworkRule {}
2424
2425unsafe impl CopyingHelper for NENetworkRule {
2426    type Result = Self;
2427}
2428
2429unsafe impl NSObjectProtocol for NENetworkRule {}
2430
2431unsafe impl NSSecureCoding for NENetworkRule {}
2432
2433impl NENetworkRule {
2434    extern_methods!(
2435        /// Initialize a newly-allocated NENetworkRule object that matches network traffic destined for a host within a specific network.
2436        ///
2437        /// 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.
2438        /// 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.
2439        /// 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.
2440        ///
2441        /// Parameter `destinationPrefix`: An integer that in combination with the address in the endpoint specifies the destination network that the rule matches.
2442        ///
2443        /// Parameter `protocol`: A NENetworkRuleProtocol value indicating the protocol that the rule matches.
2444        ///
2445        /// Returns: The initialized NENetworkRule instance.
2446        #[deprecated]
2447        #[unsafe(method(initWithDestinationNetwork:prefix:protocol:))]
2448        #[unsafe(method_family = init)]
2449        pub unsafe fn initWithDestinationNetwork_prefix_protocol(
2450            this: Allocated<Self>,
2451            network_endpoint: &NWHostEndpoint,
2452            destination_prefix: NSUInteger,
2453            protocol: NENetworkRuleProtocol,
2454        ) -> Retained<Self>;
2455
2456        /// Initialize a newly-allocated NENetworkRule object that matches network traffic destined for a host within a specific DNS domain.
2457        ///
2458        /// 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.
2459        /// 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.
2460        /// 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.
2461        /// 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.
2462        /// Examples:
2463        /// [[NENetworkRule alloc] initWithDestinationHost:[NWHostEndpoint endpointWithHostname:
2464        /// "
2465        /// com" port:@"0"] protocol:NENetworkRuleProtocolAny] - matches all TCP and UDP traffic to the host named "com".
2466        /// [[NENetworkRule alloc] initWithDestinationHost:[NWHostEndpoint endpointWithHostname:
2467        /// "
2468        /// 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.
2469        /// [[NENetworkRule alloc] initWithDestinationHost:[NWHostEndpoint endpointWithHostname:
2470        /// "
2471        /// example.com" port:@"53"] protocol:NENetworkRuleProtocolAny] - matches all DNS queries/responses for hosts in the "example.com" domain.
2472        /// [[NENetworkRule alloc] initWithDestinationHost:[NWHostEndpoint endpointWithHostname:
2473        /// "
2474        /// example.com" port:@"443"] protocol:NENetworkRuleProtocolTCP] - matches all TCP port 443 traffic to hosts in the "example.com" domain.
2475        ///
2476        /// Parameter `protocol`: A NENetworkRuleProtocol value indicating the protocol that the rule matches.
2477        ///
2478        /// Returns: The initialized NENetworkRule instance.
2479        #[deprecated]
2480        #[unsafe(method(initWithDestinationHost:protocol:))]
2481        #[unsafe(method_family = init)]
2482        pub unsafe fn initWithDestinationHost_protocol(
2483            this: Allocated<Self>,
2484            host_endpoint: &NWHostEndpoint,
2485            protocol: NENetworkRuleProtocol,
2486        ) -> Retained<Self>;
2487
2488        /// Initialize a newly-allocated NENetworkRule object that matches traffic by remote network, local network, protocol, and direction. If both remoteNetwork and localNetwork are nil
2489        /// 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
2490        /// explicitly match traffic to the loopback address (127.0.0.1 or ::1).
2491        ///
2492        /// 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.
2493        /// 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.
2494        /// 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.
2495        /// Pass nil to cause the rule to match any remote network.
2496        ///
2497        /// Parameter `remotePrefix`: An integer that in combination with the address in remoteNetwork specifies the remote network that the rule matches.
2498        ///
2499        /// 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.
2500        /// 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.
2501        /// 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.
2502        /// Pass nil to cause the rule to match any local network.
2503        ///
2504        /// Parameter `localPrefix`: An integer that in combination with the address in localNetwork specifies the local network that the rule matches. This parameter
2505        /// is ignored if localNetwork is nil.
2506        ///
2507        /// Parameter `protocol`: A NENetworkRuleProtocol value indicating the protocol that the rule matches.
2508        ///
2509        /// Parameter `direction`: A NETrafficDirection value indicating the direction of network traffic that the rule matches.
2510        ///
2511        /// Returns: The initialized NENetworkRule instance.
2512        #[deprecated]
2513        #[unsafe(method(initWithRemoteNetwork:remotePrefix:localNetwork:localPrefix:protocol:direction:))]
2514        #[unsafe(method_family = init)]
2515        pub unsafe fn initWithRemoteNetwork_remotePrefix_localNetwork_localPrefix_protocol_direction(
2516            this: Allocated<Self>,
2517            remote_network: Option<&NWHostEndpoint>,
2518            remote_prefix: NSUInteger,
2519            local_network: Option<&NWHostEndpoint>,
2520            local_prefix: NSUInteger,
2521            protocol: NENetworkRuleProtocol,
2522            direction: NETrafficDirection,
2523        ) -> Retained<Self>;
2524
2525        /// The remote endpoint that the rule matches.
2526        #[deprecated]
2527        #[unsafe(method(matchRemoteEndpoint))]
2528        #[unsafe(method_family = none)]
2529        pub unsafe fn matchRemoteEndpoint(&self) -> Option<Retained<NWHostEndpoint>>;
2530
2531        /// 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.
2532        #[unsafe(method(matchRemotePrefix))]
2533        #[unsafe(method_family = none)]
2534        pub unsafe fn matchRemotePrefix(&self) -> NSUInteger;
2535
2536        /// The local network that the rule matches.
2537        #[deprecated]
2538        #[unsafe(method(matchLocalNetwork))]
2539        #[unsafe(method_family = none)]
2540        pub unsafe fn matchLocalNetwork(&self) -> Option<Retained<NWHostEndpoint>>;
2541
2542        /// 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.
2543        #[unsafe(method(matchLocalPrefix))]
2544        #[unsafe(method_family = none)]
2545        pub unsafe fn matchLocalPrefix(&self) -> NSUInteger;
2546
2547        /// A NENetworkRuleProtocol value containing the protocol that the rule matches.
2548        #[unsafe(method(matchProtocol))]
2549        #[unsafe(method_family = none)]
2550        pub unsafe fn matchProtocol(&self) -> NENetworkRuleProtocol;
2551
2552        /// A NETrafficDirection value indicating the network traffic direction that the rule matches.
2553        #[unsafe(method(matchDirection))]
2554        #[unsafe(method_family = none)]
2555        pub unsafe fn matchDirection(&self) -> NETrafficDirection;
2556    );
2557}
2558
2559/// Methods declared on superclass `NSObject`.
2560impl NENetworkRule {
2561    extern_methods!(
2562        #[unsafe(method(init))]
2563        #[unsafe(method_family = init)]
2564        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2565
2566        #[unsafe(method(new))]
2567        #[unsafe(method_family = new)]
2568        pub unsafe fn new() -> Retained<Self>;
2569    );
2570}
2571
2572extern_class!(
2573    /// The NEFilterFlow class declares the programmatic interface of an object that represents a flow of network data to be filtered.
2574    ///
2575    /// NEFilterFlow is part of NetworkExtension.framework
2576    ///
2577    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterflow?language=objc)
2578    #[unsafe(super(NSObject))]
2579    #[derive(Debug, PartialEq, Eq, Hash)]
2580    pub struct NEFilterFlow;
2581);
2582
2583unsafe impl NSCoding for NEFilterFlow {}
2584
2585unsafe impl NSCopying for NEFilterFlow {}
2586
2587unsafe impl CopyingHelper for NEFilterFlow {
2588    type Result = Self;
2589}
2590
2591unsafe impl NSObjectProtocol for NEFilterFlow {}
2592
2593unsafe impl NSSecureCoding for NEFilterFlow {}
2594
2595impl NEFilterFlow {
2596    extern_methods!(
2597        /// The flow's HTTP request URL. Will be nil if the flow did not originate from WebKit.
2598        #[unsafe(method(URL))]
2599        #[unsafe(method_family = none)]
2600        pub unsafe fn URL(&self) -> Option<Retained<NSURL>>;
2601
2602        /// A byte string that uniquely identifies the binary for each build of the source application of the flow.
2603        #[unsafe(method(sourceAppUniqueIdentifier))]
2604        #[unsafe(method_family = none)]
2605        pub unsafe fn sourceAppUniqueIdentifier(&self) -> Option<Retained<NSData>>;
2606
2607        /// 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.
2608        #[unsafe(method(sourceAppIdentifier))]
2609        #[unsafe(method_family = none)]
2610        pub unsafe fn sourceAppIdentifier(&self) -> Option<Retained<NSString>>;
2611
2612        /// The short version string of the source application. Will be nil if the app info is unavailable.
2613        #[unsafe(method(sourceAppVersion))]
2614        #[unsafe(method_family = none)]
2615        pub unsafe fn sourceAppVersion(&self) -> Option<Retained<NSString>>;
2616
2617        /// Initial direction of the flow (outgoing or incoming flow)
2618        #[unsafe(method(direction))]
2619        #[unsafe(method_family = none)]
2620        pub unsafe fn direction(&self) -> NETrafficDirection;
2621
2622        /// Audit token of the source application of the flow.
2623        #[unsafe(method(sourceAppAuditToken))]
2624        #[unsafe(method_family = none)]
2625        pub unsafe fn sourceAppAuditToken(&self) -> Option<Retained<NSData>>;
2626
2627        /// 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,
2628        /// sourceProcessAuditToken will be different from sourceAppAuditToken and will contain the audit token of the system process. In cases where the source application directly
2629        /// created the connection sourceAppAuditToken and sourceProcessAuditToken will be identical.
2630        #[unsafe(method(sourceProcessAuditToken))]
2631        #[unsafe(method_family = none)]
2632        pub unsafe fn sourceProcessAuditToken(&self) -> Option<Retained<NSData>>;
2633
2634        /// The unique identifier of the flow.
2635        #[unsafe(method(identifier))]
2636        #[unsafe(method_family = none)]
2637        pub unsafe fn identifier(&self) -> Retained<NSUUID>;
2638    );
2639}
2640
2641/// Methods declared on superclass `NSObject`.
2642impl NEFilterFlow {
2643    extern_methods!(
2644        #[unsafe(method(init))]
2645        #[unsafe(method_family = init)]
2646        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2647
2648        #[unsafe(method(new))]
2649        #[unsafe(method_family = new)]
2650        pub unsafe fn new() -> Retained<Self>;
2651    );
2652}
2653
2654extern_class!(
2655    /// 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.
2656    ///
2657    /// NEFilterBrowserFlow is part of NetworkExtension.framework
2658    ///
2659    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterbrowserflow?language=objc)
2660    #[unsafe(super(NEFilterFlow, NSObject))]
2661    #[derive(Debug, PartialEq, Eq, Hash)]
2662    pub struct NEFilterBrowserFlow;
2663);
2664
2665unsafe impl NSCoding for NEFilterBrowserFlow {}
2666
2667unsafe impl NSCopying for NEFilterBrowserFlow {}
2668
2669unsafe impl CopyingHelper for NEFilterBrowserFlow {
2670    type Result = Self;
2671}
2672
2673unsafe impl NSObjectProtocol for NEFilterBrowserFlow {}
2674
2675unsafe impl NSSecureCoding for NEFilterBrowserFlow {}
2676
2677impl NEFilterBrowserFlow {
2678    extern_methods!(
2679        /// The NSURLRequest of the flow. This property is always nil for the control providers.
2680        #[unsafe(method(request))]
2681        #[unsafe(method_family = none)]
2682        pub unsafe fn request(&self) -> Option<Retained<NSURLRequest>>;
2683
2684        /// 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.
2685        #[unsafe(method(response))]
2686        #[unsafe(method_family = none)]
2687        pub unsafe fn response(&self) -> Option<Retained<NSURLResponse>>;
2688
2689        /// 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.
2690        #[unsafe(method(parentURL))]
2691        #[unsafe(method_family = none)]
2692        pub unsafe fn parentURL(&self) -> Option<Retained<NSURL>>;
2693    );
2694}
2695
2696/// Methods declared on superclass `NSObject`.
2697impl NEFilterBrowserFlow {
2698    extern_methods!(
2699        #[unsafe(method(init))]
2700        #[unsafe(method_family = init)]
2701        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2702
2703        #[unsafe(method(new))]
2704        #[unsafe(method_family = new)]
2705        pub unsafe fn new() -> Retained<Self>;
2706    );
2707}
2708
2709extern_class!(
2710    /// 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.
2711    ///
2712    /// NEFilterSocketFlow is part of NetworkExtension.framework
2713    ///
2714    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefiltersocketflow?language=objc)
2715    #[unsafe(super(NEFilterFlow, NSObject))]
2716    #[derive(Debug, PartialEq, Eq, Hash)]
2717    pub struct NEFilterSocketFlow;
2718);
2719
2720unsafe impl NSCoding for NEFilterSocketFlow {}
2721
2722unsafe impl NSCopying for NEFilterSocketFlow {}
2723
2724unsafe impl CopyingHelper for NEFilterSocketFlow {
2725    type Result = Self;
2726}
2727
2728unsafe impl NSObjectProtocol for NEFilterSocketFlow {}
2729
2730unsafe impl NSSecureCoding for NEFilterSocketFlow {}
2731
2732impl NEFilterSocketFlow {
2733    extern_methods!(
2734        /// 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.
2735        /// In such a case, filtering on the flow may still be performed based on its socket type, socket family or socket protocol.
2736        #[deprecated]
2737        #[unsafe(method(remoteEndpoint))]
2738        #[unsafe(method_family = none)]
2739        pub unsafe fn remoteEndpoint(&self) -> Option<Retained<NWEndpoint>>;
2740
2741        /// The flow's remote hostname. This property is only non-nil if the flow was created using Network.framework or NSURLSession.
2742        #[unsafe(method(remoteHostname))]
2743        #[unsafe(method_family = none)]
2744        pub unsafe fn remoteHostname(&self) -> Option<Retained<NSString>>;
2745
2746        /// 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.
2747        /// In such a case, filtering on the flow may still be performed based on its socket type, socket family or socket protocol.
2748        #[deprecated]
2749        #[unsafe(method(localEndpoint))]
2750        #[unsafe(method_family = none)]
2751        pub unsafe fn localEndpoint(&self) -> Option<Retained<NWEndpoint>>;
2752
2753        /// Socket family of the socket flow, such as PF_INET.
2754        #[unsafe(method(socketFamily))]
2755        #[unsafe(method_family = none)]
2756        pub unsafe fn socketFamily(&self) -> c_int;
2757
2758        /// Socket type of the socket flow, such as SOCK_STREAM.
2759        #[unsafe(method(socketType))]
2760        #[unsafe(method_family = none)]
2761        pub unsafe fn socketType(&self) -> c_int;
2762
2763        /// Socket protocol of the socket flow, such as IPPROTO_TCP.
2764        #[unsafe(method(socketProtocol))]
2765        #[unsafe(method_family = none)]
2766        pub unsafe fn socketProtocol(&self) -> c_int;
2767    );
2768}
2769
2770/// Methods declared on superclass `NSObject`.
2771impl NEFilterSocketFlow {
2772    extern_methods!(
2773        #[unsafe(method(init))]
2774        #[unsafe(method_family = init)]
2775        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2776
2777        #[unsafe(method(new))]
2778        #[unsafe(method_family = new)]
2779        pub unsafe fn new() -> Retained<Self>;
2780    );
2781}
2782
2783extern_class!(
2784    /// The NEFilterProvider class is an abstract base class that declares the programmatic interface of an
2785    /// object that implements a socket filter.
2786    ///
2787    /// NEFilterProvider is part of NetworkExtension.framework
2788    ///
2789    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterprovider?language=objc)
2790    #[unsafe(super(NEProvider, NSObject))]
2791    #[derive(Debug, PartialEq, Eq, Hash)]
2792    pub struct NEFilterProvider;
2793);
2794
2795unsafe impl NSObjectProtocol for NEFilterProvider {}
2796
2797impl NEFilterProvider {
2798    extern_methods!(
2799        #[cfg(feature = "block2")]
2800        /// This function is called by the framework when the content filter is being started. Subclasses must
2801        /// override this method and perform whatever steps are necessary to start the filter.
2802        ///
2803        /// Parameter `completionHandler`: A block that must be called when the process of starting the filter is complete. If the
2804        /// filter was started successfully, subclass implementations must pass the nil value to this block. If an error occurred
2805        /// while starting the filter, sublcass implementations must pass a non-nil NSError containing more details about the error.
2806        #[unsafe(method(startFilterWithCompletionHandler:))]
2807        #[unsafe(method_family = none)]
2808        pub unsafe fn startFilterWithCompletionHandler(
2809            &self,
2810            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
2811        );
2812
2813        #[cfg(feature = "block2")]
2814        /// This function is called by the framework when the content filter is being stopped. Subclasses must
2815        /// override this method and perform whatever steps are necessary to stop the filter.
2816        ///
2817        /// Parameter `reason`: An NEProviderStopReason indicating why the filter is being stopped.
2818        ///
2819        /// Parameter `completionHandler`: A block that must be called when the process of stopping the filter is complete.
2820        #[unsafe(method(stopFilterWithReason:completionHandler:))]
2821        #[unsafe(method_family = none)]
2822        pub unsafe fn stopFilterWithReason_completionHandler(
2823            &self,
2824            reason: NEProviderStopReason,
2825            completion_handler: &block2::Block<dyn Fn()>,
2826        );
2827
2828        /// An NEContentFilterConfiguration object containing the current filter configuration. The value of this
2829        /// property can change during the lifetime of a filter. Filter implementations can use KVO to be notified when the
2830        /// configuration changes.
2831        #[unsafe(method(filterConfiguration))]
2832        #[unsafe(method_family = none)]
2833        pub unsafe fn filterConfiguration(&self) -> Retained<NEFilterProviderConfiguration>;
2834
2835        /// This function is called by the framework when the data provider extension returns a verdict with the report property set to True.
2836        /// Subclass implementations may override this method to handle the flow report.
2837        ///
2838        /// Parameter `report`: The report being delivered.
2839        #[unsafe(method(handleReport:))]
2840        #[unsafe(method_family = none)]
2841        pub unsafe fn handleReport(&self, report: &NEFilterReport);
2842    );
2843}
2844
2845/// Methods declared on superclass `NSObject`.
2846impl NEFilterProvider {
2847    extern_methods!(
2848        #[unsafe(method(init))]
2849        #[unsafe(method_family = init)]
2850        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2851
2852        #[unsafe(method(new))]
2853        #[unsafe(method_family = new)]
2854        pub unsafe fn new() -> Retained<Self>;
2855    );
2856}
2857
2858/// A NEFilterReportFrequency controls the frequency of periodic reports.
2859///
2860/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterreportfrequency?language=objc)
2861// NS_ENUM
2862#[repr(transparent)]
2863#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2864pub struct NEFilterReportFrequency(pub NSInteger);
2865impl NEFilterReportFrequency {
2866    #[doc(alias = "NEFilterReportFrequencyNone")]
2867    pub const None: Self = Self(0);
2868    #[doc(alias = "NEFilterReportFrequencyLow")]
2869    pub const Low: Self = Self(1);
2870    #[doc(alias = "NEFilterReportFrequencyMedium")]
2871    pub const Medium: Self = Self(2);
2872    #[doc(alias = "NEFilterReportFrequencyHigh")]
2873    pub const High: Self = Self(3);
2874}
2875
2876unsafe impl Encode for NEFilterReportFrequency {
2877    const ENCODING: Encoding = NSInteger::ENCODING;
2878}
2879
2880unsafe impl RefEncode for NEFilterReportFrequency {
2881    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2882}
2883
2884extern_class!(
2885    /// The NEFilterVerdict class declares the programmatic interface for an object that is the verdict for a
2886    /// flow of network data.
2887    ///
2888    /// NEFilterVerdict is part of NetworkExtension.framework
2889    ///
2890    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterverdict?language=objc)
2891    #[unsafe(super(NSObject))]
2892    #[derive(Debug, PartialEq, Eq, Hash)]
2893    pub struct NEFilterVerdict;
2894);
2895
2896unsafe impl NSCoding for NEFilterVerdict {}
2897
2898unsafe impl NSCopying for NEFilterVerdict {}
2899
2900unsafe impl CopyingHelper for NEFilterVerdict {
2901    type Result = Self;
2902}
2903
2904unsafe impl NSObjectProtocol for NEFilterVerdict {}
2905
2906unsafe impl NSSecureCoding for NEFilterVerdict {}
2907
2908impl NEFilterVerdict {
2909    extern_methods!(
2910        /// Whether or not to send a report to the control provider's -[NEFilterProvider handleReport:]
2911        /// method when processing this verdict and when the flow is closed. Since the data provider does not need to wait
2912        /// for a response from the control provider before continuing to process the flow, this is a more efficient way to
2913        /// report a flow to the control provider than returning a "need rules" verdict. If the verdict originates in the
2914        /// control provider, this property has no effect. This property applies when the action taken upon a flow is allow,
2915        /// deny, remediate, or filterData (filterData for new flows only). Setting this flag on a verdict for a socket
2916        /// flow will also cause the data provider's -[NEFilterProvider handleReport:] method to be called when the flow
2917        /// is closed.
2918        #[unsafe(method(shouldReport))]
2919        #[unsafe(method_family = none)]
2920        pub unsafe fn shouldReport(&self) -> bool;
2921
2922        /// Setter for [`shouldReport`][Self::shouldReport].
2923        #[unsafe(method(setShouldReport:))]
2924        #[unsafe(method_family = none)]
2925        pub unsafe fn setShouldReport(&self, should_report: bool);
2926    );
2927}
2928
2929/// Methods declared on superclass `NSObject`.
2930impl NEFilterVerdict {
2931    extern_methods!(
2932        #[unsafe(method(init))]
2933        #[unsafe(method_family = init)]
2934        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2935
2936        #[unsafe(method(new))]
2937        #[unsafe(method_family = new)]
2938        pub unsafe fn new() -> Retained<Self>;
2939    );
2940}
2941
2942extern_class!(
2943    /// The NEFilterNewFlowVerdict declares the programmatic interface of an object that is the verdict for a
2944    /// new flow of network data before any of the flow's data has been seen by the filter.
2945    ///
2946    /// NEFilterNewFlowVerdict is part of NetworkExtension.framework
2947    ///
2948    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilternewflowverdict?language=objc)
2949    #[unsafe(super(NEFilterVerdict, NSObject))]
2950    #[derive(Debug, PartialEq, Eq, Hash)]
2951    pub struct NEFilterNewFlowVerdict;
2952);
2953
2954unsafe impl NSCoding for NEFilterNewFlowVerdict {}
2955
2956unsafe impl NSCopying for NEFilterNewFlowVerdict {}
2957
2958unsafe impl CopyingHelper for NEFilterNewFlowVerdict {
2959    type Result = Self;
2960}
2961
2962unsafe impl NSObjectProtocol for NEFilterNewFlowVerdict {}
2963
2964unsafe impl NSSecureCoding for NEFilterNewFlowVerdict {}
2965
2966impl NEFilterNewFlowVerdict {
2967    extern_methods!(
2968        /// The frequency at which the data provider's -[NEFilterProvider handleReport:] method is called with a NEFilterReport instance with an event of NEFilterReportEventFlowStatistics.
2969        /// The default value is NEFilterReportFrequencyNone, so by default no statistics are reported.
2970        #[unsafe(method(statisticsReportFrequency))]
2971        #[unsafe(method_family = none)]
2972        pub unsafe fn statisticsReportFrequency(&self) -> NEFilterReportFrequency;
2973
2974        /// Setter for [`statisticsReportFrequency`][Self::statisticsReportFrequency].
2975        #[unsafe(method(setStatisticsReportFrequency:))]
2976        #[unsafe(method_family = none)]
2977        pub unsafe fn setStatisticsReportFrequency(
2978            &self,
2979            statistics_report_frequency: NEFilterReportFrequency,
2980        );
2981
2982        /// This class method returns a verdict indicating that control provider needs to be asked how to handle
2983        /// the new flow. The control provider can either drop or allow the flow, or update the rules and ask the data provider
2984        /// to decide on the new flow again.
2985        ///
2986        /// Returns: The NEFilterNewFlowVerdict object.
2987        #[unsafe(method(needRulesVerdict))]
2988        #[unsafe(method_family = none)]
2989        pub unsafe fn needRulesVerdict() -> Retained<NEFilterNewFlowVerdict>;
2990
2991        /// This class method returns a verdict indicating that the flow should be allowed.
2992        ///
2993        /// Returns: The NEFilterNewFlowVerdict object.
2994        #[unsafe(method(allowVerdict))]
2995        #[unsafe(method_family = none)]
2996        pub unsafe fn allowVerdict() -> Retained<NEFilterNewFlowVerdict>;
2997
2998        /// This class method returns a verdict indicating that the flow should be dropped.
2999        ///
3000        /// Returns: The NEFilterNewFlowVerdict object.
3001        #[unsafe(method(dropVerdict))]
3002        #[unsafe(method_family = none)]
3003        pub unsafe fn dropVerdict() -> Retained<NEFilterNewFlowVerdict>;
3004
3005        /// This class method returns a verdict indicating that a "content blocked" page should be displayed to
3006        /// the user. The block page should contain a link to the given URL.
3007        ///
3008        /// Parameter `remediationURLMapKey`: Remediation map key used by data plugin to get remediation url
3009        ///
3010        /// Returns: The NEFilterNewFlowVerdict object.
3011        #[unsafe(method(remediateVerdictWithRemediationURLMapKey:remediationButtonTextMapKey:))]
3012        #[unsafe(method_family = none)]
3013        pub unsafe fn remediateVerdictWithRemediationURLMapKey_remediationButtonTextMapKey(
3014            remediation_url_map_key: &NSString,
3015            remediation_button_text_map_key: &NSString,
3016        ) -> Retained<NEFilterNewFlowVerdict>;
3017
3018        /// This class method returns a verdict indicating that safe search URL for the new should be specified
3019        ///
3020        /// Parameter `urlAppendMapKey`: URL Append map key to be used by the data plugin to notify what the url should be appended with
3021        ///
3022        /// Returns: The NEFilterNewFlowVerdict object.
3023        #[unsafe(method(URLAppendStringVerdictWithMapKey:))]
3024        #[unsafe(method_family = none)]
3025        pub unsafe fn URLAppendStringVerdictWithMapKey(
3026            url_append_map_key: &NSString,
3027        ) -> Retained<NEFilterNewFlowVerdict>;
3028
3029        /// This class method returns a new flow verdict indicating that the filter needs to make a decision about
3030        /// a new flow after seeing a portion of the flow's data.
3031        ///
3032        /// Parameter `filterInbound`: A boolean indicating if the filter needs to see inbound data
3033        ///
3034        /// Parameter `peekInboundBytes`: The number of inbound bytes that the filter needs to see in the subsequent call to
3035        /// -[NEFilterDataProvider handleInboundDataFromFlow:readBytesStartOffset:readBytes:].
3036        ///
3037        /// Parameter `filterOutbound`: boolean indicating if the filter needs to see outbound data
3038        ///
3039        /// Parameter `peekOutboundBytes`: The number of outbound bytes that the filter needs to see in the subsequent call to
3040        /// -[NEFilterDataProvider handleOutboundDataFromFlow:readBytesStartOffset:readBytes:].
3041        ///
3042        /// Returns: The new flow verdict.
3043        #[unsafe(method(filterDataVerdictWithFilterInbound:peekInboundBytes:filterOutbound:peekOutboundBytes:))]
3044        #[unsafe(method_family = none)]
3045        pub unsafe fn filterDataVerdictWithFilterInbound_peekInboundBytes_filterOutbound_peekOutboundBytes(
3046            filter_inbound: bool,
3047            peek_inbound_bytes: NSUInteger,
3048            filter_outbound: bool,
3049            peek_outbound_bytes: NSUInteger,
3050        ) -> Retained<NEFilterNewFlowVerdict>;
3051
3052        /// 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
3053        /// 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
3054        /// being paused. It is invalid to pause a flow that is already paused.
3055        ///
3056        /// Returns: The NEFilterNewFlowVerdict object.
3057        #[unsafe(method(pauseVerdict))]
3058        #[unsafe(method_family = none)]
3059        pub unsafe fn pauseVerdict() -> Retained<NEFilterNewFlowVerdict>;
3060    );
3061}
3062
3063/// Methods declared on superclass `NSObject`.
3064impl NEFilterNewFlowVerdict {
3065    extern_methods!(
3066        #[unsafe(method(init))]
3067        #[unsafe(method_family = init)]
3068        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3069
3070        #[unsafe(method(new))]
3071        #[unsafe(method_family = new)]
3072        pub unsafe fn new() -> Retained<Self>;
3073    );
3074}
3075
3076extern_class!(
3077    /// The NEFilterControlVerdict declares the programmatic interface of an object that is the verdict for a
3078    /// new flow of network data by the control provider.
3079    ///
3080    /// NEFilterControlVerdict is part of NetworkExtension.framework
3081    ///
3082    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefiltercontrolverdict?language=objc)
3083    #[unsafe(super(NEFilterNewFlowVerdict, NEFilterVerdict, NSObject))]
3084    #[derive(Debug, PartialEq, Eq, Hash)]
3085    pub struct NEFilterControlVerdict;
3086);
3087
3088unsafe impl NSCoding for NEFilterControlVerdict {}
3089
3090unsafe impl NSCopying for NEFilterControlVerdict {}
3091
3092unsafe impl CopyingHelper for NEFilterControlVerdict {
3093    type Result = Self;
3094}
3095
3096unsafe impl NSObjectProtocol for NEFilterControlVerdict {}
3097
3098unsafe impl NSSecureCoding for NEFilterControlVerdict {}
3099
3100impl NEFilterControlVerdict {
3101    extern_methods!(
3102        /// This class method returns a verdict indicating that the flow should be allowed to go through, and also
3103        /// tell the data provider whether to update its rules or not.
3104        ///
3105        /// Parameter `updateRules`: YES if the control provider has updated the rules and wants to communicate that to the data provider
3106        ///
3107        /// Returns: The NEFilterControlVerdict object.
3108        #[unsafe(method(allowVerdictWithUpdateRules:))]
3109        #[unsafe(method_family = none)]
3110        pub unsafe fn allowVerdictWithUpdateRules(
3111            update_rules: bool,
3112        ) -> Retained<NEFilterControlVerdict>;
3113
3114        /// This class method returns a verdict indicating that the flow should be dropped, and also tell the data
3115        /// provider whether to update its rules or not.
3116        ///
3117        /// Parameter `updateRules`: YES if the control provider has updated the rules and wants to communicate that to the data provider
3118        ///
3119        /// Returns: The NEFilterControlVerdict object.
3120        #[unsafe(method(dropVerdictWithUpdateRules:))]
3121        #[unsafe(method_family = none)]
3122        pub unsafe fn dropVerdictWithUpdateRules(
3123            update_rules: bool,
3124        ) -> Retained<NEFilterControlVerdict>;
3125
3126        /// This class method returns a verdict indicating that the flow should be handled by the data provider,
3127        /// and the rules needed by the data provider have been set.
3128        ///
3129        /// Returns: The NEFilterControlVerdict object.
3130        #[unsafe(method(updateRules))]
3131        #[unsafe(method_family = none)]
3132        pub unsafe fn updateRules() -> Retained<NEFilterControlVerdict>;
3133    );
3134}
3135
3136/// Methods declared on superclass `NSObject`.
3137impl NEFilterControlVerdict {
3138    extern_methods!(
3139        #[unsafe(method(init))]
3140        #[unsafe(method_family = init)]
3141        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3142
3143        #[unsafe(method(new))]
3144        #[unsafe(method_family = new)]
3145        pub unsafe fn new() -> Retained<Self>;
3146    );
3147}
3148
3149/// A NEFilterAction represents the possible actions taken upon a NEFilterFlow that can be reported by the
3150/// data provider extension to the control provider extension.
3151///
3152/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilteraction?language=objc)
3153// NS_ENUM
3154#[repr(transparent)]
3155#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
3156pub struct NEFilterAction(pub NSInteger);
3157impl NEFilterAction {
3158    #[doc(alias = "NEFilterActionInvalid")]
3159    pub const Invalid: Self = Self(0);
3160    #[doc(alias = "NEFilterActionAllow")]
3161    pub const Allow: Self = Self(1);
3162    #[doc(alias = "NEFilterActionDrop")]
3163    pub const Drop: Self = Self(2);
3164    #[doc(alias = "NEFilterActionRemediate")]
3165    pub const Remediate: Self = Self(3);
3166    #[doc(alias = "NEFilterActionFilterData")]
3167    pub const FilterData: Self = Self(4);
3168}
3169
3170unsafe impl Encode for NEFilterAction {
3171    const ENCODING: Encoding = NSInteger::ENCODING;
3172}
3173
3174unsafe impl RefEncode for NEFilterAction {
3175    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3176}
3177
3178/// A NEFilterReportEvent represents the event that is being reported by the NEFilterReport.
3179///
3180/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterreportevent?language=objc)
3181// NS_ENUM
3182#[repr(transparent)]
3183#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
3184pub struct NEFilterReportEvent(pub NSInteger);
3185impl NEFilterReportEvent {
3186    #[doc(alias = "NEFilterReportEventNewFlow")]
3187    pub const NewFlow: Self = Self(1);
3188    #[doc(alias = "NEFilterReportEventDataDecision")]
3189    pub const DataDecision: Self = Self(2);
3190    #[doc(alias = "NEFilterReportEventFlowClosed")]
3191    pub const FlowClosed: Self = Self(3);
3192    #[doc(alias = "NEFilterReportEventStatistics")]
3193    pub const Statistics: Self = Self(4);
3194}
3195
3196unsafe impl Encode for NEFilterReportEvent {
3197    const ENCODING: Encoding = NSInteger::ENCODING;
3198}
3199
3200unsafe impl RefEncode for NEFilterReportEvent {
3201    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3202}
3203
3204extern_class!(
3205    /// The NEFilterReport declares the programmatic interface of an object that is a report of actions taken by
3206    /// the data provider.
3207    ///
3208    /// NEFilterReport is part of NetworkExtension.framework
3209    ///
3210    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterreport?language=objc)
3211    #[unsafe(super(NSObject))]
3212    #[derive(Debug, PartialEq, Eq, Hash)]
3213    pub struct NEFilterReport;
3214);
3215
3216unsafe impl NSCoding for NEFilterReport {}
3217
3218unsafe impl NSCopying for NEFilterReport {}
3219
3220unsafe impl CopyingHelper for NEFilterReport {
3221    type Result = Self;
3222}
3223
3224unsafe impl NSObjectProtocol for NEFilterReport {}
3225
3226unsafe impl NSSecureCoding for NEFilterReport {}
3227
3228impl NEFilterReport {
3229    extern_methods!(
3230        /// The flow on which the described action was taken.
3231        #[unsafe(method(flow))]
3232        #[unsafe(method_family = none)]
3233        pub unsafe fn flow(&self) -> Option<Retained<NEFilterFlow>>;
3234
3235        /// The action taken upon the reported flow.
3236        #[unsafe(method(action))]
3237        #[unsafe(method_family = none)]
3238        pub unsafe fn action(&self) -> NEFilterAction;
3239
3240        /// The type of event that the report is reporting.
3241        #[unsafe(method(event))]
3242        #[unsafe(method_family = none)]
3243        pub unsafe fn event(&self) -> NEFilterReportEvent;
3244
3245        /// The number of inbound bytes received from the flow. This property is only non-zero when the report event is NEFilterReportEventFlowClosed or NEFilterReportEventFlowStatistics.
3246        #[unsafe(method(bytesInboundCount))]
3247        #[unsafe(method_family = none)]
3248        pub unsafe fn bytesInboundCount(&self) -> NSUInteger;
3249
3250        /// The number of outbound bytes sent on the flow. This property is only non-zero when the report event is NEFilterReportEventFlowClosed or NEFilterReportEventFlowStatistics.
3251        #[unsafe(method(bytesOutboundCount))]
3252        #[unsafe(method_family = none)]
3253        pub unsafe fn bytesOutboundCount(&self) -> NSUInteger;
3254    );
3255}
3256
3257/// Methods declared on superclass `NSObject`.
3258impl NEFilterReport {
3259    extern_methods!(
3260        #[unsafe(method(init))]
3261        #[unsafe(method_family = init)]
3262        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3263
3264        #[unsafe(method(new))]
3265        #[unsafe(method_family = new)]
3266        pub unsafe fn new() -> Retained<Self>;
3267    );
3268}
3269
3270extern_class!(
3271    /// The NEFilterControlProvider class declares the programmatic interface for an object that is responsible for installing filtering rules on the device.
3272    ///
3273    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefiltercontrolprovider?language=objc)
3274    #[unsafe(super(NEFilterProvider, NEProvider, NSObject))]
3275    #[derive(Debug, PartialEq, Eq, Hash)]
3276    pub struct NEFilterControlProvider;
3277);
3278
3279unsafe impl NSObjectProtocol for NEFilterControlProvider {}
3280
3281impl NEFilterControlProvider {
3282    extern_methods!(
3283        /// 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.
3284        ///
3285        /// Here is a sample remediationMap dictionary:
3286        ///
3287        /// remediationMap =
3288        /// @
3289        /// { NEFilterProviderRemediationMapRemediationURLs :
3290        /// @
3291        /// {
3292        /// "
3293        /// RemediateKey1" : @"http://www.remediation_url_1.com",
3294        /// "
3295        /// RemediateKey2" : @"http://www.remediation_url_2.com"
3296        /// },
3297        /// NEFilterProviderRemediationMapRemediationButtonTexts :
3298        /// @
3299        /// {
3300        /// "
3301        /// RemediationButtonText1" : @"Remediate URL"
3302        /// }
3303        /// };
3304        #[unsafe(method(remediationMap))]
3305        #[unsafe(method_family = none)]
3306        pub unsafe fn remediationMap(
3307            &self,
3308        ) -> Option<Retained<NSDictionary<NSString, NSDictionary<NSString, NSObject>>>>;
3309
3310        /// Setter for [`remediationMap`][Self::remediationMap].
3311        #[unsafe(method(setRemediationMap:))]
3312        #[unsafe(method_family = none)]
3313        pub unsafe fn setRemediationMap(
3314            &self,
3315            remediation_map: Option<&NSDictionary<NSString, NSDictionary<NSString, NSObject>>>,
3316        );
3317
3318        /// A dictionary containing strings to be appended to URLs.
3319        #[unsafe(method(URLAppendStringMap))]
3320        #[unsafe(method_family = none)]
3321        pub unsafe fn URLAppendStringMap(
3322            &self,
3323        ) -> Option<Retained<NSDictionary<NSString, NSString>>>;
3324
3325        /// Setter for [`URLAppendStringMap`][Self::URLAppendStringMap].
3326        #[unsafe(method(setURLAppendStringMap:))]
3327        #[unsafe(method_family = none)]
3328        pub unsafe fn setURLAppendStringMap(
3329            &self,
3330            url_append_string_map: Option<&NSDictionary<NSString, NSString>>,
3331        );
3332
3333        #[cfg(feature = "block2")]
3334        /// 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.
3335        ///
3336        /// Parameter `flow`: An NEFilterFlow object containing details about the flow that requires remediation.
3337        ///
3338        /// 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.
3339        #[unsafe(method(handleRemediationForFlow:completionHandler:))]
3340        #[unsafe(method_family = none)]
3341        pub unsafe fn handleRemediationForFlow_completionHandler(
3342            &self,
3343            flow: &NEFilterFlow,
3344            completion_handler: &block2::Block<dyn Fn(NonNull<NEFilterControlVerdict>)>,
3345        );
3346
3347        #[cfg(feature = "block2")]
3348        /// 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.
3349        ///
3350        /// Parameter `flow`: An NEFilterFlow object containing details about the flow that requires a rules update.
3351        ///
3352        /// 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.
3353        #[unsafe(method(handleNewFlow:completionHandler:))]
3354        #[unsafe(method_family = none)]
3355        pub unsafe fn handleNewFlow_completionHandler(
3356            &self,
3357            flow: &NEFilterFlow,
3358            completion_handler: &block2::Block<dyn Fn(NonNull<NEFilterControlVerdict>)>,
3359        );
3360
3361        /// This function is called by filter control implementations to notify the data provider "out of band" that the rules changed.
3362        #[unsafe(method(notifyRulesChanged))]
3363        #[unsafe(method_family = none)]
3364        pub unsafe fn notifyRulesChanged(&self);
3365    );
3366}
3367
3368/// Methods declared on superclass `NSObject`.
3369impl NEFilterControlProvider {
3370    extern_methods!(
3371        #[unsafe(method(init))]
3372        #[unsafe(method_family = init)]
3373        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3374
3375        #[unsafe(method(new))]
3376        #[unsafe(method_family = new)]
3377        pub unsafe fn new() -> Retained<Self>;
3378    );
3379}
3380
3381/// Attribute flags describing data
3382///
3383/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterdataattribute?language=objc)
3384// NS_ENUM
3385#[repr(transparent)]
3386#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
3387pub struct NEFilterDataAttribute(pub NSInteger);
3388impl NEFilterDataAttribute {
3389    #[doc(alias = "NEFilterDataAttributeHasIPHeader")]
3390    pub const HasIPHeader: Self = Self(0x00000001);
3391}
3392
3393unsafe impl Encode for NEFilterDataAttribute {
3394    const ENCODING: Encoding = NSInteger::ENCODING;
3395}
3396
3397unsafe impl RefEncode for NEFilterDataAttribute {
3398    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3399}
3400
3401extern_class!(
3402    /// 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.
3403    ///
3404    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterdataprovider?language=objc)
3405    #[unsafe(super(NEFilterProvider, NEProvider, NSObject))]
3406    #[derive(Debug, PartialEq, Eq, Hash)]
3407    pub struct NEFilterDataProvider;
3408);
3409
3410unsafe impl NSObjectProtocol for NEFilterDataProvider {}
3411
3412impl NEFilterDataProvider {
3413    extern_methods!(
3414        /// 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.
3415        ///
3416        /// Parameter `flow`: An NEFilterFlow object containing details about the new flow.
3417        ///
3418        /// Returns: An NEFilterNewFlowVerdict object containing the verdict for the new flow.
3419        #[unsafe(method(handleNewFlow:))]
3420        #[unsafe(method_family = none)]
3421        pub unsafe fn handleNewFlow(&self, flow: &NEFilterFlow)
3422            -> Retained<NEFilterNewFlowVerdict>;
3423
3424        /// 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.
3425        ///
3426        /// Parameter `flow`: The NEFilterFlow from which the data was read.
3427        ///
3428        /// Parameter `offset`: The offset in bytes from the start of the flow's inbound data at which readBytes begins.
3429        ///
3430        /// 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.
3431        ///
3432        /// Returns: An NEFilterFlowDataVerdict containing the verdict for the flow.
3433        #[unsafe(method(handleInboundDataFromFlow:readBytesStartOffset:readBytes:))]
3434        #[unsafe(method_family = none)]
3435        pub unsafe fn handleInboundDataFromFlow_readBytesStartOffset_readBytes(
3436            &self,
3437            flow: &NEFilterFlow,
3438            offset: NSUInteger,
3439            read_bytes: &NSData,
3440        ) -> Retained<NEFilterDataVerdict>;
3441
3442        /// 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.
3443        ///
3444        /// Parameter `flow`: The NEFilterFlow from which the data was read.
3445        ///
3446        /// Parameter `offset`: The offset in bytes from the start of the flow's outbound data at which readBytes begins.
3447        ///
3448        /// 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.
3449        ///
3450        /// Returns: An NEFilterFlowDataVerdict containing the verdict for the flow.
3451        #[unsafe(method(handleOutboundDataFromFlow:readBytesStartOffset:readBytes:))]
3452        #[unsafe(method_family = none)]
3453        pub unsafe fn handleOutboundDataFromFlow_readBytesStartOffset_readBytes(
3454            &self,
3455            flow: &NEFilterFlow,
3456            offset: NSUInteger,
3457            read_bytes: &NSData,
3458        ) -> Retained<NEFilterDataVerdict>;
3459
3460        /// 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.
3461        ///
3462        /// Parameter `flow`: The flow
3463        ///
3464        /// Returns: The final NEFilterFlowDataVerdict verdict for the flow.
3465        #[unsafe(method(handleInboundDataCompleteForFlow:))]
3466        #[unsafe(method_family = none)]
3467        pub unsafe fn handleInboundDataCompleteForFlow(
3468            &self,
3469            flow: &NEFilterFlow,
3470        ) -> Retained<NEFilterDataVerdict>;
3471
3472        /// 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.
3473        ///
3474        /// Parameter `flow`: The flow
3475        ///
3476        /// Returns: The final NEFilterFlowDataVerdict verdict for the flow.
3477        #[unsafe(method(handleOutboundDataCompleteForFlow:))]
3478        #[unsafe(method_family = none)]
3479        pub unsafe fn handleOutboundDataCompleteForFlow(
3480            &self,
3481            flow: &NEFilterFlow,
3482        ) -> Retained<NEFilterDataVerdict>;
3483
3484        /// 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.
3485        ///
3486        /// Parameter `flow`: The flow
3487        ///
3488        /// Returns: The final NEFilterRemediationVerdict verdict for the flow.
3489        #[unsafe(method(handleRemediationForFlow:))]
3490        #[unsafe(method_family = none)]
3491        pub unsafe fn handleRemediationForFlow(
3492            &self,
3493            flow: &NEFilterFlow,
3494        ) -> Retained<NEFilterRemediationVerdict>;
3495
3496        /// This function is called by the framework when -[NEFilterControlProvider notifyRulesChanged] is called. Subclasses should override this method to reload new rules from disk.
3497        #[unsafe(method(handleRulesChanged))]
3498        #[unsafe(method_family = none)]
3499        pub unsafe fn handleRulesChanged(&self);
3500
3501        #[cfg(feature = "block2")]
3502        /// The provider calls this function to apply the current set of filtering rules associated with the provider and also change the default filtering action.
3503        ///
3504        /// 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
3505        /// empty list of rules and a default action of NEFilterActionFilterData.
3506        ///
3507        /// 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.
3508        #[unsafe(method(applySettings:completionHandler:))]
3509        #[unsafe(method_family = none)]
3510        pub unsafe fn applySettings_completionHandler(
3511            &self,
3512            settings: Option<&NEFilterSettings>,
3513            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
3514        );
3515
3516        /// This function is called by the provider to resume a flow that was previously paused by the provider returning a pause verdict.
3517        ///
3518        /// Parameter `flow`: The flow to resume
3519        ///
3520        /// Parameter `verdict`: The next NEFilterDataVerdict for the flow. This verdict is used as the verdict corresponding to the
3521        /// flow handler callback (handleNewFlow:, handleInboundDataFromFlow:, etc.) that returned the pause verdict that
3522        /// paused the flow. This must be either a NEFilterDataVerdict or a NEFilterNewFlowVerdict. It is invalid to resume
3523        /// a flow that is not paused.
3524        #[unsafe(method(resumeFlow:withVerdict:))]
3525        #[unsafe(method_family = none)]
3526        pub unsafe fn resumeFlow_withVerdict(&self, flow: &NEFilterFlow, verdict: &NEFilterVerdict);
3527
3528        /// This function is called by the provider to update the verdict for a flow outside the context of any NEFilterDataProvider callback.
3529        ///
3530        /// Parameter `flow`: The NEFilterSocketFlow to update the verdict for.
3531        ///
3532        /// Parameter `verdict`: The NEFilterDataVerdict. Must be a +[NEFilterDataVerdict allowVerdict], a +[NEFilterDataVerdict dropVerdict], or a +[NEFilterDataVerdict dataVerdictWithPassBytes:peekBytes:].
3533        ///
3534        /// 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].
3535        #[unsafe(method(updateFlow:usingVerdict:forDirection:))]
3536        #[unsafe(method_family = none)]
3537        pub unsafe fn updateFlow_usingVerdict_forDirection(
3538            &self,
3539            flow: &NEFilterSocketFlow,
3540            verdict: &NEFilterDataVerdict,
3541            direction: NETrafficDirection,
3542        );
3543    );
3544}
3545
3546/// Methods declared on superclass `NSObject`.
3547impl NEFilterDataProvider {
3548    extern_methods!(
3549        #[unsafe(method(init))]
3550        #[unsafe(method_family = init)]
3551        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3552
3553        #[unsafe(method(new))]
3554        #[unsafe(method_family = new)]
3555        pub unsafe fn new() -> Retained<Self>;
3556    );
3557}
3558
3559extern_class!(
3560    /// 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.
3561    ///
3562    /// NEFilterDataVerdict is part of NetworkExtension.framework
3563    ///
3564    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterdataverdict?language=objc)
3565    #[unsafe(super(NEFilterVerdict, NSObject))]
3566    #[derive(Debug, PartialEq, Eq, Hash)]
3567    pub struct NEFilterDataVerdict;
3568);
3569
3570unsafe impl NSCoding for NEFilterDataVerdict {}
3571
3572unsafe impl NSCopying for NEFilterDataVerdict {}
3573
3574unsafe impl CopyingHelper for NEFilterDataVerdict {
3575    type Result = Self;
3576}
3577
3578unsafe impl NSObjectProtocol for NEFilterDataVerdict {}
3579
3580unsafe impl NSSecureCoding for NEFilterDataVerdict {}
3581
3582impl NEFilterDataVerdict {
3583    extern_methods!(
3584        /// The frequency at which the data provider's -[NEFilterProvider handleReport:] method is called with a NEFilterReport instance with an event of NEFilterReportEventFlowStatistics.
3585        /// The default value is NEFilterReportFrequencyNone, so by default no statistics are reported.
3586        #[unsafe(method(statisticsReportFrequency))]
3587        #[unsafe(method_family = none)]
3588        pub unsafe fn statisticsReportFrequency(&self) -> NEFilterReportFrequency;
3589
3590        /// Setter for [`statisticsReportFrequency`][Self::statisticsReportFrequency].
3591        #[unsafe(method(setStatisticsReportFrequency:))]
3592        #[unsafe(method_family = none)]
3593        pub unsafe fn setStatisticsReportFrequency(
3594            &self,
3595            statistics_report_frequency: NEFilterReportFrequency,
3596        );
3597
3598        /// This class method returns a verdict indicating that the flow should be allowed.
3599        ///
3600        /// Returns: The NEFilterDataVerdict object.
3601        #[unsafe(method(allowVerdict))]
3602        #[unsafe(method_family = none)]
3603        pub unsafe fn allowVerdict() -> Retained<NEFilterDataVerdict>;
3604
3605        /// This class method returns a verdict indicating that the flow should be dropped.
3606        ///
3607        /// Returns: The NEFilterDataVerdict object.
3608        #[unsafe(method(dropVerdict))]
3609        #[unsafe(method_family = none)]
3610        pub unsafe fn dropVerdict() -> Retained<NEFilterDataVerdict>;
3611
3612        /// 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.
3613        ///
3614        /// 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:
3615        ///
3616        /// 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"
3617        ///
3618        /// Returns: The NEFilterDataVerdict object.
3619        #[unsafe(method(remediateVerdictWithRemediationURLMapKey:remediationButtonTextMapKey:))]
3620        #[unsafe(method_family = none)]
3621        pub unsafe fn remediateVerdictWithRemediationURLMapKey_remediationButtonTextMapKey(
3622            remediation_url_map_key: Option<&NSString>,
3623            remediation_button_text_map_key: Option<&NSString>,
3624        ) -> Retained<NEFilterDataVerdict>;
3625
3626        /// 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.
3627        ///
3628        /// Parameter `passBytes`: The number of bytes to pass through the filter.
3629        ///
3630        /// 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:].
3631        ///
3632        /// Returns: The data flow verdict.
3633        #[unsafe(method(dataVerdictWithPassBytes:peekBytes:))]
3634        #[unsafe(method_family = none)]
3635        pub unsafe fn dataVerdictWithPassBytes_peekBytes(
3636            pass_bytes: NSUInteger,
3637            peek_bytes: NSUInteger,
3638        ) -> Retained<NEFilterDataVerdict>;
3639
3640        /// 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.
3641        ///
3642        /// Returns: The NEFilterDataVerdict object.
3643        #[unsafe(method(needRulesVerdict))]
3644        #[unsafe(method_family = none)]
3645        pub unsafe fn needRulesVerdict() -> Retained<NEFilterDataVerdict>;
3646
3647        /// 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
3648        /// 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
3649        /// being paused. It is invalid to pause a flow that is already paused.
3650        ///
3651        /// Returns: The NEFilterDataVerdict object.
3652        #[unsafe(method(pauseVerdict))]
3653        #[unsafe(method_family = none)]
3654        pub unsafe fn pauseVerdict() -> Retained<NEFilterDataVerdict>;
3655    );
3656}
3657
3658/// Methods declared on superclass `NSObject`.
3659impl NEFilterDataVerdict {
3660    extern_methods!(
3661        #[unsafe(method(init))]
3662        #[unsafe(method_family = init)]
3663        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3664
3665        #[unsafe(method(new))]
3666        #[unsafe(method_family = new)]
3667        pub unsafe fn new() -> Retained<Self>;
3668    );
3669}
3670
3671extern_class!(
3672    /// 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.
3673    ///
3674    /// NEFilterRemediationVerdict is part of NetworkExtension.framework
3675    ///
3676    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterremediationverdict?language=objc)
3677    #[unsafe(super(NEFilterVerdict, NSObject))]
3678    #[derive(Debug, PartialEq, Eq, Hash)]
3679    pub struct NEFilterRemediationVerdict;
3680);
3681
3682unsafe impl NSCoding for NEFilterRemediationVerdict {}
3683
3684unsafe impl NSCopying for NEFilterRemediationVerdict {}
3685
3686unsafe impl CopyingHelper for NEFilterRemediationVerdict {
3687    type Result = Self;
3688}
3689
3690unsafe impl NSObjectProtocol for NEFilterRemediationVerdict {}
3691
3692unsafe impl NSSecureCoding for NEFilterRemediationVerdict {}
3693
3694impl NEFilterRemediationVerdict {
3695    extern_methods!(
3696        /// This class method returns a verdict indicating that the flow should be allowed.
3697        ///
3698        /// Returns: The NEFilterRemediationVerdict object.
3699        #[unsafe(method(allowVerdict))]
3700        #[unsafe(method_family = none)]
3701        pub unsafe fn allowVerdict() -> Retained<NEFilterRemediationVerdict>;
3702
3703        /// This class method returns a verdict indicating that the flow should be dropped.
3704        ///
3705        /// Returns: The NEFilterRemediationVerdict object.
3706        #[unsafe(method(dropVerdict))]
3707        #[unsafe(method_family = none)]
3708        pub unsafe fn dropVerdict() -> Retained<NEFilterRemediationVerdict>;
3709
3710        /// 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.
3711        ///
3712        /// Returns: The NEFilterRemediationVerdict object.
3713        #[unsafe(method(needRulesVerdict))]
3714        #[unsafe(method_family = none)]
3715        pub unsafe fn needRulesVerdict() -> Retained<NEFilterRemediationVerdict>;
3716    );
3717}
3718
3719/// Methods declared on superclass `NSObject`.
3720impl NEFilterRemediationVerdict {
3721    extern_methods!(
3722        #[unsafe(method(init))]
3723        #[unsafe(method_family = init)]
3724        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3725
3726        #[unsafe(method(new))]
3727        #[unsafe(method_family = new)]
3728        pub unsafe fn new() -> Retained<Self>;
3729    );
3730}
3731
3732/// Filter error codes
3733///
3734/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefiltermanagererror?language=objc)
3735// NS_ENUM
3736#[repr(transparent)]
3737#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
3738pub struct NEFilterManagerError(pub NSInteger);
3739impl NEFilterManagerError {
3740    #[doc(alias = "NEFilterManagerErrorConfigurationInvalid")]
3741    pub const ConfigurationInvalid: Self = Self(1);
3742    #[doc(alias = "NEFilterManagerErrorConfigurationDisabled")]
3743    pub const ConfigurationDisabled: Self = Self(2);
3744    #[doc(alias = "NEFilterManagerErrorConfigurationStale")]
3745    pub const ConfigurationStale: Self = Self(3);
3746    #[doc(alias = "NEFilterManagerErrorConfigurationCannotBeRemoved")]
3747    pub const ConfigurationCannotBeRemoved: Self = Self(4);
3748    #[doc(alias = "NEFilterManagerErrorConfigurationPermissionDenied")]
3749    pub const ConfigurationPermissionDenied: Self = Self(5);
3750    #[doc(alias = "NEFilterManagerErrorConfigurationInternalError")]
3751    pub const ConfigurationInternalError: Self = Self(6);
3752}
3753
3754unsafe impl Encode for NEFilterManagerError {
3755    const ENCODING: Encoding = NSInteger::ENCODING;
3756}
3757
3758unsafe impl RefEncode for NEFilterManagerError {
3759    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3760}
3761
3762extern "C" {
3763    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefiltererrordomain?language=objc)
3764    pub static NEFilterErrorDomain: &'static NSString;
3765}
3766
3767extern "C" {
3768    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterconfigurationdidchangenotification?language=objc)
3769    pub static NEFilterConfigurationDidChangeNotification: &'static NSString;
3770}
3771
3772/// Filter grade
3773///
3774/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefiltermanagergrade?language=objc)
3775// NS_ENUM
3776#[repr(transparent)]
3777#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
3778pub struct NEFilterManagerGrade(pub NSInteger);
3779impl NEFilterManagerGrade {
3780    #[doc(alias = "NEFilterManagerGradeFirewall")]
3781    pub const Firewall: Self = Self(1);
3782    #[doc(alias = "NEFilterManagerGradeInspector")]
3783    pub const Inspector: Self = Self(2);
3784}
3785
3786unsafe impl Encode for NEFilterManagerGrade {
3787    const ENCODING: Encoding = NSInteger::ENCODING;
3788}
3789
3790unsafe impl RefEncode for NEFilterManagerGrade {
3791    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3792}
3793
3794extern_class!(
3795    /// The NEFilterManager class declares the programmatic interface for an object that manages content filtering configurations.
3796    ///
3797    /// NEFilterManager declares methods and properties for configuring and controlling a filter.
3798    ///
3799    /// Instances of this class are thread safe.
3800    ///
3801    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefiltermanager?language=objc)
3802    #[unsafe(super(NSObject))]
3803    #[derive(Debug, PartialEq, Eq, Hash)]
3804    pub struct NEFilterManager;
3805);
3806
3807unsafe impl NSObjectProtocol for NEFilterManager {}
3808
3809impl NEFilterManager {
3810    extern_methods!(
3811        /// Returns: The singleton NEFilterManager object for the calling process.
3812        #[unsafe(method(sharedManager))]
3813        #[unsafe(method_family = none)]
3814        pub unsafe fn sharedManager() -> Retained<NEFilterManager>;
3815
3816        #[cfg(feature = "block2")]
3817        /// This function loads the current filter configuration from the caller's filter preferences.
3818        ///
3819        /// 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.
3820        #[unsafe(method(loadFromPreferencesWithCompletionHandler:))]
3821        #[unsafe(method_family = none)]
3822        pub unsafe fn loadFromPreferencesWithCompletionHandler(
3823            &self,
3824            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
3825        );
3826
3827        #[cfg(feature = "block2")]
3828        /// This function removes the filter configuration from the caller's filter preferences. If the filter is enabled, the filter becomes disabled.
3829        ///
3830        /// 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.
3831        #[unsafe(method(removeFromPreferencesWithCompletionHandler:))]
3832        #[unsafe(method_family = none)]
3833        pub unsafe fn removeFromPreferencesWithCompletionHandler(
3834            &self,
3835            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
3836        );
3837
3838        #[cfg(feature = "block2")]
3839        /// This function saves the filter configuration in the caller's filter preferences. If the filter is enabled, it will become active.
3840        ///
3841        /// 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.
3842        #[unsafe(method(saveToPreferencesWithCompletionHandler:))]
3843        #[unsafe(method_family = none)]
3844        pub unsafe fn saveToPreferencesWithCompletionHandler(
3845            &self,
3846            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
3847        );
3848
3849        /// A string containing a description of the filter.
3850        #[unsafe(method(localizedDescription))]
3851        #[unsafe(method_family = none)]
3852        pub unsafe fn localizedDescription(&self) -> Option<Retained<NSString>>;
3853
3854        /// Setter for [`localizedDescription`][Self::localizedDescription].
3855        #[unsafe(method(setLocalizedDescription:))]
3856        #[unsafe(method_family = none)]
3857        pub unsafe fn setLocalizedDescription(&self, localized_description: Option<&NSString>);
3858
3859        /// An NEFilterProviderConfiguration object containing the provider-specific portion of the filter configuration.
3860        #[unsafe(method(providerConfiguration))]
3861        #[unsafe(method_family = none)]
3862        pub unsafe fn providerConfiguration(
3863            &self,
3864        ) -> Option<Retained<NEFilterProviderConfiguration>>;
3865
3866        /// Setter for [`providerConfiguration`][Self::providerConfiguration].
3867        #[unsafe(method(setProviderConfiguration:))]
3868        #[unsafe(method_family = none)]
3869        pub unsafe fn setProviderConfiguration(
3870            &self,
3871            provider_configuration: Option<&NEFilterProviderConfiguration>,
3872        );
3873
3874        /// 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.
3875        /// On macOS, up to 4 filter configurations of the same grade can be enabled simultaneously.
3876        #[unsafe(method(isEnabled))]
3877        #[unsafe(method_family = none)]
3878        pub unsafe fn isEnabled(&self) -> bool;
3879
3880        /// Setter for [`isEnabled`][Self::isEnabled].
3881        #[unsafe(method(setEnabled:))]
3882        #[unsafe(method_family = none)]
3883        pub unsafe fn setEnabled(&self, enabled: bool);
3884
3885        /// The grade of the filter. The default grade is NEFilterManagerGradeFirewall.
3886        #[unsafe(method(grade))]
3887        #[unsafe(method_family = none)]
3888        pub unsafe fn grade(&self) -> NEFilterManagerGrade;
3889
3890        /// Setter for [`grade`][Self::grade].
3891        #[unsafe(method(setGrade:))]
3892        #[unsafe(method_family = none)]
3893        pub unsafe fn setGrade(&self, grade: NEFilterManagerGrade);
3894
3895        /// Causes the content filter to disable any other installed encrypted DNS settings. This should only be used if
3896        /// the content filter expects to intercept cleartext UDP DNS packets.  On macOS disables encrypted DNS for Privacy Proxies.
3897        #[unsafe(method(disableEncryptedDNSSettings))]
3898        #[unsafe(method_family = none)]
3899        pub unsafe fn disableEncryptedDNSSettings(&self) -> bool;
3900
3901        /// Setter for [`disableEncryptedDNSSettings`][Self::disableEncryptedDNSSettings].
3902        #[unsafe(method(setDisableEncryptedDNSSettings:))]
3903        #[unsafe(method_family = none)]
3904        pub unsafe fn setDisableEncryptedDNSSettings(&self, disable_encrypted_dns_settings: bool);
3905    );
3906}
3907
3908/// Methods declared on superclass `NSObject`.
3909impl NEFilterManager {
3910    extern_methods!(
3911        #[unsafe(method(init))]
3912        #[unsafe(method_family = init)]
3913        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3914
3915        #[unsafe(method(new))]
3916        #[unsafe(method_family = new)]
3917        pub unsafe fn new() -> Retained<Self>;
3918    );
3919}
3920
3921extern_class!(
3922    /// The NEFilterPacketContext class identifies the current filtering context.
3923    ///
3924    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterpacketcontext?language=objc)
3925    #[unsafe(super(NSObject))]
3926    #[derive(Debug, PartialEq, Eq, Hash)]
3927    pub struct NEFilterPacketContext;
3928);
3929
3930unsafe impl NSObjectProtocol for NEFilterPacketContext {}
3931
3932impl NEFilterPacketContext {
3933    extern_methods!();
3934}
3935
3936/// Methods declared on superclass `NSObject`.
3937impl NEFilterPacketContext {
3938    extern_methods!(
3939        #[unsafe(method(init))]
3940        #[unsafe(method_family = init)]
3941        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3942
3943        #[unsafe(method(new))]
3944        #[unsafe(method_family = new)]
3945        pub unsafe fn new() -> Retained<Self>;
3946    );
3947}
3948
3949/// Verdict for a packet
3950///
3951/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterpacketproviderverdict?language=objc)
3952// NS_ENUM
3953#[repr(transparent)]
3954#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
3955pub struct NEFilterPacketProviderVerdict(pub NSInteger);
3956impl NEFilterPacketProviderVerdict {
3957    #[doc(alias = "NEFilterPacketProviderVerdictAllow")]
3958    pub const Allow: Self = Self(0);
3959    #[doc(alias = "NEFilterPacketProviderVerdictDrop")]
3960    pub const Drop: Self = Self(1);
3961    #[doc(alias = "NEFilterPacketProviderVerdictDelay")]
3962    pub const Delay: Self = Self(2);
3963}
3964
3965unsafe impl Encode for NEFilterPacketProviderVerdict {
3966    const ENCODING: Encoding = NSInteger::ENCODING;
3967}
3968
3969unsafe impl RefEncode for NEFilterPacketProviderVerdict {
3970    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3971}
3972
3973extern_class!(
3974    /// The NEFilterPacketProvider class declares the programmatic interface for an object that evaluates network packets decisions about whether to block, allow, or delay the packets.
3975    ///
3976    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterpacketprovider?language=objc)
3977    #[unsafe(super(NEFilterProvider, NEProvider, NSObject))]
3978    #[derive(Debug, PartialEq, Eq, Hash)]
3979    pub struct NEFilterPacketProvider;
3980);
3981
3982unsafe impl NSObjectProtocol for NEFilterPacketProvider {}
3983
3984impl NEFilterPacketProvider {
3985    extern_methods!(
3986        /// This function is used to delay a packet currently presented by packetHandler.
3987        /// This function is only valid within the packetHandler block and a verdict of
3988        /// NEFilterPacketProviderVerdictDelay must be returned after a packet is delayed.  A delayed
3989        /// packet will be prevented from continuing its journey through the networking stack until
3990        /// it is either allowed by calling allow() or is dropped by being released.
3991        ///
3992        /// Parameter `context`: The context of the current packet filter which is passed to the packetHandler block.
3993        /// The packetHandler block must pass this context when calling delayCurrentPacket().
3994        #[unsafe(method(delayCurrentPacket:))]
3995        #[unsafe(method_family = none)]
3996        pub unsafe fn delayCurrentPacket(
3997            &self,
3998            context: &NEFilterPacketContext,
3999        ) -> Retained<NEPacket>;
4000
4001        /// This function is used to allow a previously-delayed packet to continue its journey into or out of the networking stack.
4002        ///
4003        /// Parameter `packet`: A NEPacket object that contains the data of the packet that was previously delayed by the NEFilterPacketProvider.
4004        #[unsafe(method(allowPacket:))]
4005        #[unsafe(method_family = none)]
4006        pub unsafe fn allowPacket(&self, packet: &NEPacket);
4007    );
4008}
4009
4010/// Methods declared on superclass `NSObject`.
4011impl NEFilterPacketProvider {
4012    extern_methods!(
4013        #[unsafe(method(init))]
4014        #[unsafe(method_family = init)]
4015        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4016
4017        #[unsafe(method(new))]
4018        #[unsafe(method_family = new)]
4019        pub unsafe fn new() -> Retained<Self>;
4020    );
4021}
4022
4023extern_class!(
4024    /// The NEFilterProviderConfiguration class declares the programmatic interface of an object that configures a plugin-based content filter.
4025    ///
4026    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterproviderconfiguration?language=objc)
4027    #[unsafe(super(NSObject))]
4028    #[derive(Debug, PartialEq, Eq, Hash)]
4029    pub struct NEFilterProviderConfiguration;
4030);
4031
4032unsafe impl NSCoding for NEFilterProviderConfiguration {}
4033
4034unsafe impl NSCopying for NEFilterProviderConfiguration {}
4035
4036unsafe impl CopyingHelper for NEFilterProviderConfiguration {
4037    type Result = Self;
4038}
4039
4040unsafe impl NSObjectProtocol for NEFilterProviderConfiguration {}
4041
4042unsafe impl NSSecureCoding for NEFilterProviderConfiguration {}
4043
4044impl NEFilterProviderConfiguration {
4045    extern_methods!(
4046        /// 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.
4047        #[deprecated = "filterBrowsers is not supported on macOS"]
4048        #[unsafe(method(filterBrowsers))]
4049        #[unsafe(method_family = none)]
4050        pub unsafe fn filterBrowsers(&self) -> bool;
4051
4052        /// Setter for [`filterBrowsers`][Self::filterBrowsers].
4053        #[deprecated = "filterBrowsers is not supported on macOS"]
4054        #[unsafe(method(setFilterBrowsers:))]
4055        #[unsafe(method_family = none)]
4056        pub unsafe fn setFilterBrowsers(&self, filter_browsers: bool);
4057
4058        /// 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.
4059        #[unsafe(method(filterSockets))]
4060        #[unsafe(method_family = none)]
4061        pub unsafe fn filterSockets(&self) -> bool;
4062
4063        /// Setter for [`filterSockets`][Self::filterSockets].
4064        #[unsafe(method(setFilterSockets:))]
4065        #[unsafe(method_family = none)]
4066        pub unsafe fn setFilterSockets(&self, filter_sockets: bool);
4067
4068        /// If YES, a NEFilterPacketProvider will be instantiated and will be allowed to filter packets.
4069        #[unsafe(method(filterPackets))]
4070        #[unsafe(method_family = none)]
4071        pub unsafe fn filterPackets(&self) -> bool;
4072
4073        /// Setter for [`filterPackets`][Self::filterPackets].
4074        #[unsafe(method(setFilterPackets:))]
4075        #[unsafe(method_family = none)]
4076        pub unsafe fn setFilterPackets(&self, filter_packets: bool);
4077
4078        /// An optional dictionary of plugin-specific keys to be passed to the plugin.
4079        #[unsafe(method(vendorConfiguration))]
4080        #[unsafe(method_family = none)]
4081        pub unsafe fn vendorConfiguration(
4082            &self,
4083        ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
4084
4085        /// Setter for [`vendorConfiguration`][Self::vendorConfiguration].
4086        #[unsafe(method(setVendorConfiguration:))]
4087        #[unsafe(method_family = none)]
4088        pub unsafe fn setVendorConfiguration(
4089            &self,
4090            vendor_configuration: Option<&NSDictionary<NSString, AnyObject>>,
4091        );
4092
4093        /// The optional address of the server used to support the filter.
4094        #[unsafe(method(serverAddress))]
4095        #[unsafe(method_family = none)]
4096        pub unsafe fn serverAddress(&self) -> Option<Retained<NSString>>;
4097
4098        /// Setter for [`serverAddress`][Self::serverAddress].
4099        #[unsafe(method(setServerAddress:))]
4100        #[unsafe(method_family = none)]
4101        pub unsafe fn setServerAddress(&self, server_address: Option<&NSString>);
4102
4103        /// The optional username associated with the filter.
4104        #[unsafe(method(username))]
4105        #[unsafe(method_family = none)]
4106        pub unsafe fn username(&self) -> Option<Retained<NSString>>;
4107
4108        /// Setter for [`username`][Self::username].
4109        #[unsafe(method(setUsername:))]
4110        #[unsafe(method_family = none)]
4111        pub unsafe fn setUsername(&self, username: Option<&NSString>);
4112
4113        /// The optional organization associated with the filter.
4114        #[unsafe(method(organization))]
4115        #[unsafe(method_family = none)]
4116        pub unsafe fn organization(&self) -> Option<Retained<NSString>>;
4117
4118        /// Setter for [`organization`][Self::organization].
4119        #[unsafe(method(setOrganization:))]
4120        #[unsafe(method_family = none)]
4121        pub unsafe fn setOrganization(&self, organization: Option<&NSString>);
4122
4123        /// The optional password keychain reference associated with the filter.
4124        #[unsafe(method(passwordReference))]
4125        #[unsafe(method_family = none)]
4126        pub unsafe fn passwordReference(&self) -> Option<Retained<NSData>>;
4127
4128        /// Setter for [`passwordReference`][Self::passwordReference].
4129        #[unsafe(method(setPasswordReference:))]
4130        #[unsafe(method_family = none)]
4131        pub unsafe fn setPasswordReference(&self, password_reference: Option<&NSData>);
4132
4133        /// The optional certificate identity keychain reference associated with the filter.
4134        #[unsafe(method(identityReference))]
4135        #[unsafe(method_family = none)]
4136        pub unsafe fn identityReference(&self) -> Option<Retained<NSData>>;
4137
4138        /// Setter for [`identityReference`][Self::identityReference].
4139        #[unsafe(method(setIdentityReference:))]
4140        #[unsafe(method_family = none)]
4141        pub unsafe fn setIdentityReference(&self, identity_reference: Option<&NSData>);
4142
4143        /// A string containing the bundle identifier of the NEFilterDataProvider app extension or system extension.
4144        /// If this property is nil, then the bundle identifier of the NEFilterDataProvider extension in the calling app's
4145        /// bundle is used, and if the calling app's bundle contains more than one NEFilterDataProvider extension then which one will
4146        /// be used is undefined.
4147        #[unsafe(method(filterDataProviderBundleIdentifier))]
4148        #[unsafe(method_family = none)]
4149        pub unsafe fn filterDataProviderBundleIdentifier(&self) -> Option<Retained<NSString>>;
4150
4151        /// Setter for [`filterDataProviderBundleIdentifier`][Self::filterDataProviderBundleIdentifier].
4152        #[unsafe(method(setFilterDataProviderBundleIdentifier:))]
4153        #[unsafe(method_family = none)]
4154        pub unsafe fn setFilterDataProviderBundleIdentifier(
4155            &self,
4156            filter_data_provider_bundle_identifier: Option<&NSString>,
4157        );
4158
4159        /// A string containing the bundle identifier of the NEFilterPacketProvider app extension or system extension.
4160        /// If this property is nil, then the bundle identifier of the NEFilterPacketProvider extension in the calling app's
4161        /// bundle is used, and if the calling app's bundle contains more than one NEFilterPacketProvider extension then which one will
4162        /// be used is undefined.
4163        #[unsafe(method(filterPacketProviderBundleIdentifier))]
4164        #[unsafe(method_family = none)]
4165        pub unsafe fn filterPacketProviderBundleIdentifier(&self) -> Option<Retained<NSString>>;
4166
4167        /// Setter for [`filterPacketProviderBundleIdentifier`][Self::filterPacketProviderBundleIdentifier].
4168        #[unsafe(method(setFilterPacketProviderBundleIdentifier:))]
4169        #[unsafe(method_family = none)]
4170        pub unsafe fn setFilterPacketProviderBundleIdentifier(
4171            &self,
4172            filter_packet_provider_bundle_identifier: Option<&NSString>,
4173        );
4174    );
4175}
4176
4177/// Methods declared on superclass `NSObject`.
4178impl NEFilterProviderConfiguration {
4179    extern_methods!(
4180        #[unsafe(method(init))]
4181        #[unsafe(method_family = init)]
4182        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4183
4184        #[unsafe(method(new))]
4185        #[unsafe(method_family = new)]
4186        pub unsafe fn new() -> Retained<Self>;
4187    );
4188}
4189
4190extern_class!(
4191    /// 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.
4192    ///
4193    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefilterrule?language=objc)
4194    #[unsafe(super(NSObject))]
4195    #[derive(Debug, PartialEq, Eq, Hash)]
4196    pub struct NEFilterRule;
4197);
4198
4199unsafe impl NSCoding for NEFilterRule {}
4200
4201unsafe impl NSCopying for NEFilterRule {}
4202
4203unsafe impl CopyingHelper for NEFilterRule {
4204    type Result = Self;
4205}
4206
4207unsafe impl NSObjectProtocol for NEFilterRule {}
4208
4209unsafe impl NSSecureCoding for NEFilterRule {}
4210
4211impl NEFilterRule {
4212    extern_methods!(
4213        /// Initialize a newly-allocated NEFilterRule object
4214        ///
4215        /// Parameter `networkRule`: A NENetworkRule object that defines the network traffic characteristics that this rule matches.
4216        ///
4217        /// Parameter `action`: The action to take when this rule matches.
4218        #[unsafe(method(initWithNetworkRule:action:))]
4219        #[unsafe(method_family = init)]
4220        pub unsafe fn initWithNetworkRule_action(
4221            this: Allocated<Self>,
4222            network_rule: &NENetworkRule,
4223            action: NEFilterAction,
4224        ) -> Retained<Self>;
4225
4226        /// The NENetworkRule that defines the network traffic characteristics that this rule matches.
4227        #[unsafe(method(networkRule))]
4228        #[unsafe(method_family = none)]
4229        pub unsafe fn networkRule(&self) -> Retained<NENetworkRule>;
4230
4231        /// The action to take when this rule matches network traffic.
4232        #[unsafe(method(action))]
4233        #[unsafe(method_family = none)]
4234        pub unsafe fn action(&self) -> NEFilterAction;
4235    );
4236}
4237
4238/// Methods declared on superclass `NSObject`.
4239impl NEFilterRule {
4240    extern_methods!(
4241        #[unsafe(method(init))]
4242        #[unsafe(method_family = init)]
4243        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4244
4245        #[unsafe(method(new))]
4246        #[unsafe(method_family = new)]
4247        pub unsafe fn new() -> Retained<Self>;
4248    );
4249}
4250
4251extern_class!(
4252    /// The NEFilterSettings class declares the programmatic interface for an object that contains filter settings.
4253    ///
4254    /// 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.
4255    ///
4256    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nefiltersettings?language=objc)
4257    #[unsafe(super(NSObject))]
4258    #[derive(Debug, PartialEq, Eq, Hash)]
4259    pub struct NEFilterSettings;
4260);
4261
4262unsafe impl NSCoding for NEFilterSettings {}
4263
4264unsafe impl NSCopying for NEFilterSettings {}
4265
4266unsafe impl CopyingHelper for NEFilterSettings {
4267    type Result = Self;
4268}
4269
4270unsafe impl NSObjectProtocol for NEFilterSettings {}
4271
4272unsafe impl NSSecureCoding for NEFilterSettings {}
4273
4274impl NEFilterSettings {
4275    extern_methods!(
4276        /// Initialize a newly-allocated NEFilterSettings object with a set of filtering rules and a default filter action to takke if none
4277        /// of the rules match.
4278        ///
4279        /// Parameter `rules`: An NSArray containing an ordered list of NEFilterRule objects. The maximum number of rules that this array can contain is 1000.
4280        ///
4281        /// 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
4282        /// NEFilterActionFilterData. If defaultAction is NEFilterActionAllow or NEFilterActionDrop, then the rules array must contain at least one NEFilterRule.
4283        /// 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
4284        /// and have an action of NEFilterActionFilterData.
4285        ///
4286        /// Returns: the newly-initialized NEFilterSettings object.
4287        #[unsafe(method(initWithRules:defaultAction:))]
4288        #[unsafe(method_family = init)]
4289        pub unsafe fn initWithRules_defaultAction(
4290            this: Allocated<Self>,
4291            rules: &NSArray<NEFilterRule>,
4292            default_action: NEFilterAction,
4293        ) -> Retained<Self>;
4294
4295        /// An NSArray containing an ordered list of NEFilterRuleObjects. After the NEFilterSettings are applied to the system,
4296        /// each network flow is matched against these rules in order, and the NEFilterAction of the first rule that matches is taken:
4297        /// NEFilterActionAllow: Allow the flow of data to proceed on its journey through the networking stack without consulting this provider.
4298        /// NEFilterActionDrop: Drop the flow without consulting this provider.
4299        /// NEFilterActionFilterData: Call this provider's handleNewFlow: method with the flow.
4300        #[unsafe(method(rules))]
4301        #[unsafe(method_family = none)]
4302        pub unsafe fn rules(&self) -> Retained<NSArray<NEFilterRule>>;
4303
4304        /// An NEFilterAction containing the default action to take for flows of network data that do not match any of the specified rules.
4305        #[unsafe(method(defaultAction))]
4306        #[unsafe(method_family = none)]
4307        pub unsafe fn defaultAction(&self) -> NEFilterAction;
4308    );
4309}
4310
4311/// Methods declared on superclass `NSObject`.
4312impl NEFilterSettings {
4313    extern_methods!(
4314        #[unsafe(method(init))]
4315        #[unsafe(method_family = init)]
4316        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4317
4318        #[unsafe(method(new))]
4319        #[unsafe(method_family = new)]
4320        pub unsafe fn new() -> Retained<Self>;
4321    );
4322}
4323
4324extern_class!(
4325    /// The NEFlowMetaData class declares the programmatic interface for an object that contains extra information about a flow.
4326    ///
4327    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neflowmetadata?language=objc)
4328    #[unsafe(super(NSObject))]
4329    #[derive(Debug, PartialEq, Eq, Hash)]
4330    pub struct NEFlowMetaData;
4331);
4332
4333unsafe impl NSCoding for NEFlowMetaData {}
4334
4335unsafe impl NSCopying for NEFlowMetaData {}
4336
4337unsafe impl CopyingHelper for NEFlowMetaData {
4338    type Result = Self;
4339}
4340
4341unsafe impl NSObjectProtocol for NEFlowMetaData {}
4342
4343unsafe impl NSSecureCoding for NEFlowMetaData {}
4344
4345impl NEFlowMetaData {
4346    extern_methods!(
4347        /// 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.
4348        #[unsafe(method(sourceAppUniqueIdentifier))]
4349        #[unsafe(method_family = none)]
4350        pub unsafe fn sourceAppUniqueIdentifier(&self) -> Retained<NSData>;
4351
4352        /// 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.
4353        #[unsafe(method(sourceAppSigningIdentifier))]
4354        #[unsafe(method_family = none)]
4355        pub unsafe fn sourceAppSigningIdentifier(&self) -> Retained<NSString>;
4356
4357        /// Audit token of the source application of the flow.
4358        #[unsafe(method(sourceAppAuditToken))]
4359        #[unsafe(method_family = none)]
4360        pub unsafe fn sourceAppAuditToken(&self) -> Option<Retained<NSData>>;
4361
4362        /// The identifier of the content filter flow corresponding to this flow.
4363        #[unsafe(method(filterFlowIdentifier))]
4364        #[unsafe(method_family = none)]
4365        pub unsafe fn filterFlowIdentifier(&self) -> Option<Retained<NSUUID>>;
4366    );
4367}
4368
4369/// Methods declared on superclass `NSObject`.
4370impl NEFlowMetaData {
4371    extern_methods!(
4372        #[unsafe(method(init))]
4373        #[unsafe(method_family = init)]
4374        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4375
4376        #[unsafe(method(new))]
4377        #[unsafe(method_family = new)]
4378        pub unsafe fn new() -> Retained<Self>;
4379    );
4380}
4381
4382/// Wi-Fi network security type
4383///
4384/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspotnetworksecuritytype?language=objc)
4385// NS_ENUM
4386#[repr(transparent)]
4387#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
4388pub struct NEHotspotNetworkSecurityType(pub NSInteger);
4389impl NEHotspotNetworkSecurityType {
4390    #[doc(alias = "NEHotspotNetworkSecurityTypeOpen")]
4391    pub const Open: Self = Self(0);
4392    #[doc(alias = "NEHotspotNetworkSecurityTypeWEP")]
4393    pub const WEP: Self = Self(1);
4394    #[doc(alias = "NEHotspotNetworkSecurityTypePersonal")]
4395    pub const Personal: Self = Self(2);
4396    #[doc(alias = "NEHotspotNetworkSecurityTypeEnterprise")]
4397    pub const Enterprise: Self = Self(3);
4398    #[doc(alias = "NEHotspotNetworkSecurityTypeUnknown")]
4399    pub const Unknown: Self = Self(4);
4400}
4401
4402unsafe impl Encode for NEHotspotNetworkSecurityType {
4403    const ENCODING: Encoding = NSInteger::ENCODING;
4404}
4405
4406unsafe impl RefEncode for NEHotspotNetworkSecurityType {
4407    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
4408}
4409
4410extern_class!(
4411    /// The NEHotspotNetwork class provides a class method to get the SSID and BSSID of
4412    /// the current Wi-Fi network.
4413    ///
4414    /// NEHotspotNetwork is part of NetworkExtension.framework
4415    ///
4416    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspotnetwork?language=objc)
4417    #[unsafe(super(NSObject))]
4418    #[derive(Debug, PartialEq, Eq, Hash)]
4419    pub struct NEHotspotNetwork;
4420);
4421
4422unsafe impl NSObjectProtocol for NEHotspotNetwork {}
4423
4424impl NEHotspotNetwork {
4425    extern_methods!(
4426        /// The SSID of the Wi-Fi network.
4427        #[unsafe(method(SSID))]
4428        #[unsafe(method_family = none)]
4429        pub unsafe fn SSID(&self) -> Retained<NSString>;
4430
4431        /// The BSSID of the Wi-Fi network.
4432        #[unsafe(method(BSSID))]
4433        #[unsafe(method_family = none)]
4434        pub unsafe fn BSSID(&self) -> Retained<NSString>;
4435
4436        /// The security type of the Wi-Fi network.
4437        #[unsafe(method(securityType))]
4438        #[unsafe(method_family = none)]
4439        pub unsafe fn securityType(&self) -> NEHotspotNetworkSecurityType;
4440
4441        #[cfg(feature = "block2")]
4442        /// This method returns SSID, BSSID and security type of the current Wi-Fi network when the
4443        /// requesting application meets one of following 4 requirements -.
4444        /// 1. application is using CoreLocation API and has user's authorization to access precise location.
4445        /// 2. application has used NEHotspotConfiguration API to configure the current Wi-Fi network.
4446        /// 3. application has active VPN configurations installed.
4447        /// 4. application has active NEDNSSettingsManager configuration installed.
4448        /// An application will receive nil if it fails to meet any of the above 4 requirements.
4449        /// An application will receive nil if does not have the "com.apple.developer.networking.wifi-info" entitlement.
4450        ///
4451        /// Parameter `completionHandler`: A block that will be executed when current Wi-Fi network details are
4452        /// obtained from the system. The NEHotspotNetwork object passed to this block will be nil if the requesting
4453        /// application fails to meet above requirements, non-nil otherwise. NEHotspotNetwork object contains only valid
4454        /// SSID, BSSID and security type values, when the block is passed non-nil object.This block is executed on application's
4455        /// main queue.
4456        #[unsafe(method(fetchCurrentWithCompletionHandler:))]
4457        #[unsafe(method_family = none)]
4458        pub unsafe fn fetchCurrentWithCompletionHandler(
4459            completion_handler: &block2::Block<dyn Fn(*mut NEHotspotNetwork)>,
4460        );
4461    );
4462}
4463
4464/// Methods declared on superclass `NSObject`.
4465impl NEHotspotNetwork {
4466    extern_methods!(
4467        #[unsafe(method(init))]
4468        #[unsafe(method_family = init)]
4469        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4470
4471        #[unsafe(method(new))]
4472        #[unsafe(method_family = new)]
4473        pub unsafe fn new() -> Retained<Self>;
4474    );
4475}
4476
4477/// The type of the NEHotspotHelperCommand object.
4478///
4479/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspothelpercommandtype?language=objc)
4480// NS_ENUM
4481#[repr(transparent)]
4482#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
4483pub struct NEHotspotHelperCommandType(pub NSInteger);
4484impl NEHotspotHelperCommandType {
4485    #[doc(alias = "kNEHotspotHelperCommandTypeNone")]
4486    pub const None: Self = Self(0);
4487    #[doc(alias = "kNEHotspotHelperCommandTypeFilterScanList")]
4488    pub const FilterScanList: Self = Self(1);
4489    #[doc(alias = "kNEHotspotHelperCommandTypeEvaluate")]
4490    pub const Evaluate: Self = Self(2);
4491    #[doc(alias = "kNEHotspotHelperCommandTypeAuthenticate")]
4492    pub const Authenticate: Self = Self(3);
4493    #[doc(alias = "kNEHotspotHelperCommandTypePresentUI")]
4494    pub const PresentUI: Self = Self(4);
4495    #[doc(alias = "kNEHotspotHelperCommandTypeMaintain")]
4496    pub const Maintain: Self = Self(5);
4497    #[doc(alias = "kNEHotspotHelperCommandTypeLogoff")]
4498    pub const Logoff: Self = Self(6);
4499}
4500
4501unsafe impl Encode for NEHotspotHelperCommandType {
4502    const ENCODING: Encoding = NSInteger::ENCODING;
4503}
4504
4505unsafe impl RefEncode for NEHotspotHelperCommandType {
4506    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
4507}
4508
4509/// The result of processing the NEHotspotHelperCommand.
4510///
4511/// The HotspotHelper provides the result of
4512/// processing the NEHotspotHelperCommand when it instantiates
4513/// its NEHotspotHelperResponse.
4514///
4515///
4516///
4517/// interaction. This result is only valid in response to a command with type
4518/// kNEHotspotHelperCommandTypeAuthenticate.
4519///
4520/// recognize the command type.
4521///
4522/// authentication again. This result is only valid in response to a
4523/// command with type kNEHotspotHelperCommandTypeMaintain.
4524///
4525/// authenticate, the helper determined that it can't perform the
4526/// authentication. This result is only valid in response to commands of type
4527/// kNEHotspotHelperCommandTypeAuthenticate and
4528/// kNEHotspotHelperCommandTypePresentUI.
4529///
4530/// it is temporarily unable to perform the authentication.
4531/// This result is only valid in response to commands of type
4532/// kNEHotspotHelperCommandTypeAuthenticate and
4533/// kNEHotspotHelperCommandTypePresentUI.
4534///
4535/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspothelperresult?language=objc)
4536// NS_ENUM
4537#[repr(transparent)]
4538#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
4539pub struct NEHotspotHelperResult(pub NSInteger);
4540impl NEHotspotHelperResult {
4541    #[doc(alias = "kNEHotspotHelperResultSuccess")]
4542    pub const Success: Self = Self(0);
4543    #[doc(alias = "kNEHotspotHelperResultFailure")]
4544    pub const Failure: Self = Self(1);
4545    #[doc(alias = "kNEHotspotHelperResultUIRequired")]
4546    pub const UIRequired: Self = Self(2);
4547    #[doc(alias = "kNEHotspotHelperResultCommandNotRecognized")]
4548    pub const CommandNotRecognized: Self = Self(3);
4549    #[doc(alias = "kNEHotspotHelperResultAuthenticationRequired")]
4550    pub const AuthenticationRequired: Self = Self(4);
4551    #[doc(alias = "kNEHotspotHelperResultUnsupportedNetwork")]
4552    pub const UnsupportedNetwork: Self = Self(5);
4553    #[doc(alias = "kNEHotspotHelperResultTemporaryFailure")]
4554    pub const TemporaryFailure: Self = Self(6);
4555}
4556
4557unsafe impl Encode for NEHotspotHelperResult {
4558    const ENCODING: Encoding = NSInteger::ENCODING;
4559}
4560
4561unsafe impl RefEncode for NEHotspotHelperResult {
4562    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
4563}
4564
4565/// The HotspotHelper's confidence in its ability to handle the network.
4566///
4567/// The HotspotHelper indicates its confidence in being able to handle the
4568/// given hotspot network.
4569///
4570/// the network.
4571///
4572/// in being able to handle the network.
4573///
4574/// in being able to handle the network.
4575///
4576/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspothelperconfidence?language=objc)
4577// NS_ENUM
4578#[repr(transparent)]
4579#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
4580pub struct NEHotspotHelperConfidence(pub NSInteger);
4581impl NEHotspotHelperConfidence {
4582    #[doc(alias = "kNEHotspotHelperConfidenceNone")]
4583    pub const None: Self = Self(0);
4584    #[doc(alias = "kNEHotspotHelperConfidenceLow")]
4585    pub const Low: Self = Self(1);
4586    #[doc(alias = "kNEHotspotHelperConfidenceHigh")]
4587    pub const High: Self = Self(2);
4588}
4589
4590unsafe impl Encode for NEHotspotHelperConfidence {
4591    const ENCODING: Encoding = NSInteger::ENCODING;
4592}
4593
4594unsafe impl RefEncode for NEHotspotHelperConfidence {
4595    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
4596}
4597
4598/// HotspotHelper.
4599/// Extends NEHotspotNetwork class to support conveying information about the
4600/// network to the HotspotHelper. When the HotspotHelper is asked to evaluate
4601/// the current network or filter the Wi-Fi scan list, it annotates the NEHotspotNetwork
4602/// via the setConfidence method.
4603impl NEHotspotNetwork {
4604    extern_methods!(
4605        /// The signal strength for the Wi-Fi network. The value lies within
4606        /// the range 0.0 (weak/no signal) to 1.0 (strong signal).
4607        #[unsafe(method(signalStrength))]
4608        #[unsafe(method_family = none)]
4609        pub unsafe fn signalStrength(&self) -> c_double;
4610
4611        /// Indicates whether the network is secure
4612        #[unsafe(method(isSecure))]
4613        #[unsafe(method_family = none)]
4614        pub unsafe fn isSecure(&self) -> bool;
4615
4616        /// Indicates whether the network was joined automatically
4617        /// (YES) or joined by the user (NO).
4618        #[unsafe(method(didAutoJoin))]
4619        #[unsafe(method_family = none)]
4620        pub unsafe fn didAutoJoin(&self) -> bool;
4621
4622        /// Indicates whether the network was just joined. Useful in the
4623        /// Maintaining state to differentiate whether the Maintain command
4624        /// is for the initial join, or the subsequent periodic callback.
4625        #[unsafe(method(didJustJoin))]
4626        #[unsafe(method_family = none)]
4627        pub unsafe fn didJustJoin(&self) -> bool;
4628
4629        /// Indicates whether the HotspotHelper is the chosen helper for
4630        /// the network. The NEHotspotNetwork must have been instantiated via a
4631        /// call to the +[NEHotspotHelper supportedNetworkInterfaces] method. This
4632        /// is useful to restore state after the HotspotHelper application is quit
4633        /// and restarted.
4634        #[unsafe(method(isChosenHelper))]
4635        #[unsafe(method_family = none)]
4636        pub unsafe fn isChosenHelper(&self) -> bool;
4637
4638        /// Indicate the confidence in being able to handle the network.
4639        ///
4640        /// Use this method to indicate the confidence in being able to
4641        /// successfully authenticate to the given network. Used in the response
4642        /// to the kNEHotspotHelperCommandTypeEvaluate and
4643        /// kNEHotspotHelperCommandTypeFilterScanList commands.
4644        #[unsafe(method(setConfidence:))]
4645        #[unsafe(method_family = none)]
4646        pub unsafe fn setConfidence(&self, confidence: NEHotspotHelperConfidence);
4647
4648        /// Provide the password for a secure network
4649        ///
4650        /// The HotspotHelper may set a password for a secure network. The format
4651        /// password string must adhere to IEEE 802.11 guidelines appropriate for
4652        /// the particular security scheme.
4653        ///
4654        /// Used only in the response to the kNEHotspotHelperCommandTypeFilterScanList
4655        /// command.
4656        #[unsafe(method(setPassword:))]
4657        #[unsafe(method_family = none)]
4658        pub unsafe fn setPassword(&self, password: &NSString);
4659    );
4660}
4661
4662extern_class!(
4663    /// An NEHotspotHelperCommand object is provided to the helper's
4664    /// command handler block. The HotspotHelper processes the command
4665    /// instantiates an NEHotspotHelperResponse object, sets the annotated
4666    /// network or networkList (Evaluate/FilterScanList only),
4667    /// then delivers it.
4668    ///
4669    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspothelpercommand?language=objc)
4670    #[unsafe(super(NSObject))]
4671    #[derive(Debug, PartialEq, Eq, Hash)]
4672    pub struct NEHotspotHelperCommand;
4673);
4674
4675unsafe impl NSObjectProtocol for NEHotspotHelperCommand {}
4676
4677impl NEHotspotHelperCommand {
4678    extern_methods!(
4679        /// The type of the command.
4680        #[unsafe(method(commandType))]
4681        #[unsafe(method_family = none)]
4682        pub unsafe fn commandType(&self) -> NEHotspotHelperCommandType;
4683
4684        /// The network associated with the command. May be nil.
4685        #[unsafe(method(network))]
4686        #[unsafe(method_family = none)]
4687        pub unsafe fn network(&self) -> Option<Retained<NEHotspotNetwork>>;
4688
4689        /// The list of networks associated with a command. Will be nil unless
4690        /// the command type is kNEHotspotHelperCommandTypeFilterScanList.
4691        /// This property returns an NSArray of NEHotspotNetwork.
4692        #[unsafe(method(networkList))]
4693        #[unsafe(method_family = none)]
4694        pub unsafe fn networkList(&self) -> Option<Retained<NSArray<NEHotspotNetwork>>>;
4695
4696        /// Create a response to the command.
4697        ///
4698        /// Instantiate an NEHotspotHelperResponse for the command.
4699        ///
4700        /// Returns: NEHotspotHelperResponse with the specified result.
4701        #[unsafe(method(createResponse:))]
4702        #[unsafe(method_family = none)]
4703        pub unsafe fn createResponse(
4704            &self,
4705            result: NEHotspotHelperResult,
4706        ) -> Retained<NEHotspotHelperResponse>;
4707
4708        /// Create a new TCP connection over the interface associated with the command.
4709        ///
4710        /// Instantiate an NWTCPConnection to the specified endpoint
4711        /// bound to the network interface associated with the command.
4712        ///
4713        /// Returns: non-nil NWTCPConnection object if successful, nil otherwise
4714        #[deprecated = "Use the `interface` property with `nw_parameters_require_interface`"]
4715        #[unsafe(method(createTCPConnection:))]
4716        #[unsafe(method_family = none)]
4717        pub unsafe fn createTCPConnection(
4718            &self,
4719            endpoint: &NWEndpoint,
4720        ) -> Retained<NWTCPConnection>;
4721
4722        /// Create a new UDP session over the interface associated with the command.
4723        ///
4724        /// Instantiate an NWUDPSession to the specified endpoint
4725        /// bound to the network interface associated with the command.
4726        ///
4727        /// Returns: non-nil NWUDPSession object if successful, nil otherwise
4728        #[deprecated = "Use the `interface` property with `nw_parameters_require_interface`"]
4729        #[unsafe(method(createUDPSession:))]
4730        #[unsafe(method_family = none)]
4731        pub unsafe fn createUDPSession(&self, endpoint: &NWEndpoint) -> Retained<NWUDPSession>;
4732    );
4733}
4734
4735/// Methods declared on superclass `NSObject`.
4736impl NEHotspotHelperCommand {
4737    extern_methods!(
4738        #[unsafe(method(init))]
4739        #[unsafe(method_family = init)]
4740        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4741
4742        #[unsafe(method(new))]
4743        #[unsafe(method_family = new)]
4744        pub unsafe fn new() -> Retained<Self>;
4745    );
4746}
4747
4748extern_class!(
4749    /// The HotspotHelper creates an NEHotspotHelperResponse object to provide
4750    /// the results of running the corresponding NEHotspotHelperCommand.
4751    ///
4752    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspothelperresponse?language=objc)
4753    #[unsafe(super(NSObject))]
4754    #[derive(Debug, PartialEq, Eq, Hash)]
4755    pub struct NEHotspotHelperResponse;
4756);
4757
4758unsafe impl NSObjectProtocol for NEHotspotHelperResponse {}
4759
4760impl NEHotspotHelperResponse {
4761    extern_methods!(
4762        /// Set the network that conveys the confidence level.
4763        ///
4764        /// Provide the annotated NEHotspotNetwork object in the response to the
4765        /// kNEHotspotHelperCommandTypeEvaluate command. The helper sets the
4766        /// confidence in the network object to indicate its ability to handle
4767        /// the current network.
4768        #[unsafe(method(setNetwork:))]
4769        #[unsafe(method_family = none)]
4770        pub unsafe fn setNetwork(&self, network: &NEHotspotNetwork);
4771
4772        /// Set the list of handled networks.
4773        ///
4774        /// Provide an NSArray of annotated NEHotspotNetwork objects in response
4775        /// to the kNEHotspotHelperCommandTypeFilterScanList command.
4776        /// The helper provides the list of network objects that it is capable of
4777        /// handling with at least low confidence. Networks that it has no
4778        /// confidence in handling should not be specified.
4779        #[unsafe(method(setNetworkList:))]
4780        #[unsafe(method_family = none)]
4781        pub unsafe fn setNetworkList(&self, network_list: &NSArray<NEHotspotNetwork>);
4782
4783        /// Delivers the response to the command.
4784        ///
4785        /// Deliver the NEHotspotHelperResponse to the HotspotHelper infrastructure.
4786        #[unsafe(method(deliver))]
4787        #[unsafe(method_family = none)]
4788        pub unsafe fn deliver(&self);
4789    );
4790}
4791
4792/// Methods declared on superclass `NSObject`.
4793impl NEHotspotHelperResponse {
4794    extern_methods!(
4795        #[unsafe(method(init))]
4796        #[unsafe(method_family = init)]
4797        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4798
4799        #[unsafe(method(new))]
4800        #[unsafe(method_family = new)]
4801        pub unsafe fn new() -> Retained<Self>;
4802    );
4803}
4804
4805/// The type definition for the HotspotHelper's command handler block.
4806///
4807/// The application provides a block of this type when it
4808/// invokes the +[NEHotspotHelper registerWithOptions:queue:handler] method.
4809/// The block is invoked every time there is a command to be processed.
4810///
4811/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspothelperhandler?language=objc)
4812#[cfg(feature = "block2")]
4813pub type NEHotspotHelperHandler = *mut block2::Block<dyn Fn(NonNull<NEHotspotHelperCommand>)>;
4814
4815extern_class!(
4816    /// The NEHotspotHelper class allows an application to register itself as a
4817    /// HotspotHelper.
4818    ///
4819    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspothelper?language=objc)
4820    #[unsafe(super(NSObject))]
4821    #[derive(Debug, PartialEq, Eq, Hash)]
4822    pub struct NEHotspotHelper;
4823);
4824
4825unsafe impl NSObjectProtocol for NEHotspotHelper {}
4826
4827impl NEHotspotHelper {
4828    extern_methods!(
4829        /// Terminate the authentication session.
4830        ///
4831        /// The application invokes this method when it wants to logoff from the
4832        /// current network. Invoking this method causes an NEHotspotHelperCommand
4833        /// of type kNEHotspotHelperCommandTypeLogoff to be issued to the application's
4834        /// 'handler' block (see +[NEHotspotHelper registerWithOptions:queue:handler]).
4835        ///
4836        /// 'network' must correspond to the currently associated Wi-Fi network
4837        /// i.e. it must have come from the NEHotspotHelperCommand's 'network' property
4838        /// or from the +[NEHotspotHelper supportedInterfaces] method.
4839        ///
4840        /// Returns: YES if the logoff command was successfully queued, NO otherwise.
4841        ///
4842        /// Note: Notes
4843        ///
4844        /// Note: 1
4845        /// The application MUST NOT actually logoff from the network until it
4846        /// receives the command to logoff.
4847        ///
4848        /// Note: 2
4849        /// After the application invokes -[NEHotspotHelperResponse deliver] indicating
4850        /// kNEHotspotHelperResultSuccess, the Wi-Fi network is disassociated.
4851        #[unsafe(method(logoff:))]
4852        #[unsafe(method_family = none)]
4853        pub unsafe fn logoff(network: &NEHotspotNetwork) -> bool;
4854
4855        /// Return the list of network interfaces managed by the
4856        /// HotspotHelper infrastructure.
4857        ///
4858        /// Each network interface is represented by an NEHotspotNetwork object.
4859        /// Currently, the returned array contains exactly one NEHotspotNetwork
4860        /// object representing the Wi-Fi interface.
4861        ///
4862        /// The main purpose of this method is to allow a HotspotHelper to provide
4863        /// accurate status in its UI at times when it has not been given a command
4864        /// to process. This method coupled with -[NEHotspotNetwork isChosenHelper]
4865        /// allows the application to know whether it is the one that is handling
4866        /// the current network.
4867        ///
4868        /// Returns: nil if no network interfaces are being managed,
4869        /// non-nil NSArray of NEHotspotNetwork objects otherwise.
4870        #[unsafe(method(supportedNetworkInterfaces))]
4871        #[unsafe(method_family = none)]
4872        pub unsafe fn supportedNetworkInterfaces() -> Option<Retained<NSArray>>;
4873    );
4874}
4875
4876/// Methods declared on superclass `NSObject`.
4877impl NEHotspotHelper {
4878    extern_methods!(
4879        #[unsafe(method(init))]
4880        #[unsafe(method_family = init)]
4881        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4882
4883        #[unsafe(method(new))]
4884        #[unsafe(method_family = new)]
4885        pub unsafe fn new() -> Retained<Self>;
4886    );
4887}
4888
4889mod private_NSMutableURLRequestNEHotspotHelper {
4890    pub trait Sealed {}
4891}
4892
4893/// Category "NEHotspotHelper" on [`NSMutableURLRequest`].
4894#[doc(alias = "NEHotspotHelper")]
4895/// Extend NSMutableURLRequest to include a method to bind the
4896/// request to the network interface associated with the specified
4897/// NEHotspotHelperCommand object.
4898pub unsafe trait NSMutableURLRequestNEHotspotHelper:
4899    ClassType + Sized + private_NSMutableURLRequestNEHotspotHelper::Sealed
4900{
4901    extern_methods!(
4902        /// Binds the NSMutableURLRequest to the network interface associated with
4903        /// the NEHotspotHelperCommand object.
4904        #[unsafe(method(bindToHotspotHelperCommand:))]
4905        #[unsafe(method_family = none)]
4906        unsafe fn bindToHotspotHelperCommand(&self, command: &NEHotspotHelperCommand);
4907    );
4908}
4909
4910impl private_NSMutableURLRequestNEHotspotHelper::Sealed for NSMutableURLRequest {}
4911unsafe impl NSMutableURLRequestNEHotspotHelper for NSMutableURLRequest {}
4912
4913/// EAP Type.
4914///
4915/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspotconfigurationeaptype?language=objc)
4916// NS_ENUM
4917#[repr(transparent)]
4918#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
4919pub struct NEHotspotConfigurationEAPType(pub NSInteger);
4920impl NEHotspotConfigurationEAPType {
4921    #[doc(alias = "NEHotspotConfigurationEAPTypeEAPTLS")]
4922    pub const EAPTLS: Self = Self(13);
4923    #[doc(alias = "NEHotspotConfigurationEAPTypeEAPTTLS")]
4924    pub const EAPTTLS: Self = Self(21);
4925    #[doc(alias = "NEHotspotConfigurationEAPTypeEAPPEAP")]
4926    pub const EAPPEAP: Self = Self(25);
4927    #[doc(alias = "NEHotspotConfigurationEAPTypeEAPFAST")]
4928    pub const EAPFAST: Self = Self(43);
4929}
4930
4931unsafe impl Encode for NEHotspotConfigurationEAPType {
4932    const ENCODING: Encoding = NSInteger::ENCODING;
4933}
4934
4935unsafe impl RefEncode for NEHotspotConfigurationEAPType {
4936    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
4937}
4938
4939/// TTLS Inner Authentication Type.
4940///
4941/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspotconfigurationttlsinnerauthenticationtype?language=objc)
4942// NS_ENUM
4943#[repr(transparent)]
4944#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
4945pub struct NEHotspotConfigurationTTLSInnerAuthenticationType(pub NSInteger);
4946impl NEHotspotConfigurationTTLSInnerAuthenticationType {
4947    #[doc(alias = "NEHotspotConfigurationEAPTTLSInnerAuthenticationPAP")]
4948    pub const EAPTTLSInnerAuthenticationPAP: Self = Self(0);
4949    #[doc(alias = "NEHotspotConfigurationEAPTTLSInnerAuthenticationCHAP")]
4950    pub const EAPTTLSInnerAuthenticationCHAP: Self = Self(1);
4951    #[doc(alias = "NEHotspotConfigurationEAPTTLSInnerAuthenticationMSCHAP")]
4952    pub const EAPTTLSInnerAuthenticationMSCHAP: Self = Self(2);
4953    #[doc(alias = "NEHotspotConfigurationEAPTTLSInnerAuthenticationMSCHAPv2")]
4954    pub const EAPTTLSInnerAuthenticationMSCHAPv2: Self = Self(3);
4955    #[doc(alias = "NEHotspotConfigurationEAPTTLSInnerAuthenticationEAP")]
4956    pub const EAPTTLSInnerAuthenticationEAP: Self = Self(4);
4957}
4958
4959unsafe impl Encode for NEHotspotConfigurationTTLSInnerAuthenticationType {
4960    const ENCODING: Encoding = NSInteger::ENCODING;
4961}
4962
4963unsafe impl RefEncode for NEHotspotConfigurationTTLSInnerAuthenticationType {
4964    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
4965}
4966
4967extern_class!(
4968    /// NEHotspotHS20Settings class provides a set of properties that are required
4969    /// to discover and negotiate Hotspot 2.0 Wi-Fi networks.
4970    ///
4971    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspoths20settings?language=objc)
4972    #[unsafe(super(NSObject))]
4973    #[derive(Debug, PartialEq, Eq, Hash)]
4974    pub struct NEHotspotHS20Settings;
4975);
4976
4977unsafe impl NSCoding for NEHotspotHS20Settings {}
4978
4979unsafe impl NSCopying for NEHotspotHS20Settings {}
4980
4981unsafe impl CopyingHelper for NEHotspotHS20Settings {
4982    type Result = Self;
4983}
4984
4985unsafe impl NSObjectProtocol for NEHotspotHS20Settings {}
4986
4987unsafe impl NSSecureCoding for NEHotspotHS20Settings {}
4988
4989impl NEHotspotHS20Settings {
4990    extern_methods!(
4991        /// Domain Name of Legacy Hotspot or Hotspot 2.0 Wi-Fi Network.
4992        /// This Domain Name is used for Wi-Fi Hotspot 2.0 negotiation.
4993        #[unsafe(method(domainName))]
4994        #[unsafe(method_family = none)]
4995        pub unsafe fn domainName(&self) -> Retained<NSString>;
4996
4997        /// If set to YES, allows connection to networks of roaming service
4998        /// providers. Defaults to NO.
4999        #[unsafe(method(isRoamingEnabled))]
5000        #[unsafe(method_family = none)]
5001        pub unsafe fn isRoamingEnabled(&self) -> bool;
5002
5003        /// Setter for [`isRoamingEnabled`][Self::isRoamingEnabled].
5004        #[unsafe(method(setRoamingEnabled:))]
5005        #[unsafe(method_family = none)]
5006        pub unsafe fn setRoamingEnabled(&self, roaming_enabled: bool);
5007
5008        /// Array of Roaming Consortium Organization Identifiers used
5009        /// for Wi-Fi Hotspot 2.0 negotiation.
5010        #[unsafe(method(roamingConsortiumOIs))]
5011        #[unsafe(method_family = none)]
5012        pub unsafe fn roamingConsortiumOIs(&self) -> Retained<NSArray<NSString>>;
5013
5014        /// Setter for [`roamingConsortiumOIs`][Self::roamingConsortiumOIs].
5015        #[unsafe(method(setRoamingConsortiumOIs:))]
5016        #[unsafe(method_family = none)]
5017        pub unsafe fn setRoamingConsortiumOIs(&self, roaming_consortium_o_is: &NSArray<NSString>);
5018
5019        /// Array of Network Access Identifier Realm names used for
5020        /// Wi-Fi Hotspot 2.0 negotiation.
5021        #[unsafe(method(naiRealmNames))]
5022        #[unsafe(method_family = none)]
5023        pub unsafe fn naiRealmNames(&self) -> Retained<NSArray<NSString>>;
5024
5025        /// Setter for [`naiRealmNames`][Self::naiRealmNames].
5026        #[unsafe(method(setNaiRealmNames:))]
5027        #[unsafe(method_family = none)]
5028        pub unsafe fn setNaiRealmNames(&self, nai_realm_names: &NSArray<NSString>);
5029
5030        /// Array of Mobile Country Code (MCC)/Mobile Network Code (MNC)
5031        /// pairs used for Wi-Fi Hotspot 2.0 negotiation. Each string must contain
5032        /// exactly six digits.
5033        #[unsafe(method(MCCAndMNCs))]
5034        #[unsafe(method_family = none)]
5035        pub unsafe fn MCCAndMNCs(&self) -> Retained<NSArray<NSString>>;
5036
5037        /// Setter for [`MCCAndMNCs`][Self::MCCAndMNCs].
5038        #[unsafe(method(setMCCAndMNCs:))]
5039        #[unsafe(method_family = none)]
5040        pub unsafe fn setMCCAndMNCs(&self, mcc_and_mn_cs: &NSArray<NSString>);
5041
5042        /// A designated initializer to instantiate a new NEHotspotHSSettings object.
5043        /// This initializer is used to configure Legacy Hotspot or HS2.0 Wi-Fi Networks.
5044        ///
5045        ///
5046        /// Parameter `domainName`: The domain name of HS2.0 Wi-Fi Network
5047        ///
5048        /// Parameter `roamingEnabled`: If YES, allows connections to networks of roaming service providers.
5049        #[unsafe(method(initWithDomainName:roamingEnabled:))]
5050        #[unsafe(method_family = init)]
5051        pub unsafe fn initWithDomainName_roamingEnabled(
5052            this: Allocated<Self>,
5053            domain_name: &NSString,
5054            roaming_enabled: bool,
5055        ) -> Retained<Self>;
5056    );
5057}
5058
5059/// Methods declared on superclass `NSObject`.
5060impl NEHotspotHS20Settings {
5061    extern_methods!(
5062        #[unsafe(method(init))]
5063        #[unsafe(method_family = init)]
5064        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5065
5066        #[unsafe(method(new))]
5067        #[unsafe(method_family = new)]
5068        pub unsafe fn new() -> Retained<Self>;
5069    );
5070}
5071
5072extern_class!(
5073    /// NEHotspotEAPSettings class provides a set of properties that are required
5074    /// to configure a WPA/WPA2 Enterprise or Hotspot 2.0 Wi-Fi networks.
5075    ///
5076    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspoteapsettings?language=objc)
5077    #[unsafe(super(NSObject))]
5078    #[derive(Debug, PartialEq, Eq, Hash)]
5079    pub struct NEHotspotEAPSettings;
5080);
5081
5082unsafe impl NSCoding for NEHotspotEAPSettings {}
5083
5084unsafe impl NSCopying for NEHotspotEAPSettings {}
5085
5086unsafe impl CopyingHelper for NEHotspotEAPSettings {
5087    type Result = Self;
5088}
5089
5090unsafe impl NSObjectProtocol for NEHotspotEAPSettings {}
5091
5092unsafe impl NSSecureCoding for NEHotspotEAPSettings {}
5093
5094impl NEHotspotEAPSettings {
5095    extern_methods!(
5096        /// Array of supported EAP Types. Refer to NEHotspotConfigurationEAPType
5097        /// for valid values.
5098        #[unsafe(method(supportedEAPTypes))]
5099        #[unsafe(method_family = none)]
5100        pub unsafe fn supportedEAPTypes(&self) -> Retained<NSArray<NSNumber>>;
5101
5102        /// Setter for [`supportedEAPTypes`][Self::supportedEAPTypes].
5103        #[unsafe(method(setSupportedEAPTypes:))]
5104        #[unsafe(method_family = none)]
5105        pub unsafe fn setSupportedEAPTypes(&self, supported_eap_types: &NSArray<NSNumber>);
5106
5107        /// A UTF-8 encoded string containing username component of the user authentication
5108        /// credentials. Length of this property must be between 1 and 253 characters.
5109        #[unsafe(method(username))]
5110        #[unsafe(method_family = none)]
5111        pub unsafe fn username(&self) -> Retained<NSString>;
5112
5113        /// Setter for [`username`][Self::username].
5114        #[unsafe(method(setUsername:))]
5115        #[unsafe(method_family = none)]
5116        pub unsafe fn setUsername(&self, username: &NSString);
5117
5118        /// Identity string to be used in EAP-Response/Identity of the outer phase. This key is only
5119        /// relevant to TTLS, PEAP, and EAP-FAST.
5120        #[unsafe(method(outerIdentity))]
5121        #[unsafe(method_family = none)]
5122        pub unsafe fn outerIdentity(&self) -> Retained<NSString>;
5123
5124        /// Setter for [`outerIdentity`][Self::outerIdentity].
5125        #[unsafe(method(setOuterIdentity:))]
5126        #[unsafe(method_family = none)]
5127        pub unsafe fn setOuterIdentity(&self, outer_identity: &NSString);
5128
5129        /// Specifies the inner authentication used by the TTLS module.
5130        /// Possible values are PAP, CHAP, MSCHAP, MSCHAPv2, and EAP. Defaults to EAP.
5131        #[unsafe(method(ttlsInnerAuthenticationType))]
5132        #[unsafe(method_family = none)]
5133        pub unsafe fn ttlsInnerAuthenticationType(
5134            &self,
5135        ) -> NEHotspotConfigurationTTLSInnerAuthenticationType;
5136
5137        /// Setter for [`ttlsInnerAuthenticationType`][Self::ttlsInnerAuthenticationType].
5138        #[unsafe(method(setTtlsInnerAuthenticationType:))]
5139        #[unsafe(method_family = none)]
5140        pub unsafe fn setTtlsInnerAuthenticationType(
5141            &self,
5142            ttls_inner_authentication_type: NEHotspotConfigurationTTLSInnerAuthenticationType,
5143        );
5144
5145        /// The password component of the 802.1X authentication credential.
5146        /// Length of this property must be between 1 and 64 characters.
5147        #[unsafe(method(password))]
5148        #[unsafe(method_family = none)]
5149        pub unsafe fn password(&self) -> Retained<NSString>;
5150
5151        /// Setter for [`password`][Self::password].
5152        #[unsafe(method(setPassword:))]
5153        #[unsafe(method_family = none)]
5154        pub unsafe fn setPassword(&self, password: &NSString);
5155
5156        /// Array of server certificate common names that will be used to verify server's certificate.
5157        /// The string could have wildcards to specify the name, such as "*.mycompany.net". If a server presents
5158        /// a certificate with DNSName or Common Name that isn't in this list, it won't be trusted.
5159        #[unsafe(method(trustedServerNames))]
5160        #[unsafe(method_family = none)]
5161        pub unsafe fn trustedServerNames(&self) -> Retained<NSArray<NSString>>;
5162
5163        /// Setter for [`trustedServerNames`][Self::trustedServerNames].
5164        #[unsafe(method(setTrustedServerNames:))]
5165        #[unsafe(method_family = none)]
5166        pub unsafe fn setTrustedServerNames(&self, trusted_server_names: &NSArray<NSString>);
5167
5168        /// If YES, supports two-factor authentication for EAP-TTLS, PEAP, or EAP-FAST.
5169        /// If NO, allows for zero-factor authentication for EAP-TLS. The default is YES for EAP-TLS,
5170        /// and NO for other EAP types.
5171        #[unsafe(method(isTLSClientCertificateRequired))]
5172        #[unsafe(method_family = none)]
5173        pub unsafe fn isTLSClientCertificateRequired(&self) -> bool;
5174
5175        /// Setter for [`isTLSClientCertificateRequired`][Self::isTLSClientCertificateRequired].
5176        #[unsafe(method(setTlsClientCertificateRequired:))]
5177        #[unsafe(method_family = none)]
5178        pub unsafe fn setTlsClientCertificateRequired(&self, tls_client_certificate_required: bool);
5179
5180        /// TLS version to use during the TLS handshake.
5181        /// Default value is NEHotspotConfigurationEAPTLSVersion_1_2.
5182        #[unsafe(method(preferredTLSVersion))]
5183        #[unsafe(method_family = none)]
5184        pub unsafe fn preferredTLSVersion(&self) -> NEHotspotConfigurationEAPTLSVersion;
5185
5186        /// Setter for [`preferredTLSVersion`][Self::preferredTLSVersion].
5187        #[unsafe(method(setPreferredTLSVersion:))]
5188        #[unsafe(method_family = none)]
5189        pub unsafe fn setPreferredTLSVersion(
5190            &self,
5191            preferred_tls_version: NEHotspotConfigurationEAPTLSVersion,
5192        );
5193
5194        #[cfg(feature = "objc2-security")]
5195        /// Setter to configure the EAP peer identity. The application needs to store
5196        /// this identity in keychain access group "$(TeamIdentifierPrefix)com.apple.networkextensionsharing".
5197        /// The API uses SecItemCopyMatching to obtain persistent reference for this identity from application's
5198        /// keychain and uses that at the time of EAP authentication.
5199        /// This property is mandatory when EAP-TLS is desired or tlsClientCertificateRequired is set to YES.
5200        ///
5201        ///
5202        /// Parameter `identity`: The identity of the EAP Peer. This is a SecIdentityRef object that contains
5203        /// a SecKeyRef object and an associated SecCertificateRef object.
5204        ///
5205        /// Returns: returns NO if the parameter is not an object of SecIdentityRef type or if the persistent reference
5206        /// is not found in the application's keychain else returns YES.
5207        #[unsafe(method(setIdentity:))]
5208        #[unsafe(method_family = none)]
5209        pub unsafe fn setIdentity(&self, identity: &SecIdentity) -> bool;
5210
5211        /// Setter to configure an array of trusted server certificates used for trust evaluation of
5212        /// the server certificate.
5213        ///
5214        ///
5215        /// Parameter `certificates`: Each value in the array is a SecCertificateRef object. Application needs to store
5216        /// the certificates in keychain access group "$(TeamIdentifierPrefix)com.apple.networkextensionsharing".
5217        /// The API uses SecItemCopyMatching to obtain persistent reference for each certificate from application's
5218        /// keychain and uses that at the time os EAP authentication.
5219        /// Number of elements in the array cannot be more than 10.
5220        ///
5221        ///
5222        /// Returns: returns NO if any element in the array is not an object of type SecCertificateRef or if API
5223        /// fails to find persistent reference for each element from the application's keychain else return YES.
5224        #[unsafe(method(setTrustedServerCertificates:))]
5225        #[unsafe(method_family = none)]
5226        pub unsafe fn setTrustedServerCertificates(&self, certificates: &NSArray) -> bool;
5227    );
5228}
5229
5230/// Methods declared on superclass `NSObject`.
5231impl NEHotspotEAPSettings {
5232    extern_methods!(
5233        #[unsafe(method(init))]
5234        #[unsafe(method_family = init)]
5235        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5236
5237        #[unsafe(method(new))]
5238        #[unsafe(method_family = new)]
5239        pub unsafe fn new() -> Retained<Self>;
5240    );
5241}
5242
5243extern_class!(
5244    /// The NEHotspotConfiguration class represents set of properties that are required
5245    /// to configure a Wi-Fi Network.
5246    ///
5247    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspotconfiguration?language=objc)
5248    #[unsafe(super(NSObject))]
5249    #[derive(Debug, PartialEq, Eq, Hash)]
5250    pub struct NEHotspotConfiguration;
5251);
5252
5253unsafe impl NSCoding for NEHotspotConfiguration {}
5254
5255unsafe impl NSCopying for NEHotspotConfiguration {}
5256
5257unsafe impl CopyingHelper for NEHotspotConfiguration {
5258    type Result = Self;
5259}
5260
5261unsafe impl NSObjectProtocol for NEHotspotConfiguration {}
5262
5263unsafe impl NSSecureCoding for NEHotspotConfiguration {}
5264
5265impl NEHotspotConfiguration {
5266    extern_methods!(
5267        /// SSID of the Wi-Fi Network.
5268        #[unsafe(method(SSID))]
5269        #[unsafe(method_family = none)]
5270        pub unsafe fn SSID(&self) -> Retained<NSString>;
5271
5272        /// Prefix string of SSID of the Wi-Fi Network.
5273        #[unsafe(method(SSIDPrefix))]
5274        #[unsafe(method_family = none)]
5275        pub unsafe fn SSIDPrefix(&self) -> Retained<NSString>;
5276
5277        /// if set to YES the configuration will not be persisted. Default is NO.
5278        #[unsafe(method(joinOnce))]
5279        #[unsafe(method_family = none)]
5280        pub unsafe fn joinOnce(&self) -> bool;
5281
5282        /// Setter for [`joinOnce`][Self::joinOnce].
5283        #[unsafe(method(setJoinOnce:))]
5284        #[unsafe(method_family = none)]
5285        pub unsafe fn setJoinOnce(&self, join_once: bool);
5286
5287        /// The lifetime of the configuration in days. The configuration is stored for the
5288        /// number of days specified by this property. The minimum value is 1 day and maximum value is 365 days.
5289        /// A configuration does not get deleted automatically if this property is not set or set to an invalid value.
5290        /// This property does not apply to Enterprise and HS2.0 networks.
5291        #[unsafe(method(lifeTimeInDays))]
5292        #[unsafe(method_family = none)]
5293        pub unsafe fn lifeTimeInDays(&self) -> Retained<NSNumber>;
5294
5295        /// Setter for [`lifeTimeInDays`][Self::lifeTimeInDays].
5296        #[unsafe(method(setLifeTimeInDays:))]
5297        #[unsafe(method_family = none)]
5298        pub unsafe fn setLifeTimeInDays(&self, life_time_in_days: &NSNumber);
5299
5300        /// if set to YES the system will perform active scan of the SSID. Default is NO.
5301        #[unsafe(method(hidden))]
5302        #[unsafe(method_family = none)]
5303        pub unsafe fn hidden(&self) -> bool;
5304
5305        /// Setter for [`hidden`][Self::hidden].
5306        #[unsafe(method(setHidden:))]
5307        #[unsafe(method_family = none)]
5308        pub unsafe fn setHidden(&self, hidden: bool);
5309
5310        /// A designated initializer to instantiate a new NEHotspotConfiguration object.
5311        /// This initializer is used to configure open Wi-Fi Networks.
5312        ///
5313        ///
5314        /// Parameter `SSID`: The SSID of the open Wi-Fi Network.
5315        /// Length of SSID must be between 1 and 32 characters.
5316        #[unsafe(method(initWithSSID:))]
5317        #[unsafe(method_family = init)]
5318        pub unsafe fn initWithSSID(this: Allocated<Self>, ssid: &NSString) -> Retained<Self>;
5319
5320        /// A designated initializer to instantiate a new NEHotspotConfiguration object.
5321        /// This initializer is used configure either WEP or WPA/WPA2 Personal Wi-Fi Networks.
5322        ///
5323        ///
5324        /// Parameter `SSID`: The SSID of the WEP or WPA/WPA2 Personal Wi-Fi Network
5325        ///
5326        /// Parameter `passphrase`: The passphrase credential.
5327        /// For WPA/WPA2 Personal networks: between 8 and 63 characters.
5328        /// For Static WEP(64bit)  : 10 Hex Digits
5329        /// For Static WEP(128bit) : 26 Hex Digits
5330        ///
5331        /// Parameter `isWEP`: YES specifies WEP Wi-Fi Network else WPA/WPA2 Personal Wi-Fi Network
5332        #[unsafe(method(initWithSSID:passphrase:isWEP:))]
5333        #[unsafe(method_family = init)]
5334        pub unsafe fn initWithSSID_passphrase_isWEP(
5335            this: Allocated<Self>,
5336            ssid: &NSString,
5337            passphrase: &NSString,
5338            is_wep: bool,
5339        ) -> Retained<Self>;
5340
5341        /// A designated initializer to instantiate a new NEHotspotConfiguration object.
5342        /// This initializer is used configure WPA/WPA2 Enterprise Wi-Fi Networks.
5343        ///
5344        ///
5345        /// Parameter `SSID`: The SSID of WPA/WPA2 Enterprise Wi-Fi Network
5346        ///
5347        /// Parameter `eapSettings`: EAP configuration
5348        #[unsafe(method(initWithSSID:eapSettings:))]
5349        #[unsafe(method_family = init)]
5350        pub unsafe fn initWithSSID_eapSettings(
5351            this: Allocated<Self>,
5352            ssid: &NSString,
5353            eap_settings: &NEHotspotEAPSettings,
5354        ) -> Retained<Self>;
5355
5356        /// A designated initializer to instantiate a new NEHotspotConfiguration object.
5357        /// This initializer is used configure HS2.0 Wi-Fi Networks.
5358        ///
5359        ///
5360        /// Parameter `hs20Settings`: Hotspot 2.0 configuration
5361        ///
5362        /// Parameter `eapSettings`: EAP configuration
5363        #[unsafe(method(initWithHS20Settings:eapSettings:))]
5364        #[unsafe(method_family = init)]
5365        pub unsafe fn initWithHS20Settings_eapSettings(
5366            this: Allocated<Self>,
5367            hs20_settings: &NEHotspotHS20Settings,
5368            eap_settings: &NEHotspotEAPSettings,
5369        ) -> Retained<Self>;
5370
5371        /// A designated initializer to instantiate a new NEHotspotConfiguration object.
5372        /// This initializer is used to configure open Wi-Fi Networks.
5373        ///
5374        ///
5375        /// Parameter `SSIDPrefix`: The prefix string of SSID of the open Wi-Fi Network.
5376        /// Length of SSIDPrefix must be between 3 and 32 characters.
5377        #[unsafe(method(initWithSSIDPrefix:))]
5378        #[unsafe(method_family = init)]
5379        pub unsafe fn initWithSSIDPrefix(
5380            this: Allocated<Self>,
5381            ssid_prefix: &NSString,
5382        ) -> Retained<Self>;
5383
5384        /// A designated initializer to instantiate a new NEHotspotConfiguration object.
5385        /// This initializer is used configure either WEP or WPA/WPA2 Personal Wi-Fi Networks.
5386        ///
5387        ///
5388        /// Parameter `SSIDPrefix`: The prefix string of SSID of the WEP or WPA/WPA2 Personal Wi-Fi Network.
5389        /// Length of SSIDPrefix must be between 3 and 32 characters.
5390        ///
5391        /// Parameter `passphrase`: The passphrase credential.
5392        /// For WPA/WPA2 Personal networks: between 8 and 63 characters.
5393        /// For Static WEP(64bit)  : 10 Hex Digits
5394        /// For Static WEP(128bit) : 26 Hex Digits
5395        ///
5396        /// Parameter `isWEP`: YES specifies WEP Wi-Fi Network else WPA/WPA2 Personal Wi-Fi Network
5397        #[unsafe(method(initWithSSIDPrefix:passphrase:isWEP:))]
5398        #[unsafe(method_family = init)]
5399        pub unsafe fn initWithSSIDPrefix_passphrase_isWEP(
5400            this: Allocated<Self>,
5401            ssid_prefix: &NSString,
5402            passphrase: &NSString,
5403            is_wep: bool,
5404        ) -> Retained<Self>;
5405    );
5406}
5407
5408/// Methods declared on superclass `NSObject`.
5409impl NEHotspotConfiguration {
5410    extern_methods!(
5411        #[unsafe(method(init))]
5412        #[unsafe(method_family = init)]
5413        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5414
5415        #[unsafe(method(new))]
5416        #[unsafe(method_family = new)]
5417        pub unsafe fn new() -> Retained<Self>;
5418    );
5419}
5420
5421extern "C" {
5422    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspotconfigurationerrordomain?language=objc)
5423    pub static NEHotspotConfigurationErrorDomain: &'static NSString;
5424}
5425
5426/// Hotspot Configuration error codes
5427///
5428/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspotconfigurationerror?language=objc)
5429// NS_ENUM
5430#[repr(transparent)]
5431#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
5432pub struct NEHotspotConfigurationError(pub NSInteger);
5433impl NEHotspotConfigurationError {
5434    #[doc(alias = "NEHotspotConfigurationErrorInvalid")]
5435    pub const Invalid: Self = Self(0);
5436    #[doc(alias = "NEHotspotConfigurationErrorInvalidSSID")]
5437    pub const InvalidSSID: Self = Self(1);
5438    #[doc(alias = "NEHotspotConfigurationErrorInvalidWPAPassphrase")]
5439    pub const InvalidWPAPassphrase: Self = Self(2);
5440    #[doc(alias = "NEHotspotConfigurationErrorInvalidWEPPassphrase")]
5441    pub const InvalidWEPPassphrase: Self = Self(3);
5442    #[doc(alias = "NEHotspotConfigurationErrorInvalidEAPSettings")]
5443    pub const InvalidEAPSettings: Self = Self(4);
5444    #[doc(alias = "NEHotspotConfigurationErrorInvalidHS20Settings")]
5445    pub const InvalidHS20Settings: Self = Self(5);
5446    #[doc(alias = "NEHotspotConfigurationErrorInvalidHS20DomainName")]
5447    pub const InvalidHS20DomainName: Self = Self(6);
5448    #[doc(alias = "NEHotspotConfigurationErrorUserDenied")]
5449    pub const UserDenied: Self = Self(7);
5450    #[doc(alias = "NEHotspotConfigurationErrorInternal")]
5451    pub const Internal: Self = Self(8);
5452    #[doc(alias = "NEHotspotConfigurationErrorPending")]
5453    pub const Pending: Self = Self(9);
5454    #[doc(alias = "NEHotspotConfigurationErrorSystemConfiguration")]
5455    pub const SystemConfiguration: Self = Self(10);
5456    #[doc(alias = "NEHotspotConfigurationErrorUnknown")]
5457    pub const Unknown: Self = Self(11);
5458    #[doc(alias = "NEHotspotConfigurationErrorJoinOnceNotSupported")]
5459    pub const JoinOnceNotSupported: Self = Self(12);
5460    #[doc(alias = "NEHotspotConfigurationErrorAlreadyAssociated")]
5461    pub const AlreadyAssociated: Self = Self(13);
5462    #[doc(alias = "NEHotspotConfigurationErrorApplicationIsNotInForeground")]
5463    pub const ApplicationIsNotInForeground: Self = Self(14);
5464    #[doc(alias = "NEHotspotConfigurationErrorInvalidSSIDPrefix")]
5465    pub const InvalidSSIDPrefix: Self = Self(15);
5466    #[doc(alias = "NEHotspotConfigurationErrorUserUnauthorized")]
5467    pub const UserUnauthorized: Self = Self(16);
5468    #[doc(alias = "NEHotspotConfigurationErrorSystemDenied")]
5469    pub const SystemDenied: Self = Self(17);
5470}
5471
5472unsafe impl Encode for NEHotspotConfigurationError {
5473    const ENCODING: Encoding = NSInteger::ENCODING;
5474}
5475
5476unsafe impl RefEncode for NEHotspotConfigurationError {
5477    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
5478}
5479
5480extern_class!(
5481    /// The NEHotspotConfigurationManager class allows an application to
5482    /// Add/Update/Remove Wi-Fi Network Configuraton.
5483    ///
5484    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nehotspotconfigurationmanager?language=objc)
5485    #[unsafe(super(NSObject))]
5486    #[derive(Debug, PartialEq, Eq, Hash)]
5487    pub struct NEHotspotConfigurationManager;
5488);
5489
5490unsafe impl NSObjectProtocol for NEHotspotConfigurationManager {}
5491
5492impl NEHotspotConfigurationManager {
5493    extern_methods!(
5494        #[unsafe(method(sharedManager))]
5495        #[unsafe(method_family = none)]
5496        pub unsafe fn sharedManager() -> Retained<NEHotspotConfigurationManager>;
5497
5498        #[cfg(feature = "block2")]
5499        /// This function adds or updates a Wi-Fi network configuration.
5500        ///
5501        /// Parameter `configuration`: NEHotspotConfiguration object containing the Wi-Fi network configuration.
5502        ///
5503        /// Parameter `completionHandler`: A block that will be called when add/update operation is completed.
5504        /// Pass nil if application does not intend to receive the result.
5505        /// The NSError passed to this block will be nil if the configuration is successfully stored, non-nil otherwise.
5506        /// If the configuration is found invalid or API encounters some other error then completionHandler is called
5507        /// with instance of NSError containing appropriate error code. This API attempts to join the Wi-Fi network
5508        /// if the configuration is successfully added or updated and the network is found nearby.
5509        #[unsafe(method(applyConfiguration:completionHandler:))]
5510        #[unsafe(method_family = none)]
5511        pub unsafe fn applyConfiguration_completionHandler(
5512            &self,
5513            configuration: &NEHotspotConfiguration,
5514            completion_handler: Option<&block2::Block<dyn Fn(*mut NSError)>>,
5515        );
5516
5517        /// This function removes Wi-Fi configuration.
5518        /// If the joinOnce property was set to YES, invoking this method will disassociate from the Wi-Fi network
5519        /// after the configuration is removed.
5520        ///
5521        /// Parameter `SSID`: Wi-Fi SSID for which the configuration is to be deleted.
5522        #[unsafe(method(removeConfigurationForSSID:))]
5523        #[unsafe(method_family = none)]
5524        pub unsafe fn removeConfigurationForSSID(&self, ssid: &NSString);
5525
5526        /// This function removes Wi-Fi configuration.
5527        ///
5528        /// Parameter `domainName`: HS2.0 domainName for which the configuration is to be deleted.
5529        #[unsafe(method(removeConfigurationForHS20DomainName:))]
5530        #[unsafe(method_family = none)]
5531        pub unsafe fn removeConfigurationForHS20DomainName(&self, domain_name: &NSString);
5532
5533        #[cfg(feature = "block2")]
5534        /// This function returns array of SSIDs and HS2.0 Domain Names that the calling application has configured.
5535        /// It returns nil if there are no networks configurred by the calling application.
5536        #[unsafe(method(getConfiguredSSIDsWithCompletionHandler:))]
5537        #[unsafe(method_family = none)]
5538        pub unsafe fn getConfiguredSSIDsWithCompletionHandler(
5539            &self,
5540            completion_handler: &block2::Block<dyn Fn(NonNull<NSArray<NSString>>)>,
5541        );
5542    );
5543}
5544
5545/// Methods declared on superclass `NSObject`.
5546impl NEHotspotConfigurationManager {
5547    extern_methods!(
5548        #[unsafe(method(init))]
5549        #[unsafe(method_family = init)]
5550        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5551
5552        #[unsafe(method(new))]
5553        #[unsafe(method_family = new)]
5554        pub unsafe fn new() -> Retained<Self>;
5555    );
5556}
5557
5558extern_class!(
5559    /// The NEIPv4Settings class declares the programmatic interface for an object that contains IPv4 settings.
5560    ///
5561    /// Instances of this class are thread safe.
5562    ///
5563    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neipv4settings?language=objc)
5564    #[unsafe(super(NSObject))]
5565    #[derive(Debug, PartialEq, Eq, Hash)]
5566    pub struct NEIPv4Settings;
5567);
5568
5569unsafe impl NSCoding for NEIPv4Settings {}
5570
5571unsafe impl NSCopying for NEIPv4Settings {}
5572
5573unsafe impl CopyingHelper for NEIPv4Settings {
5574    type Result = Self;
5575}
5576
5577unsafe impl NSObjectProtocol for NEIPv4Settings {}
5578
5579unsafe impl NSSecureCoding for NEIPv4Settings {}
5580
5581impl NEIPv4Settings {
5582    extern_methods!(
5583        /// Initialize a newly-allocated NEIPv4Settings object.
5584        ///
5585        /// Parameter `addresses`: An array of IPv4 addresses represented as dotted decimal strings.
5586        ///
5587        /// Parameter `subnetMasks`: An array of IPv4 subnet masks represented as dotted decimal strings.
5588        ///
5589        /// Returns: The initialized object.
5590        #[unsafe(method(initWithAddresses:subnetMasks:))]
5591        #[unsafe(method_family = init)]
5592        pub unsafe fn initWithAddresses_subnetMasks(
5593            this: Allocated<Self>,
5594            addresses: &NSArray<NSString>,
5595            subnet_masks: &NSArray<NSString>,
5596        ) -> Retained<Self>;
5597
5598        /// Create a NEIPv4Settings object that will obtain IP addresses and netmasks using DHCP.
5599        ///
5600        /// Returns: The initialized object.
5601        #[unsafe(method(settingsWithAutomaticAddressing))]
5602        #[unsafe(method_family = none)]
5603        pub unsafe fn settingsWithAutomaticAddressing() -> Retained<Self>;
5604
5605        /// An array of IPv4 addresses represented as dotted decimal strings. These addresses will be set on the virtual interface used by the VPN tunnel.
5606        #[unsafe(method(addresses))]
5607        #[unsafe(method_family = none)]
5608        pub unsafe fn addresses(&self) -> Retained<NSArray<NSString>>;
5609
5610        /// 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.
5611        #[unsafe(method(subnetMasks))]
5612        #[unsafe(method_family = none)]
5613        pub unsafe fn subnetMasks(&self) -> Retained<NSArray<NSString>>;
5614
5615        /// The address of the next-hop gateway router represented as a dotted decimal string. This property is ignored for TUN interfaces.
5616        #[unsafe(method(router))]
5617        #[unsafe(method_family = none)]
5618        pub unsafe fn router(&self) -> Option<Retained<NSString>>;
5619
5620        /// Setter for [`router`][Self::router].
5621        #[unsafe(method(setRouter:))]
5622        #[unsafe(method_family = none)]
5623        pub unsafe fn setRouter(&self, router: Option<&NSString>);
5624
5625        /// An array of NEIPv4Route objects. Traffic matching these routes will be routed through the virtual interface used by the VPN tunnel.
5626        #[unsafe(method(includedRoutes))]
5627        #[unsafe(method_family = none)]
5628        pub unsafe fn includedRoutes(&self) -> Option<Retained<NSArray<NEIPv4Route>>>;
5629
5630        /// Setter for [`includedRoutes`][Self::includedRoutes].
5631        #[unsafe(method(setIncludedRoutes:))]
5632        #[unsafe(method_family = none)]
5633        pub unsafe fn setIncludedRoutes(&self, included_routes: Option<&NSArray<NEIPv4Route>>);
5634
5635        /// An array of NEIPv4Route objects. Traffic matching these routes will be routed through the current primary physical interface of the device.
5636        #[unsafe(method(excludedRoutes))]
5637        #[unsafe(method_family = none)]
5638        pub unsafe fn excludedRoutes(&self) -> Option<Retained<NSArray<NEIPv4Route>>>;
5639
5640        /// Setter for [`excludedRoutes`][Self::excludedRoutes].
5641        #[unsafe(method(setExcludedRoutes:))]
5642        #[unsafe(method_family = none)]
5643        pub unsafe fn setExcludedRoutes(&self, excluded_routes: Option<&NSArray<NEIPv4Route>>);
5644    );
5645}
5646
5647/// Methods declared on superclass `NSObject`.
5648impl NEIPv4Settings {
5649    extern_methods!(
5650        #[unsafe(method(init))]
5651        #[unsafe(method_family = init)]
5652        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5653
5654        #[unsafe(method(new))]
5655        #[unsafe(method_family = new)]
5656        pub unsafe fn new() -> Retained<Self>;
5657    );
5658}
5659
5660extern_class!(
5661    /// The NEIPv4Route class declares the programmatic interface for an object that contains settings for an IPv4 route.
5662    ///
5663    /// Instances of this class are thread safe.
5664    ///
5665    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neipv4route?language=objc)
5666    #[unsafe(super(NSObject))]
5667    #[derive(Debug, PartialEq, Eq, Hash)]
5668    pub struct NEIPv4Route;
5669);
5670
5671unsafe impl NSCoding for NEIPv4Route {}
5672
5673unsafe impl NSCopying for NEIPv4Route {}
5674
5675unsafe impl CopyingHelper for NEIPv4Route {
5676    type Result = Self;
5677}
5678
5679unsafe impl NSObjectProtocol for NEIPv4Route {}
5680
5681unsafe impl NSSecureCoding for NEIPv4Route {}
5682
5683impl NEIPv4Route {
5684    extern_methods!(
5685        /// Initialize a newly-allocated NEIPv4Route.
5686        ///
5687        /// Parameter `address`: The IPv4 address of the destination network.
5688        ///
5689        /// Parameter `subnetMask`: The subnet mask of the destination network.
5690        ///
5691        /// Returns: The initialized NEIPv4Route.
5692        #[unsafe(method(initWithDestinationAddress:subnetMask:))]
5693        #[unsafe(method_family = init)]
5694        pub unsafe fn initWithDestinationAddress_subnetMask(
5695            this: Allocated<Self>,
5696            address: &NSString,
5697            subnet_mask: &NSString,
5698        ) -> Retained<Self>;
5699
5700        /// An IPv4 address represented as a dotted decimal string.
5701        #[unsafe(method(destinationAddress))]
5702        #[unsafe(method_family = none)]
5703        pub unsafe fn destinationAddress(&self) -> Retained<NSString>;
5704
5705        /// 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.
5706        #[unsafe(method(destinationSubnetMask))]
5707        #[unsafe(method_family = none)]
5708        pub unsafe fn destinationSubnetMask(&self) -> Retained<NSString>;
5709
5710        /// 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.
5711        #[unsafe(method(gatewayAddress))]
5712        #[unsafe(method_family = none)]
5713        pub unsafe fn gatewayAddress(&self) -> Option<Retained<NSString>>;
5714
5715        /// Setter for [`gatewayAddress`][Self::gatewayAddress].
5716        #[unsafe(method(setGatewayAddress:))]
5717        #[unsafe(method_family = none)]
5718        pub unsafe fn setGatewayAddress(&self, gateway_address: Option<&NSString>);
5719
5720        /// Returns: A route object that represents the IPv4 default route.
5721        #[unsafe(method(defaultRoute))]
5722        #[unsafe(method_family = none)]
5723        pub unsafe fn defaultRoute() -> Retained<NEIPv4Route>;
5724    );
5725}
5726
5727/// Methods declared on superclass `NSObject`.
5728impl NEIPv4Route {
5729    extern_methods!(
5730        #[unsafe(method(init))]
5731        #[unsafe(method_family = init)]
5732        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5733
5734        #[unsafe(method(new))]
5735        #[unsafe(method_family = new)]
5736        pub unsafe fn new() -> Retained<Self>;
5737    );
5738}
5739
5740extern_class!(
5741    /// The NEIPv6Settings class declares the programmatic interface for an object that contains IPv6 settings.
5742    ///
5743    /// Instances of this class are thread safe.
5744    ///
5745    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neipv6settings?language=objc)
5746    #[unsafe(super(NSObject))]
5747    #[derive(Debug, PartialEq, Eq, Hash)]
5748    pub struct NEIPv6Settings;
5749);
5750
5751unsafe impl NSCoding for NEIPv6Settings {}
5752
5753unsafe impl NSCopying for NEIPv6Settings {}
5754
5755unsafe impl CopyingHelper for NEIPv6Settings {
5756    type Result = Self;
5757}
5758
5759unsafe impl NSObjectProtocol for NEIPv6Settings {}
5760
5761unsafe impl NSSecureCoding for NEIPv6Settings {}
5762
5763impl NEIPv6Settings {
5764    extern_methods!(
5765        /// Initialize a newly-allocated NEIPv6Settings object.
5766        ///
5767        /// Parameter `addresses`: An array of IPv6 addresses represented as dotted decimal strings.
5768        ///
5769        /// 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.
5770        ///
5771        /// Returns: The initialized object.
5772        #[unsafe(method(initWithAddresses:networkPrefixLengths:))]
5773        #[unsafe(method_family = init)]
5774        pub unsafe fn initWithAddresses_networkPrefixLengths(
5775            this: Allocated<Self>,
5776            addresses: &NSArray<NSString>,
5777            network_prefix_lengths: &NSArray<NSNumber>,
5778        ) -> Retained<Self>;
5779
5780        /// Create a NEIPv6Settings object that will obtain IP addresses and netmasks automatically.
5781        #[unsafe(method(settingsWithAutomaticAddressing))]
5782        #[unsafe(method_family = none)]
5783        pub unsafe fn settingsWithAutomaticAddressing() -> Retained<Self>;
5784
5785        /// Create a NEIPv6Settings object that will only use link-local IPv6 addresses.
5786        #[unsafe(method(settingsWithLinkLocalAddressing))]
5787        #[unsafe(method_family = none)]
5788        pub unsafe fn settingsWithLinkLocalAddressing() -> Retained<Self>;
5789
5790        /// An array of IPv6 addresses represented strings. These addresses will be set on the virtual interface used by the VPN tunnel.
5791        #[unsafe(method(addresses))]
5792        #[unsafe(method_family = none)]
5793        pub unsafe fn addresses(&self) -> Retained<NSArray<NSString>>;
5794
5795        /// An array of NSNumber objects each representing the length in bits of the network prefix of the corresponding address in the addresses property.
5796        #[unsafe(method(networkPrefixLengths))]
5797        #[unsafe(method_family = none)]
5798        pub unsafe fn networkPrefixLengths(&self) -> Retained<NSArray<NSNumber>>;
5799
5800        /// An array of NEIPv6Route objects. Traffic matching these routes will be routed through the virtual interface used by the VPN tunnel.
5801        #[unsafe(method(includedRoutes))]
5802        #[unsafe(method_family = none)]
5803        pub unsafe fn includedRoutes(&self) -> Option<Retained<NSArray<NEIPv6Route>>>;
5804
5805        /// Setter for [`includedRoutes`][Self::includedRoutes].
5806        #[unsafe(method(setIncludedRoutes:))]
5807        #[unsafe(method_family = none)]
5808        pub unsafe fn setIncludedRoutes(&self, included_routes: Option<&NSArray<NEIPv6Route>>);
5809
5810        /// An array of NEIPv6Route objects. Traffic matching these routes will be routed through the current primary physical interface of the device.
5811        #[unsafe(method(excludedRoutes))]
5812        #[unsafe(method_family = none)]
5813        pub unsafe fn excludedRoutes(&self) -> Option<Retained<NSArray<NEIPv6Route>>>;
5814
5815        /// Setter for [`excludedRoutes`][Self::excludedRoutes].
5816        #[unsafe(method(setExcludedRoutes:))]
5817        #[unsafe(method_family = none)]
5818        pub unsafe fn setExcludedRoutes(&self, excluded_routes: Option<&NSArray<NEIPv6Route>>);
5819    );
5820}
5821
5822/// Methods declared on superclass `NSObject`.
5823impl NEIPv6Settings {
5824    extern_methods!(
5825        #[unsafe(method(init))]
5826        #[unsafe(method_family = init)]
5827        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5828
5829        #[unsafe(method(new))]
5830        #[unsafe(method_family = new)]
5831        pub unsafe fn new() -> Retained<Self>;
5832    );
5833}
5834
5835extern_class!(
5836    /// The NEIPv6Route class declares the programmatic interface for an object that contains settings for an IPv6 route.
5837    ///
5838    /// Instances of this class are thread safe.
5839    ///
5840    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neipv6route?language=objc)
5841    #[unsafe(super(NSObject))]
5842    #[derive(Debug, PartialEq, Eq, Hash)]
5843    pub struct NEIPv6Route;
5844);
5845
5846unsafe impl NSCoding for NEIPv6Route {}
5847
5848unsafe impl NSCopying for NEIPv6Route {}
5849
5850unsafe impl CopyingHelper for NEIPv6Route {
5851    type Result = Self;
5852}
5853
5854unsafe impl NSObjectProtocol for NEIPv6Route {}
5855
5856unsafe impl NSSecureCoding for NEIPv6Route {}
5857
5858impl NEIPv6Route {
5859    extern_methods!(
5860        /// Initialize a newly-allocated NEIPv6Route.
5861        ///
5862        /// Parameter `address`: The IPv6 address of the destination network.
5863        ///
5864        /// Parameter `networkPrefixLength`: A number containing the length in bits of the network prefix of the destination network.
5865        ///
5866        /// Returns: The initialized NEIPv6Route.
5867        #[unsafe(method(initWithDestinationAddress:networkPrefixLength:))]
5868        #[unsafe(method_family = init)]
5869        pub unsafe fn initWithDestinationAddress_networkPrefixLength(
5870            this: Allocated<Self>,
5871            address: &NSString,
5872            network_prefix_length: &NSNumber,
5873        ) -> Retained<Self>;
5874
5875        /// An IPv6 address represented as a string.
5876        #[unsafe(method(destinationAddress))]
5877        #[unsafe(method_family = none)]
5878        pub unsafe fn destinationAddress(&self) -> Retained<NSString>;
5879
5880        /// 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.
5881        #[unsafe(method(destinationNetworkPrefixLength))]
5882        #[unsafe(method_family = none)]
5883        pub unsafe fn destinationNetworkPrefixLength(&self) -> Retained<NSNumber>;
5884
5885        /// 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.
5886        #[unsafe(method(gatewayAddress))]
5887        #[unsafe(method_family = none)]
5888        pub unsafe fn gatewayAddress(&self) -> Option<Retained<NSString>>;
5889
5890        /// Setter for [`gatewayAddress`][Self::gatewayAddress].
5891        #[unsafe(method(setGatewayAddress:))]
5892        #[unsafe(method_family = none)]
5893        pub unsafe fn setGatewayAddress(&self, gateway_address: Option<&NSString>);
5894
5895        /// Returns: A route object that represents the IPv6 default route.
5896        #[unsafe(method(defaultRoute))]
5897        #[unsafe(method_family = none)]
5898        pub unsafe fn defaultRoute() -> Retained<NEIPv6Route>;
5899    );
5900}
5901
5902/// Methods declared on superclass `NSObject`.
5903impl NEIPv6Route {
5904    extern_methods!(
5905        #[unsafe(method(init))]
5906        #[unsafe(method_family = init)]
5907        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5908
5909        #[unsafe(method(new))]
5910        #[unsafe(method_family = new)]
5911        pub unsafe fn new() -> Retained<Self>;
5912    );
5913}
5914
5915extern_class!(
5916    /// The NETunnelNetworkSettings class declares the programmatic interface for an object that contains network settings.
5917    ///
5918    /// 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.
5919    ///
5920    /// Instances of this class are thread safe.
5921    ///
5922    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netunnelnetworksettings?language=objc)
5923    #[unsafe(super(NSObject))]
5924    #[derive(Debug, PartialEq, Eq, Hash)]
5925    pub struct NETunnelNetworkSettings;
5926);
5927
5928unsafe impl NSCoding for NETunnelNetworkSettings {}
5929
5930unsafe impl NSCopying for NETunnelNetworkSettings {}
5931
5932unsafe impl CopyingHelper for NETunnelNetworkSettings {
5933    type Result = Self;
5934}
5935
5936unsafe impl NSObjectProtocol for NETunnelNetworkSettings {}
5937
5938unsafe impl NSSecureCoding for NETunnelNetworkSettings {}
5939
5940impl NETunnelNetworkSettings {
5941    extern_methods!(
5942        /// This function initializes a newly-allocated NETunnelNetworkSettings object with a given tunnel remote address.
5943        ///
5944        /// Parameter `address`: The address of the remote endpoint that is providing the tunnel service.
5945        #[unsafe(method(initWithTunnelRemoteAddress:))]
5946        #[unsafe(method_family = init)]
5947        pub unsafe fn initWithTunnelRemoteAddress(
5948            this: Allocated<Self>,
5949            address: &NSString,
5950        ) -> Retained<Self>;
5951
5952        /// A string containing the IP address of the remote endpoint that is providing the tunnel service.
5953        #[unsafe(method(tunnelRemoteAddress))]
5954        #[unsafe(method_family = none)]
5955        pub unsafe fn tunnelRemoteAddress(&self) -> Retained<NSString>;
5956
5957        /// An NEDNSSettings object that contains the desired tunnel DNS settings.
5958        #[unsafe(method(DNSSettings))]
5959        #[unsafe(method_family = none)]
5960        pub unsafe fn DNSSettings(&self) -> Option<Retained<NEDNSSettings>>;
5961
5962        /// Setter for [`DNSSettings`][Self::DNSSettings].
5963        #[unsafe(method(setDNSSettings:))]
5964        #[unsafe(method_family = none)]
5965        pub unsafe fn setDNSSettings(&self, dns_settings: Option<&NEDNSSettings>);
5966
5967        /// An NEProxySettings object that contains the desired tunnel proxy settings.
5968        #[unsafe(method(proxySettings))]
5969        #[unsafe(method_family = none)]
5970        pub unsafe fn proxySettings(&self) -> Option<Retained<NEProxySettings>>;
5971
5972        /// Setter for [`proxySettings`][Self::proxySettings].
5973        #[unsafe(method(setProxySettings:))]
5974        #[unsafe(method_family = none)]
5975        pub unsafe fn setProxySettings(&self, proxy_settings: Option<&NEProxySettings>);
5976    );
5977}
5978
5979/// Methods declared on superclass `NSObject`.
5980impl NETunnelNetworkSettings {
5981    extern_methods!(
5982        #[unsafe(method(init))]
5983        #[unsafe(method_family = init)]
5984        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5985
5986        #[unsafe(method(new))]
5987        #[unsafe(method_family = new)]
5988        pub unsafe fn new() -> Retained<Self>;
5989    );
5990}
5991
5992extern_class!(
5993    /// The NEPacketTunnelNetworkSettings class declares the programmatic interface for an object that contains IP network settings.
5994    ///
5995    /// 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.
5996    ///
5997    /// Instances of this class are thread safe.
5998    ///
5999    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nepackettunnelnetworksettings?language=objc)
6000    #[unsafe(super(NETunnelNetworkSettings, NSObject))]
6001    #[derive(Debug, PartialEq, Eq, Hash)]
6002    pub struct NEPacketTunnelNetworkSettings;
6003);
6004
6005unsafe impl NSCoding for NEPacketTunnelNetworkSettings {}
6006
6007unsafe impl NSCopying for NEPacketTunnelNetworkSettings {}
6008
6009unsafe impl CopyingHelper for NEPacketTunnelNetworkSettings {
6010    type Result = Self;
6011}
6012
6013unsafe impl NSObjectProtocol for NEPacketTunnelNetworkSettings {}
6014
6015unsafe impl NSSecureCoding for NEPacketTunnelNetworkSettings {}
6016
6017impl NEPacketTunnelNetworkSettings {
6018    extern_methods!(
6019        /// An NEIPv4Settings object that contains the desired tunnel IPv4 settings.
6020        #[unsafe(method(IPv4Settings))]
6021        #[unsafe(method_family = none)]
6022        pub unsafe fn IPv4Settings(&self) -> Option<Retained<NEIPv4Settings>>;
6023
6024        /// Setter for [`IPv4Settings`][Self::IPv4Settings].
6025        #[unsafe(method(setIPv4Settings:))]
6026        #[unsafe(method_family = none)]
6027        pub unsafe fn setIPv4Settings(&self, i_pv4_settings: Option<&NEIPv4Settings>);
6028
6029        /// An NEIPv6Settings object that contains the desired tunnel IPv6 settings.
6030        #[unsafe(method(IPv6Settings))]
6031        #[unsafe(method_family = none)]
6032        pub unsafe fn IPv6Settings(&self) -> Option<Retained<NEIPv6Settings>>;
6033
6034        /// Setter for [`IPv6Settings`][Self::IPv6Settings].
6035        #[unsafe(method(setIPv6Settings:))]
6036        #[unsafe(method_family = none)]
6037        pub unsafe fn setIPv6Settings(&self, i_pv6_settings: Option<&NEIPv6Settings>);
6038
6039        /// 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.
6040        #[unsafe(method(tunnelOverheadBytes))]
6041        #[unsafe(method_family = none)]
6042        pub unsafe fn tunnelOverheadBytes(&self) -> Option<Retained<NSNumber>>;
6043
6044        /// Setter for [`tunnelOverheadBytes`][Self::tunnelOverheadBytes].
6045        #[unsafe(method(setTunnelOverheadBytes:))]
6046        #[unsafe(method_family = none)]
6047        pub unsafe fn setTunnelOverheadBytes(&self, tunnel_overhead_bytes: Option<&NSNumber>);
6048
6049        /// 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.
6050        #[unsafe(method(MTU))]
6051        #[unsafe(method_family = none)]
6052        pub unsafe fn MTU(&self) -> Option<Retained<NSNumber>>;
6053
6054        /// Setter for [`MTU`][Self::MTU].
6055        #[unsafe(method(setMTU:))]
6056        #[unsafe(method_family = none)]
6057        pub unsafe fn setMTU(&self, mtu: Option<&NSNumber>);
6058    );
6059}
6060
6061/// Methods declared on superclass `NETunnelNetworkSettings`.
6062impl NEPacketTunnelNetworkSettings {
6063    extern_methods!(
6064        /// This function initializes a newly-allocated NETunnelNetworkSettings object with a given tunnel remote address.
6065        ///
6066        /// Parameter `address`: The address of the remote endpoint that is providing the tunnel service.
6067        #[unsafe(method(initWithTunnelRemoteAddress:))]
6068        #[unsafe(method_family = init)]
6069        pub unsafe fn initWithTunnelRemoteAddress(
6070            this: Allocated<Self>,
6071            address: &NSString,
6072        ) -> Retained<Self>;
6073    );
6074}
6075
6076/// Methods declared on superclass `NSObject`.
6077impl NEPacketTunnelNetworkSettings {
6078    extern_methods!(
6079        #[unsafe(method(init))]
6080        #[unsafe(method_family = init)]
6081        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6082
6083        #[unsafe(method(new))]
6084        #[unsafe(method_family = new)]
6085        pub unsafe fn new() -> Retained<Self>;
6086    );
6087}
6088
6089extern_class!(
6090    /// The NEEthernetTunnelNetworkSettings class declares the programmatic interface for an object that contains network settings.
6091    ///
6092    /// 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.
6093    ///
6094    /// Instances of this class are thread safe.
6095    ///
6096    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neethernettunnelnetworksettings?language=objc)
6097    #[unsafe(super(NEPacketTunnelNetworkSettings, NETunnelNetworkSettings, NSObject))]
6098    #[derive(Debug, PartialEq, Eq, Hash)]
6099    pub struct NEEthernetTunnelNetworkSettings;
6100);
6101
6102unsafe impl NSCoding for NEEthernetTunnelNetworkSettings {}
6103
6104unsafe impl NSCopying for NEEthernetTunnelNetworkSettings {}
6105
6106unsafe impl CopyingHelper for NEEthernetTunnelNetworkSettings {
6107    type Result = Self;
6108}
6109
6110unsafe impl NSObjectProtocol for NEEthernetTunnelNetworkSettings {}
6111
6112unsafe impl NSSecureCoding for NEEthernetTunnelNetworkSettings {}
6113
6114impl NEEthernetTunnelNetworkSettings {
6115    extern_methods!(
6116        /// This function initializes a newly-allocated NEEthernetTunnelNetworkSettings object with a given tunnel remote address and MAC address.
6117        ///
6118        /// Parameter `address`: The address of the remote endpoint that is providing the tunnel service.
6119        ///
6120        /// 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.
6121        ///
6122        /// Parameter `mtu`: The MTU (Maxium Transmission Unit) in bytes to be assigned to the tunnel interface.
6123        #[unsafe(method(initWithTunnelRemoteAddress:ethernetAddress:mtu:))]
6124        #[unsafe(method_family = init)]
6125        pub unsafe fn initWithTunnelRemoteAddress_ethernetAddress_mtu(
6126            this: Allocated<Self>,
6127            address: &NSString,
6128            ethernet_address: &NSString,
6129            mtu: NSInteger,
6130        ) -> Retained<Self>;
6131
6132        /// An NSString object containing the ethernet address of the tunnel interface.
6133        #[unsafe(method(ethernetAddress))]
6134        #[unsafe(method_family = none)]
6135        pub unsafe fn ethernetAddress(&self) -> Retained<NSString>;
6136    );
6137}
6138
6139/// Methods declared on superclass `NETunnelNetworkSettings`.
6140impl NEEthernetTunnelNetworkSettings {
6141    extern_methods!(
6142        /// This function initializes a newly-allocated NETunnelNetworkSettings object with a given tunnel remote address.
6143        ///
6144        /// Parameter `address`: The address of the remote endpoint that is providing the tunnel service.
6145        #[unsafe(method(initWithTunnelRemoteAddress:))]
6146        #[unsafe(method_family = init)]
6147        pub unsafe fn initWithTunnelRemoteAddress(
6148            this: Allocated<Self>,
6149            address: &NSString,
6150        ) -> Retained<Self>;
6151    );
6152}
6153
6154/// Methods declared on superclass `NSObject`.
6155impl NEEthernetTunnelNetworkSettings {
6156    extern_methods!(
6157        #[unsafe(method(init))]
6158        #[unsafe(method_family = init)]
6159        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6160
6161        #[unsafe(method(new))]
6162        #[unsafe(method_family = new)]
6163        pub unsafe fn new() -> Retained<Self>;
6164    );
6165}
6166
6167extern_class!(
6168    /// The NEPacketTunnelProvider class declares the programmatic interface of an object that implements the client side of a custom IP packet tunneling protocol.
6169    ///
6170    /// NEPacketTunnelProvider is part of NetworkExtension.framework.
6171    ///
6172    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nepackettunnelprovider?language=objc)
6173    #[unsafe(super(NETunnelProvider, NEProvider, NSObject))]
6174    #[derive(Debug, PartialEq, Eq, Hash)]
6175    pub struct NEPacketTunnelProvider;
6176);
6177
6178unsafe impl NSObjectProtocol for NEPacketTunnelProvider {}
6179
6180impl NEPacketTunnelProvider {
6181    extern_methods!(
6182        #[cfg(feature = "block2")]
6183        /// 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.
6184        ///
6185        /// 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.
6186        ///
6187        /// 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.
6188        #[unsafe(method(startTunnelWithOptions:completionHandler:))]
6189        #[unsafe(method_family = none)]
6190        pub unsafe fn startTunnelWithOptions_completionHandler(
6191            &self,
6192            options: Option<&NSDictionary<NSString, NSObject>>,
6193            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
6194        );
6195
6196        #[cfg(feature = "block2")]
6197        /// 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.
6198        ///
6199        /// Parameter `reason`: An NEProviderStopReason indicating why the tunnel is being stopped.
6200        ///
6201        /// Parameter `completionHandler`: A block that must be called when the tunnel is completely torn down.
6202        #[unsafe(method(stopTunnelWithReason:completionHandler:))]
6203        #[unsafe(method_family = none)]
6204        pub unsafe fn stopTunnelWithReason_completionHandler(
6205            &self,
6206            reason: NEProviderStopReason,
6207            completion_handler: &block2::Block<dyn Fn()>,
6208        );
6209
6210        /// 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.
6211        ///
6212        /// Parameter `error`: An NSError object containing details about the error that the tunnel provider implementation encountered.
6213        #[unsafe(method(cancelTunnelWithError:))]
6214        #[unsafe(method_family = none)]
6215        pub unsafe fn cancelTunnelWithError(&self, error: Option<&NSError>);
6216
6217        /// 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.
6218        #[unsafe(method(packetFlow))]
6219        #[unsafe(method_family = none)]
6220        pub unsafe fn packetFlow(&self) -> Retained<NEPacketTunnelFlow>;
6221
6222        /// 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.
6223        ///
6224        /// Parameter `remoteEndpoint`: An NWEndpoint object that specifies the remote network endpoint to connect to.
6225        ///
6226        /// Parameter `enableTLS`: A flag indicating if a TLS session should be negotiated on the connection.
6227        ///
6228        /// 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.
6229        ///
6230        /// Parameter `delegate`: An object to use as the connection delegate. This object should conform to the NWTCPConnectionAuthenticationDelegate protocol.
6231        ///
6232        /// Returns: An NWTCPConnection object.
6233        #[deprecated = "Use the `virtualInterface` property with `nw_parameters_require_interface`"]
6234        #[unsafe(method(createTCPConnectionThroughTunnelToEndpoint:enableTLS:TLSParameters:delegate:))]
6235        #[unsafe(method_family = none)]
6236        pub unsafe fn createTCPConnectionThroughTunnelToEndpoint_enableTLS_TLSParameters_delegate(
6237            &self,
6238            remote_endpoint: &NWEndpoint,
6239            enable_tls: bool,
6240            tls_parameters: Option<&NWTLSParameters>,
6241            delegate: Option<&AnyObject>,
6242        ) -> Retained<NWTCPConnection>;
6243
6244        /// 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.
6245        ///
6246        /// Parameter `remoteEndpoint`: An NWEndpoint object that specifies the remote endpoint to which UDP datagrams will be sent by the UDP session.
6247        ///
6248        /// Parameter `localEndpoint`: An NWHostEndpoint object that specifies the local IP address endpoint to use as the source endpoint of the UDP session.
6249        ///
6250        /// Returns: An NWUDPSession object.
6251        #[deprecated = "Use the `virtualInterface` property with `nw_parameters_require_interface`"]
6252        #[unsafe(method(createUDPSessionThroughTunnelToEndpoint:fromEndpoint:))]
6253        #[unsafe(method_family = none)]
6254        pub unsafe fn createUDPSessionThroughTunnelToEndpoint_fromEndpoint(
6255            &self,
6256            remote_endpoint: &NWEndpoint,
6257            local_endpoint: Option<&NWHostEndpoint>,
6258        ) -> Retained<NWUDPSession>;
6259    );
6260}
6261
6262/// Methods declared on superclass `NSObject`.
6263impl NEPacketTunnelProvider {
6264    extern_methods!(
6265        #[unsafe(method(init))]
6266        #[unsafe(method_family = init)]
6267        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6268
6269        #[unsafe(method(new))]
6270        #[unsafe(method_family = new)]
6271        pub unsafe fn new() -> Retained<Self>;
6272    );
6273}
6274
6275extern_class!(
6276    /// The NEEthernetTunnelProvider class declares the programmatic interface of an object that implements the client side of a custom link-layer packet tunneling protocol.
6277    ///
6278    /// NEEthernetTunnelProvider is part of NetworkExtension.framework.
6279    ///
6280    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neethernettunnelprovider?language=objc)
6281    #[unsafe(super(NEPacketTunnelProvider, NETunnelProvider, NEProvider, NSObject))]
6282    #[derive(Debug, PartialEq, Eq, Hash)]
6283    pub struct NEEthernetTunnelProvider;
6284);
6285
6286unsafe impl NSObjectProtocol for NEEthernetTunnelProvider {}
6287
6288impl NEEthernetTunnelProvider {
6289    extern_methods!();
6290}
6291
6292/// Methods declared on superclass `NSObject`.
6293impl NEEthernetTunnelProvider {
6294    extern_methods!(
6295        #[unsafe(method(init))]
6296        #[unsafe(method_family = init)]
6297        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6298
6299        #[unsafe(method(new))]
6300        #[unsafe(method_family = new)]
6301        pub unsafe fn new() -> Retained<Self>;
6302    );
6303}
6304
6305/// On Demand rule actions
6306///
6307/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neondemandruleaction?language=objc)
6308// NS_ENUM
6309#[repr(transparent)]
6310#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
6311pub struct NEOnDemandRuleAction(pub NSInteger);
6312impl NEOnDemandRuleAction {
6313    #[doc(alias = "NEOnDemandRuleActionConnect")]
6314    pub const Connect: Self = Self(1);
6315    #[doc(alias = "NEOnDemandRuleActionDisconnect")]
6316    pub const Disconnect: Self = Self(2);
6317    #[doc(alias = "NEOnDemandRuleActionEvaluateConnection")]
6318    pub const EvaluateConnection: Self = Self(3);
6319    #[doc(alias = "NEOnDemandRuleActionIgnore")]
6320    pub const Ignore: Self = Self(4);
6321}
6322
6323unsafe impl Encode for NEOnDemandRuleAction {
6324    const ENCODING: Encoding = NSInteger::ENCODING;
6325}
6326
6327unsafe impl RefEncode for NEOnDemandRuleAction {
6328    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
6329}
6330
6331/// On Demand rule network interface types
6332///
6333/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neondemandruleinterfacetype?language=objc)
6334// NS_ENUM
6335#[repr(transparent)]
6336#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
6337pub struct NEOnDemandRuleInterfaceType(pub NSInteger);
6338impl NEOnDemandRuleInterfaceType {
6339    #[doc(alias = "NEOnDemandRuleInterfaceTypeAny")]
6340    pub const Any: Self = Self(0);
6341    #[doc(alias = "NEOnDemandRuleInterfaceTypeEthernet")]
6342    pub const Ethernet: Self = Self(1);
6343    #[doc(alias = "NEOnDemandRuleInterfaceTypeWiFi")]
6344    pub const WiFi: Self = Self(2);
6345    #[doc(alias = "NEOnDemandRuleInterfaceTypeCellular")]
6346    pub const Cellular: Self = Self(3);
6347}
6348
6349unsafe impl Encode for NEOnDemandRuleInterfaceType {
6350    const ENCODING: Encoding = NSInteger::ENCODING;
6351}
6352
6353unsafe impl RefEncode for NEOnDemandRuleInterfaceType {
6354    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
6355}
6356
6357extern_class!(
6358    /// The NEOnDemandRule class declares the programmatic interface for an object that defines an On Demand rule.
6359    ///
6360    /// NEOnDemandRule is an abstract base class from which other action-specific rule classes are derived.
6361    ///
6362    /// Instances of this class are thread safe.
6363    ///
6364    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neondemandrule?language=objc)
6365    #[unsafe(super(NSObject))]
6366    #[derive(Debug, PartialEq, Eq, Hash)]
6367    pub struct NEOnDemandRule;
6368);
6369
6370unsafe impl NSCoding for NEOnDemandRule {}
6371
6372unsafe impl NSCopying for NEOnDemandRule {}
6373
6374unsafe impl CopyingHelper for NEOnDemandRule {
6375    type Result = Self;
6376}
6377
6378unsafe impl NSObjectProtocol for NEOnDemandRule {}
6379
6380unsafe impl NSSecureCoding for NEOnDemandRule {}
6381
6382impl NEOnDemandRule {
6383    extern_methods!(
6384        /// The rule's action
6385        #[unsafe(method(action))]
6386        #[unsafe(method_family = none)]
6387        pub unsafe fn action(&self) -> NEOnDemandRuleAction;
6388
6389        /// 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.
6390        #[unsafe(method(DNSSearchDomainMatch))]
6391        #[unsafe(method_family = none)]
6392        pub unsafe fn DNSSearchDomainMatch(&self) -> Option<Retained<NSArray<NSString>>>;
6393
6394        /// Setter for [`DNSSearchDomainMatch`][Self::DNSSearchDomainMatch].
6395        #[unsafe(method(setDNSSearchDomainMatch:))]
6396        #[unsafe(method_family = none)]
6397        pub unsafe fn setDNSSearchDomainMatch(
6398            &self,
6399            dns_search_domain_match: Option<&NSArray<NSString>>,
6400        );
6401
6402        /// 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.
6403        #[unsafe(method(DNSServerAddressMatch))]
6404        #[unsafe(method_family = none)]
6405        pub unsafe fn DNSServerAddressMatch(&self) -> Option<Retained<NSArray<NSString>>>;
6406
6407        /// Setter for [`DNSServerAddressMatch`][Self::DNSServerAddressMatch].
6408        #[unsafe(method(setDNSServerAddressMatch:))]
6409        #[unsafe(method_family = none)]
6410        pub unsafe fn setDNSServerAddressMatch(
6411            &self,
6412            dns_server_address_match: Option<&NSArray<NSString>>,
6413        );
6414
6415        /// 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.
6416        #[unsafe(method(interfaceTypeMatch))]
6417        #[unsafe(method_family = none)]
6418        pub unsafe fn interfaceTypeMatch(&self) -> NEOnDemandRuleInterfaceType;
6419
6420        /// Setter for [`interfaceTypeMatch`][Self::interfaceTypeMatch].
6421        #[unsafe(method(setInterfaceTypeMatch:))]
6422        #[unsafe(method_family = none)]
6423        pub unsafe fn setInterfaceTypeMatch(
6424            &self,
6425            interface_type_match: NEOnDemandRuleInterfaceType,
6426        );
6427
6428        /// 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.
6429        #[unsafe(method(SSIDMatch))]
6430        #[unsafe(method_family = none)]
6431        pub unsafe fn SSIDMatch(&self) -> Option<Retained<NSArray<NSString>>>;
6432
6433        /// Setter for [`SSIDMatch`][Self::SSIDMatch].
6434        #[unsafe(method(setSSIDMatch:))]
6435        #[unsafe(method_family = none)]
6436        pub unsafe fn setSSIDMatch(&self, ssid_match: Option<&NSArray<NSString>>);
6437
6438        /// 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.
6439        #[unsafe(method(probeURL))]
6440        #[unsafe(method_family = none)]
6441        pub unsafe fn probeURL(&self) -> Option<Retained<NSURL>>;
6442
6443        /// Setter for [`probeURL`][Self::probeURL].
6444        #[unsafe(method(setProbeURL:))]
6445        #[unsafe(method_family = none)]
6446        pub unsafe fn setProbeURL(&self, probe_url: Option<&NSURL>);
6447    );
6448}
6449
6450/// Methods declared on superclass `NSObject`.
6451impl NEOnDemandRule {
6452    extern_methods!(
6453        #[unsafe(method(init))]
6454        #[unsafe(method_family = init)]
6455        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6456
6457        #[unsafe(method(new))]
6458        #[unsafe(method_family = new)]
6459        pub unsafe fn new() -> Retained<Self>;
6460    );
6461}
6462
6463extern_class!(
6464    /// The NEOnDemandRuleConnect class declares the programmatic interface for an object that defines an On Demand rule with the "Connect" action.
6465    ///
6466    /// When rules of this class match, the VPN connection is started whenever an application running on the system opens a network connection.
6467    ///
6468    /// Instances of this class are thread safe.
6469    ///
6470    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neondemandruleconnect?language=objc)
6471    #[unsafe(super(NEOnDemandRule, NSObject))]
6472    #[derive(Debug, PartialEq, Eq, Hash)]
6473    pub struct NEOnDemandRuleConnect;
6474);
6475
6476unsafe impl NSCoding for NEOnDemandRuleConnect {}
6477
6478unsafe impl NSCopying for NEOnDemandRuleConnect {}
6479
6480unsafe impl CopyingHelper for NEOnDemandRuleConnect {
6481    type Result = Self;
6482}
6483
6484unsafe impl NSObjectProtocol for NEOnDemandRuleConnect {}
6485
6486unsafe impl NSSecureCoding for NEOnDemandRuleConnect {}
6487
6488impl NEOnDemandRuleConnect {
6489    extern_methods!();
6490}
6491
6492/// Methods declared on superclass `NSObject`.
6493impl NEOnDemandRuleConnect {
6494    extern_methods!(
6495        #[unsafe(method(init))]
6496        #[unsafe(method_family = init)]
6497        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6498
6499        #[unsafe(method(new))]
6500        #[unsafe(method_family = new)]
6501        pub unsafe fn new() -> Retained<Self>;
6502    );
6503}
6504
6505extern_class!(
6506    /// The NEOnDemandRuleDisconnect class declares the programmatic interface for an object that defines an On Demand rule with the "Disconnect" action.
6507    ///
6508    /// When rules of this class match, the VPN connection is not started, and the VPN connection is disconnected if it is not currently disconnected.
6509    ///
6510    /// Instances of this class are thread safe.
6511    ///
6512    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neondemandruledisconnect?language=objc)
6513    #[unsafe(super(NEOnDemandRule, NSObject))]
6514    #[derive(Debug, PartialEq, Eq, Hash)]
6515    pub struct NEOnDemandRuleDisconnect;
6516);
6517
6518unsafe impl NSCoding for NEOnDemandRuleDisconnect {}
6519
6520unsafe impl NSCopying for NEOnDemandRuleDisconnect {}
6521
6522unsafe impl CopyingHelper for NEOnDemandRuleDisconnect {
6523    type Result = Self;
6524}
6525
6526unsafe impl NSObjectProtocol for NEOnDemandRuleDisconnect {}
6527
6528unsafe impl NSSecureCoding for NEOnDemandRuleDisconnect {}
6529
6530impl NEOnDemandRuleDisconnect {
6531    extern_methods!();
6532}
6533
6534/// Methods declared on superclass `NSObject`.
6535impl NEOnDemandRuleDisconnect {
6536    extern_methods!(
6537        #[unsafe(method(init))]
6538        #[unsafe(method_family = init)]
6539        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6540
6541        #[unsafe(method(new))]
6542        #[unsafe(method_family = new)]
6543        pub unsafe fn new() -> Retained<Self>;
6544    );
6545}
6546
6547extern_class!(
6548    /// The NEOnDemandRuleIgnore class declares the programmatic interface for an object that defines an On Demand rule with the "Ignore" action.
6549    ///
6550    /// When rules of this class match, the VPN connection is not started, and the current status of the VPN connection is left unchanged.
6551    ///
6552    /// Instances of this class are thread safe.
6553    ///
6554    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neondemandruleignore?language=objc)
6555    #[unsafe(super(NEOnDemandRule, NSObject))]
6556    #[derive(Debug, PartialEq, Eq, Hash)]
6557    pub struct NEOnDemandRuleIgnore;
6558);
6559
6560unsafe impl NSCoding for NEOnDemandRuleIgnore {}
6561
6562unsafe impl NSCopying for NEOnDemandRuleIgnore {}
6563
6564unsafe impl CopyingHelper for NEOnDemandRuleIgnore {
6565    type Result = Self;
6566}
6567
6568unsafe impl NSObjectProtocol for NEOnDemandRuleIgnore {}
6569
6570unsafe impl NSSecureCoding for NEOnDemandRuleIgnore {}
6571
6572impl NEOnDemandRuleIgnore {
6573    extern_methods!();
6574}
6575
6576/// Methods declared on superclass `NSObject`.
6577impl NEOnDemandRuleIgnore {
6578    extern_methods!(
6579        #[unsafe(method(init))]
6580        #[unsafe(method_family = init)]
6581        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6582
6583        #[unsafe(method(new))]
6584        #[unsafe(method_family = new)]
6585        pub unsafe fn new() -> Retained<Self>;
6586    );
6587}
6588
6589extern_class!(
6590    /// The NEOnDemandRuleEvaluateConnection class declares the programmatic interface for an object that defines an On Demand rule with the "Evaluate Connection" action.
6591    ///
6592    /// 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.
6593    ///
6594    /// Instances of this class are thread safe.
6595    ///
6596    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neondemandruleevaluateconnection?language=objc)
6597    #[unsafe(super(NEOnDemandRule, NSObject))]
6598    #[derive(Debug, PartialEq, Eq, Hash)]
6599    pub struct NEOnDemandRuleEvaluateConnection;
6600);
6601
6602unsafe impl NSCoding for NEOnDemandRuleEvaluateConnection {}
6603
6604unsafe impl NSCopying for NEOnDemandRuleEvaluateConnection {}
6605
6606unsafe impl CopyingHelper for NEOnDemandRuleEvaluateConnection {
6607    type Result = Self;
6608}
6609
6610unsafe impl NSObjectProtocol for NEOnDemandRuleEvaluateConnection {}
6611
6612unsafe impl NSSecureCoding for NEOnDemandRuleEvaluateConnection {}
6613
6614impl NEOnDemandRuleEvaluateConnection {
6615    extern_methods!(
6616        /// An array of NEEvaluateConnectionRule objects. Each NEEvaluateConnectionRule object is evaluated in order against the properties of the network connection being established.
6617        #[unsafe(method(connectionRules))]
6618        #[unsafe(method_family = none)]
6619        pub unsafe fn connectionRules(&self)
6620            -> Option<Retained<NSArray<NEEvaluateConnectionRule>>>;
6621
6622        /// Setter for [`connectionRules`][Self::connectionRules].
6623        #[unsafe(method(setConnectionRules:))]
6624        #[unsafe(method_family = none)]
6625        pub unsafe fn setConnectionRules(
6626            &self,
6627            connection_rules: Option<&NSArray<NEEvaluateConnectionRule>>,
6628        );
6629    );
6630}
6631
6632/// Methods declared on superclass `NSObject`.
6633impl NEOnDemandRuleEvaluateConnection {
6634    extern_methods!(
6635        #[unsafe(method(init))]
6636        #[unsafe(method_family = init)]
6637        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6638
6639        #[unsafe(method(new))]
6640        #[unsafe(method_family = new)]
6641        pub unsafe fn new() -> Retained<Self>;
6642    );
6643}
6644
6645/// Evaluate Connection rule actions
6646///
6647/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neevaluateconnectionruleaction?language=objc)
6648// NS_ENUM
6649#[repr(transparent)]
6650#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
6651pub struct NEEvaluateConnectionRuleAction(pub NSInteger);
6652impl NEEvaluateConnectionRuleAction {
6653    #[doc(alias = "NEEvaluateConnectionRuleActionConnectIfNeeded")]
6654    pub const ConnectIfNeeded: Self = Self(1);
6655    #[doc(alias = "NEEvaluateConnectionRuleActionNeverConnect")]
6656    pub const NeverConnect: Self = Self(2);
6657}
6658
6659unsafe impl Encode for NEEvaluateConnectionRuleAction {
6660    const ENCODING: Encoding = NSInteger::ENCODING;
6661}
6662
6663unsafe impl RefEncode for NEEvaluateConnectionRuleAction {
6664    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
6665}
6666
6667extern_class!(
6668    /// The NEEvaluateConnectionRule class declares the programmatic interface for an object that associates properties of network connections with an action.
6669    ///
6670    /// Instances of this class are thread safe.
6671    ///
6672    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neevaluateconnectionrule?language=objc)
6673    #[unsafe(super(NSObject))]
6674    #[derive(Debug, PartialEq, Eq, Hash)]
6675    pub struct NEEvaluateConnectionRule;
6676);
6677
6678unsafe impl NSCoding for NEEvaluateConnectionRule {}
6679
6680unsafe impl NSCopying for NEEvaluateConnectionRule {}
6681
6682unsafe impl CopyingHelper for NEEvaluateConnectionRule {
6683    type Result = Self;
6684}
6685
6686unsafe impl NSObjectProtocol for NEEvaluateConnectionRule {}
6687
6688unsafe impl NSSecureCoding for NEEvaluateConnectionRule {}
6689
6690impl NEEvaluateConnectionRule {
6691    extern_methods!(
6692        /// Initialize an NEEvaluateConnectionRule instance with a list of destination host domains and an action
6693        #[unsafe(method(initWithMatchDomains:andAction:))]
6694        #[unsafe(method_family = init)]
6695        pub unsafe fn initWithMatchDomains_andAction(
6696            this: Allocated<Self>,
6697            domains: &NSArray<NSString>,
6698            action: NEEvaluateConnectionRuleAction,
6699        ) -> Retained<Self>;
6700
6701        /// The action to take if the properties of the network connection being established match the rule.
6702        #[unsafe(method(action))]
6703        #[unsafe(method_family = none)]
6704        pub unsafe fn action(&self) -> NEEvaluateConnectionRuleAction;
6705
6706        /// 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.
6707        #[unsafe(method(matchDomains))]
6708        #[unsafe(method_family = none)]
6709        pub unsafe fn matchDomains(&self) -> Retained<NSArray<NSString>>;
6710
6711        /// 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.
6712        #[unsafe(method(useDNSServers))]
6713        #[unsafe(method_family = none)]
6714        pub unsafe fn useDNSServers(&self) -> Option<Retained<NSArray<NSString>>>;
6715
6716        /// Setter for [`useDNSServers`][Self::useDNSServers].
6717        #[unsafe(method(setUseDNSServers:))]
6718        #[unsafe(method_family = none)]
6719        pub unsafe fn setUseDNSServers(&self, use_dns_servers: Option<&NSArray<NSString>>);
6720
6721        /// 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.
6722        #[unsafe(method(probeURL))]
6723        #[unsafe(method_family = none)]
6724        pub unsafe fn probeURL(&self) -> Option<Retained<NSURL>>;
6725
6726        /// Setter for [`probeURL`][Self::probeURL].
6727        #[unsafe(method(setProbeURL:))]
6728        #[unsafe(method_family = none)]
6729        pub unsafe fn setProbeURL(&self, probe_url: Option<&NSURL>);
6730    );
6731}
6732
6733/// Methods declared on superclass `NSObject`.
6734impl NEEvaluateConnectionRule {
6735    extern_methods!(
6736        #[unsafe(method(init))]
6737        #[unsafe(method_family = init)]
6738        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6739
6740        #[unsafe(method(new))]
6741        #[unsafe(method_family = new)]
6742        pub unsafe fn new() -> Retained<Self>;
6743    );
6744}
6745
6746extern_class!(
6747    /// An NEPacket object represents the data, protocol family, and metadata associated with an IP packet.
6748    /// These packets are used to read and write on an NEPacketTunnelFlow.
6749    ///
6750    /// NEPacket is part of NetworkExtension.framework
6751    ///
6752    /// Instances of this class are thread safe.
6753    ///
6754    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nepacket?language=objc)
6755    #[unsafe(super(NSObject))]
6756    #[derive(Debug, PartialEq, Eq, Hash)]
6757    pub struct NEPacket;
6758);
6759
6760unsafe impl NSCoding for NEPacket {}
6761
6762unsafe impl NSCopying for NEPacket {}
6763
6764unsafe impl CopyingHelper for NEPacket {
6765    type Result = Self;
6766}
6767
6768unsafe impl NSObjectProtocol for NEPacket {}
6769
6770unsafe impl NSSecureCoding for NEPacket {}
6771
6772impl NEPacket {
6773    extern_methods!(
6774        #[cfg(feature = "libc")]
6775        /// Initializes a new NEPacket object with data and protocol family.
6776        ///
6777        /// Parameter `data`: The content of the packet.
6778        ///
6779        /// Parameter `protocolFamily`: The protocol family of the packet (such as AF_INET or AF_INET6).
6780        #[unsafe(method(initWithData:protocolFamily:))]
6781        #[unsafe(method_family = init)]
6782        pub unsafe fn initWithData_protocolFamily(
6783            this: Allocated<Self>,
6784            data: &NSData,
6785            protocol_family: libc::sa_family_t,
6786        ) -> Retained<Self>;
6787
6788        /// The data content of the packet.
6789        #[unsafe(method(data))]
6790        #[unsafe(method_family = none)]
6791        pub unsafe fn data(&self) -> Retained<NSData>;
6792
6793        #[cfg(feature = "libc")]
6794        /// The protocol family of the packet (such as AF_INET or AF_INET6).
6795        #[unsafe(method(protocolFamily))]
6796        #[unsafe(method_family = none)]
6797        pub unsafe fn protocolFamily(&self) -> libc::sa_family_t;
6798
6799        /// The direction of the packet.
6800        #[unsafe(method(direction))]
6801        #[unsafe(method_family = none)]
6802        pub unsafe fn direction(&self) -> NETrafficDirection;
6803
6804        /// Metadata about the source application and flow for this packet.
6805        /// This property will only be non-nil when the routing method for the NEPacketTunnelProvider
6806        /// is NETunnelProviderRoutingMethodSourceApplication.
6807        #[unsafe(method(metadata))]
6808        #[unsafe(method_family = none)]
6809        pub unsafe fn metadata(&self) -> Option<Retained<NEFlowMetaData>>;
6810    );
6811}
6812
6813/// Methods declared on superclass `NSObject`.
6814impl NEPacket {
6815    extern_methods!(
6816        #[unsafe(method(init))]
6817        #[unsafe(method_family = init)]
6818        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6819
6820        #[unsafe(method(new))]
6821        #[unsafe(method_family = new)]
6822        pub unsafe fn new() -> Retained<Self>;
6823    );
6824}
6825
6826extern_class!(
6827    /// The NEPacketTunnelFlow class declares the programmatic interface of an object that is used by NEPacketTunnelProvider implementations to tunnel IP packets.
6828    ///
6829    /// NEPacketTunnelFlow is part of NetworkExtension.framework
6830    ///
6831    /// Instances of this class are thread safe.
6832    ///
6833    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nepackettunnelflow?language=objc)
6834    #[unsafe(super(NSObject))]
6835    #[derive(Debug, PartialEq, Eq, Hash)]
6836    pub struct NEPacketTunnelFlow;
6837);
6838
6839unsafe impl NSObjectProtocol for NEPacketTunnelFlow {}
6840
6841impl NEPacketTunnelFlow {
6842    extern_methods!(
6843        #[cfg(feature = "block2")]
6844        /// Read available IP packets from the flow.
6845        ///
6846        /// 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.
6847        #[unsafe(method(readPacketsWithCompletionHandler:))]
6848        #[unsafe(method_family = none)]
6849        pub unsafe fn readPacketsWithCompletionHandler(
6850            &self,
6851            completion_handler: &block2::Block<
6852                dyn Fn(NonNull<NSArray<NSData>>, NonNull<NSArray<NSNumber>>),
6853            >,
6854        );
6855
6856        /// Write multiple IP packets to the flow.
6857        ///
6858        /// Parameter `packets`: An array of NSData objects, each containing packet data to be written.
6859        ///
6860        /// Parameter `protocols`: An array of NSNumber objects. Each number contains the protocol of the packet in the corresponding index in the packets array.
6861        #[unsafe(method(writePackets:withProtocols:))]
6862        #[unsafe(method_family = none)]
6863        pub unsafe fn writePackets_withProtocols(
6864            &self,
6865            packets: &NSArray<NSData>,
6866            protocols: &NSArray<NSNumber>,
6867        ) -> bool;
6868
6869        #[cfg(feature = "block2")]
6870        /// Read available IP packets from the flow.
6871        ///
6872        /// 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.
6873        #[unsafe(method(readPacketObjectsWithCompletionHandler:))]
6874        #[unsafe(method_family = none)]
6875        pub unsafe fn readPacketObjectsWithCompletionHandler(
6876            &self,
6877            completion_handler: &block2::Block<dyn Fn(NonNull<NSArray<NEPacket>>)>,
6878        );
6879
6880        /// Write multiple IP packets to the flow.
6881        ///
6882        /// Parameter `packets`: An array of NEPacket objects, each containing packet data and protocol family to be written.
6883        #[unsafe(method(writePacketObjects:))]
6884        #[unsafe(method_family = none)]
6885        pub unsafe fn writePacketObjects(&self, packets: &NSArray<NEPacket>) -> bool;
6886    );
6887}
6888
6889/// Methods declared on superclass `NSObject`.
6890impl NEPacketTunnelFlow {
6891    extern_methods!(
6892        #[unsafe(method(init))]
6893        #[unsafe(method_family = init)]
6894        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6895
6896        #[unsafe(method(new))]
6897        #[unsafe(method_family = new)]
6898        pub unsafe fn new() -> Retained<Self>;
6899    );
6900}
6901
6902extern_class!(
6903    /// The NERelay class declares the programmatic interface of an object that
6904    /// manages the details of a relay's configuration, such as authentication and URL details.
6905    ///
6906    /// Instances of this class are thread safe.
6907    ///
6908    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nerelay?language=objc)
6909    #[unsafe(super(NSObject))]
6910    #[derive(Debug, PartialEq, Eq, Hash)]
6911    pub struct NERelay;
6912);
6913
6914unsafe impl NSCoding for NERelay {}
6915
6916unsafe impl NSCopying for NERelay {}
6917
6918unsafe impl CopyingHelper for NERelay {
6919    type Result = Self;
6920}
6921
6922unsafe impl NSObjectProtocol for NERelay {}
6923
6924unsafe impl NSSecureCoding for NERelay {}
6925
6926impl NERelay {
6927    extern_methods!(
6928        /// The URL of the relay accessible over HTTP/3.
6929        #[unsafe(method(HTTP3RelayURL))]
6930        #[unsafe(method_family = none)]
6931        pub unsafe fn HTTP3RelayURL(&self) -> Option<Retained<NSURL>>;
6932
6933        /// Setter for [`HTTP3RelayURL`][Self::HTTP3RelayURL].
6934        #[unsafe(method(setHTTP3RelayURL:))]
6935        #[unsafe(method_family = none)]
6936        pub unsafe fn setHTTP3RelayURL(&self, http3_relay_url: Option<&NSURL>);
6937
6938        /// The URL of the relay accessible over HTTP/2.
6939        #[unsafe(method(HTTP2RelayURL))]
6940        #[unsafe(method_family = none)]
6941        pub unsafe fn HTTP2RelayURL(&self) -> Option<Retained<NSURL>>;
6942
6943        /// Setter for [`HTTP2RelayURL`][Self::HTTP2RelayURL].
6944        #[unsafe(method(setHTTP2RelayURL:))]
6945        #[unsafe(method_family = none)]
6946        pub unsafe fn setHTTP2RelayURL(&self, http2_relay_url: Option<&NSURL>);
6947
6948        /// The URL of a DNS-over-HTTPS (DoH) resolver accessible via the relay.
6949        #[unsafe(method(dnsOverHTTPSURL))]
6950        #[unsafe(method_family = none)]
6951        pub unsafe fn dnsOverHTTPSURL(&self) -> Option<Retained<NSURL>>;
6952
6953        /// Setter for [`dnsOverHTTPSURL`][Self::dnsOverHTTPSURL].
6954        #[unsafe(method(setDnsOverHTTPSURL:))]
6955        #[unsafe(method_family = none)]
6956        pub unsafe fn setDnsOverHTTPSURL(&self, dns_over_httpsurl: Option<&NSURL>);
6957
6958        /// An IPv4 address prefix (such as "192.0.2.0/24") that will be used to synthesize
6959        /// DNS answers for apps that use `getaddrinfo()` to resolve domains included in `matchDomains`
6960        #[unsafe(method(syntheticDNSAnswerIPv4Prefix))]
6961        #[unsafe(method_family = none)]
6962        pub unsafe fn syntheticDNSAnswerIPv4Prefix(&self) -> Option<Retained<NSString>>;
6963
6964        /// Setter for [`syntheticDNSAnswerIPv4Prefix`][Self::syntheticDNSAnswerIPv4Prefix].
6965        #[unsafe(method(setSyntheticDNSAnswerIPv4Prefix:))]
6966        #[unsafe(method_family = none)]
6967        pub unsafe fn setSyntheticDNSAnswerIPv4Prefix(
6968            &self,
6969            synthetic_dns_answer_i_pv4_prefix: Option<&NSString>,
6970        );
6971
6972        /// An IPv6 address prefix (such as "2001:DB8::/32") that will be used to synthesize
6973        /// DNS answers for apps that use `getaddrinfo()` to resolve domains included in `matchDomains`
6974        #[unsafe(method(syntheticDNSAnswerIPv6Prefix))]
6975        #[unsafe(method_family = none)]
6976        pub unsafe fn syntheticDNSAnswerIPv6Prefix(&self) -> Option<Retained<NSString>>;
6977
6978        /// Setter for [`syntheticDNSAnswerIPv6Prefix`][Self::syntheticDNSAnswerIPv6Prefix].
6979        #[unsafe(method(setSyntheticDNSAnswerIPv6Prefix:))]
6980        #[unsafe(method_family = none)]
6981        pub unsafe fn setSyntheticDNSAnswerIPv6Prefix(
6982            &self,
6983            synthetic_dns_answer_i_pv6_prefix: Option<&NSString>,
6984        );
6985
6986        /// Additional HTTP header field names and values to be added to all relay requests.
6987        #[unsafe(method(additionalHTTPHeaderFields))]
6988        #[unsafe(method_family = none)]
6989        pub unsafe fn additionalHTTPHeaderFields(
6990            &self,
6991        ) -> Retained<NSDictionary<NSString, NSString>>;
6992
6993        /// Setter for [`additionalHTTPHeaderFields`][Self::additionalHTTPHeaderFields].
6994        #[unsafe(method(setAdditionalHTTPHeaderFields:))]
6995        #[unsafe(method_family = none)]
6996        pub unsafe fn setAdditionalHTTPHeaderFields(
6997            &self,
6998            additional_http_header_fields: &NSDictionary<NSString, NSString>,
6999        );
7000
7001        /// TLS 1.3 raw public keys to use to authenticate the relay servers.
7002        #[unsafe(method(rawPublicKeys))]
7003        #[unsafe(method_family = none)]
7004        pub unsafe fn rawPublicKeys(&self) -> Option<Retained<NSArray<NSData>>>;
7005
7006        /// Setter for [`rawPublicKeys`][Self::rawPublicKeys].
7007        #[unsafe(method(setRawPublicKeys:))]
7008        #[unsafe(method_family = none)]
7009        pub unsafe fn setRawPublicKeys(&self, raw_public_keys: Option<&NSArray<NSData>>);
7010
7011        /// The PKCS12 data for the relay client authentication. The value is a NSData in PKCS12 format.
7012        #[unsafe(method(identityData))]
7013        #[unsafe(method_family = none)]
7014        pub unsafe fn identityData(&self) -> Option<Retained<NSData>>;
7015
7016        /// Setter for [`identityData`][Self::identityData].
7017        #[unsafe(method(setIdentityData:))]
7018        #[unsafe(method_family = none)]
7019        pub unsafe fn setIdentityData(&self, identity_data: Option<&NSData>);
7020
7021        /// The password to be used to decrypt the PKCS12 identity data.
7022        #[unsafe(method(identityDataPassword))]
7023        #[unsafe(method_family = none)]
7024        pub unsafe fn identityDataPassword(&self) -> Option<Retained<NSString>>;
7025
7026        /// Setter for [`identityDataPassword`][Self::identityDataPassword].
7027        #[unsafe(method(setIdentityDataPassword:))]
7028        #[unsafe(method_family = none)]
7029        pub unsafe fn setIdentityDataPassword(&self, identity_data_password: Option<&NSString>);
7030    );
7031}
7032
7033/// Methods declared on superclass `NSObject`.
7034impl NERelay {
7035    extern_methods!(
7036        #[unsafe(method(init))]
7037        #[unsafe(method_family = init)]
7038        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7039
7040        #[unsafe(method(new))]
7041        #[unsafe(method_family = new)]
7042        pub unsafe fn new() -> Retained<Self>;
7043    );
7044}
7045
7046/// NERelay Manager error codes
7047///
7048/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nerelaymanagererror?language=objc)
7049// NS_ENUM
7050#[repr(transparent)]
7051#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
7052pub struct NERelayManagerError(pub NSInteger);
7053impl NERelayManagerError {
7054    #[doc(alias = "NERelayManagerErrorConfigurationInvalid")]
7055    pub const ConfigurationInvalid: Self = Self(1);
7056    #[doc(alias = "NERelayManagerErrorConfigurationDisabled")]
7057    pub const ConfigurationDisabled: Self = Self(2);
7058    #[doc(alias = "NERelayManagerErrorConfigurationStale")]
7059    pub const ConfigurationStale: Self = Self(3);
7060    #[doc(alias = "NERelayManagerErrorConfigurationCannotBeRemoved")]
7061    pub const ConfigurationCannotBeRemoved: Self = Self(4);
7062}
7063
7064unsafe impl Encode for NERelayManagerError {
7065    const ENCODING: Encoding = NSInteger::ENCODING;
7066}
7067
7068unsafe impl RefEncode for NERelayManagerError {
7069    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
7070}
7071
7072extern "C" {
7073    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nerelayerrordomain?language=objc)
7074    pub static NERelayErrorDomain: &'static NSString;
7075}
7076
7077/// NERelay Manager error codes detected by the client while trying to use this relay
7078///
7079/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nerelaymanagerclienterror?language=objc)
7080// NS_ENUM
7081#[repr(transparent)]
7082#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
7083pub struct NERelayManagerClientError(pub NSInteger);
7084impl NERelayManagerClientError {
7085    #[doc(alias = "NERelayManagerClientErrorNone")]
7086    pub const None: Self = Self(1);
7087    #[doc(alias = "NERelayManagerClientErrorDNSFailed")]
7088    pub const DNSFailed: Self = Self(2);
7089    #[doc(alias = "NERelayManagerClientErrorServerUnreachable")]
7090    pub const ServerUnreachable: Self = Self(3);
7091    #[doc(alias = "NERelayManagerClientErrorServerDisconnected")]
7092    pub const ServerDisconnected: Self = Self(4);
7093    #[doc(alias = "NERelayManagerClientErrorCertificateMissing")]
7094    pub const CertificateMissing: Self = Self(5);
7095    #[doc(alias = "NERelayManagerClientErrorCertificateInvalid")]
7096    pub const CertificateInvalid: Self = Self(6);
7097    #[doc(alias = "NERelayManagerClientErrorCertificateExpired")]
7098    pub const CertificateExpired: Self = Self(7);
7099    #[doc(alias = "NERelayManagerClientErrorServerCertificateInvalid")]
7100    pub const ServerCertificateInvalid: Self = Self(8);
7101    #[doc(alias = "NERelayManagerClientErrorServerCertificateExpired")]
7102    pub const ServerCertificateExpired: Self = Self(9);
7103    #[doc(alias = "NERelayManagerClientErrorOther")]
7104    pub const Other: Self = Self(10);
7105}
7106
7107unsafe impl Encode for NERelayManagerClientError {
7108    const ENCODING: Encoding = NSInteger::ENCODING;
7109}
7110
7111unsafe impl RefEncode for NERelayManagerClientError {
7112    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
7113}
7114
7115extern "C" {
7116    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nerelayclienterrordomain?language=objc)
7117    pub static NERelayClientErrorDomain: &'static NSString;
7118}
7119
7120extern "C" {
7121    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nerelayconfigurationdidchangenotification?language=objc)
7122    pub static NERelayConfigurationDidChangeNotification: &'static NSString;
7123}
7124
7125extern_class!(
7126    /// The NERelayManager class declares the programmatic interface for an object that manages relay configurations.
7127    ///
7128    /// NERelayManager declares methods and properties for configuring and controlling relay settings on the system.
7129    ///
7130    /// Instances of this class are thread safe.
7131    ///
7132    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nerelaymanager?language=objc)
7133    #[unsafe(super(NSObject))]
7134    #[derive(Debug, PartialEq, Eq, Hash)]
7135    pub struct NERelayManager;
7136);
7137
7138unsafe impl NSObjectProtocol for NERelayManager {}
7139
7140impl NERelayManager {
7141    extern_methods!(
7142        /// Returns: The singleton NERelayManager object for the calling process.
7143        #[unsafe(method(sharedManager))]
7144        #[unsafe(method_family = none)]
7145        pub unsafe fn sharedManager() -> Retained<NERelayManager>;
7146
7147        #[cfg(feature = "block2")]
7148        /// This function loads the current relay configuration from the caller's relay preferences.
7149        ///
7150        /// 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.
7151        #[unsafe(method(loadFromPreferencesWithCompletionHandler:))]
7152        #[unsafe(method_family = none)]
7153        pub unsafe fn loadFromPreferencesWithCompletionHandler(
7154            &self,
7155            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
7156        );
7157
7158        #[cfg(feature = "block2")]
7159        /// This function removes the relay configuration from the caller's relay preferences. If the relay is enabled, the relay becomes disabled.
7160        ///
7161        /// 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.
7162        #[unsafe(method(removeFromPreferencesWithCompletionHandler:))]
7163        #[unsafe(method_family = none)]
7164        pub unsafe fn removeFromPreferencesWithCompletionHandler(
7165            &self,
7166            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
7167        );
7168
7169        #[cfg(feature = "block2")]
7170        /// This function saves the relay configuration in the caller's relay preferences. If the relay are enabled, they will become active.
7171        ///
7172        /// 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.
7173        #[unsafe(method(saveToPreferencesWithCompletionHandler:))]
7174        #[unsafe(method_family = none)]
7175        pub unsafe fn saveToPreferencesWithCompletionHandler(
7176            &self,
7177            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
7178        );
7179
7180        #[cfg(feature = "block2")]
7181        /// 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.
7182        ///
7183        /// 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.
7184        ///
7185        /// 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.
7186        #[unsafe(method(getLastClientErrors:completionHandler:))]
7187        #[unsafe(method_family = none)]
7188        pub unsafe fn getLastClientErrors_completionHandler(
7189            &self,
7190            seconds: NSTimeInterval,
7191            completion_handler: &block2::Block<dyn Fn(*mut NSArray<NSError>)>,
7192        );
7193
7194        /// A string containing a description of the relay.
7195        #[unsafe(method(localizedDescription))]
7196        #[unsafe(method_family = none)]
7197        pub unsafe fn localizedDescription(&self) -> Option<Retained<NSString>>;
7198
7199        /// Setter for [`localizedDescription`][Self::localizedDescription].
7200        #[unsafe(method(setLocalizedDescription:))]
7201        #[unsafe(method_family = none)]
7202        pub unsafe fn setLocalizedDescription(&self, localized_description: Option<&NSString>);
7203
7204        /// Toggles the enabled status of the relay.
7205        #[unsafe(method(isEnabled))]
7206        #[unsafe(method_family = none)]
7207        pub unsafe fn isEnabled(&self) -> bool;
7208
7209        /// Setter for [`isEnabled`][Self::isEnabled].
7210        #[unsafe(method(setEnabled:))]
7211        #[unsafe(method_family = none)]
7212        pub unsafe fn setEnabled(&self, enabled: bool);
7213
7214        /// An array of relay configurations describing one or more relay hops.
7215        #[unsafe(method(relays))]
7216        #[unsafe(method_family = none)]
7217        pub unsafe fn relays(&self) -> Option<Retained<NSArray<NERelay>>>;
7218
7219        /// Setter for [`relays`][Self::relays].
7220        #[unsafe(method(setRelays:))]
7221        #[unsafe(method_family = none)]
7222        pub unsafe fn setRelays(&self, relays: Option<&NSArray<NERelay>>);
7223
7224        /// An array of strings containing domain names. If this property is non-nil, the relay will only be used to access hosts within the specified domains. If the property is nil, the relay will be used for all domains.
7225        #[unsafe(method(matchDomains))]
7226        #[unsafe(method_family = none)]
7227        pub unsafe fn matchDomains(&self) -> Option<Retained<NSArray<NSString>>>;
7228
7229        /// Setter for [`matchDomains`][Self::matchDomains].
7230        #[unsafe(method(setMatchDomains:))]
7231        #[unsafe(method_family = none)]
7232        pub unsafe fn setMatchDomains(&self, match_domains: Option<&NSArray<NSString>>);
7233
7234        /// 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.
7235        #[unsafe(method(excludedDomains))]
7236        #[unsafe(method_family = none)]
7237        pub unsafe fn excludedDomains(&self) -> Option<Retained<NSArray<NSString>>>;
7238
7239        /// Setter for [`excludedDomains`][Self::excludedDomains].
7240        #[unsafe(method(setExcludedDomains:))]
7241        #[unsafe(method_family = none)]
7242        pub unsafe fn setExcludedDomains(&self, excluded_domains: Option<&NSArray<NSString>>);
7243
7244        /// 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.
7245        #[unsafe(method(onDemandRules))]
7246        #[unsafe(method_family = none)]
7247        pub unsafe fn onDemandRules(&self) -> Option<Retained<NSArray<NEOnDemandRule>>>;
7248
7249        /// Setter for [`onDemandRules`][Self::onDemandRules].
7250        #[unsafe(method(setOnDemandRules:))]
7251        #[unsafe(method_family = none)]
7252        pub unsafe fn setOnDemandRules(&self, on_demand_rules: Option<&NSArray<NEOnDemandRule>>);
7253
7254        #[cfg(feature = "block2")]
7255        /// 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.
7256        ///
7257        /// 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.
7258        #[unsafe(method(loadAllManagersFromPreferencesWithCompletionHandler:))]
7259        #[unsafe(method_family = none)]
7260        pub unsafe fn loadAllManagersFromPreferencesWithCompletionHandler(
7261            completion_handler: &block2::Block<
7262                dyn Fn(NonNull<NSArray<NERelayManager>>, *mut NSError),
7263            >,
7264        );
7265    );
7266}
7267
7268/// Methods declared on superclass `NSObject`.
7269impl NERelayManager {
7270    extern_methods!(
7271        #[unsafe(method(init))]
7272        #[unsafe(method_family = init)]
7273        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7274
7275        #[unsafe(method(new))]
7276        #[unsafe(method_family = new)]
7277        pub unsafe fn new() -> Retained<Self>;
7278    );
7279}
7280
7281extern_class!(
7282    /// The NETransparentProxyManager class declares the programmatic interface for an object that is used to configure and control transparent proxies provided by NEAppProxyProviders.
7283    ///
7284    /// Instances of this class are thread safe.
7285    ///
7286    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netransparentproxymanager?language=objc)
7287    #[unsafe(super(NEVPNManager, NSObject))]
7288    #[derive(Debug, PartialEq, Eq, Hash)]
7289    pub struct NETransparentProxyManager;
7290);
7291
7292unsafe impl NSObjectProtocol for NETransparentProxyManager {}
7293
7294impl NETransparentProxyManager {
7295    extern_methods!(
7296        #[cfg(feature = "block2")]
7297        /// 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.
7298        ///
7299        /// 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.
7300        #[unsafe(method(loadAllFromPreferencesWithCompletionHandler:))]
7301        #[unsafe(method_family = none)]
7302        pub unsafe fn loadAllFromPreferencesWithCompletionHandler(
7303            completion_handler: &block2::Block<
7304                dyn Fn(*mut NSArray<NETransparentProxyManager>, *mut NSError),
7305            >,
7306        );
7307    );
7308}
7309
7310/// Methods declared on superclass `NSObject`.
7311impl NETransparentProxyManager {
7312    extern_methods!(
7313        #[unsafe(method(init))]
7314        #[unsafe(method_family = init)]
7315        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7316
7317        #[unsafe(method(new))]
7318        #[unsafe(method_family = new)]
7319        pub unsafe fn new() -> Retained<Self>;
7320    );
7321}
7322
7323extern_class!(
7324    /// The NETransparentProxyNetworkSettings class declares the programmatic interface for an object that contains network settings.
7325    ///
7326    /// 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.
7327    ///
7328    /// Instances of this class are thread safe.
7329    ///
7330    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netransparentproxynetworksettings?language=objc)
7331    #[unsafe(super(NETunnelNetworkSettings, NSObject))]
7332    #[derive(Debug, PartialEq, Eq, Hash)]
7333    pub struct NETransparentProxyNetworkSettings;
7334);
7335
7336unsafe impl NSCoding for NETransparentProxyNetworkSettings {}
7337
7338unsafe impl NSCopying for NETransparentProxyNetworkSettings {}
7339
7340unsafe impl CopyingHelper for NETransparentProxyNetworkSettings {
7341    type Result = Self;
7342}
7343
7344unsafe impl NSObjectProtocol for NETransparentProxyNetworkSettings {}
7345
7346unsafe impl NSSecureCoding for NETransparentProxyNetworkSettings {}
7347
7348impl NETransparentProxyNetworkSettings {
7349    extern_methods!(
7350        /// An array of NENetworkRule objects that collectively specify the traffic that will be routed through the transparent proxy. The following restrictions
7351        /// apply to each NENetworkRule in this list:
7352        /// Restrictions for rules with an address endpoint:
7353        /// 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 "::").
7354        /// 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".
7355        /// A port string of "53" is not allowed. Destination Domain-based rules must be used to match DNS traffic.
7356        /// The matchLocalNetwork property must be nil.
7357        /// The matchDirection property must be NETrafficDirectionOutbound.
7358        #[unsafe(method(includedNetworkRules))]
7359        #[unsafe(method_family = none)]
7360        pub unsafe fn includedNetworkRules(&self) -> Option<Retained<NSArray<NENetworkRule>>>;
7361
7362        /// Setter for [`includedNetworkRules`][Self::includedNetworkRules].
7363        #[unsafe(method(setIncludedNetworkRules:))]
7364        #[unsafe(method_family = none)]
7365        pub unsafe fn setIncludedNetworkRules(
7366            &self,
7367            included_network_rules: Option<&NSArray<NENetworkRule>>,
7368        );
7369
7370        /// An array of NENetworkRule objects that collectively specify the traffic that will not be routed through the transparent proxy. The following restrictions
7371        /// apply to each NENetworkRule in this list:
7372        /// Restrictions for rules with an address endpoint:
7373        /// 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 "::").
7374        /// 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".
7375        /// A port string of "53" is not allowed. Destination Domain-based rules must be used to match DNS traffic.
7376        /// The matchLocalNetwork property must be nil.
7377        /// The matchDirection property must be NETrafficDirectionOutbound.
7378        #[unsafe(method(excludedNetworkRules))]
7379        #[unsafe(method_family = none)]
7380        pub unsafe fn excludedNetworkRules(&self) -> Option<Retained<NSArray<NENetworkRule>>>;
7381
7382        /// Setter for [`excludedNetworkRules`][Self::excludedNetworkRules].
7383        #[unsafe(method(setExcludedNetworkRules:))]
7384        #[unsafe(method_family = none)]
7385        pub unsafe fn setExcludedNetworkRules(
7386            &self,
7387            excluded_network_rules: Option<&NSArray<NENetworkRule>>,
7388        );
7389    );
7390}
7391
7392/// Methods declared on superclass `NETunnelNetworkSettings`.
7393impl NETransparentProxyNetworkSettings {
7394    extern_methods!(
7395        /// This function initializes a newly-allocated NETunnelNetworkSettings object with a given tunnel remote address.
7396        ///
7397        /// Parameter `address`: The address of the remote endpoint that is providing the tunnel service.
7398        #[unsafe(method(initWithTunnelRemoteAddress:))]
7399        #[unsafe(method_family = init)]
7400        pub unsafe fn initWithTunnelRemoteAddress(
7401            this: Allocated<Self>,
7402            address: &NSString,
7403        ) -> Retained<Self>;
7404    );
7405}
7406
7407/// Methods declared on superclass `NSObject`.
7408impl NETransparentProxyNetworkSettings {
7409    extern_methods!(
7410        #[unsafe(method(init))]
7411        #[unsafe(method_family = init)]
7412        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7413
7414        #[unsafe(method(new))]
7415        #[unsafe(method_family = new)]
7416        pub unsafe fn new() -> Retained<Self>;
7417    );
7418}
7419
7420extern_class!(
7421    /// The NETransparentProxyProvider class declares the programmatic interface for an object that implements the client side of a custom transparent network proxy solution.
7422    /// The NETransparentProxyProvider class has the following behavior differences from its super class NEAppProxyProvider:
7423    /// - 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.
7424    /// - 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.
7425    /// - 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.
7426    ///
7427    /// NETransparentProxyProvider is part of NetworkExtension.framework
7428    ///
7429    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netransparentproxyprovider?language=objc)
7430    #[unsafe(super(NEAppProxyProvider, NETunnelProvider, NEProvider, NSObject))]
7431    #[derive(Debug, PartialEq, Eq, Hash)]
7432    pub struct NETransparentProxyProvider;
7433);
7434
7435unsafe impl NSObjectProtocol for NETransparentProxyProvider {}
7436
7437impl NETransparentProxyProvider {
7438    extern_methods!();
7439}
7440
7441/// Methods declared on superclass `NSObject`.
7442impl NETransparentProxyProvider {
7443    extern_methods!(
7444        #[unsafe(method(init))]
7445        #[unsafe(method_family = init)]
7446        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7447
7448        #[unsafe(method(new))]
7449        #[unsafe(method_family = new)]
7450        pub unsafe fn new() -> Retained<Self>;
7451    );
7452}
7453
7454/// VPN status codes
7455///
7456/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnstatus?language=objc)
7457// NS_ENUM
7458#[repr(transparent)]
7459#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
7460pub struct NEVPNStatus(pub NSInteger);
7461impl NEVPNStatus {
7462    #[doc(alias = "NEVPNStatusInvalid")]
7463    pub const Invalid: Self = Self(0);
7464    #[doc(alias = "NEVPNStatusDisconnected")]
7465    pub const Disconnected: Self = Self(1);
7466    #[doc(alias = "NEVPNStatusConnecting")]
7467    pub const Connecting: Self = Self(2);
7468    #[doc(alias = "NEVPNStatusConnected")]
7469    pub const Connected: Self = Self(3);
7470    #[doc(alias = "NEVPNStatusReasserting")]
7471    pub const Reasserting: Self = Self(4);
7472    #[doc(alias = "NEVPNStatusDisconnecting")]
7473    pub const Disconnecting: Self = Self(5);
7474}
7475
7476unsafe impl Encode for NEVPNStatus {
7477    const ENCODING: Encoding = NSInteger::ENCODING;
7478}
7479
7480unsafe impl RefEncode for NEVPNStatus {
7481    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
7482}
7483
7484extern "C" {
7485    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnstatusdidchangenotification?language=objc)
7486    pub static NEVPNStatusDidChangeNotification: &'static NSString;
7487}
7488
7489extern "C" {
7490    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnconnectionstartoptionusername?language=objc)
7491    pub static NEVPNConnectionStartOptionUsername: &'static NSString;
7492}
7493
7494extern "C" {
7495    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnconnectionstartoptionpassword?language=objc)
7496    pub static NEVPNConnectionStartOptionPassword: &'static NSString;
7497}
7498
7499/// VPN error codes
7500///
7501/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnconnectionerror?language=objc)
7502// NS_ENUM
7503#[repr(transparent)]
7504#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
7505pub struct NEVPNConnectionError(pub NSInteger);
7506impl NEVPNConnectionError {
7507    #[doc(alias = "NEVPNConnectionErrorOverslept")]
7508    pub const Overslept: Self = Self(1);
7509    #[doc(alias = "NEVPNConnectionErrorNoNetworkAvailable")]
7510    pub const NoNetworkAvailable: Self = Self(2);
7511    /// way that the VPN connection could not be maintained.
7512    #[doc(alias = "NEVPNConnectionErrorUnrecoverableNetworkChange")]
7513    pub const UnrecoverableNetworkChange: Self = Self(3);
7514    #[doc(alias = "NEVPNConnectionErrorConfigurationFailed")]
7515    pub const ConfigurationFailed: Self = Self(4);
7516    #[doc(alias = "NEVPNConnectionErrorServerAddressResolutionFailed")]
7517    pub const ServerAddressResolutionFailed: Self = Self(5);
7518    #[doc(alias = "NEVPNConnectionErrorServerNotResponding")]
7519    pub const ServerNotResponding: Self = Self(6);
7520    #[doc(alias = "NEVPNConnectionErrorServerDead")]
7521    pub const ServerDead: Self = Self(7);
7522    #[doc(alias = "NEVPNConnectionErrorAuthenticationFailed")]
7523    pub const AuthenticationFailed: Self = Self(8);
7524    #[doc(alias = "NEVPNConnectionErrorClientCertificateInvalid")]
7525    pub const ClientCertificateInvalid: Self = Self(9);
7526    #[doc(alias = "NEVPNConnectionErrorClientCertificateNotYetValid")]
7527    pub const ClientCertificateNotYetValid: Self = Self(10);
7528    #[doc(alias = "NEVPNConnectionErrorClientCertificateExpired")]
7529    pub const ClientCertificateExpired: Self = Self(11);
7530    #[doc(alias = "NEVPNConnectionErrorPluginFailed")]
7531    pub const PluginFailed: Self = Self(12);
7532    #[doc(alias = "NEVPNConnectionErrorConfigurationNotFound")]
7533    pub const ConfigurationNotFound: Self = Self(13);
7534    #[doc(alias = "NEVPNConnectionErrorPluginDisabled")]
7535    pub const PluginDisabled: Self = Self(14);
7536    #[doc(alias = "NEVPNConnectionErrorNegotiationFailed")]
7537    pub const NegotiationFailed: Self = Self(15);
7538    #[doc(alias = "NEVPNConnectionErrorServerDisconnected")]
7539    pub const ServerDisconnected: Self = Self(16);
7540    #[doc(alias = "NEVPNConnectionErrorServerCertificateInvalid")]
7541    pub const ServerCertificateInvalid: Self = Self(17);
7542    #[doc(alias = "NEVPNConnectionErrorServerCertificateNotYetValid")]
7543    pub const ServerCertificateNotYetValid: Self = Self(18);
7544    #[doc(alias = "NEVPNConnectionErrorServerCertificateExpired")]
7545    pub const ServerCertificateExpired: Self = Self(19);
7546}
7547
7548unsafe impl Encode for NEVPNConnectionError {
7549    const ENCODING: Encoding = NSInteger::ENCODING;
7550}
7551
7552unsafe impl RefEncode for NEVPNConnectionError {
7553    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
7554}
7555
7556extern "C" {
7557    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnconnectionerrordomain?language=objc)
7558    pub static NEVPNConnectionErrorDomain: &'static NSString;
7559}
7560
7561extern_class!(
7562    /// The NEVPNConnection class declares the programmatic interface for an object that manages VPN connections.
7563    ///
7564    /// Instances of this class are thread safe.
7565    ///
7566    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnconnection?language=objc)
7567    #[unsafe(super(NSObject))]
7568    #[derive(Debug, PartialEq, Eq, Hash)]
7569    pub struct NEVPNConnection;
7570);
7571
7572unsafe impl NSObjectProtocol for NEVPNConnection {}
7573
7574impl NEVPNConnection {
7575    extern_methods!(
7576        /// 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.
7577        ///
7578        /// 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:
7579        /// 1. NEVPNErrorConfigurationInvalid
7580        /// 2. NEVPNErrorConfigurationDisabled
7581        ///
7582        /// Returns: YES if the VPN tunnel was started successfully, NO if an error occurred.
7583        #[unsafe(method(startVPNTunnelAndReturnError:_))]
7584        #[unsafe(method_family = none)]
7585        pub unsafe fn startVPNTunnelAndReturnError(&self) -> Result<(), Retained<NSError>>;
7586
7587        /// 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.
7588        ///
7589        /// Parameter `options`: A dictionary that will be passed to the tunnel provider during the process of starting the tunnel.
7590        /// If not nil, 'options' is an NSDictionary may contain the following keys
7591        /// NEVPNConnectionStartOptionUsername
7592        /// NEVPNConnectionStartOptionPassword
7593        ///
7594        /// 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:
7595        /// 1. NEVPNErrorConfigurationInvalid
7596        /// 2. NEVPNErrorConfigurationDisabled
7597        ///
7598        /// Returns: YES if the VPN tunnel was started successfully, NO if an error occurred.
7599        #[unsafe(method(startVPNTunnelWithOptions:andReturnError:_))]
7600        #[unsafe(method_family = none)]
7601        pub unsafe fn startVPNTunnelWithOptions_andReturnError(
7602            &self,
7603            options: Option<&NSDictionary<NSString, NSObject>>,
7604        ) -> Result<(), Retained<NSError>>;
7605
7606        /// This function is used to stop the VPN tunnel. The VPN tunnel disconnect process is started and this function returns immediately.
7607        #[unsafe(method(stopVPNTunnel))]
7608        #[unsafe(method_family = none)]
7609        pub unsafe fn stopVPNTunnel(&self);
7610
7611        #[cfg(feature = "block2")]
7612        /// 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.
7613        ///
7614        /// Parameter `handler`: A block which takes an optional NSError that will be called when the error is obtained.
7615        #[unsafe(method(fetchLastDisconnectErrorWithCompletionHandler:))]
7616        #[unsafe(method_family = none)]
7617        pub unsafe fn fetchLastDisconnectErrorWithCompletionHandler(
7618            &self,
7619            handler: &block2::Block<dyn Fn(*mut NSError)>,
7620        );
7621
7622        /// The current status of the VPN.
7623        #[unsafe(method(status))]
7624        #[unsafe(method_family = none)]
7625        pub unsafe fn status(&self) -> NEVPNStatus;
7626
7627        /// The date and time when the connection status changed to NEVPNStatusConnected. This property is nil if the connection is not fully established.
7628        #[unsafe(method(connectedDate))]
7629        #[unsafe(method_family = none)]
7630        pub unsafe fn connectedDate(&self) -> Option<Retained<NSDate>>;
7631
7632        /// The NEVPNManager associated with this NEVPNConnection.
7633        #[unsafe(method(manager))]
7634        #[unsafe(method_family = none)]
7635        pub unsafe fn manager(&self) -> Retained<NEVPNManager>;
7636    );
7637}
7638
7639/// Methods declared on superclass `NSObject`.
7640impl NEVPNConnection {
7641    extern_methods!(
7642        #[unsafe(method(init))]
7643        #[unsafe(method_family = init)]
7644        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7645
7646        #[unsafe(method(new))]
7647        #[unsafe(method_family = new)]
7648        pub unsafe fn new() -> Retained<Self>;
7649    );
7650}
7651
7652extern_class!(
7653    /// This file declares the NETunnelProviderSession API. The NETunnelProviderSession API is used to control network tunnel services provided by NETunnelProvider implementations.
7654    ///
7655    /// This API is part of NetworkExtension.framework.
7656    ///
7657    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netunnelprovidersession?language=objc)
7658    #[unsafe(super(NEVPNConnection, NSObject))]
7659    #[derive(Debug, PartialEq, Eq, Hash)]
7660    pub struct NETunnelProviderSession;
7661);
7662
7663unsafe impl NSObjectProtocol for NETunnelProviderSession {}
7664
7665impl NETunnelProviderSession {
7666    extern_methods!(
7667        /// 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.
7668        ///
7669        /// Parameter `options`: A dictionary that will be passed as-is to the tunnel provider during the process of starting the tunnel.
7670        ///
7671        /// 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:
7672        /// 1. NEVPNErrorConfigurationInvalid
7673        /// 2. NEVPNErrorConfigurationDisabled
7674        ///
7675        /// Returns: YES if the tunnel was started successfully, NO if an error occurred.
7676        #[unsafe(method(startTunnelWithOptions:andReturnError:_))]
7677        #[unsafe(method_family = none)]
7678        pub unsafe fn startTunnelWithOptions_andReturnError(
7679            &self,
7680            options: Option<&NSDictionary<NSString, AnyObject>>,
7681        ) -> Result<(), Retained<NSError>>;
7682
7683        /// This function is used to stop the tunnel. The tunnel disconnect process is started and this function returns immediately.
7684        #[unsafe(method(stopTunnel))]
7685        #[unsafe(method_family = none)]
7686        pub unsafe fn stopTunnel(&self);
7687
7688        #[cfg(feature = "block2")]
7689        /// This function sends a message to the NETunnelProvider and provides a way to receive a response.
7690        ///
7691        /// Parameter `messageData`: An NSData object containing the message to be sent.
7692        ///
7693        /// 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:
7694        /// 1. NEVPNErrorConfigurationInvalid
7695        /// 2. NEVPNErrorConfigurationDisabled
7696        ///
7697        /// Parameter `responseHandler`: A block that handles the response. Can be set to nil if no response is expected.
7698        ///
7699        /// Returns: YES if the message was sent successfully, NO if an error occurred.
7700        #[unsafe(method(sendProviderMessage:returnError:responseHandler:))]
7701        #[unsafe(method_family = none)]
7702        pub unsafe fn sendProviderMessage_returnError_responseHandler(
7703            &self,
7704            message_data: &NSData,
7705            error: Option<&mut Option<Retained<NSError>>>,
7706            response_handler: Option<&block2::Block<dyn Fn(*mut NSData)>>,
7707        ) -> bool;
7708    );
7709}
7710
7711/// Methods declared on superclass `NSObject`.
7712impl NETunnelProviderSession {
7713    extern_methods!(
7714        #[unsafe(method(init))]
7715        #[unsafe(method_family = init)]
7716        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7717
7718        #[unsafe(method(new))]
7719        #[unsafe(method_family = new)]
7720        pub unsafe fn new() -> Retained<Self>;
7721    );
7722}
7723
7724extern_class!(
7725    /// The NETunnelProviderProtocol class declares the programmatic interface for an object that contains NETunnelProvider-specific configuration settings.
7726    ///
7727    /// Instances of this class are thread safe.
7728    ///
7729    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/netunnelproviderprotocol?language=objc)
7730    #[unsafe(super(NEVPNProtocol, NSObject))]
7731    #[derive(Debug, PartialEq, Eq, Hash)]
7732    pub struct NETunnelProviderProtocol;
7733);
7734
7735unsafe impl NSCoding for NETunnelProviderProtocol {}
7736
7737unsafe impl NSCopying for NETunnelProviderProtocol {}
7738
7739unsafe impl CopyingHelper for NETunnelProviderProtocol {
7740    type Result = Self;
7741}
7742
7743unsafe impl NSObjectProtocol for NETunnelProviderProtocol {}
7744
7745unsafe impl NSSecureCoding for NETunnelProviderProtocol {}
7746
7747impl NETunnelProviderProtocol {
7748    extern_methods!(
7749        /// A dictionary containing NETunnelProvider vendor-specific configuration parameters. This dictionary is passed as-is to NETunnelProviders when a tunnel is started.
7750        #[unsafe(method(providerConfiguration))]
7751        #[unsafe(method_family = none)]
7752        pub unsafe fn providerConfiguration(
7753            &self,
7754        ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
7755
7756        /// Setter for [`providerConfiguration`][Self::providerConfiguration].
7757        #[unsafe(method(setProviderConfiguration:))]
7758        #[unsafe(method_family = none)]
7759        pub unsafe fn setProviderConfiguration(
7760            &self,
7761            provider_configuration: Option<&NSDictionary<NSString, AnyObject>>,
7762        );
7763
7764        /// A string containing the bundle identifier of the NETunnelProvider to be used by this configuration.
7765        #[unsafe(method(providerBundleIdentifier))]
7766        #[unsafe(method_family = none)]
7767        pub unsafe fn providerBundleIdentifier(&self) -> Option<Retained<NSString>>;
7768
7769        /// Setter for [`providerBundleIdentifier`][Self::providerBundleIdentifier].
7770        #[unsafe(method(setProviderBundleIdentifier:))]
7771        #[unsafe(method_family = none)]
7772        pub unsafe fn setProviderBundleIdentifier(
7773            &self,
7774            provider_bundle_identifier: Option<&NSString>,
7775        );
7776    );
7777}
7778
7779/// Methods declared on superclass `NSObject`.
7780impl NETunnelProviderProtocol {
7781    extern_methods!(
7782        #[unsafe(method(init))]
7783        #[unsafe(method_family = init)]
7784        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7785
7786        #[unsafe(method(new))]
7787        #[unsafe(method_family = new)]
7788        pub unsafe fn new() -> Retained<Self>;
7789    );
7790}
7791
7792/// Internet Key Exchange (IKE) authentication methods used to authenticate with the IPSec server.
7793///
7794/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnikeauthenticationmethod?language=objc)
7795// NS_ENUM
7796#[repr(transparent)]
7797#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
7798pub struct NEVPNIKEAuthenticationMethod(pub NSInteger);
7799impl NEVPNIKEAuthenticationMethod {
7800    #[doc(alias = "NEVPNIKEAuthenticationMethodNone")]
7801    pub const None: Self = Self(0);
7802    #[doc(alias = "NEVPNIKEAuthenticationMethodCertificate")]
7803    pub const Certificate: Self = Self(1);
7804    #[doc(alias = "NEVPNIKEAuthenticationMethodSharedSecret")]
7805    pub const SharedSecret: Self = Self(2);
7806}
7807
7808unsafe impl Encode for NEVPNIKEAuthenticationMethod {
7809    const ENCODING: Encoding = NSInteger::ENCODING;
7810}
7811
7812unsafe impl RefEncode for NEVPNIKEAuthenticationMethod {
7813    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
7814}
7815
7816extern_class!(
7817    /// The NEVPNProtocolIPSec class declares the programmatic interface of an object that manages the IPSec-specific portion of a VPN configuration.
7818    ///
7819    /// Instances of this class use IKE version 1 for key negotiation.
7820    ///
7821    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnprotocolipsec?language=objc)
7822    #[unsafe(super(NEVPNProtocol, NSObject))]
7823    #[derive(Debug, PartialEq, Eq, Hash)]
7824    pub struct NEVPNProtocolIPSec;
7825);
7826
7827unsafe impl NSCoding for NEVPNProtocolIPSec {}
7828
7829unsafe impl NSCopying for NEVPNProtocolIPSec {}
7830
7831unsafe impl CopyingHelper for NEVPNProtocolIPSec {
7832    type Result = Self;
7833}
7834
7835unsafe impl NSObjectProtocol for NEVPNProtocolIPSec {}
7836
7837unsafe impl NSSecureCoding for NEVPNProtocolIPSec {}
7838
7839impl NEVPNProtocolIPSec {
7840    extern_methods!(
7841        /// 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.
7842        #[unsafe(method(authenticationMethod))]
7843        #[unsafe(method_family = none)]
7844        pub unsafe fn authenticationMethod(&self) -> NEVPNIKEAuthenticationMethod;
7845
7846        /// Setter for [`authenticationMethod`][Self::authenticationMethod].
7847        #[unsafe(method(setAuthenticationMethod:))]
7848        #[unsafe(method_family = none)]
7849        pub unsafe fn setAuthenticationMethod(
7850            &self,
7851            authentication_method: NEVPNIKEAuthenticationMethod,
7852        );
7853
7854        /// 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.
7855        /// 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.
7856        /// 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.
7857        #[unsafe(method(useExtendedAuthentication))]
7858        #[unsafe(method_family = none)]
7859        pub unsafe fn useExtendedAuthentication(&self) -> bool;
7860
7861        /// Setter for [`useExtendedAuthentication`][Self::useExtendedAuthentication].
7862        #[unsafe(method(setUseExtendedAuthentication:))]
7863        #[unsafe(method_family = none)]
7864        pub unsafe fn setUseExtendedAuthentication(&self, use_extended_authentication: bool);
7865
7866        /// A persistent reference to a keychain item of class kSecClassGenericPassword containing the IKE shared secret.
7867        #[unsafe(method(sharedSecretReference))]
7868        #[unsafe(method_family = none)]
7869        pub unsafe fn sharedSecretReference(&self) -> Option<Retained<NSData>>;
7870
7871        /// Setter for [`sharedSecretReference`][Self::sharedSecretReference].
7872        #[unsafe(method(setSharedSecretReference:))]
7873        #[unsafe(method_family = none)]
7874        pub unsafe fn setSharedSecretReference(&self, shared_secret_reference: Option<&NSData>);
7875
7876        /// A string identifying the local IPSec endpoint for authentication purposes.
7877        #[unsafe(method(localIdentifier))]
7878        #[unsafe(method_family = none)]
7879        pub unsafe fn localIdentifier(&self) -> Option<Retained<NSString>>;
7880
7881        /// Setter for [`localIdentifier`][Self::localIdentifier].
7882        #[unsafe(method(setLocalIdentifier:))]
7883        #[unsafe(method_family = none)]
7884        pub unsafe fn setLocalIdentifier(&self, local_identifier: Option<&NSString>);
7885
7886        /// A string identifying the remote IPSec endpoint for authentication purposes.
7887        #[unsafe(method(remoteIdentifier))]
7888        #[unsafe(method_family = none)]
7889        pub unsafe fn remoteIdentifier(&self) -> Option<Retained<NSString>>;
7890
7891        /// Setter for [`remoteIdentifier`][Self::remoteIdentifier].
7892        #[unsafe(method(setRemoteIdentifier:))]
7893        #[unsafe(method_family = none)]
7894        pub unsafe fn setRemoteIdentifier(&self, remote_identifier: Option<&NSString>);
7895    );
7896}
7897
7898/// Methods declared on superclass `NSObject`.
7899impl NEVPNProtocolIPSec {
7900    extern_methods!(
7901        #[unsafe(method(init))]
7902        #[unsafe(method_family = init)]
7903        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7904
7905        #[unsafe(method(new))]
7906        #[unsafe(method_family = new)]
7907        pub unsafe fn new() -> Retained<Self>;
7908    );
7909}
7910
7911/// IKEv2 Integrity Algorithms
7912///
7913/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnikev2integrityalgorithm?language=objc)
7914// NS_ENUM
7915#[repr(transparent)]
7916#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
7917pub struct NEVPNIKEv2IntegrityAlgorithm(pub NSInteger);
7918impl NEVPNIKEv2IntegrityAlgorithm {
7919    #[deprecated = "Use SHA-2 for integrity protection instead"]
7920    #[doc(alias = "NEVPNIKEv2IntegrityAlgorithmSHA96")]
7921    pub const SHA96: Self = Self(1);
7922    #[deprecated = "Use SHA-2 for integrity protection instead"]
7923    #[doc(alias = "NEVPNIKEv2IntegrityAlgorithmSHA160")]
7924    pub const SHA160: Self = Self(2);
7925    #[doc(alias = "NEVPNIKEv2IntegrityAlgorithmSHA256")]
7926    pub const SHA256: Self = Self(3);
7927    #[doc(alias = "NEVPNIKEv2IntegrityAlgorithmSHA384")]
7928    pub const SHA384: Self = Self(4);
7929    #[doc(alias = "NEVPNIKEv2IntegrityAlgorithmSHA512")]
7930    pub const SHA512: Self = Self(5);
7931}
7932
7933unsafe impl Encode for NEVPNIKEv2IntegrityAlgorithm {
7934    const ENCODING: Encoding = NSInteger::ENCODING;
7935}
7936
7937unsafe impl RefEncode for NEVPNIKEv2IntegrityAlgorithm {
7938    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
7939}
7940
7941/// IKEv2 Dead Peer Detection Rates
7942///
7943/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnikev2deadpeerdetectionrate?language=objc)
7944// NS_ENUM
7945#[repr(transparent)]
7946#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
7947pub struct NEVPNIKEv2DeadPeerDetectionRate(pub NSInteger);
7948impl NEVPNIKEv2DeadPeerDetectionRate {
7949    #[doc(alias = "NEVPNIKEv2DeadPeerDetectionRateNone")]
7950    pub const None: Self = Self(0);
7951    #[doc(alias = "NEVPNIKEv2DeadPeerDetectionRateLow")]
7952    pub const Low: Self = Self(1);
7953    #[doc(alias = "NEVPNIKEv2DeadPeerDetectionRateMedium")]
7954    pub const Medium: Self = Self(2);
7955    #[doc(alias = "NEVPNIKEv2DeadPeerDetectionRateHigh")]
7956    pub const High: Self = Self(3);
7957}
7958
7959unsafe impl Encode for NEVPNIKEv2DeadPeerDetectionRate {
7960    const ENCODING: Encoding = NSInteger::ENCODING;
7961}
7962
7963unsafe impl RefEncode for NEVPNIKEv2DeadPeerDetectionRate {
7964    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
7965}
7966
7967/// IKEv2 Diffie Hellman groups
7968///
7969/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnikev2diffiehellmangroup?language=objc)
7970// NS_ENUM
7971#[repr(transparent)]
7972#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
7973pub struct NEVPNIKEv2DiffieHellmanGroup(pub NSInteger);
7974impl NEVPNIKEv2DiffieHellmanGroup {
7975    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroupInvalid")]
7976    pub const GroupInvalid: Self = Self(0);
7977    #[deprecated = "Use Diffie Hellman group 14 or greater instead"]
7978    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup1")]
7979    pub const Group1: Self = Self(1);
7980    #[deprecated = "Use Diffie Hellman group 14 or greater instead"]
7981    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup2")]
7982    pub const Group2: Self = Self(2);
7983    #[deprecated = "Use Diffie Hellman group 14 or greater instead"]
7984    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup5")]
7985    pub const Group5: Self = Self(5);
7986    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup14")]
7987    pub const Group14: Self = Self(14);
7988    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup15")]
7989    pub const Group15: Self = Self(15);
7990    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup16")]
7991    pub const Group16: Self = Self(16);
7992    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup17")]
7993    pub const Group17: Self = Self(17);
7994    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup18")]
7995    pub const Group18: Self = Self(18);
7996    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup19")]
7997    pub const Group19: Self = Self(19);
7998    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup20")]
7999    pub const Group20: Self = Self(20);
8000    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup21")]
8001    pub const Group21: Self = Self(21);
8002    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup31")]
8003    pub const Group31: Self = Self(31);
8004    #[doc(alias = "NEVPNIKEv2DiffieHellmanGroup32")]
8005    pub const Group32: Self = Self(32);
8006}
8007
8008unsafe impl Encode for NEVPNIKEv2DiffieHellmanGroup {
8009    const ENCODING: Encoding = NSInteger::ENCODING;
8010}
8011
8012unsafe impl RefEncode for NEVPNIKEv2DiffieHellmanGroup {
8013    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
8014}
8015
8016/// IKEv2 Certificate types
8017///
8018/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnikev2certificatetype?language=objc)
8019// NS_ENUM
8020#[repr(transparent)]
8021#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
8022pub struct NEVPNIKEv2CertificateType(pub NSInteger);
8023impl NEVPNIKEv2CertificateType {
8024    #[doc(alias = "NEVPNIKEv2CertificateTypeRSA")]
8025    pub const RSA: Self = Self(1);
8026    #[doc(alias = "NEVPNIKEv2CertificateTypeECDSA256")]
8027    pub const ECDSA256: Self = Self(2);
8028    #[doc(alias = "NEVPNIKEv2CertificateTypeECDSA384")]
8029    pub const ECDSA384: Self = Self(3);
8030    #[doc(alias = "NEVPNIKEv2CertificateTypeECDSA521")]
8031    pub const ECDSA521: Self = Self(4);
8032    #[doc(alias = "NEVPNIKEv2CertificateTypeEd25519")]
8033    pub const Ed25519: Self = Self(5);
8034    #[doc(alias = "NEVPNIKEv2CertificateTypeRSAPSS")]
8035    pub const RSAPSS: Self = Self(6);
8036}
8037
8038unsafe impl Encode for NEVPNIKEv2CertificateType {
8039    const ENCODING: Encoding = NSInteger::ENCODING;
8040}
8041
8042unsafe impl RefEncode for NEVPNIKEv2CertificateType {
8043    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
8044}
8045
8046/// TLS Versions for use in EAP-TLS
8047///
8048/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnikev2tlsversion?language=objc)
8049// NS_ENUM
8050#[repr(transparent)]
8051#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
8052pub struct NEVPNIKEv2TLSVersion(pub NSInteger);
8053impl NEVPNIKEv2TLSVersion {
8054    #[doc(alias = "NEVPNIKEv2TLSVersionDefault")]
8055    pub const VersionDefault: Self = Self(0);
8056    #[doc(alias = "NEVPNIKEv2TLSVersion1_0")]
8057    pub const Version1_0: Self = Self(1);
8058    #[doc(alias = "NEVPNIKEv2TLSVersion1_1")]
8059    pub const Version1_1: Self = Self(2);
8060    #[doc(alias = "NEVPNIKEv2TLSVersion1_2")]
8061    pub const Version1_2: Self = Self(3);
8062}
8063
8064unsafe impl Encode for NEVPNIKEv2TLSVersion {
8065    const ENCODING: Encoding = NSInteger::ENCODING;
8066}
8067
8068unsafe impl RefEncode for NEVPNIKEv2TLSVersion {
8069    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
8070}
8071
8072extern_class!(
8073    /// The NEVPNIKEv2SecurityAssociationParameters class declares the programmatic interface of an object that manages parameters for an IPSec Security Association
8074    ///
8075    /// Instances of this class are thread safe.
8076    ///
8077    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnikev2securityassociationparameters?language=objc)
8078    #[unsafe(super(NSObject))]
8079    #[derive(Debug, PartialEq, Eq, Hash)]
8080    pub struct NEVPNIKEv2SecurityAssociationParameters;
8081);
8082
8083unsafe impl NSCoding for NEVPNIKEv2SecurityAssociationParameters {}
8084
8085unsafe impl NSCopying for NEVPNIKEv2SecurityAssociationParameters {}
8086
8087unsafe impl CopyingHelper for NEVPNIKEv2SecurityAssociationParameters {
8088    type Result = Self;
8089}
8090
8091unsafe impl NSObjectProtocol for NEVPNIKEv2SecurityAssociationParameters {}
8092
8093unsafe impl NSSecureCoding for NEVPNIKEv2SecurityAssociationParameters {}
8094
8095impl NEVPNIKEv2SecurityAssociationParameters {
8096    extern_methods!(
8097        /// 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.
8098        /// Prior to that the default was NEVPNIKEv2EncryptionAlgorithm3DES. On tvOS, the default is NEVPNIKEv2EncryptionAlgorithmAES256GCM.
8099        #[unsafe(method(encryptionAlgorithm))]
8100        #[unsafe(method_family = none)]
8101        pub unsafe fn encryptionAlgorithm(&self) -> NEVPNIKEv2EncryptionAlgorithm;
8102
8103        /// Setter for [`encryptionAlgorithm`][Self::encryptionAlgorithm].
8104        #[unsafe(method(setEncryptionAlgorithm:))]
8105        #[unsafe(method_family = none)]
8106        pub unsafe fn setEncryptionAlgorithm(
8107            &self,
8108            encryption_algorithm: NEVPNIKEv2EncryptionAlgorithm,
8109        );
8110
8111        /// 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.
8112        /// Default is NEVPNIKEv2IntegrityAlgorithmSHA256 starting in macOS 11, iOS 14, and tvOS 17.  Prior to that the default was NEVPNIKEv2IntegrityAlgorithmSHA96.
8113        #[unsafe(method(integrityAlgorithm))]
8114        #[unsafe(method_family = none)]
8115        pub unsafe fn integrityAlgorithm(&self) -> NEVPNIKEv2IntegrityAlgorithm;
8116
8117        /// Setter for [`integrityAlgorithm`][Self::integrityAlgorithm].
8118        #[unsafe(method(setIntegrityAlgorithm:))]
8119        #[unsafe(method_family = none)]
8120        pub unsafe fn setIntegrityAlgorithm(
8121            &self,
8122            integrity_algorithm: NEVPNIKEv2IntegrityAlgorithm,
8123        );
8124
8125        /// 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.
8126        #[unsafe(method(diffieHellmanGroup))]
8127        #[unsafe(method_family = none)]
8128        pub unsafe fn diffieHellmanGroup(&self) -> NEVPNIKEv2DiffieHellmanGroup;
8129
8130        /// Setter for [`diffieHellmanGroup`][Self::diffieHellmanGroup].
8131        #[unsafe(method(setDiffieHellmanGroup:))]
8132        #[unsafe(method_family = none)]
8133        pub unsafe fn setDiffieHellmanGroup(
8134            &self,
8135            diffie_hellman_group: NEVPNIKEv2DiffieHellmanGroup,
8136        );
8137
8138        /// 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.
8139        #[unsafe(method(lifetimeMinutes))]
8140        #[unsafe(method_family = none)]
8141        pub unsafe fn lifetimeMinutes(&self) -> i32;
8142
8143        /// Setter for [`lifetimeMinutes`][Self::lifetimeMinutes].
8144        #[unsafe(method(setLifetimeMinutes:))]
8145        #[unsafe(method_family = none)]
8146        pub unsafe fn setLifetimeMinutes(&self, lifetime_minutes: i32);
8147    );
8148}
8149
8150/// Methods declared on superclass `NSObject`.
8151impl NEVPNIKEv2SecurityAssociationParameters {
8152    extern_methods!(
8153        #[unsafe(method(init))]
8154        #[unsafe(method_family = init)]
8155        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8156
8157        #[unsafe(method(new))]
8158        #[unsafe(method_family = new)]
8159        pub unsafe fn new() -> Retained<Self>;
8160    );
8161}
8162
8163extern_class!(
8164    /// The NEVPNIKEv2PPKConfiguration class declares the programmatic interface of an object that manages parameters for a Post-quantum Pre-shared Key (PPK)
8165    ///
8166    /// Instances of this class conform to RFC 8784.
8167    /// Instances of this class are thread safe.
8168    ///
8169    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnikev2ppkconfiguration?language=objc)
8170    #[unsafe(super(NSObject))]
8171    #[derive(Debug, PartialEq, Eq, Hash)]
8172    pub struct NEVPNIKEv2PPKConfiguration;
8173);
8174
8175unsafe impl NSCopying for NEVPNIKEv2PPKConfiguration {}
8176
8177unsafe impl CopyingHelper for NEVPNIKEv2PPKConfiguration {
8178    type Result = Self;
8179}
8180
8181unsafe impl NSObjectProtocol for NEVPNIKEv2PPKConfiguration {}
8182
8183impl NEVPNIKEv2PPKConfiguration {
8184    extern_methods!(
8185        /// Initialize a newly-allocated NEVPNIKEv2PPKConfiguration object.
8186        ///
8187        /// Parameter `identifier`: The identifier for the PPK.
8188        ///
8189        /// Parameter `keychainReference`: A persistent reference to a keychain item of class kSecClassGenericPassword containing the PPK.
8190        #[unsafe(method(initWithIdentifier:keychainReference:))]
8191        #[unsafe(method_family = init)]
8192        pub unsafe fn initWithIdentifier_keychainReference(
8193            this: Allocated<Self>,
8194            identifier: &NSString,
8195            keychain_reference: &NSData,
8196        ) -> Retained<Self>;
8197
8198        /// The identifer for the PPK.
8199        #[unsafe(method(identifier))]
8200        #[unsafe(method_family = none)]
8201        pub unsafe fn identifier(&self) -> Retained<NSString>;
8202
8203        /// A persistent reference to a keychain item of class kSecClassGenericPassword containing the PPK.
8204        #[unsafe(method(keychainReference))]
8205        #[unsafe(method_family = none)]
8206        pub unsafe fn keychainReference(&self) -> Retained<NSData>;
8207
8208        /// Boolean indicating whether use of the PPK is mandatory or not. Default is YES.
8209        #[unsafe(method(isMandatory))]
8210        #[unsafe(method_family = none)]
8211        pub unsafe fn isMandatory(&self) -> bool;
8212
8213        /// Setter for [`isMandatory`][Self::isMandatory].
8214        #[unsafe(method(setIsMandatory:))]
8215        #[unsafe(method_family = none)]
8216        pub unsafe fn setIsMandatory(&self, is_mandatory: bool);
8217    );
8218}
8219
8220/// Methods declared on superclass `NSObject`.
8221impl NEVPNIKEv2PPKConfiguration {
8222    extern_methods!(
8223        #[unsafe(method(init))]
8224        #[unsafe(method_family = init)]
8225        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8226
8227        #[unsafe(method(new))]
8228        #[unsafe(method_family = new)]
8229        pub unsafe fn new() -> Retained<Self>;
8230    );
8231}
8232
8233extern_class!(
8234    /// The NEVPNProtocolIKEv2 class declares the programmatic interface of an object that manages the IKEv2-specific portion of a VPN configuration.
8235    ///
8236    /// Instances of this class use IKE version 2 for key negotiation.
8237    /// Instances of this class are thread safe.
8238    ///
8239    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nevpnprotocolikev2?language=objc)
8240    #[unsafe(super(NEVPNProtocolIPSec, NEVPNProtocol, NSObject))]
8241    #[derive(Debug, PartialEq, Eq, Hash)]
8242    pub struct NEVPNProtocolIKEv2;
8243);
8244
8245unsafe impl NSCoding for NEVPNProtocolIKEv2 {}
8246
8247unsafe impl NSCopying for NEVPNProtocolIKEv2 {}
8248
8249unsafe impl CopyingHelper for NEVPNProtocolIKEv2 {
8250    type Result = Self;
8251}
8252
8253unsafe impl NSObjectProtocol for NEVPNProtocolIKEv2 {}
8254
8255unsafe impl NSSecureCoding for NEVPNProtocolIKEv2 {}
8256
8257impl NEVPNProtocolIKEv2 {
8258    extern_methods!(
8259        /// How frequently the IKEv2 client will run the dead peer detection algorithm.  Default is NEVPNIKEv2DeadPeerDetectionRateMedium.
8260        #[unsafe(method(deadPeerDetectionRate))]
8261        #[unsafe(method_family = none)]
8262        pub unsafe fn deadPeerDetectionRate(&self) -> NEVPNIKEv2DeadPeerDetectionRate;
8263
8264        /// Setter for [`deadPeerDetectionRate`][Self::deadPeerDetectionRate].
8265        #[unsafe(method(setDeadPeerDetectionRate:))]
8266        #[unsafe(method_family = none)]
8267        pub unsafe fn setDeadPeerDetectionRate(
8268            &self,
8269            dead_peer_detection_rate: NEVPNIKEv2DeadPeerDetectionRate,
8270        );
8271
8272        /// A string containing the Subject Common Name field of the Certificate Authority certificate that issued the IKEv2 server's certificate.
8273        #[unsafe(method(serverCertificateIssuerCommonName))]
8274        #[unsafe(method_family = none)]
8275        pub unsafe fn serverCertificateIssuerCommonName(&self) -> Option<Retained<NSString>>;
8276
8277        /// Setter for [`serverCertificateIssuerCommonName`][Self::serverCertificateIssuerCommonName].
8278        #[unsafe(method(setServerCertificateIssuerCommonName:))]
8279        #[unsafe(method_family = none)]
8280        pub unsafe fn setServerCertificateIssuerCommonName(
8281            &self,
8282            server_certificate_issuer_common_name: Option<&NSString>,
8283        );
8284
8285        /// A string containing the value to verify in the IKEv2 server certificate's Subject Common Name field.
8286        #[unsafe(method(serverCertificateCommonName))]
8287        #[unsafe(method_family = none)]
8288        pub unsafe fn serverCertificateCommonName(&self) -> Option<Retained<NSString>>;
8289
8290        /// Setter for [`serverCertificateCommonName`][Self::serverCertificateCommonName].
8291        #[unsafe(method(setServerCertificateCommonName:))]
8292        #[unsafe(method_family = none)]
8293        pub unsafe fn setServerCertificateCommonName(
8294            &self,
8295            server_certificate_common_name: Option<&NSString>,
8296        );
8297
8298        /// contains the type of certificate if an certificate is configured.  Default is RSA.
8299        #[unsafe(method(certificateType))]
8300        #[unsafe(method_family = none)]
8301        pub unsafe fn certificateType(&self) -> NEVPNIKEv2CertificateType;
8302
8303        /// Setter for [`certificateType`][Self::certificateType].
8304        #[unsafe(method(setCertificateType:))]
8305        #[unsafe(method_family = none)]
8306        pub unsafe fn setCertificateType(&self, certificate_type: NEVPNIKEv2CertificateType);
8307
8308        /// Boolean indicating if client should use INTERNAL_IP4_SUBNET / INTERNAL_IP6_SUBNET attributes.  Default is False.
8309        #[unsafe(method(useConfigurationAttributeInternalIPSubnet))]
8310        #[unsafe(method_family = none)]
8311        pub unsafe fn useConfigurationAttributeInternalIPSubnet(&self) -> bool;
8312
8313        /// Setter for [`useConfigurationAttributeInternalIPSubnet`][Self::useConfigurationAttributeInternalIPSubnet].
8314        #[unsafe(method(setUseConfigurationAttributeInternalIPSubnet:))]
8315        #[unsafe(method_family = none)]
8316        pub unsafe fn setUseConfigurationAttributeInternalIPSubnet(
8317            &self,
8318            use_configuration_attribute_internal_ip_subnet: bool,
8319        );
8320
8321        /// Parameters for the IKE SA
8322        #[unsafe(method(IKESecurityAssociationParameters))]
8323        #[unsafe(method_family = none)]
8324        pub unsafe fn IKESecurityAssociationParameters(
8325            &self,
8326        ) -> Retained<NEVPNIKEv2SecurityAssociationParameters>;
8327
8328        /// Parameters for the child SA
8329        #[unsafe(method(childSecurityAssociationParameters))]
8330        #[unsafe(method_family = none)]
8331        pub unsafe fn childSecurityAssociationParameters(
8332            &self,
8333        ) -> Retained<NEVPNIKEv2SecurityAssociationParameters>;
8334
8335        /// Disable MOBIKE negotiation. Default is NO.
8336        #[unsafe(method(disableMOBIKE))]
8337        #[unsafe(method_family = none)]
8338        pub unsafe fn disableMOBIKE(&self) -> bool;
8339
8340        /// Setter for [`disableMOBIKE`][Self::disableMOBIKE].
8341        #[unsafe(method(setDisableMOBIKE:))]
8342        #[unsafe(method_family = none)]
8343        pub unsafe fn setDisableMOBIKE(&self, disable_mobike: bool);
8344
8345        /// Disable Server Redirect. Default is NO.
8346        #[unsafe(method(disableRedirect))]
8347        #[unsafe(method_family = none)]
8348        pub unsafe fn disableRedirect(&self) -> bool;
8349
8350        /// Setter for [`disableRedirect`][Self::disableRedirect].
8351        #[unsafe(method(setDisableRedirect:))]
8352        #[unsafe(method_family = none)]
8353        pub unsafe fn setDisableRedirect(&self, disable_redirect: bool);
8354
8355        /// Enable Perfect Forward Secrecy. Default is NO.
8356        #[unsafe(method(enablePFS))]
8357        #[unsafe(method_family = none)]
8358        pub unsafe fn enablePFS(&self) -> bool;
8359
8360        /// Setter for [`enablePFS`][Self::enablePFS].
8361        #[unsafe(method(setEnablePFS:))]
8362        #[unsafe(method_family = none)]
8363        pub unsafe fn setEnablePFS(&self, enable_pfs: bool);
8364
8365        /// Enable certificate revocation check. Default is NO.
8366        #[unsafe(method(enableRevocationCheck))]
8367        #[unsafe(method_family = none)]
8368        pub unsafe fn enableRevocationCheck(&self) -> bool;
8369
8370        /// Setter for [`enableRevocationCheck`][Self::enableRevocationCheck].
8371        #[unsafe(method(setEnableRevocationCheck:))]
8372        #[unsafe(method_family = none)]
8373        pub unsafe fn setEnableRevocationCheck(&self, enable_revocation_check: bool);
8374
8375        /// Require positive certificate revocation check response for peer certificate validation to pass. Default is NO.
8376        #[unsafe(method(strictRevocationCheck))]
8377        #[unsafe(method_family = none)]
8378        pub unsafe fn strictRevocationCheck(&self) -> bool;
8379
8380        /// Setter for [`strictRevocationCheck`][Self::strictRevocationCheck].
8381        #[unsafe(method(setStrictRevocationCheck:))]
8382        #[unsafe(method_family = none)]
8383        pub unsafe fn setStrictRevocationCheck(&self, strict_revocation_check: bool);
8384
8385        /// Sets a minimum TLS version to allow for EAP-TLS authentication. Default is NEVPNIKEv2TLSVersionDefault.
8386        #[unsafe(method(minimumTLSVersion))]
8387        #[unsafe(method_family = none)]
8388        pub unsafe fn minimumTLSVersion(&self) -> NEVPNIKEv2TLSVersion;
8389
8390        /// Setter for [`minimumTLSVersion`][Self::minimumTLSVersion].
8391        #[unsafe(method(setMinimumTLSVersion:))]
8392        #[unsafe(method_family = none)]
8393        pub unsafe fn setMinimumTLSVersion(&self, minimum_tls_version: NEVPNIKEv2TLSVersion);
8394
8395        /// Sets a maximum TLS version to allow for EAP-TLS authentication. Default is NEVPNIKEv2TLSVersionDefault.
8396        #[unsafe(method(maximumTLSVersion))]
8397        #[unsafe(method_family = none)]
8398        pub unsafe fn maximumTLSVersion(&self) -> NEVPNIKEv2TLSVersion;
8399
8400        /// Setter for [`maximumTLSVersion`][Self::maximumTLSVersion].
8401        #[unsafe(method(setMaximumTLSVersion:))]
8402        #[unsafe(method_family = none)]
8403        pub unsafe fn setMaximumTLSVersion(&self, maximum_tls_version: NEVPNIKEv2TLSVersion);
8404
8405        /// Enable Fallback is used to support Wi-Fi Assist. Wi-Fi Assist allows connections for foreground apps to switch over
8406        /// to Cellular Data when WiFi connectivity is poor. By setting the EnableFallback key, the device will bring up a tunnel over
8407        /// Cellular Data to carry traffic that is eligible for Wi-Fi Assist and also requires VPN. Enabling fallback requires that the
8408        /// server support multiple tunnels for a single user. Default is NO.
8409        #[unsafe(method(enableFallback))]
8410        #[unsafe(method_family = none)]
8411        pub unsafe fn enableFallback(&self) -> bool;
8412
8413        /// Setter for [`enableFallback`][Self::enableFallback].
8414        #[unsafe(method(setEnableFallback:))]
8415        #[unsafe(method_family = none)]
8416        pub unsafe fn setEnableFallback(&self, enable_fallback: bool);
8417
8418        /// Maximum Transmission Unit (MTU) size in bytes to assign to the tunnel interface.
8419        #[unsafe(method(mtu))]
8420        #[unsafe(method_family = none)]
8421        pub unsafe fn mtu(&self) -> NSUInteger;
8422
8423        /// Setter for [`mtu`][Self::mtu].
8424        #[unsafe(method(setMtu:))]
8425        #[unsafe(method_family = none)]
8426        pub unsafe fn setMtu(&self, mtu: NSUInteger);
8427
8428        /// Configuration for the use of a Post-quantum Pre-shared Key (PPK).
8429        #[unsafe(method(ppkConfiguration))]
8430        #[unsafe(method_family = none)]
8431        pub unsafe fn ppkConfiguration(&self) -> Option<Retained<NEVPNIKEv2PPKConfiguration>>;
8432
8433        /// Setter for [`ppkConfiguration`][Self::ppkConfiguration].
8434        #[unsafe(method(setPpkConfiguration:))]
8435        #[unsafe(method_family = none)]
8436        pub unsafe fn setPpkConfiguration(
8437            &self,
8438            ppk_configuration: Option<&NEVPNIKEv2PPKConfiguration>,
8439        );
8440    );
8441}
8442
8443/// Methods declared on superclass `NSObject`.
8444impl NEVPNProtocolIKEv2 {
8445    extern_methods!(
8446        #[unsafe(method(init))]
8447        #[unsafe(method_family = init)]
8448        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8449
8450        #[unsafe(method(new))]
8451        #[unsafe(method_family = new)]
8452        pub unsafe fn new() -> Retained<Self>;
8453    );
8454}
8455
8456extern "C" {
8457    /// [Apple's documentation](https://developer.apple.com/documentation/networkextension/neapppusherrordomain?language=objc)
8458    pub static NEAppPushErrorDomain: &'static NSErrorDomain;
8459}
8460
8461/// App Push Manager error codes
8462///
8463/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neapppushmanagererror?language=objc)
8464#[repr(transparent)]
8465#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
8466pub struct NEAppPushManagerError(pub NSInteger);
8467impl NEAppPushManagerError {
8468    #[doc(alias = "NEAppPushManagerErrorConfigurationInvalid")]
8469    pub const ConfigurationInvalid: Self = Self(1);
8470    #[doc(alias = "NEAppPushManagerErrorConfigurationNotLoaded")]
8471    pub const ConfigurationNotLoaded: Self = Self(2);
8472    #[doc(alias = "NEAppPushManagerErrorInternalError")]
8473    pub const InternalError: Self = Self(3);
8474    #[doc(alias = "NEAppPushManagerErrorInactiveSession")]
8475    pub const InactiveSession: Self = Self(4);
8476}
8477
8478unsafe impl Encode for NEAppPushManagerError {
8479    const ENCODING: Encoding = NSInteger::ENCODING;
8480}
8481
8482unsafe impl RefEncode for NEAppPushManagerError {
8483    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
8484}
8485
8486extern_class!(
8487    /// The NEPrivateLTENetwork class declares an object that contains the parameters of a private LTE network.
8488    ///
8489    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neprivateltenetwork?language=objc)
8490    #[unsafe(super(NSObject))]
8491    #[derive(Debug, PartialEq, Eq, Hash)]
8492    pub struct NEPrivateLTENetwork;
8493);
8494
8495unsafe impl NSCoding for NEPrivateLTENetwork {}
8496
8497unsafe impl NSCopying for NEPrivateLTENetwork {}
8498
8499unsafe impl CopyingHelper for NEPrivateLTENetwork {
8500    type Result = Self;
8501}
8502
8503unsafe impl NSObjectProtocol for NEPrivateLTENetwork {}
8504
8505unsafe impl NSSecureCoding for NEPrivateLTENetwork {}
8506
8507impl NEPrivateLTENetwork {
8508    extern_methods!(
8509        /// Mobile Country Code of the private LTE network.
8510        #[unsafe(method(mobileCountryCode))]
8511        #[unsafe(method_family = none)]
8512        pub unsafe fn mobileCountryCode(&self) -> Retained<NSString>;
8513
8514        /// Setter for [`mobileCountryCode`][Self::mobileCountryCode].
8515        #[unsafe(method(setMobileCountryCode:))]
8516        #[unsafe(method_family = none)]
8517        pub unsafe fn setMobileCountryCode(&self, mobile_country_code: &NSString);
8518
8519        /// Mobile Network Code of the private LTE network.
8520        #[unsafe(method(mobileNetworkCode))]
8521        #[unsafe(method_family = none)]
8522        pub unsafe fn mobileNetworkCode(&self) -> Retained<NSString>;
8523
8524        /// Setter for [`mobileNetworkCode`][Self::mobileNetworkCode].
8525        #[unsafe(method(setMobileNetworkCode:))]
8526        #[unsafe(method_family = none)]
8527        pub unsafe fn setMobileNetworkCode(&self, mobile_network_code: &NSString);
8528
8529        /// Tracking Area Code of the private LTE network. This property is only applicable for band 48 private LTE networks.
8530        #[unsafe(method(trackingAreaCode))]
8531        #[unsafe(method_family = none)]
8532        pub unsafe fn trackingAreaCode(&self) -> Option<Retained<NSString>>;
8533
8534        /// Setter for [`trackingAreaCode`][Self::trackingAreaCode].
8535        #[unsafe(method(setTrackingAreaCode:))]
8536        #[unsafe(method_family = none)]
8537        pub unsafe fn setTrackingAreaCode(&self, tracking_area_code: Option<&NSString>);
8538    );
8539}
8540
8541/// Methods declared on superclass `NSObject`.
8542impl NEPrivateLTENetwork {
8543    extern_methods!(
8544        #[unsafe(method(init))]
8545        #[unsafe(method_family = init)]
8546        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8547
8548        #[unsafe(method(new))]
8549        #[unsafe(method_family = new)]
8550        pub unsafe fn new() -> Retained<Self>;
8551    );
8552}
8553
8554extern_class!(
8555    /// The NEAppPushManager class declares a programmatic interface to configure NEAppPushProvider.
8556    ///
8557    /// NEAppPushManager declares methods and properties for configuring and managing life cycle of app push provider.
8558    ///
8559    /// Instances of this class are thread safe.
8560    ///
8561    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neapppushmanager?language=objc)
8562    #[unsafe(super(NSObject))]
8563    #[derive(Debug, PartialEq, Eq, Hash)]
8564    pub struct NEAppPushManager;
8565);
8566
8567unsafe impl NSObjectProtocol for NEAppPushManager {}
8568
8569impl NEAppPushManager {
8570    extern_methods!(
8571        /// 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
8572        /// is started. The upper limit of number of SSIDs is 10.
8573        #[unsafe(method(matchSSIDs))]
8574        #[unsafe(method_family = none)]
8575        pub unsafe fn matchSSIDs(&self) -> Retained<NSArray<NSString>>;
8576
8577        /// Setter for [`matchSSIDs`][Self::matchSSIDs].
8578        #[unsafe(method(setMatchSSIDs:))]
8579        #[unsafe(method_family = none)]
8580        pub unsafe fn setMatchSSIDs(&self, match_ssi_ds: &NSArray<NSString>);
8581
8582        /// An array of NEPrivateLTENetwork objects. If the properties of current private LTE network match with properties of one of these NEPrivateLTENetwork objects then the
8583        /// 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
8584        #[unsafe(method(matchPrivateLTENetworks))]
8585        #[unsafe(method_family = none)]
8586        pub unsafe fn matchPrivateLTENetworks(&self) -> Retained<NSArray<NEPrivateLTENetwork>>;
8587
8588        /// Setter for [`matchPrivateLTENetworks`][Self::matchPrivateLTENetworks].
8589        #[unsafe(method(setMatchPrivateLTENetworks:))]
8590        #[unsafe(method_family = none)]
8591        pub unsafe fn setMatchPrivateLTENetworks(
8592            &self,
8593            match_private_lte_networks: &NSArray<NEPrivateLTENetwork>,
8594        );
8595
8596        /// 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
8597        /// type are not supported. This dictionary is passed as-is to NEAppPushProvider when is it is started or notified for other specified reasons.
8598        #[unsafe(method(providerConfiguration))]
8599        #[unsafe(method_family = none)]
8600        pub unsafe fn providerConfiguration(&self) -> Retained<NSDictionary<NSString, AnyObject>>;
8601
8602        /// Setter for [`providerConfiguration`][Self::providerConfiguration].
8603        #[unsafe(method(setProviderConfiguration:))]
8604        #[unsafe(method_family = none)]
8605        pub unsafe fn setProviderConfiguration(
8606            &self,
8607            provider_configuration: &NSDictionary<NSString, AnyObject>,
8608        );
8609
8610        /// A string containing the bundle identifier of the NEAppPushProvider.
8611        #[unsafe(method(providerBundleIdentifier))]
8612        #[unsafe(method_family = none)]
8613        pub unsafe fn providerBundleIdentifier(&self) -> Option<Retained<NSString>>;
8614
8615        /// Setter for [`providerBundleIdentifier`][Self::providerBundleIdentifier].
8616        #[unsafe(method(setProviderBundleIdentifier:))]
8617        #[unsafe(method_family = none)]
8618        pub unsafe fn setProviderBundleIdentifier(
8619            &self,
8620            provider_bundle_identifier: Option<&NSString>,
8621        );
8622
8623        /// An instance of type NEAppPushDelegate that is required to receive incoming call informarion from the provider.
8624        #[unsafe(method(delegate))]
8625        #[unsafe(method_family = none)]
8626        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NEAppPushDelegate>>>;
8627
8628        /// This is a [weak property][objc2::topics::weak_property].
8629        /// Setter for [`delegate`][Self::delegate].
8630        #[unsafe(method(setDelegate:))]
8631        #[unsafe(method_family = none)]
8632        pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NEAppPushDelegate>>);
8633
8634        #[cfg(feature = "block2")]
8635        /// This class method asynchronously reads all of the saved configurations and returns them as an array of NEAppPushManager objects.
8636        ///
8637        /// Parameter `completionHandler`: A block that takes an array of NEAppPushManager objects. The array passed to the block may be empty if no configurations
8638        /// were successfully read from the disk. The NSError object passed to this block will be nil if the load operation succeeded, non-nil otherwise.
8639        #[unsafe(method(loadAllFromPreferencesWithCompletionHandler:))]
8640        #[unsafe(method_family = none)]
8641        pub unsafe fn loadAllFromPreferencesWithCompletionHandler(
8642            completion_handler: &block2::Block<
8643                dyn Fn(*mut NSArray<NEAppPushManager>, *mut NSError),
8644            >,
8645        );
8646
8647        #[cfg(feature = "block2")]
8648        /// This method loads the saved configuration from the persistent store.
8649        ///
8650        /// 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.
8651        #[unsafe(method(loadFromPreferencesWithCompletionHandler:))]
8652        #[unsafe(method_family = none)]
8653        pub unsafe fn loadFromPreferencesWithCompletionHandler(
8654            &self,
8655            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
8656        );
8657
8658        #[cfg(feature = "block2")]
8659        /// This method removes the configuration from the persistent store.
8660        ///
8661        /// 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.
8662        #[unsafe(method(removeFromPreferencesWithCompletionHandler:))]
8663        #[unsafe(method_family = none)]
8664        pub unsafe fn removeFromPreferencesWithCompletionHandler(
8665            &self,
8666            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
8667        );
8668
8669        #[cfg(feature = "block2")]
8670        /// This method saves the configuration in the persistent store.
8671        ///
8672        /// 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.
8673        #[unsafe(method(saveToPreferencesWithCompletionHandler:))]
8674        #[unsafe(method_family = none)]
8675        pub unsafe fn saveToPreferencesWithCompletionHandler(
8676            &self,
8677            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
8678        );
8679
8680        /// A string containing a description of the app push manager.
8681        #[unsafe(method(localizedDescription))]
8682        #[unsafe(method_family = none)]
8683        pub unsafe fn localizedDescription(&self) -> Option<Retained<NSString>>;
8684
8685        /// Setter for [`localizedDescription`][Self::localizedDescription].
8686        #[unsafe(method(setLocalizedDescription:))]
8687        #[unsafe(method_family = none)]
8688        pub unsafe fn setLocalizedDescription(&self, localized_description: Option<&NSString>);
8689
8690        /// 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.
8691        #[unsafe(method(isEnabled))]
8692        #[unsafe(method_family = none)]
8693        pub unsafe fn isEnabled(&self) -> bool;
8694
8695        /// Setter for [`isEnabled`][Self::isEnabled].
8696        #[unsafe(method(setEnabled:))]
8697        #[unsafe(method_family = none)]
8698        pub unsafe fn setEnabled(&self, enabled: bool);
8699
8700        /// If set to YES, it indicates the associated configuration is in use. Use KVO to watch for changes.
8701        #[unsafe(method(isActive))]
8702        #[unsafe(method_family = none)]
8703        pub unsafe fn isActive(&self) -> bool;
8704    );
8705}
8706
8707/// Methods declared on superclass `NSObject`.
8708impl NEAppPushManager {
8709    extern_methods!(
8710        #[unsafe(method(init))]
8711        #[unsafe(method_family = init)]
8712        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8713
8714        #[unsafe(method(new))]
8715        #[unsafe(method_family = new)]
8716        pub unsafe fn new() -> Retained<Self>;
8717    );
8718}
8719
8720extern_protocol!(
8721    /// Delegate for NEAppPushManager.
8722    ///
8723    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neapppushdelegate?language=objc)
8724    pub unsafe trait NEAppPushDelegate: NSObjectProtocol {
8725        /// This delegate method is called when the provider reports incoming call using reportIncomingCommunicationWithUserInfo method.
8726        ///
8727        /// Parameter `userInfo`: A dictionary of custom information that the provider passes to reportIncomingCommunicationWithUserInfo method.
8728        #[unsafe(method(appPushManager:didReceiveIncomingCallWithUserInfo:))]
8729        #[unsafe(method_family = none)]
8730        unsafe fn appPushManager_didReceiveIncomingCallWithUserInfo(
8731            &self,
8732            manager: &NEAppPushManager,
8733            user_info: &NSDictionary,
8734        );
8735    }
8736);
8737
8738extern_class!(
8739    /// The NEAppPushProvider class declares a programmatic interface to manage a life cycle of app push provider. It also allows the provider to handle outgoing
8740    /// communication message from the containing app, and pass incoming call message to the containing app.
8741    /// NEAppPushProvider is part of NetworkExtension.framework
8742    ///
8743    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/neapppushprovider?language=objc)
8744    #[unsafe(super(NEProvider, NSObject))]
8745    #[derive(Debug, PartialEq, Eq, Hash)]
8746    pub struct NEAppPushProvider;
8747);
8748
8749unsafe impl NSObjectProtocol for NEAppPushProvider {}
8750
8751impl NEAppPushProvider {
8752    extern_methods!(
8753        /// A dictionary containing current vendor-specific configuration parameters. This dictionary is provided by NEAppPushManager. Use KVO to watch for changes.
8754        #[unsafe(method(providerConfiguration))]
8755        #[unsafe(method_family = none)]
8756        pub unsafe fn providerConfiguration(
8757            &self,
8758        ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
8759
8760        #[cfg(feature = "block2")]
8761        /// This method is called by the framework when the provider is started. Subclasses must override this method to create a connection with its server.
8762        ///
8763        /// 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,
8764        /// 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
8765        /// was successfully created.
8766        #[deprecated]
8767        #[unsafe(method(startWithCompletionHandler:))]
8768        #[unsafe(method_family = none)]
8769        pub unsafe fn startWithCompletionHandler(
8770            &self,
8771            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
8772        );
8773
8774        /// This method is called by the framework when the provider is started. Subclasses must override this method to create a connection with its server.
8775        #[unsafe(method(start))]
8776        #[unsafe(method_family = none)]
8777        pub unsafe fn start(&self);
8778
8779        #[cfg(feature = "block2")]
8780        /// 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.
8781        ///
8782        /// Parameter `reason`: An NEProviderStopReason indicating why the provider was stopped.
8783        ///
8784        /// Parameter `completionHandler`: A block that must be called when the provider is completely stopped.
8785        #[unsafe(method(stopWithReason:completionHandler:))]
8786        #[unsafe(method_family = none)]
8787        pub unsafe fn stopWithReason_completionHandler(
8788            &self,
8789            reason: NEProviderStopReason,
8790            completion_handler: &block2::Block<dyn Fn()>,
8791        );
8792
8793        /// This function is called by the provider when it determines incoming call on the conection.
8794        ///
8795        /// Parameter `userInfo`: A dictionary of custom information associated with the incoming call. This dictionary is passed to containg app as-is.
8796        #[unsafe(method(reportIncomingCallWithUserInfo:))]
8797        #[unsafe(method_family = none)]
8798        pub unsafe fn reportIncomingCallWithUserInfo(&self, user_info: &NSDictionary);
8799
8800        /// This function is called by the provider when it receives a Push to Talk message on the connection.
8801        ///
8802        /// 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.
8803        #[unsafe(method(reportPushToTalkMessageWithUserInfo:))]
8804        #[unsafe(method_family = none)]
8805        pub unsafe fn reportPushToTalkMessageWithUserInfo(&self, user_info: &NSDictionary);
8806
8807        /// This method is called by the framework periodically after every 60 seconds. Subclasses must override this method to perform necessary tasks.
8808        #[unsafe(method(handleTimerEvent))]
8809        #[unsafe(method_family = none)]
8810        pub unsafe fn handleTimerEvent(&self);
8811    );
8812}
8813
8814/// Methods declared on superclass `NSObject`.
8815impl NEAppPushProvider {
8816    extern_methods!(
8817        #[unsafe(method(init))]
8818        #[unsafe(method_family = init)]
8819        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8820
8821        #[unsafe(method(new))]
8822        #[unsafe(method_family = new)]
8823        pub unsafe fn new() -> Retained<Self>;
8824    );
8825}
8826
8827extern_class!(
8828    /// NWEndpoint is a generic class to represent network endpoints, such as a port on a remote server.
8829    ///
8830    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwendpoint?language=objc)
8831    #[unsafe(super(NSObject))]
8832    #[derive(Debug, PartialEq, Eq, Hash)]
8833    #[deprecated = "Use nw_endpoint_t in Network framework instead, see deprecation notice in <NetworkExtension/NWEndpoint.h>"]
8834    pub struct NWEndpoint;
8835);
8836
8837unsafe impl NSCoding for NWEndpoint {}
8838
8839unsafe impl NSCopying for NWEndpoint {}
8840
8841unsafe impl CopyingHelper for NWEndpoint {
8842    type Result = Self;
8843}
8844
8845unsafe impl NSObjectProtocol for NWEndpoint {}
8846
8847unsafe impl NSSecureCoding for NWEndpoint {}
8848
8849impl NWEndpoint {
8850    extern_methods!();
8851}
8852
8853/// Methods declared on superclass `NSObject`.
8854impl NWEndpoint {
8855    extern_methods!(
8856        #[unsafe(method(init))]
8857        #[unsafe(method_family = init)]
8858        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8859
8860        #[unsafe(method(new))]
8861        #[unsafe(method_family = new)]
8862        pub unsafe fn new() -> Retained<Self>;
8863    );
8864}
8865
8866extern_class!(
8867    /// NWHostEndpoint is a subclass of NWEndpoint. It represents an endpoint backed by a
8868    /// hostname and port. Note that a hostname string may be an IP or IPv6 address.
8869    ///
8870    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwhostendpoint?language=objc)
8871    #[unsafe(super(NWEndpoint, NSObject))]
8872    #[derive(Debug, PartialEq, Eq, Hash)]
8873    #[deprecated = "Use `nw_endpoint_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWHostEndpoint.h>"]
8874    pub struct NWHostEndpoint;
8875);
8876
8877unsafe impl NSCoding for NWHostEndpoint {}
8878
8879unsafe impl NSCopying for NWHostEndpoint {}
8880
8881unsafe impl CopyingHelper for NWHostEndpoint {
8882    type Result = Self;
8883}
8884
8885unsafe impl NSObjectProtocol for NWHostEndpoint {}
8886
8887unsafe impl NSSecureCoding for NWHostEndpoint {}
8888
8889impl NWHostEndpoint {
8890    extern_methods!(
8891        /// Parameter `hostname`: A string representation of the hostname or address, such as www.apple.com or 10.0.0.1.
8892        ///
8893        /// Parameter `port`: A string containing the port on the host, such as 80.
8894        ///
8895        /// Returns: An initialized NWHostEndpoint object.
8896        #[deprecated = "Use `nw_endpoint_create_host` in Network framework instead, see deprecation notice in <NetworkExtension/NWHostEndpoint.h>"]
8897        #[unsafe(method(endpointWithHostname:port:))]
8898        #[unsafe(method_family = none)]
8899        pub unsafe fn endpointWithHostname_port(
8900            hostname: &NSString,
8901            port: &NSString,
8902        ) -> Retained<Self>;
8903
8904        /// The endpoint's hostname.
8905        #[deprecated = "Use `nw_endpoint_get_hostname` in Network framework instead, see deprecation notice in <NetworkExtension/NWHostEndpoint.h>"]
8906        #[unsafe(method(hostname))]
8907        #[unsafe(method_family = none)]
8908        pub unsafe fn hostname(&self) -> Retained<NSString>;
8909
8910        /// The endpoint's port.
8911        #[deprecated = "Use `nw_endpoint_get_port` in Network framework instead, see deprecation notice in <NetworkExtension/NWHostEndpoint.h>"]
8912        #[unsafe(method(port))]
8913        #[unsafe(method_family = none)]
8914        pub unsafe fn port(&self) -> Retained<NSString>;
8915    );
8916}
8917
8918/// Methods declared on superclass `NSObject`.
8919impl NWHostEndpoint {
8920    extern_methods!(
8921        #[unsafe(method(init))]
8922        #[unsafe(method_family = init)]
8923        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8924
8925        #[unsafe(method(new))]
8926        #[unsafe(method_family = new)]
8927        pub unsafe fn new() -> Retained<Self>;
8928    );
8929}
8930
8931extern_class!(
8932    /// NWBonjourServiceEndpoint is a subclass of NWEndpoint. It represents an endpoint
8933    /// backed by a Bonjour service, specified with a name, type, and domain. For example, the
8934    /// Bonjour service MyMusicStudio._music._tcp.local. has the name "MyMusicStudio",
8935    /// the type "_music._tcp", and the domain "local".
8936    ///
8937    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwbonjourserviceendpoint?language=objc)
8938    #[unsafe(super(NWEndpoint, NSObject))]
8939    #[derive(Debug, PartialEq, Eq, Hash)]
8940    #[deprecated = "Use `nw_endpoint_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWBonjourServiceEndpoint.h>"]
8941    pub struct NWBonjourServiceEndpoint;
8942);
8943
8944unsafe impl NSCoding for NWBonjourServiceEndpoint {}
8945
8946unsafe impl NSCopying for NWBonjourServiceEndpoint {}
8947
8948unsafe impl CopyingHelper for NWBonjourServiceEndpoint {
8949    type Result = Self;
8950}
8951
8952unsafe impl NSObjectProtocol for NWBonjourServiceEndpoint {}
8953
8954unsafe impl NSSecureCoding for NWBonjourServiceEndpoint {}
8955
8956impl NWBonjourServiceEndpoint {
8957    extern_methods!(
8958        /// Parameter `name`: The Bonjour service name.
8959        ///
8960        /// Parameter `type`: The Bonjour service type.
8961        ///
8962        /// Parameter `domain`: The Bonjour service domain.
8963        ///
8964        /// Returns: An initialized NWBonjourServiceEndpoint object.
8965        #[deprecated = "Use `nw_endpoint_create_bonjour_service` in Network framework instead, see deprecation notice in <NetworkExtension/NWBonjourServiceEndpoint.h>"]
8966        #[unsafe(method(endpointWithName:type:domain:))]
8967        #[unsafe(method_family = none)]
8968        pub unsafe fn endpointWithName_type_domain(
8969            name: &NSString,
8970            r#type: &NSString,
8971            domain: &NSString,
8972        ) -> Retained<Self>;
8973
8974        /// The endpoint's Bonjour service name.
8975        #[deprecated = "Use `nw_endpoint_get_bonjour_service_name` in Network framework instead, see deprecation notice in <NetworkExtension/NWBonjourServiceEndpoint.h>"]
8976        #[unsafe(method(name))]
8977        #[unsafe(method_family = none)]
8978        pub unsafe fn name(&self) -> Retained<NSString>;
8979
8980        /// The endpoint's Bonjour service type.
8981        #[deprecated = "Use `nw_endpoint_get_bonjour_service_type` in Network framework instead, see deprecation notice in <NetworkExtension/NWBonjourServiceEndpoint.h>"]
8982        #[unsafe(method(type))]
8983        #[unsafe(method_family = none)]
8984        pub unsafe fn r#type(&self) -> Retained<NSString>;
8985
8986        /// The endpoint's Bonjour service domain.
8987        #[deprecated = "Use `nw_endpoint_get_bonjour_service_domain` in Network framework instead, see deprecation notice in <NetworkExtension/NWBonjourServiceEndpoint.h>"]
8988        #[unsafe(method(domain))]
8989        #[unsafe(method_family = none)]
8990        pub unsafe fn domain(&self) -> Retained<NSString>;
8991    );
8992}
8993
8994/// Methods declared on superclass `NSObject`.
8995impl NWBonjourServiceEndpoint {
8996    extern_methods!(
8997        #[unsafe(method(init))]
8998        #[unsafe(method_family = init)]
8999        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9000
9001        #[unsafe(method(new))]
9002        #[unsafe(method_family = new)]
9003        pub unsafe fn new() -> Retained<Self>;
9004    );
9005}
9006
9007/// Path status values
9008///
9009/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwpathstatus?language=objc)
9010// NS_ENUM
9011#[deprecated = "Use `nw_path_status_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWPath.h>"]
9012#[repr(transparent)]
9013#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
9014pub struct NWPathStatus(pub NSInteger);
9015impl NWPathStatus {
9016    #[deprecated = "Use `nw_path_status_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWPath.h>"]
9017    #[doc(alias = "NWPathStatusInvalid")]
9018    pub const Invalid: Self = Self(0);
9019    #[deprecated = "Use `nw_path_status_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWPath.h>"]
9020    #[doc(alias = "NWPathStatusSatisfied")]
9021    pub const Satisfied: Self = Self(1);
9022    #[deprecated = "Use `nw_path_status_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWPath.h>"]
9023    #[doc(alias = "NWPathStatusUnsatisfied")]
9024    pub const Unsatisfied: Self = Self(2);
9025    /// a connection attempt.
9026    #[deprecated = "Use `nw_path_status_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWPath.h>"]
9027    #[doc(alias = "NWPathStatusSatisfiable")]
9028    pub const Satisfiable: Self = Self(3);
9029}
9030
9031unsafe impl Encode for NWPathStatus {
9032    const ENCODING: Encoding = NSInteger::ENCODING;
9033}
9034
9035unsafe impl RefEncode for NWPathStatus {
9036    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
9037}
9038
9039extern_class!(
9040    /// A network path, represented with NWPath, expresses the viability status and
9041    /// properties of the path that a networking connection will take on the device. For example,
9042    /// if the path status is NWPathStatusSatisfied, then a connection could use that path.
9043    ///
9044    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwpath?language=objc)
9045    #[unsafe(super(NSObject))]
9046    #[derive(Debug, PartialEq, Eq, Hash)]
9047    #[deprecated = "Use `nw_path_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWPath.h>"]
9048    pub struct NWPath;
9049);
9050
9051unsafe impl NSObjectProtocol for NWPath {}
9052
9053impl NWPath {
9054    extern_methods!(
9055        /// The evaluated NWPathStatus of the NWPath.
9056        #[deprecated = "Use `nw_path_get_status` in Network framework instead, see deprecation notice in <NetworkExtension/NWPath.h>"]
9057        #[unsafe(method(status))]
9058        #[unsafe(method_family = none)]
9059        pub unsafe fn status(&self) -> NWPathStatus;
9060
9061        /// Returns YES if the path is considered expensive, as when using a cellular data plan.
9062        #[deprecated = "Use `nw_path_is_expensive` in Network framework instead, see deprecation notice in <NetworkExtension/NWPath.h>"]
9063        #[unsafe(method(isExpensive))]
9064        #[unsafe(method_family = none)]
9065        pub unsafe fn isExpensive(&self) -> bool;
9066
9067        /// Returns YES if the path is considered constrained, as when it is in save data mode.
9068        #[deprecated = "Use `nw_path_is_constrained` in Network framework instead, see deprecation notice in <NetworkExtension/NWPath.h>"]
9069        #[unsafe(method(isConstrained))]
9070        #[unsafe(method_family = none)]
9071        pub unsafe fn isConstrained(&self) -> bool;
9072
9073        /// Parameter `path`: An NWPath object to compare.
9074        ///
9075        /// Returns: YES if the two path objects have the same content, NO otherwise.
9076        #[deprecated = "Use `nw_path_is_equal` in Network framework instead, see deprecation notice in <NetworkExtension/NWPath.h>"]
9077        #[unsafe(method(isEqualToPath:))]
9078        #[unsafe(method_family = none)]
9079        pub unsafe fn isEqualToPath(&self, path: &NWPath) -> bool;
9080    );
9081}
9082
9083/// Methods declared on superclass `NSObject`.
9084impl NWPath {
9085    extern_methods!(
9086        #[unsafe(method(init))]
9087        #[unsafe(method_family = init)]
9088        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9089
9090        #[unsafe(method(new))]
9091        #[unsafe(method_family = new)]
9092        pub unsafe fn new() -> Retained<Self>;
9093    );
9094}
9095
9096/// Defined connection states. New types may be defined in the future.
9097///
9098/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwtcpconnectionstate?language=objc)
9099// NS_ENUM
9100#[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9101#[repr(transparent)]
9102#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
9103pub struct NWTCPConnectionState(pub NSInteger);
9104impl NWTCPConnectionState {
9105    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9106    #[doc(alias = "NWTCPConnectionStateInvalid")]
9107    pub const Invalid: Self = Self(0);
9108    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9109    #[doc(alias = "NWTCPConnectionStateConnecting")]
9110    pub const Connecting: Self = Self(1);
9111    /// waiting for better condition(s) before trying again.
9112    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9113    #[doc(alias = "NWTCPConnectionStateWaiting")]
9114    pub const Waiting: Self = Self(2);
9115    /// to transfer data. If TLS is in use, the TLS handshake would have finished when the connection
9116    /// is in this state.
9117    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9118    #[doc(alias = "NWTCPConnectionStateConnected")]
9119    pub const Connected: Self = Self(3);
9120    /// possible to transfer data. The application should call cancellation method to clean up resources
9121    /// when the connection is in this state.
9122    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9123    #[doc(alias = "NWTCPConnectionStateDisconnected")]
9124    pub const Disconnected: Self = Self(4);
9125    /// the cancellation method.
9126    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9127    #[doc(alias = "NWTCPConnectionStateCancelled")]
9128    pub const Cancelled: Self = Self(5);
9129}
9130
9131unsafe impl Encode for NWTCPConnectionState {
9132    const ENCODING: Encoding = NSInteger::ENCODING;
9133}
9134
9135unsafe impl RefEncode for NWTCPConnectionState {
9136    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
9137}
9138
9139extern_class!(
9140    /// Establish TCP connections to an endpoint, and send and receive data on the TCP connection.
9141    ///
9142    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwtcpconnection?language=objc)
9143    #[unsafe(super(NSObject))]
9144    #[derive(Debug, PartialEq, Eq, Hash)]
9145    #[deprecated = "Use `nw_connection_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9146    pub struct NWTCPConnection;
9147);
9148
9149unsafe impl NSObjectProtocol for NWTCPConnection {}
9150
9151impl NWTCPConnection {
9152    extern_methods!(
9153        /// This convenience initializer can be used to create a new connection that would only
9154        /// be connected if there exists a better path (as determined by the system) to the destination
9155        /// endpoint of the original connection. It will be initialized using the same destination endpoint
9156        /// and set of parameters from the original connection.
9157        ///
9158        /// If the original connection becomes disconnected or cancelled, the new "upgrade" connection
9159        /// would automatically be considered better.
9160        ///
9161        /// The caller should create an NWTCPConnection and watch for the hasBetterPath property.
9162        /// When this property is YES, the caller should attempt to create a new upgrade
9163        /// connection, with the goal to start transferring data on the new better path as soon as
9164        /// possible to reduce power and potentially monetary cost. When the new upgrade connection
9165        /// becomes connected and when the caller wraps up the previous caller session on
9166        /// the original connection, the caller can start using the new upgrade connection and
9167        /// tear down the original one.
9168        ///
9169        ///
9170        /// Parameter `connection`: The original connection from which the caller will upgrade
9171        ///
9172        /// Returns: An initialized NWTCPConnection
9173        #[deprecated = "Use `nw_connection_create` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9174        #[unsafe(method(initWithUpgradeForConnection:))]
9175        #[unsafe(method_family = init)]
9176        pub unsafe fn initWithUpgradeForConnection(
9177            this: Allocated<Self>,
9178            connection: &NWTCPConnection,
9179        ) -> Retained<Self>;
9180
9181        /// The status of the connection. Use KVO to watch this property to get updates.
9182        #[deprecated = "Use `nw_connection_set_state_changed_handler` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9183        #[unsafe(method(state))]
9184        #[unsafe(method_family = none)]
9185        pub unsafe fn state(&self) -> NWTCPConnectionState;
9186
9187        /// YES if the connection can read and write data, NO otherwise. Use KVO to watch this property.
9188        #[deprecated = "Use `nw_connection_set_viability_changed_handler` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9189        #[unsafe(method(isViable))]
9190        #[unsafe(method_family = none)]
9191        pub unsafe fn isViable(&self) -> bool;
9192
9193        /// YES if the system determines there is a better path the destination can be reached if
9194        /// the caller creates a new connection using the same endpoint and parameters. This can
9195        /// be done using the convenience upgrade initializer method.
9196        /// Use KVO to watch this property to get updates.
9197        #[deprecated = "Use `nw_connection_set_better_path_available_handler` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9198        #[unsafe(method(hasBetterPath))]
9199        #[unsafe(method_family = none)]
9200        pub unsafe fn hasBetterPath(&self) -> bool;
9201
9202        /// The destination endpoint with which this connection was created.
9203        #[deprecated = "Use `nw_connection_copy_endpoint` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9204        #[unsafe(method(endpoint))]
9205        #[unsafe(method_family = none)]
9206        pub unsafe fn endpoint(&self) -> Retained<NWEndpoint>;
9207
9208        /// The network path over which the connection was established. The caller can query
9209        /// additional properties from the NWPath object for more information.
9210        ///
9211        /// Note that this contains a snapshot of information at the time of connection establishment
9212        /// for this connection only. As a result, some underlying properties might change in time and
9213        /// might not reflect the path for other connections that might be established at different times.
9214        #[deprecated = "Use `nw_connection_copy_current_path` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9215        #[unsafe(method(connectedPath))]
9216        #[unsafe(method_family = none)]
9217        pub unsafe fn connectedPath(&self) -> Option<Retained<NWPath>>;
9218
9219        /// The IP address endpoint from which the connection was connected.
9220        #[deprecated = "Use `nw_path_copy_effective_local_endpoint` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9221        #[unsafe(method(localAddress))]
9222        #[unsafe(method_family = none)]
9223        pub unsafe fn localAddress(&self) -> Option<Retained<NWEndpoint>>;
9224
9225        /// The IP address endpoint to which the connection was connected.
9226        #[deprecated = "Use `nw_path_copy_effective_remote_endpoint` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9227        #[unsafe(method(remoteAddress))]
9228        #[unsafe(method_family = none)]
9229        pub unsafe fn remoteAddress(&self) -> Option<Retained<NWEndpoint>>;
9230
9231        /// When the connection is connected to a Bonjour service endpoint, the TXT record associated
9232        /// with the Bonjour service is available via this property. Beware that the value comes from
9233        /// the network. Care must be taken when parsing this potentially malicious value.
9234        #[deprecated = "Use `nw_endpoint_copy_txt_record` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9235        #[unsafe(method(txtRecord))]
9236        #[unsafe(method_family = none)]
9237        pub unsafe fn txtRecord(&self) -> Option<Retained<NSData>>;
9238
9239        /// The connection-wide error property indicates any fatal error that occurred while
9240        /// processing the connection or performing data reading or writing.
9241        #[deprecated = "Use `nw_connection_set_state_changed_handler` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9242        #[unsafe(method(error))]
9243        #[unsafe(method_family = none)]
9244        pub unsafe fn error(&self) -> Option<Retained<NSError>>;
9245
9246        /// Cancel the connection. This will clean up the resources associated with this object
9247        /// and transition this object to NWTCPConnectionStateCancelled state.
9248        #[deprecated = "Use `nw_connection_cancel` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9249        #[unsafe(method(cancel))]
9250        #[unsafe(method_family = none)]
9251        pub unsafe fn cancel(&self);
9252
9253        #[cfg(feature = "block2")]
9254        /// Read "length" number of bytes. See readMinimumLength:maximumLength:completionHandler:
9255        /// for a complete discussion of the callback behavior.
9256        ///
9257        /// Parameter `length`: The exact number of bytes the application wants to read
9258        ///
9259        /// Parameter `completion`: The completion handler to be invoked when there is data to read or an error occurred
9260        #[deprecated = "Use `nw_connection_receive` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9261        #[unsafe(method(readLength:completionHandler:))]
9262        #[unsafe(method_family = none)]
9263        pub unsafe fn readLength_completionHandler(
9264            &self,
9265            length: NSUInteger,
9266            completion: &block2::Block<dyn Fn(*mut NSData, *mut NSError)>,
9267        );
9268
9269        #[cfg(feature = "block2")]
9270        /// Read the requested range of bytes. The completion handler will be invoked when:
9271        /// - Exactly "length" number of bytes have been read. 'data' will be non-nil.
9272        ///
9273        /// - Fewer than "length" number of bytes, including 0 bytes, have been read, and the connection's
9274        /// read side has been closed. 'data' might be nil, depending on whether there was any data to be
9275        /// read when the connection's read side was closed.
9276        ///
9277        /// - Some fatal error has occurred, and 'data' will be nil.
9278        ///
9279        /// To know when to schedule a read again, check for the condition whether an error has occurred.
9280        ///
9281        /// For better performance, the caller should pick the effective minimum and maximum lengths.
9282        /// For example, if the caller absolutely needs a specific number of bytes before it can
9283        /// make any progress, use that value as the minimum. The maximum bytes can be the upperbound
9284        /// that the caller wants to read. Typically, the minimum length can be the caller
9285        /// protocol fixed-size header and the maximum length can be the maximum size of the payload or
9286        /// the size of the current read buffer.
9287        ///
9288        ///
9289        /// Parameter `minimum`: The minimum number of bytes the caller wants to read
9290        ///
9291        /// Parameter `maximum`: The maximum number of bytes the caller wants to read
9292        ///
9293        /// Parameter `completion`: The completion handler to be invoked when there is data to read or an error occurred
9294        #[deprecated = "Use `nw_connection_receive` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9295        #[unsafe(method(readMinimumLength:maximumLength:completionHandler:))]
9296        #[unsafe(method_family = none)]
9297        pub unsafe fn readMinimumLength_maximumLength_completionHandler(
9298            &self,
9299            minimum: NSUInteger,
9300            maximum: NSUInteger,
9301            completion: &block2::Block<dyn Fn(*mut NSData, *mut NSError)>,
9302        );
9303
9304        #[cfg(feature = "block2")]
9305        /// Write the given data object content. Callers should wait until the completionHandler is executed
9306        /// before issuing another write.
9307        ///
9308        /// Parameter `data`: The data object whose content will be written
9309        ///
9310        /// Parameter `completion`: The completion handler to be invoked when the data content has been written or an error has occurred.
9311        /// If the error is nil, the write succeeded and the caller can write more data.
9312        #[deprecated = "Use `nw_connection_send` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9313        #[unsafe(method(write:completionHandler:))]
9314        #[unsafe(method_family = none)]
9315        pub unsafe fn write_completionHandler(
9316            &self,
9317            data: &NSData,
9318            completion: &block2::Block<dyn Fn(*mut NSError)>,
9319        );
9320
9321        /// Close this connection's write side such that further write requests won't succeed.
9322        /// Note that this has the effect of closing the read side of the peer connection.
9323        /// When the connection's read side and write side are closed, the connection is considered
9324        /// disconnected and will transition to the appropriate state.
9325        #[deprecated = "Use `nw_connection_send` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9326        #[unsafe(method(writeClose))]
9327        #[unsafe(method_family = none)]
9328        pub unsafe fn writeClose(&self);
9329    );
9330}
9331
9332/// Methods declared on superclass `NSObject`.
9333impl NWTCPConnection {
9334    extern_methods!(
9335        #[unsafe(method(init))]
9336        #[unsafe(method_family = init)]
9337        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9338
9339        #[unsafe(method(new))]
9340        #[unsafe(method_family = new)]
9341        pub unsafe fn new() -> Retained<Self>;
9342    );
9343}
9344
9345extern_protocol!(
9346    /// Allows the caller to take custom actions on some connection events.
9347    ///
9348    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwtcpconnectionauthenticationdelegate?language=objc)
9349    #[deprecated = "Use `sec_protocol_options_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9350    pub unsafe trait NWTCPConnectionAuthenticationDelegate: NSObjectProtocol {
9351        /// The caller can implement this optional protocol method to decide whether it
9352        /// wants to provide the identity for this connection for authentication. If this delegate
9353        /// method is not implemented, the return value will default to YES if
9354        /// provideIdentityForConnection:completionHandler: is implemented.
9355        ///
9356        /// Parameter `connection`: The connection sending this message
9357        ///
9358        /// Returns: YES to provide the identity for this connection, in which case, the delegate method
9359        /// provideIdentityForConnection:completionHandler: will be called.
9360        #[deprecated = "Use `sec_protocol_options_set_challenge_block` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9361        #[optional]
9362        #[unsafe(method(shouldProvideIdentityForConnection:))]
9363        #[unsafe(method_family = none)]
9364        unsafe fn shouldProvideIdentityForConnection(&self, connection: &NWTCPConnection) -> bool;
9365
9366        #[cfg(all(feature = "block2", feature = "objc2-security"))]
9367        /// The caller can implement this optional protocol method to provide the identity
9368        /// and an optional certificate chain to be used for authentication.
9369        ///
9370        /// Parameter `connection`: The connection sending this message
9371        ///
9372        /// Parameter `completion`: The completion handler for passing identity and certificate chain to the connection.
9373        /// The "identity" argument is required and must not be nil. The "certificateChain" argument is optional,
9374        /// and is an array of one or more SecCertificateRef objects. The certificate chain must contain objects
9375        /// of type SecCertificateRef only. If the certificate chain is set, it will be used. Otherwise, the leaf
9376        /// certificate will be extracted from the SecIdentityRef object and will be used for authentication.
9377        ///
9378        /// The caller is responsible for keeping the argument object(s) alive for the duration of the
9379        /// completion handler invocation.
9380        #[deprecated = "Use `sec_protocol_options_set_challenge_block` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9381        #[optional]
9382        #[unsafe(method(provideIdentityForConnection:completionHandler:))]
9383        #[unsafe(method_family = none)]
9384        unsafe fn provideIdentityForConnection_completionHandler(
9385            &self,
9386            connection: &NWTCPConnection,
9387            completion: &block2::Block<dyn Fn(NonNull<SecIdentity>, NonNull<NSArray<AnyObject>>)>,
9388        );
9389
9390        /// The caller can implement this optional protocol method to decide whether it
9391        /// wants to take over the default trust evaluation for this connection. If this delegate method
9392        /// is not implemented, the return value will default to YES if
9393        /// provideIdentityForConnection:completionHandler: is implemented.
9394        ///
9395        /// Parameter `connection`: The connection sending this message
9396        ///
9397        /// Returns: YES to take over the default trust evaluation, in which case, the delegate method
9398        /// evaluateTrustForConnection:peerCertificateChain:completionHandler: will be called.
9399        #[deprecated = "Use `sec_protocol_options_set_verify_block` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9400        #[optional]
9401        #[unsafe(method(shouldEvaluateTrustForConnection:))]
9402        #[unsafe(method_family = none)]
9403        unsafe fn shouldEvaluateTrustForConnection(&self, connection: &NWTCPConnection) -> bool;
9404
9405        #[cfg(all(feature = "block2", feature = "objc2-security"))]
9406        /// The caller can implement this optional protocol method to set up custom policies
9407        /// for peer certificate trust evaluation. If the delegate method is implemented, the caller
9408        /// is responsible for creating and setting up the SecTrustRef object and passing it to the
9409        /// completion handler. Otherwise, the default trust evaluation policy is used for the connection.
9410        ///
9411        /// Parameter `connection`: The connection sending this message
9412        ///
9413        /// Parameter `peerCertificateChain`: The peer certificate chain
9414        ///
9415        /// Parameter `completion`: The completion handler for passing the SecTrustRef object to the connection.
9416        /// The SecTrustRef object "trust" is required and must not be nil. It will be evaluated using
9417        /// SecTrustEvaluate() if necessary. The caller is responsible for keeping the argument object
9418        /// alive for the duration of the completion handler invocation.
9419        #[deprecated = "Use `sec_protocol_options_set_verify_block` in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>"]
9420        #[optional]
9421        #[unsafe(method(evaluateTrustForConnection:peerCertificateChain:completionHandler:))]
9422        #[unsafe(method_family = none)]
9423        unsafe fn evaluateTrustForConnection_peerCertificateChain_completionHandler(
9424            &self,
9425            connection: &NWTCPConnection,
9426            peer_certificate_chain: &NSArray<AnyObject>,
9427            completion: &block2::Block<dyn Fn(NonNull<SecTrust>)>,
9428        );
9429    }
9430);
9431
9432/// UDP session state values
9433///
9434/// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwudpsessionstate?language=objc)
9435// NS_ENUM
9436#[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
9437#[repr(transparent)]
9438#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
9439pub struct NWUDPSessionState(pub NSInteger);
9440impl NWUDPSessionState {
9441    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
9442    #[doc(alias = "NWUDPSessionStateInvalid")]
9443    pub const Invalid: Self = Self(0);
9444    /// attempting to make the session ready.
9445    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
9446    #[doc(alias = "NWUDPSessionStateWaiting")]
9447    pub const Waiting: Self = Self(1);
9448    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
9449    #[doc(alias = "NWUDPSessionStatePreparing")]
9450    pub const Preparing: Self = Self(2);
9451    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
9452    #[doc(alias = "NWUDPSessionStateReady")]
9453    pub const Ready: Self = Self(3);
9454    /// at this time, either due to problems with the path or the client rejecting the
9455    /// endpoints.
9456    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
9457    #[doc(alias = "NWUDPSessionStateFailed")]
9458    pub const Failed: Self = Self(4);
9459    #[deprecated = "Use `nw_connection_state_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
9460    #[doc(alias = "NWUDPSessionStateCancelled")]
9461    pub const Cancelled: Self = Self(5);
9462}
9463
9464unsafe impl Encode for NWUDPSessionState {
9465    const ENCODING: Encoding = NSInteger::ENCODING;
9466}
9467
9468unsafe impl RefEncode for NWUDPSessionState {
9469    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
9470}
9471
9472extern_class!(
9473    /// Open UDP datagram sessions to an endpoint, and send and receive datagrams.
9474    ///
9475    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwudpsession?language=objc)
9476    #[unsafe(super(NSObject))]
9477    #[derive(Debug, PartialEq, Eq, Hash)]
9478    #[deprecated = "Use `nw_connection_t` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
9479    pub struct NWUDPSession;
9480);
9481
9482unsafe impl NSObjectProtocol for NWUDPSession {}
9483
9484impl NWUDPSession {
9485    extern_methods!(
9486        /// This convenience initializer can be used to create a new session based on the
9487        /// original session's endpoint and parameters.
9488        ///
9489        /// The application should create an NWUDPSession and watch the "hasBetterPath" property.
9490        /// When this property is YES, it should call initWithUpgradeForSession: to create a new
9491        /// session, with the goal to start transferring data on the new better path as soon as
9492        /// possible to reduce power and potentially monetary cost. When the new "upgrade" session
9493        /// becomes ready and when the application wraps up the previous application session on
9494        /// the original session, the application can start using the new "upgrade" session and
9495        /// tear down the original one.
9496        ///
9497        ///
9498        /// Parameter `session`: The original session from which the application will upgrade
9499        ///
9500        /// Returns: An initialized NWUDPSession object.
9501        #[deprecated = "Use `nw_connection_create` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
9502        #[unsafe(method(initWithUpgradeForSession:))]
9503        #[unsafe(method_family = init)]
9504        pub unsafe fn initWithUpgradeForSession(
9505            this: Allocated<Self>,
9506            session: &NWUDPSession,
9507        ) -> Retained<Self>;
9508
9509        /// The current state of the UDP session. If the state is NWUDPSessionStateReady,
9510        /// then the connection is eligible for reading and writing. The state will be
9511        /// NWUDPSessionStateFailed if the endpoint could not be resolved, or all endpoints have been
9512        /// rejected. Use KVO to watch for changes.
9513        #[deprecated = "Use `nw_connection_set_state_changed_handler` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
9514        #[unsafe(method(state))]
9515        #[unsafe(method_family = none)]
9516        pub unsafe fn state(&self) -> NWUDPSessionState;
9517
9518        /// The provided endpoint.
9519        #[deprecated = "Use `nw_connection_copy_endpoint` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
9520        #[unsafe(method(endpoint))]
9521        #[unsafe(method_family = none)]
9522        pub unsafe fn endpoint(&self) -> Retained<NWEndpoint>;
9523
9524        /// The currently targeted remote endpoint. Use KVO to watch for changes.
9525        #[deprecated = "Use `nw_connection_copy_current_path` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
9526        #[unsafe(method(resolvedEndpoint))]
9527        #[unsafe(method_family = none)]
9528        pub unsafe fn resolvedEndpoint(&self) -> Option<Retained<NWEndpoint>>;
9529
9530        /// YES if the connection can read and write data, NO otherwise.
9531        /// Use KVO to watch this property.
9532        #[deprecated = "Use `nw_connection_set_viability_changed_handler` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
9533        #[unsafe(method(isViable))]
9534        #[unsafe(method_family = none)]
9535        pub unsafe fn isViable(&self) -> bool;
9536
9537        /// YES if there is another path available that is preferred over the currentPath.
9538        /// To take advantage of this path, create a new UDPSession. Use KVO to watch for changes.
9539        #[deprecated = "Use `nw_connection_set_better_path_available_handler` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
9540        #[unsafe(method(hasBetterPath))]
9541        #[unsafe(method_family = none)]
9542        pub unsafe fn hasBetterPath(&self) -> bool;
9543
9544        /// The current evaluated path for the resolvedEndpoint. Use KVO to watch for changes.
9545        #[deprecated = "Use `nw_connection_copy_current_path` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
9546        #[unsafe(method(currentPath))]
9547        #[unsafe(method_family = none)]
9548        pub unsafe fn currentPath(&self) -> Option<Retained<NWPath>>;
9549
9550        /// Mark the current value of resolvedEndpoint as unusable, and try to switch to the
9551        /// next available endpoint. This should be used when the caller has attempted to communicate
9552        /// with the current resolvedEndpoint, and the caller has determined that it is unusable. If
9553        /// there are no other resolved endpoints, the session will move to the failed state.
9554        #[deprecated = "Use `nw_connection_cancel_current_endpoint` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
9555        #[unsafe(method(tryNextResolvedEndpoint))]
9556        #[unsafe(method_family = none)]
9557        pub unsafe fn tryNextResolvedEndpoint(&self);
9558
9559        /// The maximum size of a datagram to be written currently. If a datagram is written
9560        /// with a longer length, the datagram may be fragmented or encounter an error. Note that this
9561        /// value is not guaranteed to be the maximum datagram length for end-to-end communication
9562        /// across the network. Use KVO to watch for changes.
9563        #[deprecated = "Use `nw_connection_get_maximum_datagram_size` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
9564        #[unsafe(method(maximumDatagramLength))]
9565        #[unsafe(method_family = none)]
9566        pub unsafe fn maximumDatagramLength(&self) -> NSUInteger;
9567
9568        #[cfg(feature = "block2")]
9569        /// Set a read handler for datagrams. Reads will be scheduled by the system, so this
9570        /// method only needs to be called once for a session.
9571        ///
9572        /// Parameter `handler`: A handler called when datagrams have been read, or when an error has occurred.
9573        ///
9574        /// Parameter `maxDatagrams`: The maximum number of datagrams to send to the handler.
9575        #[deprecated = "Use `nw_connection_receive` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
9576        #[unsafe(method(setReadHandler:maxDatagrams:))]
9577        #[unsafe(method_family = none)]
9578        pub unsafe fn setReadHandler_maxDatagrams(
9579            &self,
9580            handler: &block2::Block<dyn Fn(*mut NSArray<NSData>, *mut NSError)>,
9581            max_datagrams: NSUInteger,
9582        );
9583
9584        #[cfg(feature = "block2")]
9585        /// Write multiple datagrams. Callers should wait until the completionHandler is executed
9586        /// before issuing another write.
9587        ///
9588        /// Parameter `datagramArray`: An NSArray of NSData objects, containing the ordered list datagrams to write.
9589        ///
9590        /// Parameter `completionHandler`: A handler called when the write request has either succeeded or failed.
9591        #[deprecated = "Use `nw_connection_send` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
9592        #[unsafe(method(writeMultipleDatagrams:completionHandler:))]
9593        #[unsafe(method_family = none)]
9594        pub unsafe fn writeMultipleDatagrams_completionHandler(
9595            &self,
9596            datagram_array: &NSArray<NSData>,
9597            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
9598        );
9599
9600        #[cfg(feature = "block2")]
9601        /// Write a single datagram. Callers should wait until the completionHandler is executed
9602        /// before issuing another write.
9603        ///
9604        /// Parameter `datagram`: An NSData containing the datagram to write.
9605        ///
9606        /// Parameter `completionHandler`: A handler called when the write request has either succeeded or failed.
9607        #[deprecated = "Use `nw_connection_send` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
9608        #[unsafe(method(writeDatagram:completionHandler:))]
9609        #[unsafe(method_family = none)]
9610        pub unsafe fn writeDatagram_completionHandler(
9611            &self,
9612            datagram: &NSData,
9613            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
9614        );
9615
9616        /// Move into the NWUDPSessionStateCancelled state. The connection will be terminated,
9617        /// and all handlers will be cancelled.
9618        #[deprecated = "Use `nw_connection_cancel` in Network framework instead, see deprecation notice in <NetworkExtension/NWUDPSession.h>"]
9619        #[unsafe(method(cancel))]
9620        #[unsafe(method_family = none)]
9621        pub unsafe fn cancel(&self);
9622    );
9623}
9624
9625/// Methods declared on superclass `NSObject`.
9626impl NWUDPSession {
9627    extern_methods!(
9628        #[unsafe(method(init))]
9629        #[unsafe(method_family = init)]
9630        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9631
9632        #[unsafe(method(new))]
9633        #[unsafe(method_family = new)]
9634        pub unsafe fn new() -> Retained<Self>;
9635    );
9636}
9637
9638extern_class!(
9639    /// DEPRECATION NOTICE
9640    ///
9641    /// NW object wrappers are hidden in Swift 6. To continue accessing them, you
9642    /// can prepend double underscores to the symbol name.
9643    ///
9644    /// See also [Apple's documentation](https://developer.apple.com/documentation/networkextension/nwtlsparameters?language=objc)
9645    #[unsafe(super(NSObject))]
9646    #[derive(Debug, PartialEq, Eq, Hash)]
9647    #[deprecated = "Use `sec_protocol_options_t` in Security framework instead, see deprecation notice in <NetworkExtension/NWTLSParameters.h>"]
9648    pub struct NWTLSParameters;
9649);
9650
9651unsafe impl NSObjectProtocol for NWTLSParameters {}
9652
9653impl NWTLSParameters {
9654    extern_methods!(
9655        /// The session ID for the associated connection, used for TLS session resumption.
9656        /// This property is optional when using TLS.
9657        #[deprecated = "Use `sec_protocol_options_set_tls_resumption_enabled` in Security framework instead, see deprecation notice in <NetworkExtension/NWTLSParameters.h>"]
9658        #[unsafe(method(TLSSessionID))]
9659        #[unsafe(method_family = none)]
9660        pub unsafe fn TLSSessionID(&self) -> Option<Retained<NSData>>;
9661
9662        /// Setter for [`TLSSessionID`][Self::TLSSessionID].
9663        #[deprecated = "Use `sec_protocol_options_set_tls_resumption_enabled` in Security framework instead, see deprecation notice in <NetworkExtension/NWTLSParameters.h>"]
9664        #[unsafe(method(setTLSSessionID:))]
9665        #[unsafe(method_family = none)]
9666        pub unsafe fn setTLSSessionID(&self, tls_session_id: Option<&NSData>);
9667
9668        /// The set of allowed cipher suites, as defined in
9669        /// <Security
9670        /// /CipherSuite.h>.
9671        /// If set to nil, the default cipher suites will be used.
9672        #[deprecated = "Use `sec_protocol_options_append_tls_ciphersuite` in Security framework instead, see deprecation notice in <NetworkExtension/NWTLSParameters.h>"]
9673        #[unsafe(method(SSLCipherSuites))]
9674        #[unsafe(method_family = none)]
9675        pub unsafe fn SSLCipherSuites(&self) -> Option<Retained<NSSet<NSNumber>>>;
9676
9677        /// Setter for [`SSLCipherSuites`][Self::SSLCipherSuites].
9678        #[deprecated = "Use `sec_protocol_options_append_tls_ciphersuite` in Security framework instead, see deprecation notice in <NetworkExtension/NWTLSParameters.h>"]
9679        #[unsafe(method(setSSLCipherSuites:))]
9680        #[unsafe(method_family = none)]
9681        pub unsafe fn setSSLCipherSuites(&self, ssl_cipher_suites: Option<&NSSet<NSNumber>>);
9682
9683        /// The minimum allowed SSLProtocol value. as defined in
9684        /// <Security
9685        /// /SecureTransport.h>.
9686        /// If set, the SSL handshake will not accept any protocol version older than the minimum.
9687        #[deprecated = "Use `sec_protocol_options_set_min_tls_protocol_version` in Security framework instead, see deprecation notice in <NetworkExtension/NWTLSParameters.h>"]
9688        #[unsafe(method(minimumSSLProtocolVersion))]
9689        #[unsafe(method_family = none)]
9690        pub unsafe fn minimumSSLProtocolVersion(&self) -> NSUInteger;
9691
9692        /// Setter for [`minimumSSLProtocolVersion`][Self::minimumSSLProtocolVersion].
9693        #[deprecated = "Use `sec_protocol_options_set_min_tls_protocol_version` in Security framework instead, see deprecation notice in <NetworkExtension/NWTLSParameters.h>"]
9694        #[unsafe(method(setMinimumSSLProtocolVersion:))]
9695        #[unsafe(method_family = none)]
9696        pub unsafe fn setMinimumSSLProtocolVersion(&self, minimum_ssl_protocol_version: NSUInteger);
9697
9698        /// The maximum allowed SSLProtocol value. as defined in
9699        /// <Security
9700        /// /SecureTransport.h>.
9701        /// If set, the SSL handshake will not accept any protocol version newer than the maximum.
9702        /// This property should be used with caution, since it may limit the use of preferred
9703        /// SSL protocols.
9704        #[deprecated = "Use `sec_protocol_options_set_max_tls_protocol_version` in Security framework instead, see deprecation notice in <NetworkExtension/NWTLSParameters.h>"]
9705        #[unsafe(method(maximumSSLProtocolVersion))]
9706        #[unsafe(method_family = none)]
9707        pub unsafe fn maximumSSLProtocolVersion(&self) -> NSUInteger;
9708
9709        /// Setter for [`maximumSSLProtocolVersion`][Self::maximumSSLProtocolVersion].
9710        #[deprecated = "Use `sec_protocol_options_set_max_tls_protocol_version` in Security framework instead, see deprecation notice in <NetworkExtension/NWTLSParameters.h>"]
9711        #[unsafe(method(setMaximumSSLProtocolVersion:))]
9712        #[unsafe(method_family = none)]
9713        pub unsafe fn setMaximumSSLProtocolVersion(&self, maximum_ssl_protocol_version: NSUInteger);
9714    );
9715}
9716
9717/// Methods declared on superclass `NSObject`.
9718impl NWTLSParameters {
9719    extern_methods!(
9720        #[unsafe(method(init))]
9721        #[unsafe(method_family = init)]
9722        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9723
9724        #[unsafe(method(new))]
9725        #[unsafe(method_family = new)]
9726        pub unsafe fn new() -> Retained<Self>;
9727    );
9728}