[Network] Add Support for DotNet Attributes (#12590)

Co-authored-by: TJ Lambert <tjlambert@microsoft.com>
This commit is contained in:
TJ Lambert 2021-08-31 10:50:09 -05:00 коммит произвёл GitHub
Родитель 20bf555ccd
Коммит 6a9e515f5e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
37 изменённых файлов: 449 добавлений и 1 удалений

Просмотреть файл

@ -10,6 +10,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -19,8 +20,13 @@ using OS_nw_advertise_descriptor=System.IntPtr;
using OS_nw_txt_record=System.IntPtr;
namespace Network {
#if !NET
[TV (12,0), Mac (10,14), iOS (12,0)]
[Watch (6,0)]
#else
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("tvos12.0")]
#endif
public class NWAdvertiseDescriptor : NativeObject {
public NWAdvertiseDescriptor (IntPtr handle, bool owns) : base (handle, owns)
{ }
@ -65,15 +71,33 @@ namespace Network {
get => nw_advertise_descriptor_get_no_auto_rename (GetCheckedHandle ());
}
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
[DllImport (Constants.NetworkLibrary)]
static extern OS_nw_txt_record nw_advertise_descriptor_copy_txt_record_object (OS_nw_advertise_descriptor advertise_descriptor);
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
[DllImport (Constants.NetworkLibrary)]
static extern void nw_advertise_descriptor_set_txt_record_object (OS_nw_advertise_descriptor advertise_descriptor, OS_nw_txt_record txt_record);
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public NWTxtRecord TxtRecord {
get => new NWTxtRecord (nw_advertise_descriptor_copy_txt_record_object (GetCheckedHandle ()), owns: true);
set => nw_advertise_descriptor_set_txt_record_object (GetCheckedHandle (), value.GetHandle ());

Просмотреть файл

@ -11,6 +11,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -21,7 +22,13 @@ using OS_nw_txt_record=System.IntPtr;
namespace Network {
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0), Watch (6,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public class NWBrowseResult : NativeObject {
internal NWBrowseResult (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -12,6 +12,7 @@ using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -27,7 +28,13 @@ namespace Network {
public delegate void NWBrowserCompleteChangesDelegate (List<(NWBrowseResult? result, NWBrowseResultChange change)>? changes);
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0), Watch (6,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public class NWBrowser : NativeObject {
bool started = false;

Просмотреть файл

@ -11,6 +11,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -19,7 +20,13 @@ using OS_nw_browse_descriptor=System.IntPtr;
namespace Network {
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0), Watch (6,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public class NWBrowserDescriptor: NativeObject {
internal NWBrowserDescriptor (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -10,6 +10,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -41,8 +42,13 @@ namespace Network {
//
public delegate void NWConnectionReceiveReadOnlySpanCompletion (ReadOnlySpan<byte> data, NWContentContext? context, bool isComplete, NWError? error);
#if !NET
[TV (12,0), Mac (10,14), iOS (12,0)]
[Watch (6,0)]
#else
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("tvos12.0")]
#endif
public class NWConnection : NativeObject {
public NWConnection (IntPtr handle, bool owns) : base (handle, owns) {}
@ -564,7 +570,13 @@ namespace Network {
BlockLiteral.SimpleCall (method, (arg)=> nw_connection_batch (GetCheckedHandle (), arg));
}
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
[DllImport (Constants.NetworkLibrary)]
unsafe static extern void nw_connection_access_establishment_report (IntPtr connection, IntPtr queue, ref BlockLiteral access_block);
@ -582,7 +594,13 @@ namespace Network {
}
}
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
[BindingImpl (BindingImplOptions.Optimizable)]
public void GetEstablishmentReport (DispatchQueue queue, Action<NWEstablishmentReport> handler)
{

Просмотреть файл

@ -1,5 +1,6 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -15,16 +16,27 @@ using OS_nw_endpoint=System.IntPtr;
namespace Network {
#if !NET
[TV (14,0), Mac (11,0), iOS (14,0), Watch (7,0)]
[MacCatalyst (14,0)]
#endif
public delegate void NWConnectionGroupReceiveDelegate (DispatchData content, NWContentContext context, bool isCompleted);
#if !NET
[TV (14,0), Mac (11,0), iOS (14,0), Watch (7,0)]
[MacCatalyst (14,0)]
#endif
public delegate void NWConnectionGroupStateChangedDelegate (NWConnectionGroupState state, NWError? error);
#if !NET
[TV (14,0), Mac (11,0), iOS (14,0), Watch (7,0)]
[MacCatalyst (14,0)]
#else
[SupportedOSPlatform ("ios14.0")]
[SupportedOSPlatform ("tvos14.0")]
[SupportedOSPlatform ("macos11.0")]
[SupportedOSPlatform ("maccatalyst14.0")]
#endif
public class NWConnectionGroup : NativeObject {
protected NWConnectionGroup (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -11,6 +11,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -21,8 +22,13 @@ namespace Network {
// The content context, there are a few pre-configured content contexts for sending
// available as static properties on this class
//
#if !NET
[TV (12,0), Mac (10,14), iOS (12,0)]
[Watch (6,0)]
#else
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("tvos12.0")]
#endif
public class NWContentContext : NativeObject {
bool global;
public NWContentContext (IntPtr handle, bool owns) : base (handle, owns)

Просмотреть файл

@ -12,6 +12,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -22,7 +23,13 @@ using OS_nw_interface=System.IntPtr;
namespace Network {
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0), Watch (6,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public class NWDataTransferReport : NativeObject {
internal NWDataTransferReport (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -12,6 +12,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -20,8 +21,14 @@ using OS_nw_endpoint=System.IntPtr;
namespace Network {
#if !NET
[TV (12,0), Mac (10,14), iOS (12,0)]
[Watch (6,0)]
#else
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("tvos12.0")]
#endif
public class NWEndpoint : NativeObject {
public NWEndpoint (IntPtr handle, bool owns) : base (handle, owns) {}
@ -107,11 +114,23 @@ namespace Network {
public string? BonjourServiceDomain => Marshal.PtrToStringAnsi (nw_endpoint_get_bonjour_service_domain (GetCheckedHandle ()));
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
[DllImport (Constants.NetworkLibrary, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
static extern OS_nw_endpoint nw_endpoint_create_url (string url);
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public static NWEndpoint? Create (string url)
{
if (url == null)
@ -122,11 +141,23 @@ namespace Network {
return new NWEndpoint (handle, owns: true);
}
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
[DllImport (Constants.NetworkLibrary, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr nw_endpoint_get_url (OS_nw_endpoint endpoint);
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public string? Url => Marshal.PtrToStringAnsi (nw_endpoint_get_url (GetCheckedHandle ()));
}
}

Просмотреть файл

@ -12,13 +12,19 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
namespace Network {
#if !NET
[TV (12,0), Mac (10,14), iOS (12,0)]
[Watch (6,0)]
#else
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("tvos12.0")]
#endif
public class NWError : NativeObject {
public NWError (IntPtr handle, bool owns) : base (handle, owns)
{

Просмотреть файл

@ -13,6 +13,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -24,7 +25,13 @@ using nw_protocol_definition_t=System.IntPtr;
namespace Network {
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0), Watch (6,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public class NWEstablishmentReport : NativeObject {
internal NWEstablishmentReport (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -14,6 +14,7 @@ using System;
using System.Text;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -24,10 +25,16 @@ using OS_dispatch_data=System.IntPtr;
namespace Network {
#if !NET
[NoWatch, NoTV, NoiOS, Mac (10,15)]
#endif
public delegate void NWEthernetChannelReceiveDelegate (DispatchData? content, ushort vlanTag, string? localAddress, string? remoteAddress);
#if !NET
[NoWatch, NoTV, NoiOS, Mac (10,15)]
#else
[SupportedOSPlatform ("macos10.15")]
#endif
public class NWEthernetChannel : NativeObject {
internal NWEthernetChannel (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -12,6 +12,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -29,7 +30,13 @@ namespace Network {
public delegate nuint NWFramerParseCompletionDelegate (Memory<byte> buffer, [MarshalAs (UnmanagedType.I1)] bool isCompleted);
public delegate nuint NWFramerInputDelegate (NWFramer framer);
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0), Watch (6,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public class NWFramer : NativeObject {
internal NWFramer (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -12,6 +12,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -26,7 +27,13 @@ using OS_nw_parameters=System.IntPtr;
namespace Network {
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0), Watch (6,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public class NWFramerMessage : NWProtocolMetadata {
internal NWFramerMessage (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -13,10 +13,16 @@ using System;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
using System.Runtime.Versioning;
namespace Network {
#if !NET
[TV (12,0), Mac (10,14), iOS (12,0), Watch (6,0)]
#else
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("tvos12.0")]
#endif
public class NWIPMetadata : NWProtocolMetadata {
internal NWIPMetadata (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -12,6 +12,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -20,8 +21,13 @@ using OS_nw_interface=System.IntPtr;
namespace Network {
#if !NET
[TV (12,0), Mac (10,14), iOS (12,0)]
[Watch (6,0)]
#else
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("tvos12.0")]
#endif
public class NWInterface : NativeObject {
public NWInterface (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -11,14 +11,20 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
namespace Network {
#if !NET
[TV (12,0), Mac (10,14), iOS (12,0)]
[Watch (6,0)]
#else
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("tvos12.0")]
#endif
public class NWListener : NativeObject {
bool connectionHandlerWasSet = false;
object connectionHandlerLock = new object ();
@ -234,15 +240,33 @@ namespace Network {
nw_listener_set_advertise_descriptor (GetCheckedHandle (), descriptor.GetHandle ());
}
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
[DllImport (Constants.NetworkLibrary)]
static extern uint nw_listener_get_new_connection_limit (IntPtr listener);
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
[DllImport (Constants.NetworkLibrary)]
static extern void nw_listener_set_new_connection_limit (IntPtr listener, uint new_connection_limit);
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public uint ConnectionLimit {
get => nw_listener_get_new_connection_limit (GetCheckedHandle ());
set => nw_listener_set_new_connection_limit (GetCheckedHandle (), value);

Просмотреть файл

@ -1,5 +1,6 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -10,8 +11,15 @@ using OS_nw_endpoint=System.IntPtr;
namespace Network {
#if !NET
[TV (14,0), Mac (11,0), iOS (14,0), Watch (7,0)]
[MacCatalyst (14,0)]
#else
[SupportedOSPlatform ("ios14.0")]
[SupportedOSPlatform ("tvos14.0")]
[SupportedOSPlatform ("macos11.0")]
[SupportedOSPlatform ("maccatalyst14.0")]
#endif
public class NWMulticastGroup : NativeObject {
internal NWMulticastGroup (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -12,6 +12,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -20,8 +21,13 @@ using nw_parameters_t=System.IntPtr;
namespace Network {
#if !NET
[TV (12,0), Mac (10,14), iOS (12,0)]
[Watch (6,0)]
#else
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("tvos12.0")]
#endif
public class NWParameters : NativeObject {
public NWParameters (IntPtr handle, bool owns) : base (handle, owns) {}
@ -176,11 +182,19 @@ namespace Network {
}
#if MONOMAC
#if !NET
[NoWatch, NoTV, NoiOS, Mac (10,15)]
#else
[SupportedOSPlatform ("macos10.15")]
#endif
[DllImport (Constants.NetworkLibrary)]
unsafe static extern IntPtr nw_parameters_create_custom_ip (byte custom_ip_protocol_number, BlockLiteral *configure_ip);
#if !NET
[NoWatch, NoTV, NoiOS, Mac (10,15)]
#else
[SupportedOSPlatform ("macos10.15")]
#endif
[BindingImpl (BindingImplOptions.Optimizable)]
public unsafe static NWParameters CreateCustomIP (byte protocolNumber, Action<NWProtocolOptions>? configureCustomIP = null)
{
@ -476,16 +490,34 @@ namespace Network {
set => nw_parameters_set_include_peer_to_peer (GetCheckedHandle (), value);
}
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
[DllImport (Constants.NetworkLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
static extern bool nw_parameters_get_prohibit_constrained (IntPtr parameters);
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
[DllImport (Constants.NetworkLibrary)]
static extern void nw_parameters_set_prohibit_constrained (IntPtr parameters, [MarshalAs (UnmanagedType.I1)] bool prohibit_constrained);
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public bool ProhibitConstrained {
get => nw_parameters_get_prohibit_constrained (GetCheckedHandle ());
set => nw_parameters_set_prohibit_constrained (GetCheckedHandle (), value);

Просмотреть файл

@ -12,14 +12,20 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
namespace Network {
#if !NET
[TV (12,0), Mac (10,14), iOS (12,0)]
[Watch (6,0)]
#else
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("tvos12.0")]
#endif
public class NWPath : NativeObject {
public NWPath (IntPtr handle, bool owns) : base (handle, owns) {}
@ -124,15 +130,33 @@ namespace Network {
}
}
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
[DllImport (Constants.NetworkLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
static extern bool nw_path_is_constrained (IntPtr path);
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public bool IsConstrained => nw_path_is_constrained (GetCheckedHandle ());
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
[DllImport (Constants.NetworkLibrary)]
static extern void nw_path_enumerate_gateways (IntPtr path, ref BlockLiteral enumerate_block);
@ -149,7 +173,13 @@ namespace Network {
}
}
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
[BindingImpl (BindingImplOptions.Optimizable)]
public void EnumerateGateways (Action<NWEndpoint> callback)
{
@ -166,13 +196,27 @@ namespace Network {
}
}
#if !NET
[iOS (14,2)][TV (14,2)][Watch (7,1)][Mac (11,0)]
[MacCatalyst (14,2)]
#else
[SupportedOSPlatform ("ios14.2")]
[SupportedOSPlatform ("tvos14.2")]
[SupportedOSPlatform ("macos11.0")]
[SupportedOSPlatform ("maccatalyst14.2")]
#endif
[DllImport (Constants.NetworkLibrary)]
static extern NWPathUnsatisfiedReason /* nw_path_unsatisfied_reason_t */ nw_path_get_unsatisfied_reason (IntPtr /* OS_nw_path */ path);
#if !NET
[iOS (14,2)][TV (14,2)][Watch (7,1)][Mac (11,0)]
[MacCatalyst (14,2)]
#else
[SupportedOSPlatform ("ios14.2")]
[SupportedOSPlatform ("tvos14.2")]
[SupportedOSPlatform ("macos11.0")]
[SupportedOSPlatform ("maccatalyst14.2")]
#endif
public NWPathUnsatisfiedReason GetUnsatisfiedReason ()
{
return nw_path_get_unsatisfied_reason (GetCheckedHandle ());

Просмотреть файл

@ -12,14 +12,20 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
namespace Network {
#if !NET
[TV (12,0), Mac (10,14), iOS (12,0)]
[Watch (6,0)]
#else
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("tvos12.0")]
#endif
public class NWPathMonitor : NativeObject {
public NWPathMonitor (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -12,6 +12,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -20,8 +21,13 @@ using OS_nw_protocol_definition=System.IntPtr;
namespace Network {
#if !NET
[TV (12,0), Mac (10,14), iOS (12,0)]
[Watch (6,0)]
#else
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("tvos12.0")]
#endif
public class NWProtocolDefinition : NativeObject {
public NWProtocolDefinition (IntPtr handle, bool owns) : base (handle, owns) {}
@ -78,20 +84,44 @@ namespace Network {
public static NWProtocolDefinition CreateTlsDefinition () => new NWProtocolDefinition (nw_protocol_copy_tls_definition (), owns: true);
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
[DllImport (Constants.NetworkLibrary)]
static extern OS_nw_protocol_definition nw_protocol_copy_ws_definition ();
#if !XAMCORE_4_0
#if !NET
[Obsolete ("Use 'CreateWebSocketDefinition' method instead.")]
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
[Obsolete ("Use 'CreateWebSocketDefinition' method instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
public static NWProtocolDefinition WebSocketDefinition => new NWProtocolDefinition (nw_protocol_copy_ws_definition (), owns: true);
#endif
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public static NWProtocolDefinition CreateWebSocketDefinition () => new NWProtocolDefinition (nw_protocol_copy_ws_definition (), owns: true);
#if !NET
[TV (13,0), Mac (10,15)]
#else
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
[DllImport (Constants.NetworkLibrary)]
static extern unsafe OS_nw_protocol_definition nw_framer_create_definition (string identifier, NWFramerCreateFlags flags, ref BlockLiteral start_handler);
delegate NWFramerStartResult nw_framer_create_definition_t (IntPtr block, IntPtr framer);
@ -109,7 +139,13 @@ namespace Network {
return NWFramerStartResult.Unknown;
}
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
[BindingImpl (BindingImplOptions.Optimizable)]
public static NWProtocolDefinition CreateFramerDefinition (string identifier, NWFramerCreateFlags flags, Func<NWFramer, NWFramerStartResult> startCallback)
{

Просмотреть файл

@ -12,6 +12,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -21,7 +22,13 @@ using IntPtr=System.IntPtr;
namespace Network {
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0), Watch (6,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public class NWProtocolIPOptions : NWProtocolOptions {
internal NWProtocolIPOptions (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -12,6 +12,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -22,8 +23,13 @@ using nw_service_class_t=System.IntPtr;
namespace Network {
#if !NET
[TV (12,0), Mac (10,14), iOS (12,0)]
[Watch (6,0)]
#else
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("tvos12.0")]
#endif
public class NWProtocolMetadata : NativeObject {
[DllImport (Constants.NetworkLibrary)]
@ -196,20 +202,44 @@ namespace Network {
}
#endif
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
[DllImport (Constants.NetworkLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
internal static extern bool nw_protocol_metadata_is_framer_message (OS_nw_protocol_metadata metadata);
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public bool IsFramerMessage => nw_protocol_metadata_is_framer_message (GetCheckedHandle ());
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
[DllImport (Constants.NetworkLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
internal static extern bool nw_protocol_metadata_is_ws (OS_nw_protocol_metadata metadata);
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public bool IsWebSocket => nw_protocol_metadata_is_ws (GetCheckedHandle ());
}
}

Просмотреть файл

@ -12,6 +12,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -21,8 +22,13 @@ using IntPtr=System.IntPtr;
namespace Network {
#if !NET
[TV (12,0), Mac (10,14), iOS (12,0)]
[Watch (6,0)]
#else
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("tvos12.0")]
#endif
public class NWProtocolOptions : NativeObject {
public NWProtocolOptions (IntPtr handle, bool owns) : base (handle, owns) {}
@ -107,12 +113,26 @@ namespace Network {
}
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
[DllImport (Constants.NetworkLibrary)]
internal static extern void nw_ip_options_set_local_address_preference (IntPtr options, NWIPLocalAddressPreference preference);
#if !NET
[Obsolete ("Use the 'NWProtocolIPOptions' class instead.")]
[TV (13,0), Mac (10,15), iOS (13,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
[UnsupportedOSPlatform ("maccatalystq")]
[Obsolete ("Use the 'NWProtocolIPOptions' class instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#endif
public NWIPLocalAddressPreference IPLocalAddressPreference {
set => nw_ip_options_set_local_address_preference (GetCheckedHandle (), value);
}

Просмотреть файл

@ -11,6 +11,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -23,8 +24,13 @@ using nw_protocol_options_t=System.IntPtr;
namespace Network {
#if !NET
[TV (12,0), Mac (10,14), iOS (12,0)]
[Watch (6,0)]
#else
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("tvos12.0")]
#endif
public class NWProtocolStack : NativeObject {
public NWProtocolStack (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -12,6 +12,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -21,7 +22,12 @@ using IntPtr=System.IntPtr;
namespace Network {
#if !NET
[TV (12,0), Mac (10,14), iOS (12,0), Watch (6,0)]
#else
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("tvos12.0")]
#endif
public class NWProtocolTcpOptions : NWProtocolOptions {
internal NWProtocolTcpOptions (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -12,6 +12,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -21,7 +22,12 @@ using IntPtr=System.IntPtr;
namespace Network {
#if !NET
[TV (12,0), Mac (10,14), iOS (12,0), Watch (6,0)]
#else
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("tvos12.0")]
#endif
public class NWProtocolTlsOptions : NWProtocolOptions {
internal NWProtocolTlsOptions (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -14,10 +14,16 @@ using ObjCRuntime;
using Foundation;
using CoreFoundation;
using Security;
using System.Runtime.Versioning;
namespace Network {
#if !NET
[TV (12,0), Mac (10,14), iOS (12,0), Watch (6,0)]
#else
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("tvos12.0")]
#endif
public class NWProtocolUdpOptions : NWProtocolOptions {
internal NWProtocolUdpOptions (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -13,10 +13,16 @@ using System;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
using System.Runtime.Versioning;
namespace Network {
#if !NET
[TV (12,0), Mac (10,14), iOS (12,0), Watch (6,0)]
#else
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("tvos12.0")]
#endif
public class NWTcpMetadata : NWProtocolMetadata {
internal NWTcpMetadata (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -14,10 +14,16 @@ using ObjCRuntime;
using Foundation;
using Security;
using CoreFoundation;
using System.Runtime.Versioning;
namespace Network {
#if !NET
[TV (12,0), Mac (10,14), iOS (12,0), Watch (6,0)]
#else
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("tvos12.0")]
#endif
public class NWTlsMetadata : NWProtocolMetadata {
internal NWTlsMetadata (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -12,6 +12,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using ObjCRuntime;
using Foundation;
@ -24,8 +25,13 @@ using OS_nw_txt_record=System.IntPtr;
namespace Network {
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0), Watch (6,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public class NWTxtRecord : NativeObject {
internal NWTxtRecord (IntPtr handle, bool owns) : base (handle, owns) { }

Просмотреть файл

@ -14,10 +14,16 @@ using ObjCRuntime;
using Foundation;
using Security;
using CoreFoundation;
using System.Runtime.Versioning;
namespace Network {
#if !NET
[TV (12,0), Mac (10,14), iOS (12,0), Watch (6,0)]
#else
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("tvos12.0")]
#endif
public class NWUdpMetadata : NWProtocolMetadata {
internal NWUdpMetadata (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -12,6 +12,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -22,7 +23,13 @@ using dispatch_queue_t =System.IntPtr;
namespace Network {
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0), Watch (6,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public class NWWebSocketMetadata : NWProtocolMetadata {
internal NWWebSocketMetadata (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -12,6 +12,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -21,7 +22,13 @@ using nw_ws_request_t=System.IntPtr;
namespace Network {
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0), Watch (6,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public class NWWebSocketOptions : NWProtocolOptions {
bool autoReplyPing = false;
bool skipHandShake = false;

Просмотреть файл

@ -12,6 +12,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -20,7 +21,13 @@ using OS_nw_ws_request=System.IntPtr;
namespace Network {
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0), Watch (6,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public class NWWebSocketRequest : NativeObject {
internal NWWebSocketRequest (IntPtr handle, bool owns) : base (handle, owns) {}

Просмотреть файл

@ -12,6 +12,7 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ObjCRuntime;
using Foundation;
using CoreFoundation;
@ -20,7 +21,13 @@ using OS_nw_ws_response=System.IntPtr;
namespace Network {
#if !NET
[TV (13,0), Mac (10,15), iOS (13,0), Watch (6,0)]
#else
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos10.15")]
#endif
public class NWWebSocketResponse : NativeObject {
internal NWWebSocketResponse (IntPtr handle, bool owns) : base (handle, owns) {}