From 431e578ae9816815a230347987f446f547a02847 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Fri, 2 Sep 2022 17:27:49 -0400 Subject: [PATCH] [NetworkExtensions] Add support for Xcode 14 beta 6. (#15847) Co-authored-by: Rolf Bjarne Kvinge --- src/networkextension.cs | 64 +++++++++++++++++++ .../iOS-NetworkExtension.ignore | 3 + .../iOS-NetworkExtension.todo | 8 --- .../macOS-NetworkExtension.ignore | 3 + .../macOS-NetworkExtension.todo | 14 ---- .../xtro-sharpie/iOS-NetworkExtension.ignore | 3 + tests/xtro-sharpie/iOS-NetworkExtension.todo | 8 --- .../macOS-NetworkExtension.ignore | 3 + .../xtro-sharpie/macOS-NetworkExtension.todo | 14 ---- 9 files changed, 76 insertions(+), 44 deletions(-) delete mode 100644 tests/xtro-sharpie/api-annotations-dotnet/iOS-NetworkExtension.todo delete mode 100644 tests/xtro-sharpie/api-annotations-dotnet/macOS-NetworkExtension.todo delete mode 100644 tests/xtro-sharpie/iOS-NetworkExtension.todo delete mode 100644 tests/xtro-sharpie/macOS-NetworkExtension.todo diff --git a/src/networkextension.cs b/src/networkextension.cs index d407b3681b..3e2d3c9ae1 100644 --- a/src/networkextension.cs +++ b/src/networkextension.cs @@ -177,6 +177,33 @@ namespace NetworkExtension { Unknown = 4, } + [NoWatch, NoTV, Mac (13,0), iOS (16,0), MacCatalyst (16,0)] + [Native] + [ErrorDomain ("NEVPNConnectionErrorDomain")] + public enum NEVpnConnectionError : long + { + Overslept = 1, + NoNetworkAvailable = 2, + UnrecoverableNetworkChange = 3, + ConfigurationFailed = 4, + ServerAddressResolutionFailed = 5, + ServerNotResponding = 6, + ServerDead = 7, + AuthenticationFailed = 8, + ClientCertificateInvalid = 9, + ClientCertificateNotYetValid = 10, + ClientCertificateExpired = 11, + PluginFailed = 12, + ConfigurationNotFound = 13, + PluginDisabled = 14, + NegotiationFailed = 15, + ServerDisconnected = 16, + ServerCertificateInvalid = 17, + ServerCertificateNotYetValid = 18, + ServerCertificateExpired = 19, + } + + [iOS (9,0)][Mac (10,11)] [BaseType (typeof (NSObject))] [Abstract] // documented as such and ... @@ -930,6 +957,11 @@ namespace NetworkExtension { [NullAllowed, Export ("excludedRoutes", ArgumentSemantic.Copy)] NEIPv4Route[] ExcludedRoutes { get; set; } + + [NoWatch, NoTV, NoiOS, Mac (13, 0)] + [Export ("router")] + [NullAllowed] + string Router { get; set; } } [iOS (9,0)][Mac (10,11)] @@ -1249,6 +1281,11 @@ namespace NetworkExtension { [Notification] [Field ("NEVPNStatusDidChangeNotification")] NSString StatusDidChangeNotification { get; } + + [Async] + [NoWatch, NoTV, Mac (13,0), iOS (16,0), MacCatalyst (16,0)] + [Export ("fetchLastDisconnectErrorWithCompletionHandler:")] + void FetchLastDisconnectError (Action handler); } [Static][Internal] @@ -2303,6 +2340,11 @@ namespace NetworkExtension { [NullAllowed] [Export ("serverURL", ArgumentSemantic.Copy)] NSUrl ServerUrl { get; set; } + + [NoWatch, NoTV, Mac (13, 0), iOS (16, 0), MacCatalyst (16,0)] + [Export ("identityReference", ArgumentSemantic.Copy)] + [NullAllowed] + NSData IdentityReference { get; set; } } [NoWatch, NoTV, Mac (11,0), iOS (14,0)] @@ -2312,6 +2354,11 @@ namespace NetworkExtension { [NullAllowed] [Export ("serverName")] string ServerName { get; set; } + + [NoWatch, NoTV, Mac (13, 0), iOS (16, 0), MacCatalyst (16,0)] + [Export ("identityReference", ArgumentSemantic.Copy)] + [NullAllowed] + NSData IdentityReference { get; set; } } [NoWatch, NoTV, Mac (11,0), iOS (14,0)] @@ -2390,4 +2437,21 @@ namespace NetworkExtension { string TrackingAreaCode { get; set; } } + [NoWatch, NoTV, NoiOS, Mac (13,0)] + [BaseType (typeof (NEPacketTunnelProvider))] + interface NEEthernetTunnelProvider + { + } + + [NoWatch, NoTV, NoiOS, Mac (13,0)] + [BaseType (typeof (NEPacketTunnelNetworkSettings))] + interface NEEthernetTunnelNetworkSettings + { + [Export ("initWithTunnelRemoteAddress:ethernetAddress:mtu:")] + NativeHandle Constructor (string address, string ethernetAddress, nint mtu); + + [Export ("ethernetAddress")] + string EthernetAddress { get; } + } + } diff --git a/tests/xtro-sharpie/api-annotations-dotnet/iOS-NetworkExtension.ignore b/tests/xtro-sharpie/api-annotations-dotnet/iOS-NetworkExtension.ignore index 3b4e70d9a9..7f58943a16 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/iOS-NetworkExtension.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/iOS-NetworkExtension.ignore @@ -3,3 +3,6 @@ ## is, which means we can't use the same managed enum for both cases (the native enums aren't entirely identical ## either: one is pointer sized while the other is 32-bit always). !duplicate-type-name! NWPathStatus enum exists as both NetworkExtension.NWPathStatus and Network.NWPathStatus + +# value got removed in xcode14 +!extra-enum-value! Managed value 1 for NEOnDemandRuleInterfaceType.Ethernet is available for the current platform while the value in the native header is not diff --git a/tests/xtro-sharpie/api-annotations-dotnet/iOS-NetworkExtension.todo b/tests/xtro-sharpie/api-annotations-dotnet/iOS-NetworkExtension.todo deleted file mode 100644 index 96e57b5fa8..0000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/iOS-NetworkExtension.todo +++ /dev/null @@ -1,8 +0,0 @@ -!extra-enum-value! Managed value 1 for NEOnDemandRuleInterfaceType.Ethernet is available for the current platform while the value in the native header is not -!missing-enum! NEVPNConnectionError not bound -!missing-field! NEVPNConnectionErrorDomain not bound -!missing-selector! NEDNSOverHTTPSSettings::identityReference not bound -!missing-selector! NEDNSOverHTTPSSettings::setIdentityReference: not bound -!missing-selector! NEDNSOverTLSSettings::identityReference not bound -!missing-selector! NEDNSOverTLSSettings::setIdentityReference: not bound -!missing-selector! NEVPNConnection::fetchLastDisconnectErrorWithCompletionHandler: not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/macOS-NetworkExtension.ignore b/tests/xtro-sharpie/api-annotations-dotnet/macOS-NetworkExtension.ignore index 3b4e70d9a9..2075383b39 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/macOS-NetworkExtension.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/macOS-NetworkExtension.ignore @@ -3,3 +3,6 @@ ## is, which means we can't use the same managed enum for both cases (the native enums aren't entirely identical ## either: one is pointer sized while the other is 32-bit always). !duplicate-type-name! NWPathStatus enum exists as both NetworkExtension.NWPathStatus and Network.NWPathStatus + +# enum got removed from mac Os in xcode 14 +!extra-enum-value! Managed value 3 for NEOnDemandRuleInterfaceType.Cellular is available for the current platform while the value in the native header is not diff --git a/tests/xtro-sharpie/api-annotations-dotnet/macOS-NetworkExtension.todo b/tests/xtro-sharpie/api-annotations-dotnet/macOS-NetworkExtension.todo deleted file mode 100644 index 2ea761db93..0000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/macOS-NetworkExtension.todo +++ /dev/null @@ -1,14 +0,0 @@ -!extra-enum-value! Managed value 3 for NEOnDemandRuleInterfaceType.Cellular is available for the current platform while the value in the native header is not -!missing-enum! NEVPNConnectionError not bound -!missing-field! NEVPNConnectionErrorDomain not bound -!missing-selector! NEDNSOverHTTPSSettings::identityReference not bound -!missing-selector! NEDNSOverHTTPSSettings::setIdentityReference: not bound -!missing-selector! NEDNSOverTLSSettings::identityReference not bound -!missing-selector! NEDNSOverTLSSettings::setIdentityReference: not bound -!missing-selector! NEEthernetTunnelNetworkSettings::ethernetAddress not bound -!missing-selector! NEEthernetTunnelNetworkSettings::initWithTunnelRemoteAddress:ethernetAddress:mtu: not bound -!missing-selector! NEIPv4Settings::router not bound -!missing-selector! NEIPv4Settings::setRouter: not bound -!missing-selector! NEVPNConnection::fetchLastDisconnectErrorWithCompletionHandler: not bound -!missing-type! NEEthernetTunnelNetworkSettings not bound -!missing-type! NEEthernetTunnelProvider not bound diff --git a/tests/xtro-sharpie/iOS-NetworkExtension.ignore b/tests/xtro-sharpie/iOS-NetworkExtension.ignore index 3b4e70d9a9..7f58943a16 100644 --- a/tests/xtro-sharpie/iOS-NetworkExtension.ignore +++ b/tests/xtro-sharpie/iOS-NetworkExtension.ignore @@ -3,3 +3,6 @@ ## is, which means we can't use the same managed enum for both cases (the native enums aren't entirely identical ## either: one is pointer sized while the other is 32-bit always). !duplicate-type-name! NWPathStatus enum exists as both NetworkExtension.NWPathStatus and Network.NWPathStatus + +# value got removed in xcode14 +!extra-enum-value! Managed value 1 for NEOnDemandRuleInterfaceType.Ethernet is available for the current platform while the value in the native header is not diff --git a/tests/xtro-sharpie/iOS-NetworkExtension.todo b/tests/xtro-sharpie/iOS-NetworkExtension.todo deleted file mode 100644 index 96e57b5fa8..0000000000 --- a/tests/xtro-sharpie/iOS-NetworkExtension.todo +++ /dev/null @@ -1,8 +0,0 @@ -!extra-enum-value! Managed value 1 for NEOnDemandRuleInterfaceType.Ethernet is available for the current platform while the value in the native header is not -!missing-enum! NEVPNConnectionError not bound -!missing-field! NEVPNConnectionErrorDomain not bound -!missing-selector! NEDNSOverHTTPSSettings::identityReference not bound -!missing-selector! NEDNSOverHTTPSSettings::setIdentityReference: not bound -!missing-selector! NEDNSOverTLSSettings::identityReference not bound -!missing-selector! NEDNSOverTLSSettings::setIdentityReference: not bound -!missing-selector! NEVPNConnection::fetchLastDisconnectErrorWithCompletionHandler: not bound diff --git a/tests/xtro-sharpie/macOS-NetworkExtension.ignore b/tests/xtro-sharpie/macOS-NetworkExtension.ignore index 3edebbdcc6..92127e97f5 100644 --- a/tests/xtro-sharpie/macOS-NetworkExtension.ignore +++ b/tests/xtro-sharpie/macOS-NetworkExtension.ignore @@ -7,3 +7,6 @@ ## is, which means we can't use the same managed enum for both cases (the native enums aren't entirely identical ## either: one is pointer sized while the other is 32-bit always). !duplicate-type-name! NWPathStatus enum exists as both NetworkExtension.NWPathStatus and Network.NWPathStatus + +# enum got removed from mac Os in xcode 14 +!extra-enum-value! Managed value 3 for NEOnDemandRuleInterfaceType.Cellular is available for the current platform while the value in the native header is not diff --git a/tests/xtro-sharpie/macOS-NetworkExtension.todo b/tests/xtro-sharpie/macOS-NetworkExtension.todo deleted file mode 100644 index 2ea761db93..0000000000 --- a/tests/xtro-sharpie/macOS-NetworkExtension.todo +++ /dev/null @@ -1,14 +0,0 @@ -!extra-enum-value! Managed value 3 for NEOnDemandRuleInterfaceType.Cellular is available for the current platform while the value in the native header is not -!missing-enum! NEVPNConnectionError not bound -!missing-field! NEVPNConnectionErrorDomain not bound -!missing-selector! NEDNSOverHTTPSSettings::identityReference not bound -!missing-selector! NEDNSOverHTTPSSettings::setIdentityReference: not bound -!missing-selector! NEDNSOverTLSSettings::identityReference not bound -!missing-selector! NEDNSOverTLSSettings::setIdentityReference: not bound -!missing-selector! NEEthernetTunnelNetworkSettings::ethernetAddress not bound -!missing-selector! NEEthernetTunnelNetworkSettings::initWithTunnelRemoteAddress:ethernetAddress:mtu: not bound -!missing-selector! NEIPv4Settings::router not bound -!missing-selector! NEIPv4Settings::setRouter: not bound -!missing-selector! NEVPNConnection::fetchLastDisconnectErrorWithCompletionHandler: not bound -!missing-type! NEEthernetTunnelNetworkSettings not bound -!missing-type! NEEthernetTunnelProvider not bound