[Network] Implement Xcode 16.0 beta 1-6 changes. (#21075)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
This commit is contained in:
Родитель
adc67f1ef1
Коммит
0aed4d8aaf
|
@ -175,6 +175,8 @@ namespace Network {
|
|||
Default = 0,
|
||||
Allow = 1,
|
||||
Prohibit = 2,
|
||||
[Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
|
||||
Persistent = 3,
|
||||
}
|
||||
|
||||
// this maps to `nw_path_status_t` in Network/Headers/path.h (and not the enum from NetworkExtension)
|
||||
|
|
|
@ -96,6 +96,35 @@ namespace Network {
|
|||
return new NWListener (handle, owns: true);
|
||||
}
|
||||
|
||||
#if __MACOS__ && NET
|
||||
[SupportedOSPlatform ("macos")]
|
||||
[UnsupportedOSPlatform ("tvos")]
|
||||
[UnsupportedOSPlatform ("ios")]
|
||||
[UnsupportedOSPlatform ("maccatalyst")]
|
||||
[DllImport (Constants.NetworkLibrary)]
|
||||
extern static IntPtr nw_listener_create_with_launchd_key (/* nw_parameters_t */ IntPtr nwparameters, /* const char */ IntPtr launchd_key);
|
||||
|
||||
/// <summary>Creates an <see cref="NWListener" /> instance from a launchd key.</summary>
|
||||
/// <param name="parameters">The parameters to use for the listener, including the protocols to use.</param>
|
||||
/// <param name="launchd_key">The name of the socket entry as specified in the launchd.plist.</param>
|
||||
/// <returns>A new <see cref="NWListener" /> instance, or null if not successful.</returns>
|
||||
[SupportedOSPlatform ("macos")]
|
||||
[UnsupportedOSPlatform ("tvos")]
|
||||
[UnsupportedOSPlatform ("ios")]
|
||||
[UnsupportedOSPlatform ("maccatalyst")]
|
||||
public static NWListener? Create (NWParameters parameters, string launchd_key)
|
||||
{
|
||||
if (launchd_key is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (launchd_key));
|
||||
|
||||
using var launchd_key_ptr = new TransientString (launchd_key);
|
||||
var handle = nw_listener_create_with_launchd_key (parameters.GetNonNullHandle (nameof (parameters)), launchd_key_ptr);
|
||||
if (handle == IntPtr.Zero)
|
||||
return null;
|
||||
return new NWListener (handle, owns: true);
|
||||
}
|
||||
#endif // __MACOS__ && NET
|
||||
|
||||
[DllImport (Constants.NetworkLibrary)]
|
||||
extern static void nw_listener_set_queue (IntPtr listener, IntPtr queue);
|
||||
|
||||
|
|
|
@ -54,6 +54,15 @@ namespace Network {
|
|||
set => nw_quic_set_keepalive_interval (GetCheckedHandle (), value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the default keepalive value. The current default is every 20 seconds, but this is subject to change.
|
||||
/// </summary>
|
||||
public void SetDefaultKeepAlive ()
|
||||
{
|
||||
// #define NW_QUIC_CONNECTION_DEFAULT_KEEPALIVE UINT16_MAX
|
||||
KeepaliveInterval = ushort.MaxValue;
|
||||
}
|
||||
|
||||
[DllImport (Constants.NetworkLibrary, EntryPoint = "nw_quic_get_application_error_reason")]
|
||||
static extern IntPtr nw_quic_get_application_error_reason_ptr (OS_nw_protocol_metadata metadata);
|
||||
|
||||
|
|
|
@ -15538,6 +15538,7 @@ F:Network.NWParametersAttribution.Developer
|
|||
F:Network.NWParametersAttribution.User
|
||||
F:Network.NWParametersExpiredDnsBehavior.Allow
|
||||
F:Network.NWParametersExpiredDnsBehavior.Default
|
||||
F:Network.NWParametersExpiredDnsBehavior.Persistent
|
||||
F:Network.NWParametersExpiredDnsBehavior.Prohibit
|
||||
F:Network.NWPathStatus.Invalid
|
||||
F:Network.NWPathStatus.Satisfiable
|
||||
|
|
|
@ -61,6 +61,16 @@ namespace MonoTouchFixtures.Network {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
#if __MACOS__ && NET
|
||||
[Test]
|
||||
public void TestCreateLaunchd ()
|
||||
{
|
||||
using var parameters = NWParameters.CreateTcp ();
|
||||
using var instance = NWListener.Create (parameters, "xamarinlaunchdkey");
|
||||
Assert.IsNotNull (instance, "Create");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
!missing-pinvoke! nw_listener_create_with_launchd_key is not bound
|
Загрузка…
Ссылка в новой задаче