[Network] Make P/Invokes in NWConnection[Group] have blittable signatures. (#20662)
Contributes towards #15684.
This commit is contained in:
Родитель
7b3ad09aac
Коммит
5c5a4580ec
|
@ -498,7 +498,7 @@ namespace Network {
|
||||||
static extern unsafe void nw_connection_send (IntPtr handle,
|
static extern unsafe void nw_connection_send (IntPtr handle,
|
||||||
IntPtr dispatchData,
|
IntPtr dispatchData,
|
||||||
IntPtr contentContext,
|
IntPtr contentContext,
|
||||||
[MarshalAs (UnmanagedType.U1)] bool isComplete,
|
byte isComplete,
|
||||||
BlockLiteral* callback);
|
BlockLiteral* callback);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -511,7 +511,7 @@ namespace Network {
|
||||||
nw_connection_send (handle: GetCheckedHandle (),
|
nw_connection_send (handle: GetCheckedHandle (),
|
||||||
dispatchData: buffer.GetHandle (),
|
dispatchData: buffer.GetHandle (),
|
||||||
contentContext: contentContext,
|
contentContext: contentContext,
|
||||||
isComplete: isComplete,
|
isComplete: isComplete.AsByte (),
|
||||||
callback: callback);
|
callback: callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,7 @@ namespace Network {
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
unsafe static extern void nw_connection_group_set_receive_handler (OS_nw_connection_group group, uint maximum_message_size, [MarshalAs (UnmanagedType.I1)] bool reject_oversized_messages, BlockLiteral* handler);
|
unsafe static extern void nw_connection_group_set_receive_handler (OS_nw_connection_group group, uint maximum_message_size, byte reject_oversized_messages, BlockLiteral* handler);
|
||||||
|
|
||||||
#if !NET
|
#if !NET
|
||||||
delegate void nw_connection_group_receive_handler_t (IntPtr block, IntPtr content, IntPtr context, byte isCompleted);
|
delegate void nw_connection_group_receive_handler_t (IntPtr block, IntPtr content, IntPtr context, byte isCompleted);
|
||||||
|
@ -259,7 +259,7 @@ namespace Network {
|
||||||
{
|
{
|
||||||
unsafe {
|
unsafe {
|
||||||
if (handler is null) {
|
if (handler is null) {
|
||||||
nw_connection_group_set_receive_handler (GetCheckedHandle (), maximumMessageSize, rejectOversizedMessages, null);
|
nw_connection_group_set_receive_handler (GetCheckedHandle (), maximumMessageSize, rejectOversizedMessages.AsByte (), null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ namespace Network {
|
||||||
using var block = new BlockLiteral ();
|
using var block = new BlockLiteral ();
|
||||||
block.SetupBlockUnsafe (static_ReceiveHandler, handler);
|
block.SetupBlockUnsafe (static_ReceiveHandler, handler);
|
||||||
#endif
|
#endif
|
||||||
nw_connection_group_set_receive_handler (GetCheckedHandle (), maximumMessageSize, rejectOversizedMessages, &block);
|
nw_connection_group_set_receive_handler (GetCheckedHandle (), maximumMessageSize, rejectOversizedMessages.AsByte (), &block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,8 +432,7 @@ namespace Network {
|
||||||
[MacCatalyst (15, 0)]
|
[MacCatalyst (15, 0)]
|
||||||
#endif
|
#endif
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
[return: MarshalAs (UnmanagedType.I1)]
|
static extern byte nw_connection_group_reinsert_extracted_connection (OS_nw_connection_group group, OS_nw_connection connection);
|
||||||
static extern bool nw_connection_group_reinsert_extracted_connection (OS_nw_connection_group group, OS_nw_connection connection);
|
|
||||||
|
|
||||||
#if NET
|
#if NET
|
||||||
[SupportedOSPlatform ("tvos15.0")]
|
[SupportedOSPlatform ("tvos15.0")]
|
||||||
|
@ -451,7 +450,7 @@ namespace Network {
|
||||||
{
|
{
|
||||||
if (connection is null)
|
if (connection is null)
|
||||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (connection));
|
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (connection));
|
||||||
return nw_connection_group_reinsert_extracted_connection (GetCheckedHandle (), connection.Handle);
|
return nw_connection_group_reinsert_extracted_connection (GetCheckedHandle (), connection.Handle) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NET
|
#if NET
|
||||||
|
|
|
@ -27,7 +27,6 @@ namespace Cecil.Tests {
|
||||||
"AVFoundation.AVSampleCursorSyncInfo ObjCRuntime.Messaging::AVSampleCursorSyncInfo_objc_msgSend(System.IntPtr,System.IntPtr)",
|
"AVFoundation.AVSampleCursorSyncInfo ObjCRuntime.Messaging::AVSampleCursorSyncInfo_objc_msgSend(System.IntPtr,System.IntPtr)",
|
||||||
"AVFoundation.AVSampleCursorSyncInfo ObjCRuntime.Messaging::AVSampleCursorSyncInfo_objc_msgSendSuper_stret(System.IntPtr,System.IntPtr)",
|
"AVFoundation.AVSampleCursorSyncInfo ObjCRuntime.Messaging::AVSampleCursorSyncInfo_objc_msgSendSuper_stret(System.IntPtr,System.IntPtr)",
|
||||||
"AVFoundation.AVSampleCursorSyncInfo ObjCRuntime.Messaging::AVSampleCursorSyncInfo_objc_msgSendSuper(System.IntPtr,System.IntPtr)",
|
"AVFoundation.AVSampleCursorSyncInfo ObjCRuntime.Messaging::AVSampleCursorSyncInfo_objc_msgSendSuper(System.IntPtr,System.IntPtr)",
|
||||||
"System.Boolean Network.NWConnectionGroup::nw_connection_group_reinsert_extracted_connection(System.IntPtr,System.IntPtr)",
|
|
||||||
"System.Boolean Network.NWContentContext::nw_content_context_get_is_final(System.IntPtr)",
|
"System.Boolean Network.NWContentContext::nw_content_context_get_is_final(System.IntPtr)",
|
||||||
"System.Boolean Network.NWEstablishmentReport::nw_establishment_report_get_proxy_configured(System.IntPtr)",
|
"System.Boolean Network.NWEstablishmentReport::nw_establishment_report_get_proxy_configured(System.IntPtr)",
|
||||||
"System.Boolean Network.NWEstablishmentReport::nw_establishment_report_get_used_proxy(System.IntPtr)",
|
"System.Boolean Network.NWEstablishmentReport::nw_establishment_report_get_used_proxy(System.IntPtr)",
|
||||||
|
@ -56,8 +55,6 @@ namespace Cecil.Tests {
|
||||||
"System.Int32 AudioUnit.AUGraph::NewAUGraph(System.IntPtr&)",
|
"System.Int32 AudioUnit.AUGraph::NewAUGraph(System.IntPtr&)",
|
||||||
"System.IntPtr ObjCRuntime.Selector::GetHandle(System.String)",
|
"System.IntPtr ObjCRuntime.Selector::GetHandle(System.String)",
|
||||||
"System.IntPtr Security.SecKey::SecKeyCreateEncryptedData(System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr&)",
|
"System.IntPtr Security.SecKey::SecKeyCreateEncryptedData(System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr&)",
|
||||||
"System.Void Network.NWConnection::nw_connection_send(System.IntPtr,System.IntPtr,System.IntPtr,System.Boolean,ObjCRuntime.BlockLiteral*)",
|
|
||||||
"System.Void Network.NWConnectionGroup::nw_connection_group_set_receive_handler(System.IntPtr,System.UInt32,System.Boolean,ObjCRuntime.BlockLiteral*)",
|
|
||||||
"System.Void Network.NWContentContext::nw_content_context_set_is_final(System.IntPtr,System.Boolean)",
|
"System.Void Network.NWContentContext::nw_content_context_set_is_final(System.IntPtr,System.Boolean)",
|
||||||
"System.Void Network.NWMulticastGroup::nw_multicast_group_descriptor_set_disable_unicast_traffic(System.IntPtr,System.Boolean)",
|
"System.Void Network.NWMulticastGroup::nw_multicast_group_descriptor_set_disable_unicast_traffic(System.IntPtr,System.Boolean)",
|
||||||
"System.Void Network.NWParameters::nw_parameters_set_fast_open_enabled(System.IntPtr,System.Boolean)",
|
"System.Void Network.NWParameters::nw_parameters_set_fast_open_enabled(System.IntPtr,System.Boolean)",
|
||||||
|
|
Загрузка…
Ссылка в новой задаче