Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 35 additions & 35 deletions src/Network/NWAdvertiseDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
using Foundation;
using CoreFoundation;

using nw_advertise_descriptor_t=System.IntPtr;
using OS_nw_advertise_descriptor=System.IntPtr;
using OS_nw_txt_record=System.IntPtr;
using nw_advertise_descriptor_t = System.IntPtr;
using OS_nw_advertise_descriptor = System.IntPtr;
using OS_nw_txt_record = System.IntPtr;

#if !NET
using NativeHandle = System.IntPtr;
Expand All @@ -29,10 +29,10 @@ namespace Network {
[SupportedOSPlatform ("ios12.0")]
[SupportedOSPlatform ("maccatalyst")]
#else
[TV (12,0)]
[Mac (10,14)]
[iOS (12,0)]
[Watch (6,0)]
[TV (12, 0)]
[Mac (10, 14)]
[iOS (12, 0)]
[Watch (6, 0)]
#endif
public class NWAdvertiseDescriptor : NativeObject {
[Preserve (Conditional = true)]
Expand All @@ -49,10 +49,10 @@ public NWAdvertiseDescriptor (NativeHandle handle, bool owns) : base (handle, ow
[SupportedOSPlatform ("ios16.0")]
[SupportedOSPlatform ("maccatalyst16.0")]
#else
[TV (16,0)]
[Mac (13,0)]
[iOS (16,0)]
[Watch (9,0)]
[TV (16, 0)]
[Mac (13, 0)]
[iOS (16, 0)]
[Watch (9, 0)]
#endif
[DllImport (Constants.NetworkLibrary)]
static extern OS_nw_advertise_descriptor nw_advertise_descriptor_create_application_service (string application_service_name);
Expand All @@ -63,23 +63,23 @@ public NWAdvertiseDescriptor (NativeHandle handle, bool owns) : base (handle, ow
[SupportedOSPlatform ("ios16.0")]
[SupportedOSPlatform ("maccatalyst16.0")]
#else
[TV (16,0)]
[Mac (13,0)]
[iOS (16,0)]
[Watch (9,0)]
[TV (16, 0)]
[Mac (13, 0)]
[iOS (16, 0)]
[Watch (9, 0)]
#endif
public NWAdvertiseDescriptor (string applicationServiceName) : base (nw_advertise_descriptor_create_application_service (applicationServiceName), true) {}
public NWAdvertiseDescriptor (string applicationServiceName) : base (nw_advertise_descriptor_create_application_service (applicationServiceName), true) { }

#if NET
[SupportedOSPlatform ("tvos16.0")]
[SupportedOSPlatform ("macos13.0")]
[SupportedOSPlatform ("ios16.0")]
[SupportedOSPlatform ("maccatalyst16.0")]
#else
[TV (16,0)]
[Mac (13,0)]
[iOS (16,0)]
[Watch (9,0)]
[TV (16, 0)]
[Mac (13, 0)]
[iOS (16, 0)]
[Watch (9, 0)]
#endif
[DllImport (Constants.NetworkLibrary)]
static extern IntPtr nw_advertise_descriptor_get_application_service_name (OS_nw_advertise_descriptor advertise_descriptor);
Expand All @@ -90,10 +90,10 @@ public NWAdvertiseDescriptor (string applicationServiceName) : base (nw_advertis
[SupportedOSPlatform ("ios16.0")]
[SupportedOSPlatform ("maccatalyst16.0")]
#else
[TV (16,0)]
[Mac (13,0)]
[iOS (16,0)]
[Watch (9,0)]
[TV (16, 0)]
[Mac (13, 0)]
[iOS (16, 0)]
[Watch (9, 0)]
#endif
public string? ApplicationServiceName {
get {
Expand Down Expand Up @@ -148,9 +148,9 @@ public bool NoAutoRename {
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
#else
[TV (13,0)]
[Mac (10,15)]
[iOS (13,0)]
[TV (13, 0)]
[Mac (10, 15)]
[iOS (13, 0)]
#endif
[DllImport (Constants.NetworkLibrary)]
static extern OS_nw_txt_record nw_advertise_descriptor_copy_txt_record_object (OS_nw_advertise_descriptor advertise_descriptor);
Expand All @@ -161,9 +161,9 @@ public bool NoAutoRename {
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
#else
[TV (13,0)]
[Mac (10,15)]
[iOS (13,0)]
[TV (13, 0)]
[Mac (10, 15)]
[iOS (13, 0)]
#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);
Expand All @@ -174,13 +174,13 @@ public bool NoAutoRename {
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
#else
[TV (13,0)]
[Mac (10,15)]
[iOS (13,0)]
[TV (13, 0)]
[Mac (10, 15)]
[iOS (13, 0)]
#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 ());
get => new NWTxtRecord (nw_advertise_descriptor_copy_txt_record_object (GetCheckedHandle ()), owns: true);
set => nw_advertise_descriptor_set_txt_record_object (GetCheckedHandle (), value.GetHandle ());
}
}
}
18 changes: 9 additions & 9 deletions src/Network/NWBrowseResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
using Foundation;
using CoreFoundation;

using OS_nw_browse_result=System.IntPtr;
using OS_nw_endpoint=System.IntPtr;
using OS_nw_txt_record=System.IntPtr;
using OS_nw_browse_result = System.IntPtr;
using OS_nw_endpoint = System.IntPtr;
using OS_nw_txt_record = System.IntPtr;

#if !NET
using NativeHandle = System.IntPtr;
Expand All @@ -31,15 +31,15 @@ namespace Network {
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
#else
[TV (13,0)]
[Mac (10,15)]
[iOS (13,0)]
[Watch (6,0)]
[TV (13, 0)]
[Mac (10, 15)]
[iOS (13, 0)]
[Watch (6, 0)]
#endif
public class NWBrowseResult : NativeObject {

[Preserve (Conditional = true)]
internal NWBrowseResult (NativeHandle handle, bool owns) : base (handle, owns) {}
internal NWBrowseResult (NativeHandle handle, bool owns) : base (handle, owns) { }

[DllImport (Constants.NetworkLibrary)]
static extern OS_nw_endpoint nw_browse_result_copy_endpoint (OS_nw_browse_result result);
Expand All @@ -54,7 +54,7 @@ internal NWBrowseResult (NativeHandle handle, bool owns) : base (handle, owns) {
[DllImport (Constants.NetworkLibrary)]
static extern OS_nw_txt_record nw_browse_result_copy_txt_record_object (OS_nw_browse_result result);

public NWTxtRecord TxtRecord => new NWTxtRecord (nw_browse_result_copy_txt_record_object (GetCheckedHandle ()), owns: true);
public NWTxtRecord TxtRecord => new NWTxtRecord (nw_browse_result_copy_txt_record_object (GetCheckedHandle ()), owns: true);

[DllImport (Constants.NetworkLibrary)]
static extern NWBrowseResultChange nw_browse_result_get_changes (OS_nw_browse_result old_result, OS_nw_browse_result new_result);
Expand Down
38 changes: 19 additions & 19 deletions src/Network/NWBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
using Foundation;
using CoreFoundation;

using OS_nw_browser=System.IntPtr;
using OS_nw_browse_descriptor=System.IntPtr;
using OS_nw_parameters=System.IntPtr;
using dispatch_queue_t =System.IntPtr;
using OS_nw_browser = System.IntPtr;
using OS_nw_browse_descriptor = System.IntPtr;
using OS_nw_parameters = System.IntPtr;
using dispatch_queue_t = System.IntPtr;

#if !NET
using NativeHandle = System.IntPtr;
Expand All @@ -37,10 +37,10 @@ namespace Network {
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
#else
[TV (13,0)]
[Mac (10,15)]
[iOS (13,0)]
[Watch (6,0)]
[TV (13, 0)]
[Mac (10, 15)]
[iOS (13, 0)]
[Watch (6, 0)]
#endif
public class NWBrowser : NativeObject {

Expand All @@ -66,7 +66,7 @@ public NWBrowser (NWBrowserDescriptor descriptor, NWParameters? parameters)
SetChangesHandler (InternalChangesHandler);
}

public NWBrowser (NWBrowserDescriptor descriptor) : this (descriptor, null) {}
public NWBrowser (NWBrowserDescriptor descriptor) : this (descriptor, null) { }

[DllImport (Constants.NetworkLibrary)]
static extern void nw_browser_set_queue (OS_nw_browser browser, dispatch_queue_t queue);
Expand Down Expand Up @@ -111,7 +111,7 @@ public void Cancel ()

public bool IsActive {
get {
lock (startLock)
lock (startLock)
return started;
}
}
Expand All @@ -129,7 +129,7 @@ public NWParameters Parameters
=> new NWParameters (nw_browser_copy_parameters (GetCheckedHandle ()), owns: true);

[DllImport (Constants.NetworkLibrary)]
unsafe static extern void nw_browser_set_browse_results_changed_handler (OS_nw_browser browser, void *handler);
unsafe static extern void nw_browser_set_browse_results_changed_handler (OS_nw_browser browser, void* handler);

delegate void nw_browser_browse_results_changed_handler_t (IntPtr block, IntPtr oldResult, IntPtr newResult, bool completed);
static nw_browser_browse_results_changed_handler_t static_ChangesHandler = TrampolineChangesHandler;
Expand Down Expand Up @@ -165,7 +165,7 @@ void InternalChangesHandler (NWBrowseResult? oldResult, NWBrowseResult? newResul
// results can be null, since we could have a not old one
oldResult?.Dispose ();
newResult?.Dispose ();
return;
return;
}
// get the change, add it to the list
var change = NWBrowseResult.GetChanges (oldResult, newResult);
Expand All @@ -177,7 +177,7 @@ void InternalChangesHandler (NWBrowseResult? oldResult, NWBrowseResult? newResul
lock (changesLock) {
changes.Add (result);
// only call when we know we are done
if (completed) {
if (completed) {
tmp_changes = changes;
changes = new List<(NWBrowseResult? result, NWBrowseResultChange change)> ();
}
Expand All @@ -199,15 +199,15 @@ void SetChangesHandler (NWBrowserChangesDelegate? handler)
return;
}
BlockLiteral block_handler = new BlockLiteral ();
BlockLiteral *block_ptr_handler = &block_handler;
BlockLiteral* block_ptr_handler = &block_handler;
block_handler.SetupBlockUnsafe (static_ChangesHandler, handler);
try {
nw_browser_set_browse_results_changed_handler (GetCheckedHandle (), (void*) block_ptr_handler);
} finally {
block_handler.CleanupBlock ();
}
}
}
}

// let to not change the API, but would be nice to remove it in the following releases.
#if !NET
Expand All @@ -216,7 +216,7 @@ void SetChangesHandler (NWBrowserChangesDelegate? handler)
#endif

[DllImport (Constants.NetworkLibrary)]
unsafe static extern void nw_browser_set_state_changed_handler (OS_nw_browser browser, void *state_changed_handler);
unsafe static extern void nw_browser_set_state_changed_handler (OS_nw_browser browser, void* state_changed_handler);

delegate void nw_browser_set_state_changed_handler_t (IntPtr block, NWBrowserState state, IntPtr error);
static nw_browser_set_state_changed_handler_t static_StateChangesHandler = TrampolineStateChangesHandler;
Expand All @@ -226,7 +226,7 @@ static void TrampolineStateChangesHandler (IntPtr block, NWBrowserState state, I
{
var del = BlockLiteral.GetTarget<Action<NWBrowserState, NWError?>> (block);
if (del is not null) {
var nwError = (error == IntPtr.Zero)? null : new NWError (error, owns: false);
var nwError = (error == IntPtr.Zero) ? null : new NWError (error, owns: false);
del (state, nwError);
}
}
Expand All @@ -240,14 +240,14 @@ public void SetStateChangesHandler (Action<NWBrowserState, NWError?> handler)
return;
}
BlockLiteral block_handler = new BlockLiteral ();
BlockLiteral *block_ptr_handler = &block_handler;
BlockLiteral* block_ptr_handler = &block_handler;
block_handler.SetupBlockUnsafe (static_StateChangesHandler, handler);
try {
nw_browser_set_state_changed_handler (GetCheckedHandle (), (void*) block_ptr_handler);
} finally {
block_handler.CleanupBlock ();
}
}
}
}
}
}
Loading