[Network] Robustify, I ran into hard to diagnose bugs due to Dipose() being called, and figured this was a good time to robustify our use of disposed objects, so did that now
This commit is contained in:
Родитель
78458beacf
Коммит
cf62ae9886
|
@ -45,7 +45,7 @@ namespace Network {
|
||||||
if (txt == null)
|
if (txt == null)
|
||||||
throw new ArgumentNullException (nameof (txt));
|
throw new ArgumentNullException (nameof (txt));
|
||||||
var n = System.Text.Encoding.UTF8.GetByteCount (txt);
|
var n = System.Text.Encoding.UTF8.GetByteCount (txt);
|
||||||
nw_advertise_descriptor_set_txt_record (handle, txt, (IntPtr) n);
|
nw_advertise_descriptor_set_txt_record (GetHandle (), txt, (IntPtr) n);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -59,8 +59,8 @@ namespace Network {
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public bool NoAutoRename {
|
public bool NoAutoRename {
|
||||||
set => nw_advertise_descriptor_set_no_auto_rename (handle, value);
|
set => nw_advertise_descriptor_set_no_auto_rename (GetHandle (), value);
|
||||||
get => nw_advertise_descriptor_get_no_auto_rename (handle);
|
get => nw_advertise_descriptor_get_no_auto_rename (GetHandle ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace Network {
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public NWEndpoint Endpoint {
|
public NWEndpoint Endpoint {
|
||||||
get {
|
get {
|
||||||
var x = nw_connection_copy_endpoint (handle);
|
var x = nw_connection_copy_endpoint (GetHandle ());
|
||||||
if (x == IntPtr.Zero)
|
if (x == IntPtr.Zero)
|
||||||
return null;
|
return null;
|
||||||
return new NWEndpoint (x, owns: true);
|
return new NWEndpoint (x, owns: true);
|
||||||
|
@ -72,7 +72,7 @@ namespace Network {
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public NWParameters Parameters {
|
public NWParameters Parameters {
|
||||||
get {
|
get {
|
||||||
var x = nw_connection_copy_parameters (handle);
|
var x = nw_connection_copy_parameters (GetHandle());
|
||||||
if (x == IntPtr.Zero)
|
if (x == IntPtr.Zero)
|
||||||
return null;
|
return null;
|
||||||
return new NWParameters (x, owns: true);
|
return new NWParameters (x, owns: true);
|
||||||
|
@ -101,7 +101,7 @@ namespace Network {
|
||||||
public unsafe void SetStateChangeHandler (Action<NWConnectionState,NWError> stateHandler)
|
public unsafe void SetStateChangeHandler (Action<NWConnectionState,NWError> stateHandler)
|
||||||
{
|
{
|
||||||
if (stateHandler == null){
|
if (stateHandler == null){
|
||||||
nw_connection_set_state_changed_handler (handle, null);
|
nw_connection_set_state_changed_handler (GetHandle(), null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ namespace Network {
|
||||||
block_ptr_handler = &block_handler;
|
block_ptr_handler = &block_handler;
|
||||||
block_handler.SetupBlockUnsafe (static_stateChangeHandler, stateHandler);
|
block_handler.SetupBlockUnsafe (static_stateChangeHandler, stateHandler);
|
||||||
|
|
||||||
nw_connection_set_state_changed_handler (handle, (void*) block_ptr_handler);
|
nw_connection_set_state_changed_handler (GetHandle(), (void*) block_ptr_handler);
|
||||||
block_ptr_handler->CleanupBlock ();
|
block_ptr_handler->CleanupBlock ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ namespace Network {
|
||||||
public unsafe void SetBooleanChangeHandler (Action<bool> callback)
|
public unsafe void SetBooleanChangeHandler (Action<bool> callback)
|
||||||
{
|
{
|
||||||
if (callback == null){
|
if (callback == null){
|
||||||
nw_connection_set_viability_changed_handler (handle, null);
|
nw_connection_set_viability_changed_handler (GetHandle(), null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -148,7 +148,7 @@ namespace Network {
|
||||||
block_ptr_handler = &block_handler;
|
block_ptr_handler = &block_handler;
|
||||||
block_handler.SetupBlockUnsafe (static_BooleanChangeHandler, callback);
|
block_handler.SetupBlockUnsafe (static_BooleanChangeHandler, callback);
|
||||||
|
|
||||||
nw_connection_set_viability_changed_handler (handle, (void*) block_ptr_handler);
|
nw_connection_set_viability_changed_handler (GetHandle(), (void*) block_ptr_handler);
|
||||||
block_ptr_handler->CleanupBlock ();
|
block_ptr_handler->CleanupBlock ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ namespace Network {
|
||||||
public unsafe void SetBetterPathAvailableHandler (Action<bool> callback)
|
public unsafe void SetBetterPathAvailableHandler (Action<bool> callback)
|
||||||
{
|
{
|
||||||
if (callback == null){
|
if (callback == null){
|
||||||
nw_connection_set_better_path_available_handler (handle, null);
|
nw_connection_set_better_path_available_handler (GetHandle(), null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -171,7 +171,7 @@ namespace Network {
|
||||||
block_ptr_handler = &block_handler;
|
block_ptr_handler = &block_handler;
|
||||||
block_handler.SetupBlockUnsafe (static_BooleanChangeHandler, callback);
|
block_handler.SetupBlockUnsafe (static_BooleanChangeHandler, callback);
|
||||||
|
|
||||||
nw_connection_set_better_path_available_handler (handle, (void*) block_ptr_handler);
|
nw_connection_set_better_path_available_handler (GetHandle(), (void*) block_ptr_handler);
|
||||||
block_ptr_handler->CleanupBlock ();
|
block_ptr_handler->CleanupBlock ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ namespace Network {
|
||||||
block_ptr_handler = &block_handler;
|
block_ptr_handler = &block_handler;
|
||||||
block_handler.SetupBlockUnsafe (static_PathChanged, callback);
|
block_handler.SetupBlockUnsafe (static_PathChanged, callback);
|
||||||
|
|
||||||
nw_connection_set_path_changed_handler (handle, (void*) block_ptr_handler);
|
nw_connection_set_path_changed_handler (GetHandle(), (void*) block_ptr_handler);
|
||||||
block_ptr_handler->CleanupBlock ();
|
block_ptr_handler->CleanupBlock ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ namespace Network {
|
||||||
{
|
{
|
||||||
if (queue == null)
|
if (queue == null)
|
||||||
throw new ArgumentNullException (nameof (queue));
|
throw new ArgumentNullException (nameof (queue));
|
||||||
nw_connection_set_queue (handle, queue.handle);
|
nw_connection_set_queue (GetHandle(), queue.handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -226,35 +226,35 @@ namespace Network {
|
||||||
static extern void nw_connection_start (IntPtr handle);
|
static extern void nw_connection_start (IntPtr handle);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void Start () => nw_connection_start (handle);
|
public void Start () => nw_connection_start (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
static extern void nw_connection_restart (IntPtr handle);
|
static extern void nw_connection_restart (IntPtr handle);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void Restart () => nw_connection_restart (handle);
|
public void Restart () => nw_connection_restart (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
static extern void nw_connection_cancel (IntPtr handle);
|
static extern void nw_connection_cancel (IntPtr handle);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void Cancel () => nw_connection_cancel (handle);
|
public void Cancel () => nw_connection_cancel (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
static extern void nw_connection_force_cancel (IntPtr handle);
|
static extern void nw_connection_force_cancel (IntPtr handle);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void ForceCancel () => nw_connection_force_cancel (handle);
|
public void ForceCancel () => nw_connection_force_cancel (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
static extern void nw_connection_cancel_current_endpoint (IntPtr handle);
|
static extern void nw_connection_cancel_current_endpoint (IntPtr handle);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void CancelCurrentEndpoint () => nw_connection_cancel_current_endpoint (handle);
|
public void CancelCurrentEndpoint () => nw_connection_cancel_current_endpoint (GetHandle());
|
||||||
|
|
||||||
delegate void nw_connection_receive_completion_t (IntPtr block,
|
delegate void nw_connection_receive_completion_t (IntPtr block,
|
||||||
IntPtr dispatchData,
|
IntPtr dispatchData,
|
||||||
|
@ -305,7 +305,7 @@ namespace Network {
|
||||||
block_ptr_handler = &block_handler;
|
block_ptr_handler = &block_handler;
|
||||||
block_handler.SetupBlockUnsafe (static_ReceiveCompletion, callback);
|
block_handler.SetupBlockUnsafe (static_ReceiveCompletion, callback);
|
||||||
|
|
||||||
nw_connection_receive (handle, minimumIncompleteLength, maximumLength, (void*) block_ptr_handler);
|
nw_connection_receive (GetHandle(), minimumIncompleteLength, maximumLength, (void*) block_ptr_handler);
|
||||||
block_ptr_handler->CleanupBlock ();
|
block_ptr_handler->CleanupBlock ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -323,7 +323,7 @@ namespace Network {
|
||||||
block_ptr_handler = &block_handler;
|
block_ptr_handler = &block_handler;
|
||||||
block_handler.SetupBlockUnsafe (static_ReceiveCompletion, callback);
|
block_handler.SetupBlockUnsafe (static_ReceiveCompletion, callback);
|
||||||
|
|
||||||
nw_connection_receive_message (handle, (void*) block_ptr_handler);
|
nw_connection_receive_message (GetHandle(), (void*) block_ptr_handler);
|
||||||
block_ptr_handler->CleanupBlock ();
|
block_ptr_handler->CleanupBlock ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -359,7 +359,7 @@ namespace Network {
|
||||||
//
|
//
|
||||||
unsafe void LowLevelSend (IntPtr handle, DispatchData buffer, IntPtr contentContext, bool isComplete, void *callback)
|
unsafe void LowLevelSend (IntPtr handle, DispatchData buffer, IntPtr contentContext, bool isComplete, void *callback)
|
||||||
{
|
{
|
||||||
nw_connection_send (handle: handle,
|
nw_connection_send (handle: GetHandle(),
|
||||||
dispatchData: buffer == null ? IntPtr.Zero : buffer.Handle,
|
dispatchData: buffer == null ? IntPtr.Zero : buffer.Handle,
|
||||||
contentContext: contentContext,
|
contentContext: contentContext,
|
||||||
isComplete: isComplete,
|
isComplete: isComplete,
|
||||||
|
@ -402,7 +402,7 @@ namespace Network {
|
||||||
block_ptr_handler = &block_handler;
|
block_ptr_handler = &block_handler;
|
||||||
block_handler.SetupBlockUnsafe (static_SendCompletion, callback);
|
block_handler.SetupBlockUnsafe (static_SendCompletion, callback);
|
||||||
|
|
||||||
LowLevelSend (handle, buffer, context.Handle, isComplete, block_ptr_handler);
|
LowLevelSend (GetHandle(), buffer, context.Handle, isComplete, block_ptr_handler);
|
||||||
block_ptr_handler->CleanupBlock ();
|
block_ptr_handler->CleanupBlock ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -423,7 +423,7 @@ namespace Network {
|
||||||
if (context == null)
|
if (context == null)
|
||||||
throw new ArgumentNullException (nameof (context));
|
throw new ArgumentNullException (nameof (context));
|
||||||
|
|
||||||
LowLevelSend (handle, buffer, context.Handle, isComplete, (void *) NW_CONNECTION_SEND_IDEMPOTENT_CONTENT ());
|
LowLevelSend (GetHandle(), buffer, context.Handle, isComplete, (void *) NW_CONNECTION_SEND_IDEMPOTENT_CONTENT ());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -441,7 +441,7 @@ namespace Network {
|
||||||
extern static string nw_connection_copy_description (IntPtr handle);
|
extern static string nw_connection_copy_description (IntPtr handle);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public string Description => nw_connection_copy_description (handle);
|
public string Description => nw_connection_copy_description (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
|
@ -450,7 +450,7 @@ namespace Network {
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public NWPath CurrentPath {
|
public NWPath CurrentPath {
|
||||||
get {
|
get {
|
||||||
var x = nw_connection_copy_current_path (handle);
|
var x = nw_connection_copy_current_path (GetHandle());
|
||||||
if (x == IntPtr.Zero)
|
if (x == IntPtr.Zero)
|
||||||
return null;
|
return null;
|
||||||
return new NWPath (x, owns: true);
|
return new NWPath (x, owns: true);
|
||||||
|
@ -467,7 +467,7 @@ namespace Network {
|
||||||
if (definition == null)
|
if (definition == null)
|
||||||
throw new ArgumentNullException (nameof (definition));
|
throw new ArgumentNullException (nameof (definition));
|
||||||
|
|
||||||
var x = nw_connection_copy_protocol_metadata (handle, definition.handle);
|
var x = nw_connection_copy_protocol_metadata (GetHandle(), definition.handle);
|
||||||
if (x == IntPtr.Zero)
|
if (x == IntPtr.Zero)
|
||||||
return null;
|
return null;
|
||||||
return new NWProtocolMetadata (x, owns: true);
|
return new NWProtocolMetadata (x, owns: true);
|
||||||
|
@ -477,7 +477,7 @@ namespace Network {
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
extern static uint nw_connection_get_maximum_datagram_size (IntPtr handle);
|
extern static uint nw_connection_get_maximum_datagram_size (IntPtr handle);
|
||||||
|
|
||||||
public uint MaximumDatagramSize => nw_connection_get_maximum_datagram_size (handle);
|
public uint MaximumDatagramSize => nw_connection_get_maximum_datagram_size (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
|
@ -486,7 +486,7 @@ namespace Network {
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void Batch (Action method)
|
public void Batch (Action method)
|
||||||
{
|
{
|
||||||
BlockLiteral.SimpleCall (method, (arg)=> nw_connection_batch (handle, arg));
|
BlockLiteral.SimpleCall (method, (arg)=> nw_connection_batch (GetHandle(), arg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace Network {
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
extern static IntPtr nw_content_context_get_identifier (IntPtr handle);
|
extern static IntPtr nw_content_context_get_identifier (IntPtr handle);
|
||||||
|
|
||||||
public string Identifier => Marshal.PtrToStringAnsi (nw_content_context_get_identifier (handle));
|
public string Identifier => Marshal.PtrToStringAnsi (nw_content_context_get_identifier (GetHandle()));
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
|
@ -72,8 +72,8 @@ namespace Network {
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public bool IsFinal {
|
public bool IsFinal {
|
||||||
get => nw_content_context_get_is_final (handle);
|
get => nw_content_context_get_is_final (GetHandle());
|
||||||
set => nw_content_context_set_is_final (handle, value);
|
set => nw_content_context_set_is_final (GetHandle(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -86,8 +86,8 @@ namespace Network {
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public ulong ExpirationMilliseconds {
|
public ulong ExpirationMilliseconds {
|
||||||
get => nw_content_context_get_expiration_milliseconds (handle);
|
get => nw_content_context_get_expiration_milliseconds (GetHandle());
|
||||||
set => nw_content_context_set_expiration_milliseconds (handle, value);
|
set => nw_content_context_set_expiration_milliseconds (GetHandle(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -100,8 +100,8 @@ namespace Network {
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public double RelativePriority {
|
public double RelativePriority {
|
||||||
get => nw_content_context_get_relative_priority (handle);
|
get => nw_content_context_get_relative_priority (GetHandle());
|
||||||
set => nw_content_context_set_relative_priority (handle, value);
|
set => nw_content_context_set_relative_priority (GetHandle(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -115,13 +115,13 @@ namespace Network {
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public NWContentContext Antecedent {
|
public NWContentContext Antecedent {
|
||||||
get {
|
get {
|
||||||
var h = nw_content_context_copy_antecedent (handle);
|
var h = nw_content_context_copy_antecedent (GetHandle());
|
||||||
if (h == IntPtr.Zero)
|
if (h == IntPtr.Zero)
|
||||||
return null;
|
return null;
|
||||||
return new NWContentContext (h, owns: true);
|
return new NWContentContext (h, owns: true);
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
nw_content_context_set_antecedent (handle, value == null ? IntPtr.Zero : value.Handle);
|
nw_content_context_set_antecedent (GetHandle(), value == null ? IntPtr.Zero : value.Handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ namespace Network {
|
||||||
{
|
{
|
||||||
if (protocolDefinition == null)
|
if (protocolDefinition == null)
|
||||||
throw new ArgumentNullException (nameof (protocolDefinition));
|
throw new ArgumentNullException (nameof (protocolDefinition));
|
||||||
var x = nw_content_context_copy_protocol_metadata (handle, protocolDefinition.handle);
|
var x = nw_content_context_copy_protocol_metadata (GetHandle(), protocolDefinition.handle);
|
||||||
if (x == IntPtr.Zero)
|
if (x == IntPtr.Zero)
|
||||||
return null;
|
return null;
|
||||||
return new NWProtocolMetadata (x, owns: true);
|
return new NWProtocolMetadata (x, owns: true);
|
||||||
|
@ -148,7 +148,7 @@ namespace Network {
|
||||||
{
|
{
|
||||||
if (protocolMetadata == null)
|
if (protocolMetadata == null)
|
||||||
throw new ArgumentNullException (nameof (protocolMetadata));
|
throw new ArgumentNullException (nameof (protocolMetadata));
|
||||||
nw_content_context_set_metadata_for_protocol (handle, protocolMetadata.Handle);
|
nw_content_context_set_metadata_for_protocol (GetHandle(), protocolMetadata.Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate void ProtocolIterator (IntPtr block, IntPtr definition, IntPtr metadata);
|
delegate void ProtocolIterator (IntPtr block, IntPtr definition, IntPtr metadata);
|
||||||
|
@ -188,7 +188,7 @@ namespace Network {
|
||||||
block_ptr_handler = &block_handler;
|
block_ptr_handler = &block_handler;
|
||||||
block_handler.SetupBlockUnsafe (static_ProtocolIterator, callback);
|
block_handler.SetupBlockUnsafe (static_ProtocolIterator, callback);
|
||||||
|
|
||||||
nw_content_context_foreach_protocol_metadata (handle, (void*) block_ptr_handler);
|
nw_content_context_foreach_protocol_metadata (GetHandle(), (void*) block_ptr_handler);
|
||||||
block_ptr_handler->CleanupBlock ();
|
block_ptr_handler->CleanupBlock ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace Network {
|
||||||
extern static NWEndpointType nw_endpoint_get_type (OS_nw_endpoint handle);
|
extern static NWEndpointType nw_endpoint_get_type (OS_nw_endpoint handle);
|
||||||
|
|
||||||
[Mac(10,14)][iOS(12,0)][TV(12,0)]
|
[Mac(10,14)][iOS(12,0)][TV(12,0)]
|
||||||
public NWEndpointType Type => nw_endpoint_get_type (handle);
|
public NWEndpointType Type => nw_endpoint_get_type (GetHandle());
|
||||||
|
|
||||||
[Mac(10,14)][iOS(12,0)][TV(12,0)]
|
[Mac(10,14)][iOS(12,0)][TV(12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
|
@ -56,14 +56,14 @@ namespace Network {
|
||||||
static extern IntPtr nw_endpoint_get_hostname (OS_nw_endpoint endpoint);
|
static extern IntPtr nw_endpoint_get_hostname (OS_nw_endpoint endpoint);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public string Hostname => Marshal.PtrToStringAnsi (nw_endpoint_get_hostname (handle));
|
public string Hostname => Marshal.PtrToStringAnsi (nw_endpoint_get_hostname (GetHandle()));
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
static extern string nw_endpoint_copy_port_string (OS_nw_endpoint endpoint);
|
static extern string nw_endpoint_copy_port_string (OS_nw_endpoint endpoint);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public string Port => nw_endpoint_copy_port_string (handle);
|
public string Port => nw_endpoint_copy_port_string (GetHandle());
|
||||||
|
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -71,7 +71,7 @@ namespace Network {
|
||||||
static extern ushort nw_endpoint_get_port (OS_nw_endpoint endpoint);
|
static extern ushort nw_endpoint_get_port (OS_nw_endpoint endpoint);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public ushort PortNumber => nw_endpoint_get_port (handle);
|
public ushort PortNumber => nw_endpoint_get_port (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
|
@ -86,7 +86,7 @@ namespace Network {
|
||||||
static extern string nw_endpoint_copy_address_string (OS_nw_endpoint endpoint);
|
static extern string nw_endpoint_copy_address_string (OS_nw_endpoint endpoint);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public string Address => nw_endpoint_copy_address_string (handle);
|
public string Address => nw_endpoint_copy_address_string (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
|
@ -113,21 +113,21 @@ namespace Network {
|
||||||
static extern unsafe IntPtr nw_endpoint_get_bonjour_service_name (OS_nw_endpoint endpoint);
|
static extern unsafe IntPtr nw_endpoint_get_bonjour_service_name (OS_nw_endpoint endpoint);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public string BonjourServiceName => Marshal.PtrToStringAnsi (nw_endpoint_get_bonjour_service_name (handle));
|
public string BonjourServiceName => Marshal.PtrToStringAnsi (nw_endpoint_get_bonjour_service_name (GetHandle()));
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
static extern IntPtr nw_endpoint_get_bonjour_service_type (OS_nw_endpoint endpoint);
|
static extern IntPtr nw_endpoint_get_bonjour_service_type (OS_nw_endpoint endpoint);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public string BonjourServiceType => Marshal.PtrToStringAnsi (nw_endpoint_get_bonjour_service_type (handle));
|
public string BonjourServiceType => Marshal.PtrToStringAnsi (nw_endpoint_get_bonjour_service_type (GetHandle()));
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
static extern IntPtr nw_endpoint_get_bonjour_service_domain (OS_nw_endpoint endpoint);
|
static extern IntPtr nw_endpoint_get_bonjour_service_domain (OS_nw_endpoint endpoint);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public string BonjourServiceDomain => Marshal.PtrToStringAnsi (nw_endpoint_get_bonjour_service_domain (handle));
|
public string BonjourServiceDomain => Marshal.PtrToStringAnsi (nw_endpoint_get_bonjour_service_domain (GetHandle()));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,14 +34,14 @@ namespace Network {
|
||||||
static extern NWErrorDomain nw_error_get_error_domain (IntPtr error);
|
static extern NWErrorDomain nw_error_get_error_domain (IntPtr error);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public NWErrorDomain ErrorDomain => nw_error_get_error_domain (handle);
|
public NWErrorDomain ErrorDomain => nw_error_get_error_domain (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
static extern int nw_error_get_error_code (IntPtr handle);
|
static extern int nw_error_get_error_code (IntPtr handle);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public int ErrorCode => nw_error_get_error_code (handle);
|
public int ErrorCode => nw_error_get_error_code (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
|
@ -50,7 +50,7 @@ namespace Network {
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public CFException CFError {
|
public CFException CFError {
|
||||||
get {
|
get {
|
||||||
return CFException.FromCFError (nw_error_copy_cf_error (handle), true);
|
return CFException.FromCFError (nw_error_copy_cf_error (GetHandle()), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,19 +24,19 @@ namespace Network {
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
static extern NWInterfaceType nw_interface_get_type (OS_nw_interface iface);
|
static extern NWInterfaceType nw_interface_get_type (OS_nw_interface iface);
|
||||||
|
|
||||||
public NWInterfaceType InterfaceType => nw_interface_get_type (handle);
|
public NWInterfaceType InterfaceType => nw_interface_get_type (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
static extern IntPtr nw_interface_get_name (OS_nw_interface iface);
|
static extern IntPtr nw_interface_get_name (OS_nw_interface iface);
|
||||||
|
|
||||||
public string Name => Marshal.PtrToStringAnsi (nw_interface_get_name (handle));
|
public string Name => Marshal.PtrToStringAnsi (nw_interface_get_name (GetHandle()));
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
static extern uint nw_interface_get_index (OS_nw_interface iface);
|
static extern uint nw_interface_get_index (OS_nw_interface iface);
|
||||||
|
|
||||||
public uint Index => nw_interface_get_index (handle);
|
public uint Index => nw_interface_get_index (GetHandle());
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum NWInterfaceType {
|
public enum NWInterfaceType {
|
||||||
|
|
|
@ -22,40 +22,9 @@ namespace Network {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NWListener : INativeObject, IDisposable {
|
public class NWListener : NativeObject {
|
||||||
IntPtr handle;
|
public NWListener (IntPtr handle, bool owns) : base (handle, owns)
|
||||||
public IntPtr Handle {
|
|
||||||
get { return handle; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public NWListener (IntPtr handle, bool owns)
|
|
||||||
{
|
{
|
||||||
this.handle = handle;
|
|
||||||
if (owns == false)
|
|
||||||
CFObject.CFRetain (handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
public NWListener (IntPtr handle) : this (handle, false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
~NWListener ()
|
|
||||||
{
|
|
||||||
Dispose (false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose ()
|
|
||||||
{
|
|
||||||
Dispose (true);
|
|
||||||
GC.SuppressFinalize (this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void Dispose (bool disposing)
|
|
||||||
{
|
|
||||||
if (handle != IntPtr.Zero) {
|
|
||||||
CFObject.CFRelease (handle);
|
|
||||||
handle = IntPtr.Zero;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -75,7 +44,7 @@ namespace Network {
|
||||||
handle = nw_listener_create_with_port (port, parameters.handle);
|
handle = nw_listener_create_with_port (port, parameters.handle);
|
||||||
if (handle == IntPtr.Zero)
|
if (handle == IntPtr.Zero)
|
||||||
return null;
|
return null;
|
||||||
return new NWListener (handle);
|
return new NWListener (handle, owns: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -93,7 +62,7 @@ namespace Network {
|
||||||
handle = nw_listener_create (parameters.handle);
|
handle = nw_listener_create (parameters.handle);
|
||||||
if (handle == IntPtr.Zero)
|
if (handle == IntPtr.Zero)
|
||||||
return null;
|
return null;
|
||||||
return new NWListener (handle);
|
return new NWListener (handle, owns: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -112,7 +81,7 @@ namespace Network {
|
||||||
var handle = nw_listener_create_with_connection (connection.handle, parameters.handle);
|
var handle = nw_listener_create_with_connection (connection.handle, parameters.handle);
|
||||||
if (handle == IntPtr.Zero)
|
if (handle == IntPtr.Zero)
|
||||||
return null;
|
return null;
|
||||||
return new NWListener (handle);
|
return new NWListener (handle, owns: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -125,7 +94,7 @@ namespace Network {
|
||||||
if (queue == null)
|
if (queue == null)
|
||||||
throw new ArgumentNullException (nameof(queue));
|
throw new ArgumentNullException (nameof(queue));
|
||||||
|
|
||||||
nw_listener_set_queue (handle, queue.handle);
|
nw_listener_set_queue (GetHandle(), queue.handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -133,14 +102,14 @@ namespace Network {
|
||||||
extern static ushort nw_listener_get_port (IntPtr listener);
|
extern static ushort nw_listener_get_port (IntPtr listener);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public ushort Port => nw_listener_get_port (handle);
|
public ushort Port => nw_listener_get_port (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
extern static void nw_listener_start (IntPtr handle);
|
extern static void nw_listener_start (IntPtr handle);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void Start () => nw_listener_start (handle);
|
public void Start () => nw_listener_start (GetHandle());
|
||||||
|
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -148,7 +117,7 @@ namespace Network {
|
||||||
extern static void nw_listener_cancel (IntPtr handle);
|
extern static void nw_listener_cancel (IntPtr handle);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void Cancel () => nw_listener_cancel (handle);
|
public void Cancel () => nw_listener_cancel (GetHandle());
|
||||||
|
|
||||||
delegate void nw_listener_state_changed_handler_t (IntPtr block, NWListenerState state, IntPtr nwerror);
|
delegate void nw_listener_state_changed_handler_t (IntPtr block, NWListenerState state, IntPtr nwerror);
|
||||||
static nw_listener_state_changed_handler_t static_ListenerStateChanged = TrampolineListenerStateChanged;
|
static nw_listener_state_changed_handler_t static_ListenerStateChanged = TrampolineListenerStateChanged;
|
||||||
|
@ -173,7 +142,7 @@ namespace Network {
|
||||||
{
|
{
|
||||||
unsafe {
|
unsafe {
|
||||||
if (callback == null){
|
if (callback == null){
|
||||||
nw_listener_set_state_changed_handler (handle, null);
|
nw_listener_set_state_changed_handler (GetHandle(), null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +152,7 @@ namespace Network {
|
||||||
block_ptr_handler = &block_handler;
|
block_ptr_handler = &block_handler;
|
||||||
block_handler.SetupBlockUnsafe (static_ListenerStateChanged, callback);
|
block_handler.SetupBlockUnsafe (static_ListenerStateChanged, callback);
|
||||||
|
|
||||||
nw_listener_set_state_changed_handler (handle, (void*) block_ptr_handler);
|
nw_listener_set_state_changed_handler (GetHandle(), (void*) block_ptr_handler);
|
||||||
block_ptr_handler->CleanupBlock ();
|
block_ptr_handler->CleanupBlock ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,7 +179,7 @@ namespace Network {
|
||||||
{
|
{
|
||||||
unsafe {
|
unsafe {
|
||||||
if (callback == null){
|
if (callback == null){
|
||||||
nw_listener_set_new_connection_handler (handle, null);
|
nw_listener_set_new_connection_handler (GetHandle(), null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,7 +189,7 @@ namespace Network {
|
||||||
block_ptr_handler = &block_handler;
|
block_ptr_handler = &block_handler;
|
||||||
block_handler.SetupBlockUnsafe (static_NewConnection, callback);
|
block_handler.SetupBlockUnsafe (static_NewConnection, callback);
|
||||||
|
|
||||||
nw_listener_set_new_connection_handler (handle, (void*) block_ptr_handler);
|
nw_listener_set_new_connection_handler (GetHandle(), (void*) block_ptr_handler);
|
||||||
block_ptr_handler->CleanupBlock ();
|
block_ptr_handler->CleanupBlock ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,7 +219,7 @@ namespace Network {
|
||||||
{
|
{
|
||||||
unsafe {
|
unsafe {
|
||||||
if (callback == null){
|
if (callback == null){
|
||||||
nw_listener_set_advertised_endpoint_changed_handler (handle, null);
|
nw_listener_set_advertised_endpoint_changed_handler (GetHandle(), null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +229,7 @@ namespace Network {
|
||||||
block_ptr_handler = &block_handler;
|
block_ptr_handler = &block_handler;
|
||||||
block_handler.SetupBlockUnsafe (static_AdvertisedEndpointChangedHandler, callback);
|
block_handler.SetupBlockUnsafe (static_AdvertisedEndpointChangedHandler, callback);
|
||||||
|
|
||||||
nw_listener_set_advertised_endpoint_changed_handler (handle, (void*) block_ptr_handler);
|
nw_listener_set_advertised_endpoint_changed_handler (GetHandle(), (void*) block_ptr_handler);
|
||||||
block_ptr_handler->CleanupBlock ();
|
block_ptr_handler->CleanupBlock ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -272,7 +241,7 @@ namespace Network {
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void SetAdvertiseDescriptor (NWAdvertiseDescriptor descriptor)
|
public void SetAdvertiseDescriptor (NWAdvertiseDescriptor descriptor)
|
||||||
{
|
{
|
||||||
nw_listener_set_advertise_descriptor (handle, descriptor == null ? IntPtr.Zero : descriptor.handle);
|
nw_listener_set_advertise_descriptor (GetHandle(), descriptor == null ? IntPtr.Zero : descriptor.handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ namespace Network {
|
||||||
|
|
||||||
public NWParameters Clone ()
|
public NWParameters Clone ()
|
||||||
{
|
{
|
||||||
return new NWParameters (nw_parameters_copy (handle), owns: true);
|
return new NWParameters (nw_parameters_copy (GetHandle()), owns: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -203,8 +203,8 @@ namespace Network {
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public NWMultiPathService MultipathService {
|
public NWMultiPathService MultipathService {
|
||||||
get => nw_parameters_get_multipath_service (handle);
|
get => nw_parameters_get_multipath_service (GetHandle());
|
||||||
set => nw_parameters_set_multipath_service (handle, value);
|
set => nw_parameters_set_multipath_service (GetHandle(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ namespace Network {
|
||||||
static extern IntPtr nw_parameters_copy_default_protocol_stack (nw_parameters_t parameters);
|
static extern IntPtr nw_parameters_copy_default_protocol_stack (nw_parameters_t parameters);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public NWProtocolStack ProtocolStack => new NWProtocolStack (nw_parameters_copy_default_protocol_stack (handle), owns: true);
|
public NWProtocolStack ProtocolStack => new NWProtocolStack (nw_parameters_copy_default_protocol_stack (GetHandle()), owns: true);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
|
@ -226,8 +226,8 @@ namespace Network {
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public bool LocalOnly {
|
public bool LocalOnly {
|
||||||
get => nw_parameters_get_local_only (handle);
|
get => nw_parameters_get_local_only (GetHandle());
|
||||||
set => nw_parameters_set_local_only (handle, value);
|
set => nw_parameters_set_local_only (GetHandle(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -241,8 +241,8 @@ namespace Network {
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public bool PreferNoProxy {
|
public bool PreferNoProxy {
|
||||||
get => nw_parameters_get_prefer_no_proxy (handle);
|
get => nw_parameters_get_prefer_no_proxy (GetHandle());
|
||||||
set => nw_parameters_set_prefer_no_proxy (handle, value);
|
set => nw_parameters_set_prefer_no_proxy (GetHandle(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -254,8 +254,8 @@ namespace Network {
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public NWParametersExpiredDnsBehavior ExpiredDnsBehavior {
|
public NWParametersExpiredDnsBehavior ExpiredDnsBehavior {
|
||||||
get => nw_parameters_get_expired_dns_behavior (handle);
|
get => nw_parameters_get_expired_dns_behavior (GetHandle());
|
||||||
set => nw_parameters_set_expired_dns_behavior (handle, value);
|
set => nw_parameters_set_expired_dns_behavior (GetHandle(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -265,7 +265,7 @@ namespace Network {
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void RequireInterface (NWInterface iface)
|
public void RequireInterface (NWInterface iface)
|
||||||
{
|
{
|
||||||
nw_parameters_require_interface (handle, iface == null ? IntPtr.Zero : iface.handle);
|
nw_parameters_require_interface (GetHandle(), iface == null ? IntPtr.Zero : iface.handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -275,12 +275,12 @@ namespace Network {
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public NWInterface Interface {
|
public NWInterface Interface {
|
||||||
get {
|
get {
|
||||||
var iface = nw_parameters_copy_required_interface (handle);
|
var iface = nw_parameters_copy_required_interface (GetHandle());
|
||||||
|
|
||||||
if (iface == IntPtr.Zero)
|
if (iface == IntPtr.Zero)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return new NWInterface (handle, owns: true);
|
return new NWInterface (GetHandle(), owns: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,7 +294,7 @@ namespace Network {
|
||||||
if (iface == null)
|
if (iface == null)
|
||||||
throw new ArgumentNullException (nameof (iface));
|
throw new ArgumentNullException (nameof (iface));
|
||||||
|
|
||||||
nw_parameters_prohibit_interface (handle, iface.handle);
|
nw_parameters_prohibit_interface (GetHandle(), iface.handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -304,7 +304,7 @@ namespace Network {
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void ClearProhibitedInterfaces ()
|
public void ClearProhibitedInterfaces ()
|
||||||
{
|
{
|
||||||
nw_parameters_clear_prohibited_interfaces (handle);
|
nw_parameters_clear_prohibited_interfaces (GetHandle());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -317,8 +317,8 @@ namespace Network {
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public NWInterfaceType RequiredIntefaceType {
|
public NWInterfaceType RequiredIntefaceType {
|
||||||
get => nw_parameters_get_required_interface_type (handle);
|
get => nw_parameters_get_required_interface_type (GetHandle());
|
||||||
set => nw_parameters_set_required_interface_type (handle, value);
|
set => nw_parameters_set_required_interface_type (GetHandle(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -329,7 +329,7 @@ namespace Network {
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void ProhibitInterfaceType (NWInterfaceType ifaceType)
|
public void ProhibitInterfaceType (NWInterfaceType ifaceType)
|
||||||
{
|
{
|
||||||
nw_parameters_prohibit_interface_type (handle, ifaceType);
|
nw_parameters_prohibit_interface_type (GetHandle(), ifaceType);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -339,7 +339,7 @@ namespace Network {
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void ClearProhibitedInterfaceTypes ()
|
public void ClearProhibitedInterfaceTypes ()
|
||||||
{
|
{
|
||||||
nw_parameters_clear_prohibited_interface_types (handle);
|
nw_parameters_clear_prohibited_interface_types (GetHandle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -375,7 +375,7 @@ namespace Network {
|
||||||
block_ptr_handler = &block_handler;
|
block_ptr_handler = &block_handler;
|
||||||
block_handler.SetupBlockUnsafe (static_iterateProhibitedHandler, iterationCallback);
|
block_handler.SetupBlockUnsafe (static_iterateProhibitedHandler, iterationCallback);
|
||||||
|
|
||||||
nw_parameters_iterate_prohibited_interfaces (handle, (void*) block_ptr_handler);
|
nw_parameters_iterate_prohibited_interfaces (GetHandle(), (void*) block_ptr_handler);
|
||||||
block_ptr_handler->CleanupBlock ();
|
block_ptr_handler->CleanupBlock ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -409,7 +409,7 @@ namespace Network {
|
||||||
block_ptr_handler = &block_handler;
|
block_ptr_handler = &block_handler;
|
||||||
block_handler.SetupBlockUnsafe (static_IterateProhibitedTypeHandler, callback);
|
block_handler.SetupBlockUnsafe (static_IterateProhibitedTypeHandler, callback);
|
||||||
|
|
||||||
nw_parameters_iterate_prohibited_interface_types (handle, (void*) block_ptr_handler);
|
nw_parameters_iterate_prohibited_interface_types (GetHandle(), (void*) block_ptr_handler);
|
||||||
block_ptr_handler->CleanupBlock ();
|
block_ptr_handler->CleanupBlock ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -425,8 +425,8 @@ namespace Network {
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public bool ProhibitExpensive {
|
public bool ProhibitExpensive {
|
||||||
get => nw_parameters_get_prohibit_expensive (handle);
|
get => nw_parameters_get_prohibit_expensive (GetHandle());
|
||||||
set => nw_parameters_set_prohibit_expensive (handle, value);
|
set => nw_parameters_set_prohibit_expensive (GetHandle(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -440,8 +440,8 @@ namespace Network {
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public bool ReuseLocalAddress {
|
public bool ReuseLocalAddress {
|
||||||
get => nw_parameters_get_reuse_local_address (handle);
|
get => nw_parameters_get_reuse_local_address (GetHandle());
|
||||||
set => nw_parameters_set_reuse_local_address (handle, value);
|
set => nw_parameters_set_reuse_local_address (GetHandle(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -455,8 +455,8 @@ namespace Network {
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public bool FastOpenEnabled {
|
public bool FastOpenEnabled {
|
||||||
get => nw_parameters_get_fast_open_enabled (handle);
|
get => nw_parameters_get_fast_open_enabled (GetHandle());
|
||||||
set => nw_parameters_set_fast_open_enabled (handle, value);
|
set => nw_parameters_set_fast_open_enabled (GetHandle(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -469,8 +469,8 @@ namespace Network {
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public NWServiceClass ServiceClass {
|
public NWServiceClass ServiceClass {
|
||||||
get => nw_parameters_get_service_class (handle);
|
get => nw_parameters_get_service_class (GetHandle());
|
||||||
set => nw_parameters_set_service_class (handle, value);
|
set => nw_parameters_set_service_class (GetHandle(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -484,15 +484,15 @@ namespace Network {
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public NWEndpoint LocalEndpoint {
|
public NWEndpoint LocalEndpoint {
|
||||||
get {
|
get {
|
||||||
var x = nw_parameters_copy_local_endpoint (handle);
|
var x = nw_parameters_copy_local_endpoint (GetHandle());
|
||||||
if (x == IntPtr.Zero)
|
if (x == IntPtr.Zero)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return new NWEndpoint (handle, owns: true);
|
return new NWEndpoint (x, owns: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
set {
|
set {
|
||||||
nw_parameters_set_local_endpoint (handle, value == null ? IntPtr.Zero : value.handle);
|
nw_parameters_set_local_endpoint (GetHandle(), value == null ? IntPtr.Zero : value.handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace Network {
|
||||||
extern static NWPathStatus nw_path_get_status (IntPtr handle);
|
extern static NWPathStatus nw_path_get_status (IntPtr handle);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public NWPathStatus Status => nw_path_get_status (handle);
|
public NWPathStatus Status => nw_path_get_status (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
|
@ -37,7 +37,7 @@ namespace Network {
|
||||||
extern static bool nw_path_is_expensive (IntPtr handle);
|
extern static bool nw_path_is_expensive (IntPtr handle);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public bool IsExpensive => nw_path_is_expensive (handle);
|
public bool IsExpensive => nw_path_is_expensive (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
|
@ -45,7 +45,7 @@ namespace Network {
|
||||||
extern static bool nw_path_has_ipv4 (IntPtr handle);
|
extern static bool nw_path_has_ipv4 (IntPtr handle);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public bool HasIpV4 => nw_path_has_ipv4 (handle);
|
public bool HasIpV4 => nw_path_has_ipv4 (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
|
@ -53,7 +53,7 @@ namespace Network {
|
||||||
extern static bool nw_path_has_ipv6 (IntPtr handle);
|
extern static bool nw_path_has_ipv6 (IntPtr handle);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public bool HasIpV6 => nw_path_has_ipv6 (handle);
|
public bool HasIpV6 => nw_path_has_ipv6 (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
|
@ -61,7 +61,7 @@ namespace Network {
|
||||||
extern static bool nw_path_has_dns (IntPtr handle);
|
extern static bool nw_path_has_dns (IntPtr handle);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public bool HasDns => nw_path_has_dns (handle);
|
public bool HasDns => nw_path_has_dns (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
|
@ -69,7 +69,7 @@ namespace Network {
|
||||||
extern static bool nw_path_uses_interface_type (IntPtr handle, NWInterfaceType type);
|
extern static bool nw_path_uses_interface_type (IntPtr handle, NWInterfaceType type);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public bool UsesInterfaceType (NWInterfaceType type) => nw_path_uses_interface_type (handle, type);
|
public bool UsesInterfaceType (NWInterfaceType type) => nw_path_uses_interface_type (GetHandle(), type);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
|
@ -78,7 +78,7 @@ namespace Network {
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public NWEndpoint EffectiveLocalEndpoint {
|
public NWEndpoint EffectiveLocalEndpoint {
|
||||||
get {
|
get {
|
||||||
var x = nw_path_copy_effective_local_endpoint (handle);
|
var x = nw_path_copy_effective_local_endpoint (GetHandle());
|
||||||
if (x == IntPtr.Zero)
|
if (x == IntPtr.Zero)
|
||||||
return null;
|
return null;
|
||||||
return new NWEndpoint (x, owns: true);
|
return new NWEndpoint (x, owns: true);
|
||||||
|
@ -92,7 +92,7 @@ namespace Network {
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public NWEndpoint EffectiveRemoteEndpoint {
|
public NWEndpoint EffectiveRemoteEndpoint {
|
||||||
get {
|
get {
|
||||||
var x = nw_path_copy_effective_remote_endpoint (handle);
|
var x = nw_path_copy_effective_remote_endpoint (GetHandle());
|
||||||
if (x == IntPtr.Zero)
|
if (x == IntPtr.Zero)
|
||||||
return null;
|
return null;
|
||||||
return new NWEndpoint (x, owns: true);
|
return new NWEndpoint (x, owns: true);
|
||||||
|
@ -110,7 +110,7 @@ namespace Network {
|
||||||
if (other == null)
|
if (other == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return nw_path_is_equal (handle, other.handle);
|
return nw_path_is_equal (GetHandle(), other.handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate void nw_path_enumerate_interfaces_block_t (IntPtr block, IntPtr iface);
|
delegate void nw_path_enumerate_interfaces_block_t (IntPtr block, IntPtr iface);
|
||||||
|
@ -142,7 +142,7 @@ namespace Network {
|
||||||
block_ptr_handler = &block_handler;
|
block_ptr_handler = &block_handler;
|
||||||
block_handler.SetupBlockUnsafe (static_Enumerator, callback);
|
block_handler.SetupBlockUnsafe (static_Enumerator, callback);
|
||||||
|
|
||||||
nw_path_enumerate_interfaces (handle, (void*) block_ptr_handler);
|
nw_path_enumerate_interfaces (GetHandle(), (void*) block_ptr_handler);
|
||||||
block_ptr_handler->CleanupBlock ();
|
block_ptr_handler->CleanupBlock ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,41 +15,8 @@ using CoreFoundation;
|
||||||
|
|
||||||
namespace Network {
|
namespace Network {
|
||||||
|
|
||||||
public class NWPathMonitor : INativeObject, IDisposable {
|
public class NWPathMonitor : NativeObject {
|
||||||
IntPtr handle;
|
public NWPathMonitor (IntPtr handle, bool owns) : base (handle, owns) {}
|
||||||
public IntPtr Handle {
|
|
||||||
get { return handle; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public NWPathMonitor (IntPtr handle, bool owns)
|
|
||||||
{
|
|
||||||
this.handle = handle;
|
|
||||||
if (owns == false)
|
|
||||||
CFObject.CFRetain (handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
public NWPathMonitor (IntPtr handle) : this (handle, false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
~NWPathMonitor ()
|
|
||||||
{
|
|
||||||
Dispose (false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose ()
|
|
||||||
{
|
|
||||||
Dispose (true);
|
|
||||||
GC.SuppressFinalize (this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void Dispose (bool disposing)
|
|
||||||
{
|
|
||||||
if (handle != IntPtr.Zero) {
|
|
||||||
CFObject.CFRelease (handle);
|
|
||||||
handle = IntPtr.Zero;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
|
@ -76,14 +43,14 @@ namespace Network {
|
||||||
extern static void nw_path_monitor_cancel (IntPtr handle);
|
extern static void nw_path_monitor_cancel (IntPtr handle);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void Cancel () => nw_path_monitor_cancel (handle);
|
public void Cancel () => nw_path_monitor_cancel (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
extern static void nw_path_monitor_start (IntPtr handle);
|
extern static void nw_path_monitor_start (IntPtr handle);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void Start () => nw_path_monitor_start (handle);
|
public void Start () => nw_path_monitor_start (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
|
@ -94,7 +61,7 @@ namespace Network {
|
||||||
{
|
{
|
||||||
if (queue == null)
|
if (queue == null)
|
||||||
throw new ArgumentNullException (nameof (queue));
|
throw new ArgumentNullException (nameof (queue));
|
||||||
nw_path_monitor_set_queue (handle, queue.handle);
|
nw_path_monitor_set_queue (GetHandle(), queue.handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace Network {
|
||||||
return false;
|
return false;
|
||||||
if (!(other is NWProtocolDefinition))
|
if (!(other is NWProtocolDefinition))
|
||||||
return false;
|
return false;
|
||||||
return nw_protocol_definition_is_equal (handle, (other as NWProtocolDefinition).handle);
|
return nw_protocol_definition_is_equal (GetHandle(), (other as NWProtocolDefinition).handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -103,21 +103,21 @@ namespace Network {
|
||||||
extern static void nw_tcp_options_set_no_delay (IntPtr handle, [MarshalAs (UnmanagedType.U1)] bool noDelay);
|
extern static void nw_tcp_options_set_no_delay (IntPtr handle, [MarshalAs (UnmanagedType.U1)] bool noDelay);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void TcpSetNoDelay (bool noDelay) => nw_tcp_options_set_no_delay (handle, noDelay);
|
public void TcpSetNoDelay (bool noDelay) => nw_tcp_options_set_no_delay (GetHandle(), noDelay);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
extern static void nw_tcp_options_set_no_push(IntPtr handle, [MarshalAs (UnmanagedType.U1)] bool noPush);
|
extern static void nw_tcp_options_set_no_push(IntPtr handle, [MarshalAs (UnmanagedType.U1)] bool noPush);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void TcpSetNoPush (bool noPush) => nw_tcp_options_set_no_push (handle, noPush);
|
public void TcpSetNoPush (bool noPush) => nw_tcp_options_set_no_push (GetHandle(), noPush);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
extern static void nw_tcp_options_set_no_options(IntPtr handle, [MarshalAs (UnmanagedType.U1)] bool noOptions);
|
extern static void nw_tcp_options_set_no_options(IntPtr handle, [MarshalAs (UnmanagedType.U1)] bool noOptions);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void TcpSetNoOptions (bool noOptions) => nw_tcp_options_set_no_options (handle, noOptions);
|
public void TcpSetNoOptions (bool noOptions) => nw_tcp_options_set_no_options (GetHandle(), noOptions);
|
||||||
|
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -125,86 +125,86 @@ namespace Network {
|
||||||
extern static void nw_tcp_options_set_enable_keepalive(IntPtr handle, [MarshalAs (UnmanagedType.U1)] bool enableKeepalive);
|
extern static void nw_tcp_options_set_enable_keepalive(IntPtr handle, [MarshalAs (UnmanagedType.U1)] bool enableKeepalive);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void TcpSetEnableKeepAlive (bool enableKeepalive) => nw_tcp_options_set_enable_keepalive (handle, enableKeepalive);
|
public void TcpSetEnableKeepAlive (bool enableKeepalive) => nw_tcp_options_set_enable_keepalive (GetHandle(), enableKeepalive);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
extern static void nw_tcp_options_set_keepalive_count(IntPtr handle, uint keepaliveCount);
|
extern static void nw_tcp_options_set_keepalive_count(IntPtr handle, uint keepaliveCount);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void TcpSetKeepaliveCount (uint keepaliveCount) => nw_tcp_options_set_keepalive_count (handle, keepaliveCount);
|
public void TcpSetKeepaliveCount (uint keepaliveCount) => nw_tcp_options_set_keepalive_count (GetHandle(), keepaliveCount);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
extern static void nw_tcp_options_set_keepalive_idle_time(IntPtr handle, uint keepaliveIdleTime);
|
extern static void nw_tcp_options_set_keepalive_idle_time(IntPtr handle, uint keepaliveIdleTime);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void TcpSetKeepaliveIdleTime (uint keepaliveIdleTime) => nw_tcp_options_set_keepalive_idle_time (handle, keepaliveIdleTime);
|
public void TcpSetKeepaliveIdleTime (uint keepaliveIdleTime) => nw_tcp_options_set_keepalive_idle_time (GetHandle(), keepaliveIdleTime);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
extern static void nw_tcp_options_set_keepalive_interval(IntPtr handle, uint keepaliveInterval);
|
extern static void nw_tcp_options_set_keepalive_interval(IntPtr handle, uint keepaliveInterval);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void TcpSetKeepaliveInterval (uint keepaliveInterval) => nw_tcp_options_set_keepalive_interval (handle, keepaliveInterval);
|
public void TcpSetKeepaliveInterval (uint keepaliveInterval) => nw_tcp_options_set_keepalive_interval (GetHandle(), keepaliveInterval);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
extern static void nw_tcp_options_set_maximum_segment_size(IntPtr handle, uint maximumSegmentSize);
|
extern static void nw_tcp_options_set_maximum_segment_size(IntPtr handle, uint maximumSegmentSize);
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void TcpSetMaximumSegmentSize (uint maximumSegmentSize) => nw_tcp_options_set_maximum_segment_size (handle, maximumSegmentSize);
|
public void TcpSetMaximumSegmentSize (uint maximumSegmentSize) => nw_tcp_options_set_maximum_segment_size (GetHandle(), maximumSegmentSize);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
extern static void nw_tcp_options_set_connection_timeout(IntPtr handle, uint connectionTimeout);
|
extern static void nw_tcp_options_set_connection_timeout(IntPtr handle, uint connectionTimeout);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void TcpSetConnectionTimeout (uint connectionTimeout) => nw_tcp_options_set_connection_timeout (handle, connectionTimeout);
|
public void TcpSetConnectionTimeout (uint connectionTimeout) => nw_tcp_options_set_connection_timeout (GetHandle(), connectionTimeout);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
extern static void nw_tcp_options_set_persist_timeout(IntPtr handle, uint persistTimeout);
|
extern static void nw_tcp_options_set_persist_timeout(IntPtr handle, uint persistTimeout);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void TcpSetPersistTimeout (uint persistTimeout) => nw_tcp_options_set_persist_timeout (handle, persistTimeout);
|
public void TcpSetPersistTimeout (uint persistTimeout) => nw_tcp_options_set_persist_timeout (GetHandle(), persistTimeout);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
extern static void nw_tcp_options_set_retransmit_connection_drop_time (IntPtr handle, uint retransmitConnectionDropTime);
|
extern static void nw_tcp_options_set_retransmit_connection_drop_time (IntPtr handle, uint retransmitConnectionDropTime);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void TcpSetRetransmitConnectionDropTime (uint retransmitConnectionDropTime) => nw_tcp_options_set_retransmit_connection_drop_time (handle, retransmitConnectionDropTime);
|
public void TcpSetRetransmitConnectionDropTime (uint retransmitConnectionDropTime) => nw_tcp_options_set_retransmit_connection_drop_time (GetHandle(), retransmitConnectionDropTime);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
extern static void nw_tcp_options_set_retransmit_fin_drop (IntPtr handle, [MarshalAs (UnmanagedType.U1)] bool retransmitFinDrop);
|
extern static void nw_tcp_options_set_retransmit_fin_drop (IntPtr handle, [MarshalAs (UnmanagedType.U1)] bool retransmitFinDrop);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void TcpSetRetransmitFinDrop (bool retransmitFinDrop) => nw_tcp_options_set_retransmit_fin_drop (handle, retransmitFinDrop);
|
public void TcpSetRetransmitFinDrop (bool retransmitFinDrop) => nw_tcp_options_set_retransmit_fin_drop (GetHandle(), retransmitFinDrop);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
extern static void nw_tcp_options_set_disable_ack_stretching (IntPtr handle, [MarshalAs (UnmanagedType.U1)] bool disableAckStretching);
|
extern static void nw_tcp_options_set_disable_ack_stretching (IntPtr handle, [MarshalAs (UnmanagedType.U1)] bool disableAckStretching);
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void TcpSetDisableAckStretching (bool disableAckStretching) => nw_tcp_options_set_disable_ack_stretching (handle, disableAckStretching);
|
public void TcpSetDisableAckStretching (bool disableAckStretching) => nw_tcp_options_set_disable_ack_stretching (GetHandle(), disableAckStretching);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
extern static void nw_tcp_options_set_enable_fast_open (IntPtr handle, [MarshalAs (UnmanagedType.U1)] bool enableFastOpen);
|
extern static void nw_tcp_options_set_enable_fast_open (IntPtr handle, [MarshalAs (UnmanagedType.U1)] bool enableFastOpen);
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void TcpSetEnableFastOpen (bool enableFastOpen) => nw_tcp_options_set_enable_fast_open (handle, enableFastOpen);
|
public void TcpSetEnableFastOpen (bool enableFastOpen) => nw_tcp_options_set_enable_fast_open (GetHandle(), enableFastOpen);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
extern static void nw_tcp_options_set_disable_ecn (IntPtr handle, [MarshalAs (UnmanagedType.U1)] bool disableEcn);
|
extern static void nw_tcp_options_set_disable_ecn (IntPtr handle, [MarshalAs (UnmanagedType.U1)] bool disableEcn);
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void TcpSetDisableEcn (bool disableEcn) => nw_tcp_options_set_disable_ecn (handle, disableEcn);
|
public void TcpSetDisableEcn (bool disableEcn) => nw_tcp_options_set_disable_ecn (GetHandle(), disableEcn);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
extern static void nw_udp_options_set_prefer_no_checksum (IntPtr handle, [MarshalAs (UnmanagedType.U1)] bool preferNoChecksums);
|
extern static void nw_udp_options_set_prefer_no_checksum (IntPtr handle, [MarshalAs (UnmanagedType.U1)] bool preferNoChecksums);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void UdpSetPreferNoChecksum (bool preferNoChecksums) => nw_udp_options_set_prefer_no_checksum (handle, preferNoChecksums);
|
public void UdpSetPreferNoChecksum (bool preferNoChecksums) => nw_udp_options_set_prefer_no_checksum (GetHandle(), preferNoChecksums);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,28 +60,28 @@ namespace Network {
|
||||||
static extern OS_nw_protocol_definition nw_protocol_metadata_copy_definition (OS_nw_protocol_metadata metadata);
|
static extern OS_nw_protocol_definition nw_protocol_metadata_copy_definition (OS_nw_protocol_metadata metadata);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public NWProtocolDefinition ProtocolDefinition => new NWProtocolDefinition (nw_protocol_metadata_copy_definition (handle), owns: true);
|
public NWProtocolDefinition ProtocolDefinition => new NWProtocolDefinition (nw_protocol_metadata_copy_definition (GetHandle()), owns: true);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
[return: MarshalAs (UnmanagedType.I1)]
|
[return: MarshalAs (UnmanagedType.I1)]
|
||||||
static extern bool nw_protocol_metadata_is_ip (OS_nw_protocol_metadata metadata);
|
static extern bool nw_protocol_metadata_is_ip (OS_nw_protocol_metadata metadata);
|
||||||
|
|
||||||
public bool IsIP => nw_protocol_metadata_is_ip (handle);
|
public bool IsIP => nw_protocol_metadata_is_ip (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
[return: MarshalAs (UnmanagedType.I1)]
|
[return: MarshalAs (UnmanagedType.I1)]
|
||||||
static extern bool nw_protocol_metadata_is_udp (OS_nw_protocol_metadata metadata);
|
static extern bool nw_protocol_metadata_is_udp (OS_nw_protocol_metadata metadata);
|
||||||
|
|
||||||
public bool IsUdp => nw_protocol_metadata_is_udp (handle);
|
public bool IsUdp => nw_protocol_metadata_is_udp (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
[return: MarshalAs (UnmanagedType.I1)]
|
[return: MarshalAs (UnmanagedType.I1)]
|
||||||
static extern bool nw_protocol_metadata_is_tls (OS_nw_protocol_metadata metadata);
|
static extern bool nw_protocol_metadata_is_tls (OS_nw_protocol_metadata metadata);
|
||||||
|
|
||||||
public bool IsTls => nw_protocol_metadata_is_tls (handle);
|
public bool IsTls => nw_protocol_metadata_is_tls (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
|
@ -93,8 +93,8 @@ namespace Network {
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public NWIPEcnFlag IPMetadataEcnFlag {
|
public NWIPEcnFlag IPMetadataEcnFlag {
|
||||||
get => nw_ip_metadata_get_ecn_flag (handle);
|
get => nw_ip_metadata_get_ecn_flag (GetHandle());
|
||||||
set => nw_ip_metadata_set_ecn_flag (handle, value);
|
set => nw_ip_metadata_set_ecn_flag (GetHandle(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -107,8 +107,8 @@ namespace Network {
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public NWServiceClass ServiceClass {
|
public NWServiceClass ServiceClass {
|
||||||
get => nw_ip_metadata_get_service_class (handle);
|
get => nw_ip_metadata_get_service_class (GetHandle());
|
||||||
set => nw_ip_metadata_set_service_class (handle, value);
|
set => nw_ip_metadata_set_service_class (GetHandle(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -116,13 +116,13 @@ namespace Network {
|
||||||
extern static uint nw_tcp_get_available_receive_buffer (IntPtr handle);
|
extern static uint nw_tcp_get_available_receive_buffer (IntPtr handle);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public uint TcpGetAvaialbleReceiveBuffer () => nw_tcp_get_available_receive_buffer (handle);
|
public uint TcpGetAvaialbleReceiveBuffer () => nw_tcp_get_available_receive_buffer (GetHandle());
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
extern static uint nw_tcp_get_available_send_buffer (IntPtr handle);
|
extern static uint nw_tcp_get_available_send_buffer (IntPtr handle);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public uint TcpGetAvailableSendBuffer () => nw_tcp_get_available_send_buffer (handle);
|
public uint TcpGetAvailableSendBuffer () => nw_tcp_get_available_send_buffer (GetHandle());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace Network {
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
static extern OS_nw_protocol_definition nw_protocol_options_copy_definition (OS_nw_protocol_options options);
|
static extern OS_nw_protocol_definition nw_protocol_options_copy_definition (OS_nw_protocol_options options);
|
||||||
|
|
||||||
public NWProtocolDefinition ProtocolDefinition => new NWProtocolDefinition (nw_protocol_options_copy_definition (handle), owns: true);
|
public NWProtocolDefinition ProtocolDefinition => new NWProtocolDefinition (nw_protocol_options_copy_definition (GetHandle()), owns: true);
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
[DllImport (Constants.NetworkLibrary)]
|
[DllImport (Constants.NetworkLibrary)]
|
||||||
|
@ -34,7 +34,7 @@ namespace Network {
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void SetVersion (NWIPVersion version)
|
public void SetVersion (NWIPVersion version)
|
||||||
{
|
{
|
||||||
nw_ip_options_set_version (handle, version);
|
nw_ip_options_set_version (GetHandle(), version);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -43,7 +43,7 @@ namespace Network {
|
||||||
|
|
||||||
public void SetHopLimit (byte hopLimit)
|
public void SetHopLimit (byte hopLimit)
|
||||||
{
|
{
|
||||||
nw_ip_options_set_hop_limit (handle, hopLimit);
|
nw_ip_options_set_hop_limit (GetHandle(), hopLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -53,7 +53,7 @@ namespace Network {
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void SetUseMinimumMtu (bool useMinimumMtu)
|
public void SetUseMinimumMtu (bool useMinimumMtu)
|
||||||
{
|
{
|
||||||
nw_ip_options_set_use_minimum_mtu (handle, useMinimumMtu);
|
nw_ip_options_set_use_minimum_mtu (GetHandle(), useMinimumMtu);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -63,7 +63,7 @@ namespace Network {
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
public void SetDisableFragmentation (bool disableFragmentation)
|
public void SetDisableFragmentation (bool disableFragmentation)
|
||||||
{
|
{
|
||||||
nw_ip_options_set_disable_fragmentation (handle, disableFragmentation);
|
nw_ip_options_set_disable_fragmentation (GetHandle(), disableFragmentation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace Network {
|
||||||
{
|
{
|
||||||
if (options == null)
|
if (options == null)
|
||||||
throw new ArgumentNullException (nameof (options));
|
throw new ArgumentNullException (nameof (options));
|
||||||
nw_protocol_stack_prepend_application_protocol (handle, options.Handle);
|
nw_protocol_stack_prepend_application_protocol (GetHandle(), options.Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12,0), Mac (10,14), iOS (12,0)]
|
[TV (12,0), Mac (10,14), iOS (12,0)]
|
||||||
|
@ -41,7 +41,7 @@ namespace Network {
|
||||||
|
|
||||||
public void ClearApplicationProtocols ()
|
public void ClearApplicationProtocols ()
|
||||||
{
|
{
|
||||||
nw_protocol_stack_clear_application_protocols (handle);
|
nw_protocol_stack_clear_application_protocols (GetHandle());
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate void nw_protocol_stack_iterate_protocols_block_t (IntPtr block, IntPtr options);
|
delegate void nw_protocol_stack_iterate_protocols_block_t (IntPtr block, IntPtr options);
|
||||||
|
@ -71,7 +71,7 @@ namespace Network {
|
||||||
block_ptr_handler = &block_handler;
|
block_ptr_handler = &block_handler;
|
||||||
block_handler.SetupBlockUnsafe (static_iterateHandler, callback);
|
block_handler.SetupBlockUnsafe (static_iterateHandler, callback);
|
||||||
|
|
||||||
nw_protocol_stack_iterate_application_protocols (Handle, (void*) block_ptr_handler);
|
nw_protocol_stack_iterate_application_protocols (GetHandle(), (void*) block_ptr_handler);
|
||||||
block_ptr_handler->CleanupBlock ();
|
block_ptr_handler->CleanupBlock ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,8 +86,8 @@ namespace Network {
|
||||||
|
|
||||||
[TV (12, 0), Mac (10, 14), iOS (12, 0)]
|
[TV (12, 0), Mac (10, 14), iOS (12, 0)]
|
||||||
public NWProtocolOptions TransportProtocol {
|
public NWProtocolOptions TransportProtocol {
|
||||||
get => new NWProtocolOptions (nw_protocol_stack_copy_transport_protocol (handle), owns: true);
|
get => new NWProtocolOptions (nw_protocol_stack_copy_transport_protocol (GetHandle()), owns: true);
|
||||||
set => nw_protocol_stack_set_transport_protocol (handle, value.Handle);
|
set => nw_protocol_stack_set_transport_protocol (GetHandle(), value.Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TV (12, 0), Mac (10, 14), iOS (12, 0)]
|
[TV (12, 0), Mac (10, 14), iOS (12, 0)]
|
||||||
|
@ -95,6 +95,6 @@ namespace Network {
|
||||||
extern static IntPtr nw_protocol_stack_copy_internet_protocol (nw_protocol_stack_t stack);
|
extern static IntPtr nw_protocol_stack_copy_internet_protocol (nw_protocol_stack_t stack);
|
||||||
|
|
||||||
[TV (12, 0), Mac (10, 14), iOS (12, 0)]
|
[TV (12, 0), Mac (10, 14), iOS (12, 0)]
|
||||||
public NWProtocolOptions InternetProtocol => new NWProtocolOptions (nw_protocol_stack_copy_internet_protocol (handle), owns: true);
|
public NWProtocolOptions InternetProtocol => new NWProtocolOptions (nw_protocol_stack_copy_internet_protocol (GetHandle()), owns: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче