main/Smdn.Net.AddressResolution-1.1.0
Created
January 11, 2024 14:37
-
-
Save smdn/6e4f5d2967d36c49685725f486d63059 to your computer and use it in GitHub Desktop.
Smdn.Net.AddressResolution 1.1.0 Release Notes
- 2024-01-11 update assembly version
- 2024-01-11 add CompatibilitySuppressions.xml
- 2024-01-11 improve IPNetworkProfile.Create(Predicate<NetworkInterface>) to wrap and rethrow an InvalidOperationsException when Predicate throws an exception
- 2024-01-11 add IPNetworkProfile.Create(IPNetwork)
- 2024-01-11 enable network scan using with arp-scan in privileged processes
- 2024-01-11 fix or suppress warning CA1859: Change return type of method
- 2024-01-10 fix or suppress warning IDE0055: Fix formatting
- 2024-01-10 fix warning IDE1006: Naming rule violation
- 2024-01-10 drop target framework net7.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/doc/api-list/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution-net6.0.apilist.cs b/doc/api-list/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution-net6.0.apilist.cs | |
index fd58fc2..cd0a785 100644 | |
--- a/doc/api-list/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution-net6.0.apilist.cs | |
+++ b/doc/api-list/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution-net6.0.apilist.cs | |
@@ -1,299 +1,299 @@ | |
-// Smdn.Net.AddressResolution.dll (Smdn.Net.AddressResolution-1.0.2) | |
+// Smdn.Net.AddressResolution.dll (Smdn.Net.AddressResolution-1.1.0) | |
// Name: Smdn.Net.AddressResolution | |
-// AssemblyVersion: 1.0.2.0 | |
-// InformationalVersion: 1.0.2+34189a504878bfc5e98c592355e026ca8e4ee848 | |
+// AssemblyVersion: 1.1.0.0 | |
+// InformationalVersion: 1.1.0+fe88b9191dd60b0f5dc1e1881193ccd376b9795c | |
// TargetFramework: .NETCoreApp,Version=v6.0 | |
// Configuration: Release | |
// Referenced assemblies: | |
// Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 | |
// Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 | |
// System.Collections, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
// System.Collections.Concurrent, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
// System.ComponentModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
// System.ComponentModel.Primitives, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
// System.Diagnostics.Process, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
// System.Linq, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
// System.Memory, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | |
// System.Net.NetworkInformation, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
// System.Net.Ping, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
// System.Net.Primitives, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
// System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
// System.Runtime.InteropServices, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
// System.Runtime.InteropServices.RuntimeInformation, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
// System.Threading, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
// Vanara.PInvoke.IpHlpApi, Version=3.4.13.0, Culture=neutral, PublicKeyToken=c37e4080322237fa | |
// Vanara.PInvoke.Shared, Version=3.4.13.0, Culture=neutral, PublicKeyToken=c37e4080322237fa | |
// Vanara.PInvoke.Ws2_32, Version=3.4.13.0, Culture=neutral, PublicKeyToken=c37e4080322237fa | |
#nullable enable annotations | |
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Diagnostics.CodeAnalysis; | |
using System.Net; | |
using System.Net.NetworkInformation; | |
using System.Runtime.CompilerServices; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Microsoft.Extensions.Logging; | |
using Smdn.Net; | |
using Smdn.Net.AddressResolution; | |
using Smdn.Net.AddressTables; | |
using Smdn.Net.NetworkScanning; | |
namespace Smdn.Net { | |
public abstract class IPNetworkProfile { | |
public static IPNetworkProfile Create() {} | |
public static IPNetworkProfile Create(Func<IEnumerable<IPAddress>?> addressRangeGenerator, NetworkInterface? networkInterface = null) {} | |
public static IPNetworkProfile Create(IPAddress baseAddress, IPAddress subnetMask, NetworkInterface? networkInterface = null) {} | |
public static IPNetworkProfile Create(IPAddress baseAddress, int prefixLength, NetworkInterface? networkInterface = null) {} | |
public static IPNetworkProfile Create(NetworkInterface networkInterface) {} | |
public static IPNetworkProfile Create(Predicate<NetworkInterface> predicateForNetworkInterface) {} | |
public static IPNetworkProfile CreateFromNetworkInterface(Guid id) {} | |
public static IPNetworkProfile CreateFromNetworkInterface(PhysicalAddress physicalAddress) {} | |
public static IPNetworkProfile CreateFromNetworkInterface(string id) {} | |
public static IPNetworkProfile CreateFromNetworkInterfaceName(string name) {} | |
protected IPNetworkProfile(NetworkInterface? networkInterface) {} | |
public NetworkInterface? NetworkInterface { get; } | |
public abstract IEnumerable<IPAddress>? GetAddressRange(); | |
} | |
public static class PhysicalAddressExtensions { | |
public static string ToMacAddressString(this PhysicalAddress hardwareAddress, char delimiter = ':') {} | |
} | |
} | |
namespace Smdn.Net.AddressResolution { | |
public interface IAddressResolver<TAddress, TResolvedAddress> where TAddress : notnull where TResolvedAddress : notnull { | |
void Invalidate(TAddress address); | |
ValueTask<TResolvedAddress?> ResolveAsync(TAddress address, CancellationToken cancellationToken); | |
} | |
public class MacAddressResolver : MacAddressResolverBase { | |
protected MacAddressResolver(IAddressTable addressTable, bool shouldDisposeAddressTable, INetworkScanner? networkScanner, bool shouldDisposeNetworkScanner, NetworkInterface? networkInterface, int maxParallelCountForRefreshInvalidatedAddresses, ILogger? logger) {} | |
public MacAddressResolver() {} | |
public MacAddressResolver(IAddressTable? addressTable, INetworkScanner? networkScanner, bool shouldDisposeAddressTable = false, bool shouldDisposeNetworkScanner = false, NetworkInterface? networkInterface = null, int maxParallelCountForRefreshInvalidatedAddresses = 3, IServiceProvider? serviceProvider = null) {} | |
public MacAddressResolver(IPNetworkProfile? networkProfile, IServiceProvider? serviceProvider = null) {} | |
public bool CanPerformNetworkScan { get; } | |
public override bool HasInvalidated { get; } | |
public TimeSpan NetworkScanInterval { get; set; } | |
public TimeSpan NetworkScanMinInterval { get; set; } | |
protected override void Dispose(bool disposing) {} | |
public IAsyncEnumerable<AddressTableEntry> EnumerateAddressTableEntriesAsync(CancellationToken cancellationToken = default) {} | |
public IAsyncEnumerable<AddressTableEntry> EnumerateAddressTableEntriesAsync(Predicate<AddressTableEntry> predicate, CancellationToken cancellationToken = default) {} | |
protected override void InvalidateCore(IPAddress ipAddress) {} | |
protected override void InvalidateCore(PhysicalAddress macAddress) {} | |
protected override ValueTask RefreshAddressTableAsyncCore(CancellationToken cancellationToken = default) {} | |
protected override ValueTask RefreshInvalidatedAddressesAsyncCore(CancellationToken cancellationToken = default) {} | |
protected override async ValueTask<PhysicalAddress?> ResolveIPAddressToMacAddressAsyncCore(IPAddress ipAddress, CancellationToken cancellationToken) {} | |
protected override async ValueTask<IPAddress?> ResolveMacAddressToIPAddressAsyncCore(PhysicalAddress macAddress, CancellationToken cancellationToken) {} | |
protected virtual async ValueTask<AddressTableEntry> SelectAddressTableEntryAsync(Predicate<AddressTableEntry> predicate, CancellationToken cancellationToken) {} | |
} | |
public abstract class MacAddressResolverBase : | |
IAddressResolver<IPAddress, PhysicalAddress>, | |
IAddressResolver<PhysicalAddress, IPAddress>, | |
IDisposable | |
{ | |
protected static PhysicalAddress AllZeroMacAddress { get; } | |
public static MacAddressResolverBase Null { get; } | |
protected MacAddressResolverBase(ILogger? logger = null) {} | |
public abstract bool HasInvalidated { get; } | |
protected ILogger? Logger { get; } | |
protected virtual void Dispose(bool disposing) {} | |
public void Dispose() {} | |
public void Invalidate(IPAddress ipAddress) {} | |
public void Invalidate(PhysicalAddress macAddress) {} | |
protected abstract void InvalidateCore(IPAddress ipAddress); | |
protected abstract void InvalidateCore(PhysicalAddress macAddress); | |
public ValueTask RefreshAddressTableAsync(CancellationToken cancellationToken = default) {} | |
protected virtual ValueTask RefreshAddressTableAsyncCore(CancellationToken cancellationToken) {} | |
public ValueTask RefreshInvalidatedAddressesAsync(CancellationToken cancellationToken = default) {} | |
protected virtual ValueTask RefreshInvalidatedAddressesAsyncCore(CancellationToken cancellationToken) {} | |
public ValueTask<PhysicalAddress?> ResolveIPAddressToMacAddressAsync(IPAddress ipAddress, CancellationToken cancellationToken = default) {} | |
protected abstract ValueTask<PhysicalAddress?> ResolveIPAddressToMacAddressAsyncCore(IPAddress ipAddress, CancellationToken cancellationToken); | |
public ValueTask<IPAddress?> ResolveMacAddressToIPAddressAsync(PhysicalAddress macAddress, CancellationToken cancellationToken = default) {} | |
protected abstract ValueTask<IPAddress?> ResolveMacAddressToIPAddressAsyncCore(PhysicalAddress macAddress, CancellationToken cancellationToken); | |
void IAddressResolver<IPAddress, PhysicalAddress>.Invalidate(IPAddress address) {} | |
ValueTask<PhysicalAddress?> IAddressResolver<IPAddress, PhysicalAddress>.ResolveAsync(IPAddress address, CancellationToken cancellationToken) {} | |
void IAddressResolver<PhysicalAddress, IPAddress>.Invalidate(PhysicalAddress address) {} | |
ValueTask<IPAddress?> IAddressResolver<PhysicalAddress, IPAddress>.ResolveAsync(PhysicalAddress address, CancellationToken cancellationToken) {} | |
protected void ThrowIfDisposed() {} | |
} | |
} | |
namespace Smdn.Net.AddressTables { | |
public interface IAddressTable : IDisposable { | |
IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsync(CancellationToken cancellationToken); | |
} | |
public enum AddressTableEntryState : int { | |
Delay = 4, | |
Incomplete = 1, | |
None = 0, | |
Probe = 5, | |
Reachable = 2, | |
Stale = 3, | |
} | |
public abstract class AddressTable : IAddressTable { | |
public static IAddressTable Null { get; } | |
public static IAddressTable Create(IServiceProvider? serviceProvider = null) {} | |
protected AddressTable(ILogger? logger = null) {} | |
protected ILogger? Logger { get; } | |
protected virtual void Dispose(bool disposing) {} | |
public void Dispose() {} | |
public IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsync(CancellationToken cancellationToken = default) {} | |
protected abstract IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsyncCore(CancellationToken cancellationToken); | |
protected void ThrowIfDisposed() {} | |
} | |
public sealed class IpHlpApiAddressTable : AddressTable { | |
public static bool IsSupported { get; } | |
public IpHlpApiAddressTable(IServiceProvider? serviceProvider = null) {} | |
[AsyncIteratorStateMachine(typeof(IpHlpApiAddressTable.<EnumerateEntriesAsyncCore>d__4))] | |
protected override IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsyncCore([EnumeratorCancellation] CancellationToken cancellationToken) {} | |
} | |
public sealed class ProcfsArpAddressTable : AddressTable { | |
public static bool IsSupported { get; } | |
public ProcfsArpAddressTable(IServiceProvider? serviceProvider = null) {} | |
[AsyncIteratorStateMachine(typeof(ProcfsArpAddressTable.<EnumerateEntriesAsyncCore>d__5))] | |
protected override IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsyncCore([EnumeratorCancellation] CancellationToken cancellationToken) {} | |
} | |
public readonly struct AddressTableEntry : | |
IEquatable<AddressTableEntry>, | |
IEquatable<IPAddress>, | |
IEquatable<PhysicalAddress> | |
{ | |
public static readonly AddressTableEntry Empty; // = "{IP=, MAC=(null), IsPermanent=False, State=None, Iface=}" | |
public static IEqualityComparer<AddressTableEntry> DefaultEqualityComparer { get; } | |
public static IEqualityComparer<AddressTableEntry> ExceptStateEqualityComparer { get; } | |
public AddressTableEntry(IPAddress ipAddress, PhysicalAddress? physicalAddress, bool isPermanent, AddressTableEntryState state, string? interfaceId) {} | |
public IPAddress? IPAddress { get; } | |
public string? InterfaceId { get; } | |
[MemberNotNullWhen(false, "IPAddress")] | |
public bool IsEmpty { [MemberNotNullWhen(false, "IPAddress")] get; } | |
public bool IsPermanent { get; } | |
public PhysicalAddress? PhysicalAddress { get; } | |
public AddressTableEntryState State { get; } | |
public bool Equals(AddressTableEntry other) {} | |
public bool Equals(IPAddress? other) {} | |
public bool Equals(PhysicalAddress? other) {} | |
public override bool Equals(object? obj) {} | |
public override int GetHashCode() {} | |
public override string ToString() {} | |
} | |
} | |
namespace Smdn.Net.NetworkScanning { | |
public interface INetworkScanner : IDisposable { | |
ValueTask ScanAsync(CancellationToken cancellationToken); | |
ValueTask ScanAsync(IEnumerable<IPAddress> addresses, CancellationToken cancellationToken); | |
} | |
public sealed class ArpScanCommandNetworkScanner : CommandNetworkScanner { | |
public static bool IsSupported { get; } | |
public ArpScanCommandNetworkScanner(IPNetworkProfile? networkProfile, IServiceProvider? serviceProvider = null) {} | |
protected override bool GetCommandLineArguments(IEnumerable<IPAddress> addressesToScan, out string executable, out string arguments) {} | |
protected override bool GetCommandLineArguments(out string executable, out string arguments) {} | |
} | |
public abstract class CommandNetworkScanner : INetworkScanner { | |
public interface IProcessFactory { | |
Process CreateProcess(ProcessStartInfo processStartInfo); | |
} | |
protected readonly struct Command { | |
public Command(string name, string? executablePath) {} | |
public bool IsAvailable { get; } | |
public string Name { get; } | |
public string GetExecutablePathOrThrow() {} | |
} | |
protected static IReadOnlyCollection<string> DefaultCommandPaths { get; } | |
protected static CommandNetworkScanner.Command FindCommand(string command, IEnumerable<string> paths) {} | |
protected CommandNetworkScanner(ILogger? logger, IServiceProvider? serviceProvider) {} | |
protected virtual void Dispose(bool disposing) {} | |
public void Dispose() {} | |
protected abstract bool GetCommandLineArguments(IEnumerable<IPAddress> addressesToScan, out string executable, out string? arguments); | |
protected abstract bool GetCommandLineArguments(out string executable, out string? arguments); | |
public virtual ValueTask ScanAsync(CancellationToken cancellationToken = default) {} | |
public virtual ValueTask ScanAsync(IEnumerable<IPAddress> addresses, CancellationToken cancellationToken = default) {} | |
protected void ThrowIfDisposed() {} | |
} | |
public sealed class IpHlpApiNetworkScanner : NetworkScanner { | |
public static bool IsSupported { get; } | |
public IpHlpApiNetworkScanner(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {} | |
protected override async ValueTask ScanAsyncCore(IPAddress address, CancellationToken cancellationToken = default) {} | |
} | |
public abstract class NetworkScanner : INetworkScanner { | |
public static INetworkScanner Null { get; } | |
public static INetworkScanner Create(IPNetworkProfile? networkProfile, IServiceProvider? serviceProvider = null) {} | |
protected NetworkScanner(IPNetworkProfile networkProfile, ILogger? logger = null) {} | |
protected ILogger? Logger { get; } | |
protected IPNetworkProfile NetworkProfile { get; } | |
protected virtual void Dispose(bool disposing) {} | |
public void Dispose() {} | |
public virtual ValueTask ScanAsync(CancellationToken cancellationToken = default) {} | |
public virtual ValueTask ScanAsync(IEnumerable<IPAddress> addresses, CancellationToken cancellationToken = default) {} | |
protected virtual ValueTask ScanAsyncCore(IPAddress address, CancellationToken cancellationToken) {} | |
protected void ThrowIfDisposed() {} | |
} | |
public sealed class NmapCommandNetworkScanner : CommandNetworkScanner { | |
public static bool IsSupported { get; } | |
public NmapCommandNetworkScanner(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {} | |
protected override bool GetCommandLineArguments(IEnumerable<IPAddress> addressesToScan, out string executable, out string arguments) {} | |
protected override bool GetCommandLineArguments(out string executable, out string arguments) {} | |
} | |
public sealed class PingNetworkScanner : NetworkScanner { | |
public static bool IsSupported { get; } | |
public PingNetworkScanner(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {} | |
protected override void Dispose(bool disposing) {} | |
protected override async ValueTask ScanAsyncCore(IPAddress address, CancellationToken cancellationToken = default) {} | |
} | |
} | |
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.2.2.0. | |
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.3.2.0. | |
// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating) | |
diff --git a/doc/api-list/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution-net7.0.apilist.cs b/doc/api-list/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution-net8.0.apilist.cs | |
similarity index 93% | |
rename from doc/api-list/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution-net7.0.apilist.cs | |
rename to doc/api-list/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution-net8.0.apilist.cs | |
index ae2eaaf..8133b50 100644 | |
--- a/doc/api-list/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution-net7.0.apilist.cs | |
+++ b/doc/api-list/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution-net8.0.apilist.cs | |
@@ -1,298 +1,299 @@ | |
-// Smdn.Net.AddressResolution.dll (Smdn.Net.AddressResolution-1.0.2) | |
+// Smdn.Net.AddressResolution.dll (Smdn.Net.AddressResolution-1.1.0) | |
// Name: Smdn.Net.AddressResolution | |
-// AssemblyVersion: 1.0.2.0 | |
-// InformationalVersion: 1.0.2+34189a504878bfc5e98c592355e026ca8e4ee848 | |
-// TargetFramework: .NETCoreApp,Version=v7.0 | |
+// AssemblyVersion: 1.1.0.0 | |
+// InformationalVersion: 1.1.0+fe88b9191dd60b0f5dc1e1881193ccd376b9795c | |
+// TargetFramework: .NETCoreApp,Version=v8.0 | |
// Configuration: Release | |
// Referenced assemblies: | |
// Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 | |
// Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 | |
-// System.Collections, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
-// System.Collections.Concurrent, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
-// System.ComponentModel, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
-// System.ComponentModel.Primitives, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
-// System.Diagnostics.Process, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
-// System.Linq, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
-// System.Memory, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | |
-// System.Net.NetworkInformation, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
-// System.Net.Ping, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
-// System.Net.Primitives, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
-// System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
-// System.Runtime.InteropServices, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
-// System.Threading, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
+// System.Collections, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
+// System.Collections.Concurrent, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
+// System.ComponentModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
+// System.ComponentModel.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
+// System.Diagnostics.Process, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
+// System.Linq, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
+// System.Memory, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | |
+// System.Net.NetworkInformation, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
+// System.Net.Ping, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
+// System.Net.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
+// System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
+// System.Runtime.InteropServices, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
+// System.Threading, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
// Vanara.PInvoke.IpHlpApi, Version=3.4.13.0, Culture=neutral, PublicKeyToken=c37e4080322237fa | |
// Vanara.PInvoke.Shared, Version=3.4.13.0, Culture=neutral, PublicKeyToken=c37e4080322237fa | |
// Vanara.PInvoke.Ws2_32, Version=3.4.13.0, Culture=neutral, PublicKeyToken=c37e4080322237fa | |
#nullable enable annotations | |
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Diagnostics.CodeAnalysis; | |
using System.Net; | |
using System.Net.NetworkInformation; | |
using System.Runtime.CompilerServices; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Microsoft.Extensions.Logging; | |
using Smdn.Net; | |
using Smdn.Net.AddressResolution; | |
using Smdn.Net.AddressTables; | |
using Smdn.Net.NetworkScanning; | |
namespace Smdn.Net { | |
public abstract class IPNetworkProfile { | |
public static IPNetworkProfile Create() {} | |
public static IPNetworkProfile Create(Func<IEnumerable<IPAddress>?> addressRangeGenerator, NetworkInterface? networkInterface = null) {} | |
public static IPNetworkProfile Create(IPAddress baseAddress, IPAddress subnetMask, NetworkInterface? networkInterface = null) {} | |
public static IPNetworkProfile Create(IPAddress baseAddress, int prefixLength, NetworkInterface? networkInterface = null) {} | |
+ public static IPNetworkProfile Create(IPNetwork network, NetworkInterface? networkInterface = null) {} | |
public static IPNetworkProfile Create(NetworkInterface networkInterface) {} | |
public static IPNetworkProfile Create(Predicate<NetworkInterface> predicateForNetworkInterface) {} | |
public static IPNetworkProfile CreateFromNetworkInterface(Guid id) {} | |
public static IPNetworkProfile CreateFromNetworkInterface(PhysicalAddress physicalAddress) {} | |
public static IPNetworkProfile CreateFromNetworkInterface(string id) {} | |
public static IPNetworkProfile CreateFromNetworkInterfaceName(string name) {} | |
protected IPNetworkProfile(NetworkInterface? networkInterface) {} | |
public NetworkInterface? NetworkInterface { get; } | |
public abstract IEnumerable<IPAddress>? GetAddressRange(); | |
} | |
public static class PhysicalAddressExtensions { | |
public static string ToMacAddressString(this PhysicalAddress hardwareAddress, char delimiter = ':') {} | |
} | |
} | |
namespace Smdn.Net.AddressResolution { | |
public interface IAddressResolver<TAddress, TResolvedAddress> where TAddress : notnull where TResolvedAddress : notnull { | |
void Invalidate(TAddress address); | |
ValueTask<TResolvedAddress?> ResolveAsync(TAddress address, CancellationToken cancellationToken); | |
} | |
public class MacAddressResolver : MacAddressResolverBase { | |
protected MacAddressResolver(IAddressTable addressTable, bool shouldDisposeAddressTable, INetworkScanner? networkScanner, bool shouldDisposeNetworkScanner, NetworkInterface? networkInterface, int maxParallelCountForRefreshInvalidatedAddresses, ILogger? logger) {} | |
public MacAddressResolver() {} | |
public MacAddressResolver(IAddressTable? addressTable, INetworkScanner? networkScanner, bool shouldDisposeAddressTable = false, bool shouldDisposeNetworkScanner = false, NetworkInterface? networkInterface = null, int maxParallelCountForRefreshInvalidatedAddresses = 3, IServiceProvider? serviceProvider = null) {} | |
public MacAddressResolver(IPNetworkProfile? networkProfile, IServiceProvider? serviceProvider = null) {} | |
public bool CanPerformNetworkScan { get; } | |
public override bool HasInvalidated { get; } | |
public TimeSpan NetworkScanInterval { get; set; } | |
public TimeSpan NetworkScanMinInterval { get; set; } | |
protected override void Dispose(bool disposing) {} | |
public IAsyncEnumerable<AddressTableEntry> EnumerateAddressTableEntriesAsync(CancellationToken cancellationToken = default) {} | |
public IAsyncEnumerable<AddressTableEntry> EnumerateAddressTableEntriesAsync(Predicate<AddressTableEntry> predicate, CancellationToken cancellationToken = default) {} | |
protected override void InvalidateCore(IPAddress ipAddress) {} | |
protected override void InvalidateCore(PhysicalAddress macAddress) {} | |
protected override ValueTask RefreshAddressTableAsyncCore(CancellationToken cancellationToken = default) {} | |
protected override ValueTask RefreshInvalidatedAddressesAsyncCore(CancellationToken cancellationToken = default) {} | |
protected override async ValueTask<PhysicalAddress?> ResolveIPAddressToMacAddressAsyncCore(IPAddress ipAddress, CancellationToken cancellationToken) {} | |
protected override async ValueTask<IPAddress?> ResolveMacAddressToIPAddressAsyncCore(PhysicalAddress macAddress, CancellationToken cancellationToken) {} | |
protected virtual async ValueTask<AddressTableEntry> SelectAddressTableEntryAsync(Predicate<AddressTableEntry> predicate, CancellationToken cancellationToken) {} | |
} | |
public abstract class MacAddressResolverBase : | |
IAddressResolver<IPAddress, PhysicalAddress>, | |
IAddressResolver<PhysicalAddress, IPAddress>, | |
IDisposable | |
{ | |
protected static PhysicalAddress AllZeroMacAddress { get; } | |
public static MacAddressResolverBase Null { get; } | |
protected MacAddressResolverBase(ILogger? logger = null) {} | |
public abstract bool HasInvalidated { get; } | |
protected ILogger? Logger { get; } | |
protected virtual void Dispose(bool disposing) {} | |
public void Dispose() {} | |
public void Invalidate(IPAddress ipAddress) {} | |
public void Invalidate(PhysicalAddress macAddress) {} | |
protected abstract void InvalidateCore(IPAddress ipAddress); | |
protected abstract void InvalidateCore(PhysicalAddress macAddress); | |
public ValueTask RefreshAddressTableAsync(CancellationToken cancellationToken = default) {} | |
protected virtual ValueTask RefreshAddressTableAsyncCore(CancellationToken cancellationToken) {} | |
public ValueTask RefreshInvalidatedAddressesAsync(CancellationToken cancellationToken = default) {} | |
protected virtual ValueTask RefreshInvalidatedAddressesAsyncCore(CancellationToken cancellationToken) {} | |
public ValueTask<PhysicalAddress?> ResolveIPAddressToMacAddressAsync(IPAddress ipAddress, CancellationToken cancellationToken = default) {} | |
protected abstract ValueTask<PhysicalAddress?> ResolveIPAddressToMacAddressAsyncCore(IPAddress ipAddress, CancellationToken cancellationToken); | |
public ValueTask<IPAddress?> ResolveMacAddressToIPAddressAsync(PhysicalAddress macAddress, CancellationToken cancellationToken = default) {} | |
protected abstract ValueTask<IPAddress?> ResolveMacAddressToIPAddressAsyncCore(PhysicalAddress macAddress, CancellationToken cancellationToken); | |
void IAddressResolver<IPAddress, PhysicalAddress>.Invalidate(IPAddress address) {} | |
ValueTask<PhysicalAddress?> IAddressResolver<IPAddress, PhysicalAddress>.ResolveAsync(IPAddress address, CancellationToken cancellationToken) {} | |
void IAddressResolver<PhysicalAddress, IPAddress>.Invalidate(PhysicalAddress address) {} | |
ValueTask<IPAddress?> IAddressResolver<PhysicalAddress, IPAddress>.ResolveAsync(PhysicalAddress address, CancellationToken cancellationToken) {} | |
protected void ThrowIfDisposed() {} | |
} | |
} | |
namespace Smdn.Net.AddressTables { | |
public interface IAddressTable : IDisposable { | |
IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsync(CancellationToken cancellationToken); | |
} | |
public enum AddressTableEntryState : int { | |
Delay = 4, | |
Incomplete = 1, | |
None = 0, | |
Probe = 5, | |
Reachable = 2, | |
Stale = 3, | |
} | |
public abstract class AddressTable : IAddressTable { | |
public static IAddressTable Null { get; } | |
public static IAddressTable Create(IServiceProvider? serviceProvider = null) {} | |
protected AddressTable(ILogger? logger = null) {} | |
protected ILogger? Logger { get; } | |
protected virtual void Dispose(bool disposing) {} | |
public void Dispose() {} | |
public IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsync(CancellationToken cancellationToken = default) {} | |
protected abstract IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsyncCore(CancellationToken cancellationToken); | |
protected void ThrowIfDisposed() {} | |
} | |
public sealed class IpHlpApiAddressTable : AddressTable { | |
public static bool IsSupported { get; } | |
public IpHlpApiAddressTable(IServiceProvider? serviceProvider = null) {} | |
[AsyncIteratorStateMachine(typeof(IpHlpApiAddressTable.<EnumerateEntriesAsyncCore>d__4))] | |
protected override IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsyncCore([EnumeratorCancellation] CancellationToken cancellationToken) {} | |
} | |
public sealed class ProcfsArpAddressTable : AddressTable { | |
public static bool IsSupported { get; } | |
public ProcfsArpAddressTable(IServiceProvider? serviceProvider = null) {} | |
[AsyncIteratorStateMachine(typeof(ProcfsArpAddressTable.<EnumerateEntriesAsyncCore>d__5))] | |
protected override IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsyncCore([EnumeratorCancellation] CancellationToken cancellationToken) {} | |
} | |
public readonly struct AddressTableEntry : | |
IEquatable<AddressTableEntry>, | |
IEquatable<IPAddress>, | |
IEquatable<PhysicalAddress> | |
{ | |
public static readonly AddressTableEntry Empty; // = "{IP=, MAC=(null), IsPermanent=False, State=None, Iface=}" | |
public static IEqualityComparer<AddressTableEntry> DefaultEqualityComparer { get; } | |
public static IEqualityComparer<AddressTableEntry> ExceptStateEqualityComparer { get; } | |
public AddressTableEntry(IPAddress ipAddress, PhysicalAddress? physicalAddress, bool isPermanent, AddressTableEntryState state, string? interfaceId) {} | |
public IPAddress? IPAddress { get; } | |
public string? InterfaceId { get; } | |
[MemberNotNullWhen(false, "IPAddress")] | |
public bool IsEmpty { [MemberNotNullWhen(false, "IPAddress")] get; } | |
public bool IsPermanent { get; } | |
public PhysicalAddress? PhysicalAddress { get; } | |
public AddressTableEntryState State { get; } | |
public bool Equals(AddressTableEntry other) {} | |
public bool Equals(IPAddress? other) {} | |
public bool Equals(PhysicalAddress? other) {} | |
public override bool Equals(object? obj) {} | |
public override int GetHashCode() {} | |
public override string ToString() {} | |
} | |
} | |
namespace Smdn.Net.NetworkScanning { | |
public interface INetworkScanner : IDisposable { | |
ValueTask ScanAsync(CancellationToken cancellationToken); | |
ValueTask ScanAsync(IEnumerable<IPAddress> addresses, CancellationToken cancellationToken); | |
} | |
public sealed class ArpScanCommandNetworkScanner : CommandNetworkScanner { | |
public static bool IsSupported { get; } | |
public ArpScanCommandNetworkScanner(IPNetworkProfile? networkProfile, IServiceProvider? serviceProvider = null) {} | |
protected override bool GetCommandLineArguments(IEnumerable<IPAddress> addressesToScan, out string executable, out string arguments) {} | |
protected override bool GetCommandLineArguments(out string executable, out string arguments) {} | |
} | |
public abstract class CommandNetworkScanner : INetworkScanner { | |
public interface IProcessFactory { | |
Process CreateProcess(ProcessStartInfo processStartInfo); | |
} | |
protected readonly struct Command { | |
public Command(string name, string? executablePath) {} | |
public bool IsAvailable { get; } | |
public string Name { get; } | |
public string GetExecutablePathOrThrow() {} | |
} | |
protected static IReadOnlyCollection<string> DefaultCommandPaths { get; } | |
protected static CommandNetworkScanner.Command FindCommand(string command, IEnumerable<string> paths) {} | |
protected CommandNetworkScanner(ILogger? logger, IServiceProvider? serviceProvider) {} | |
protected virtual void Dispose(bool disposing) {} | |
public void Dispose() {} | |
protected abstract bool GetCommandLineArguments(IEnumerable<IPAddress> addressesToScan, out string executable, out string? arguments); | |
protected abstract bool GetCommandLineArguments(out string executable, out string? arguments); | |
public virtual ValueTask ScanAsync(CancellationToken cancellationToken = default) {} | |
public virtual ValueTask ScanAsync(IEnumerable<IPAddress> addresses, CancellationToken cancellationToken = default) {} | |
protected void ThrowIfDisposed() {} | |
} | |
public sealed class IpHlpApiNetworkScanner : NetworkScanner { | |
public static bool IsSupported { get; } | |
public IpHlpApiNetworkScanner(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {} | |
protected override async ValueTask ScanAsyncCore(IPAddress address, CancellationToken cancellationToken = default) {} | |
} | |
public abstract class NetworkScanner : INetworkScanner { | |
public static INetworkScanner Null { get; } | |
public static INetworkScanner Create(IPNetworkProfile? networkProfile, IServiceProvider? serviceProvider = null) {} | |
protected NetworkScanner(IPNetworkProfile networkProfile, ILogger? logger = null) {} | |
protected ILogger? Logger { get; } | |
protected IPNetworkProfile NetworkProfile { get; } | |
protected virtual void Dispose(bool disposing) {} | |
public void Dispose() {} | |
public virtual ValueTask ScanAsync(CancellationToken cancellationToken = default) {} | |
public virtual ValueTask ScanAsync(IEnumerable<IPAddress> addresses, CancellationToken cancellationToken = default) {} | |
protected virtual ValueTask ScanAsyncCore(IPAddress address, CancellationToken cancellationToken) {} | |
protected void ThrowIfDisposed() {} | |
} | |
public sealed class NmapCommandNetworkScanner : CommandNetworkScanner { | |
public static bool IsSupported { get; } | |
public NmapCommandNetworkScanner(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {} | |
protected override bool GetCommandLineArguments(IEnumerable<IPAddress> addressesToScan, out string executable, out string arguments) {} | |
protected override bool GetCommandLineArguments(out string executable, out string arguments) {} | |
} | |
public sealed class PingNetworkScanner : NetworkScanner { | |
public static bool IsSupported { get; } | |
public PingNetworkScanner(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {} | |
protected override void Dispose(bool disposing) {} | |
protected override async ValueTask ScanAsyncCore(IPAddress address, CancellationToken cancellationToken = default) {} | |
} | |
} | |
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.2.2.0. | |
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.3.2.0. | |
// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating) | |
diff --git a/doc/api-list/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution-netstandard2.0.apilist.cs b/doc/api-list/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution-netstandard2.0.apilist.cs | |
index 1eb767c..36ef88d 100644 | |
--- a/doc/api-list/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution-netstandard2.0.apilist.cs | |
+++ b/doc/api-list/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution-netstandard2.0.apilist.cs | |
@@ -1,288 +1,288 @@ | |
-// Smdn.Net.AddressResolution.dll (Smdn.Net.AddressResolution-1.0.2) | |
+// Smdn.Net.AddressResolution.dll (Smdn.Net.AddressResolution-1.1.0) | |
// Name: Smdn.Net.AddressResolution | |
-// AssemblyVersion: 1.0.2.0 | |
-// InformationalVersion: 1.0.2+34189a504878bfc5e98c592355e026ca8e4ee848 | |
+// AssemblyVersion: 1.1.0.0 | |
+// InformationalVersion: 1.1.0+fe88b9191dd60b0f5dc1e1881193ccd376b9795c | |
// TargetFramework: .NETStandard,Version=v2.0 | |
// Configuration: Release | |
// Referenced assemblies: | |
// Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | |
// Microsoft.Bcl.HashCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | |
// Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 | |
// Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 | |
// System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | |
// System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | |
// Vanara.PInvoke.IpHlpApi, Version=3.4.13.0, Culture=neutral, PublicKeyToken=c37e4080322237fa | |
// Vanara.PInvoke.Shared, Version=3.4.13.0, Culture=neutral, PublicKeyToken=c37e4080322237fa | |
// Vanara.PInvoke.Ws2_32, Version=3.4.13.0, Culture=neutral, PublicKeyToken=c37e4080322237fa | |
// netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | |
#nullable enable annotations | |
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Net; | |
using System.Net.NetworkInformation; | |
using System.Runtime.CompilerServices; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Microsoft.Extensions.Logging; | |
using Smdn.Net; | |
using Smdn.Net.AddressResolution; | |
using Smdn.Net.AddressTables; | |
using Smdn.Net.NetworkScanning; | |
namespace Smdn.Net { | |
public abstract class IPNetworkProfile { | |
public static IPNetworkProfile Create() {} | |
public static IPNetworkProfile Create(Func<IEnumerable<IPAddress>?> addressRangeGenerator, NetworkInterface? networkInterface = null) {} | |
public static IPNetworkProfile Create(IPAddress baseAddress, IPAddress subnetMask, NetworkInterface? networkInterface = null) {} | |
public static IPNetworkProfile Create(IPAddress baseAddress, int prefixLength, NetworkInterface? networkInterface = null) {} | |
public static IPNetworkProfile Create(NetworkInterface networkInterface) {} | |
public static IPNetworkProfile Create(Predicate<NetworkInterface> predicateForNetworkInterface) {} | |
public static IPNetworkProfile CreateFromNetworkInterface(Guid id) {} | |
public static IPNetworkProfile CreateFromNetworkInterface(PhysicalAddress physicalAddress) {} | |
public static IPNetworkProfile CreateFromNetworkInterface(string id) {} | |
public static IPNetworkProfile CreateFromNetworkInterfaceName(string name) {} | |
protected IPNetworkProfile(NetworkInterface? networkInterface) {} | |
public NetworkInterface? NetworkInterface { get; } | |
public abstract IEnumerable<IPAddress>? GetAddressRange(); | |
} | |
public static class PhysicalAddressExtensions { | |
public static string ToMacAddressString(this PhysicalAddress hardwareAddress, char delimiter = ':') {} | |
} | |
} | |
namespace Smdn.Net.AddressResolution { | |
public interface IAddressResolver<TAddress, TResolvedAddress> where TAddress : notnull where TResolvedAddress : notnull { | |
void Invalidate(TAddress address); | |
ValueTask<TResolvedAddress?> ResolveAsync(TAddress address, CancellationToken cancellationToken); | |
} | |
public class MacAddressResolver : MacAddressResolverBase { | |
protected MacAddressResolver(IAddressTable addressTable, bool shouldDisposeAddressTable, INetworkScanner? networkScanner, bool shouldDisposeNetworkScanner, NetworkInterface? networkInterface, int maxParallelCountForRefreshInvalidatedAddresses, ILogger? logger) {} | |
public MacAddressResolver() {} | |
public MacAddressResolver(IAddressTable? addressTable, INetworkScanner? networkScanner, bool shouldDisposeAddressTable = false, bool shouldDisposeNetworkScanner = false, NetworkInterface? networkInterface = null, int maxParallelCountForRefreshInvalidatedAddresses = 3, IServiceProvider? serviceProvider = null) {} | |
public MacAddressResolver(IPNetworkProfile? networkProfile, IServiceProvider? serviceProvider = null) {} | |
public bool CanPerformNetworkScan { get; } | |
public override bool HasInvalidated { get; } | |
public TimeSpan NetworkScanInterval { get; set; } | |
public TimeSpan NetworkScanMinInterval { get; set; } | |
protected override void Dispose(bool disposing) {} | |
public IAsyncEnumerable<AddressTableEntry> EnumerateAddressTableEntriesAsync(CancellationToken cancellationToken = default) {} | |
public IAsyncEnumerable<AddressTableEntry> EnumerateAddressTableEntriesAsync(Predicate<AddressTableEntry> predicate, CancellationToken cancellationToken = default) {} | |
protected override void InvalidateCore(IPAddress ipAddress) {} | |
protected override void InvalidateCore(PhysicalAddress macAddress) {} | |
protected override ValueTask RefreshAddressTableAsyncCore(CancellationToken cancellationToken = default) {} | |
protected override ValueTask RefreshInvalidatedAddressesAsyncCore(CancellationToken cancellationToken = default) {} | |
protected override async ValueTask<PhysicalAddress?> ResolveIPAddressToMacAddressAsyncCore(IPAddress ipAddress, CancellationToken cancellationToken) {} | |
protected override async ValueTask<IPAddress?> ResolveMacAddressToIPAddressAsyncCore(PhysicalAddress macAddress, CancellationToken cancellationToken) {} | |
protected virtual async ValueTask<AddressTableEntry> SelectAddressTableEntryAsync(Predicate<AddressTableEntry> predicate, CancellationToken cancellationToken) {} | |
} | |
public abstract class MacAddressResolverBase : | |
IAddressResolver<IPAddress, PhysicalAddress>, | |
IAddressResolver<PhysicalAddress, IPAddress>, | |
IDisposable | |
{ | |
protected static PhysicalAddress AllZeroMacAddress { get; } | |
public static MacAddressResolverBase Null { get; } | |
protected MacAddressResolverBase(ILogger? logger = null) {} | |
public abstract bool HasInvalidated { get; } | |
protected ILogger? Logger { get; } | |
protected virtual void Dispose(bool disposing) {} | |
public void Dispose() {} | |
public void Invalidate(IPAddress ipAddress) {} | |
public void Invalidate(PhysicalAddress macAddress) {} | |
protected abstract void InvalidateCore(IPAddress ipAddress); | |
protected abstract void InvalidateCore(PhysicalAddress macAddress); | |
public ValueTask RefreshAddressTableAsync(CancellationToken cancellationToken = default) {} | |
protected virtual ValueTask RefreshAddressTableAsyncCore(CancellationToken cancellationToken) {} | |
public ValueTask RefreshInvalidatedAddressesAsync(CancellationToken cancellationToken = default) {} | |
protected virtual ValueTask RefreshInvalidatedAddressesAsyncCore(CancellationToken cancellationToken) {} | |
public ValueTask<PhysicalAddress?> ResolveIPAddressToMacAddressAsync(IPAddress ipAddress, CancellationToken cancellationToken = default) {} | |
protected abstract ValueTask<PhysicalAddress?> ResolveIPAddressToMacAddressAsyncCore(IPAddress ipAddress, CancellationToken cancellationToken); | |
public ValueTask<IPAddress?> ResolveMacAddressToIPAddressAsync(PhysicalAddress macAddress, CancellationToken cancellationToken = default) {} | |
protected abstract ValueTask<IPAddress?> ResolveMacAddressToIPAddressAsyncCore(PhysicalAddress macAddress, CancellationToken cancellationToken); | |
void IAddressResolver<IPAddress, PhysicalAddress>.Invalidate(IPAddress address) {} | |
ValueTask<PhysicalAddress?> IAddressResolver<IPAddress, PhysicalAddress>.ResolveAsync(IPAddress address, CancellationToken cancellationToken) {} | |
void IAddressResolver<PhysicalAddress, IPAddress>.Invalidate(PhysicalAddress address) {} | |
ValueTask<IPAddress?> IAddressResolver<PhysicalAddress, IPAddress>.ResolveAsync(PhysicalAddress address, CancellationToken cancellationToken) {} | |
protected void ThrowIfDisposed() {} | |
} | |
} | |
namespace Smdn.Net.AddressTables { | |
public interface IAddressTable : IDisposable { | |
IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsync(CancellationToken cancellationToken); | |
} | |
public enum AddressTableEntryState : int { | |
Delay = 4, | |
Incomplete = 1, | |
None = 0, | |
Probe = 5, | |
Reachable = 2, | |
Stale = 3, | |
} | |
public abstract class AddressTable : IAddressTable { | |
public static IAddressTable Null { get; } | |
public static IAddressTable Create(IServiceProvider? serviceProvider = null) {} | |
protected AddressTable(ILogger? logger = null) {} | |
protected ILogger? Logger { get; } | |
protected virtual void Dispose(bool disposing) {} | |
public void Dispose() {} | |
public IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsync(CancellationToken cancellationToken = default) {} | |
protected abstract IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsyncCore(CancellationToken cancellationToken); | |
protected void ThrowIfDisposed() {} | |
} | |
public sealed class IpHlpApiAddressTable : AddressTable { | |
public static bool IsSupported { get; } | |
public IpHlpApiAddressTable(IServiceProvider? serviceProvider = null) {} | |
[AsyncIteratorStateMachine(typeof(IpHlpApiAddressTable.<EnumerateEntriesAsyncCore>d__4))] | |
protected override IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsyncCore([EnumeratorCancellation] CancellationToken cancellationToken) {} | |
} | |
public sealed class ProcfsArpAddressTable : AddressTable { | |
public static bool IsSupported { get; } | |
public ProcfsArpAddressTable(IServiceProvider? serviceProvider = null) {} | |
[AsyncIteratorStateMachine(typeof(ProcfsArpAddressTable.<EnumerateEntriesAsyncCore>d__5))] | |
protected override IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsyncCore([EnumeratorCancellation] CancellationToken cancellationToken) {} | |
} | |
public readonly struct AddressTableEntry : | |
IEquatable<AddressTableEntry>, | |
IEquatable<IPAddress>, | |
IEquatable<PhysicalAddress> | |
{ | |
public static readonly AddressTableEntry Empty; // = "{IP=, MAC=(null), IsPermanent=False, State=None, Iface=}" | |
public static IEqualityComparer<AddressTableEntry> DefaultEqualityComparer { get; } | |
public static IEqualityComparer<AddressTableEntry> ExceptStateEqualityComparer { get; } | |
public AddressTableEntry(IPAddress ipAddress, PhysicalAddress? physicalAddress, bool isPermanent, AddressTableEntryState state, string? interfaceId) {} | |
public IPAddress? IPAddress { get; } | |
public string? InterfaceId { get; } | |
public bool IsEmpty { get; } | |
public bool IsPermanent { get; } | |
public PhysicalAddress? PhysicalAddress { get; } | |
public AddressTableEntryState State { get; } | |
public bool Equals(AddressTableEntry other) {} | |
public bool Equals(IPAddress? other) {} | |
public bool Equals(PhysicalAddress? other) {} | |
public override bool Equals(object? obj) {} | |
public override int GetHashCode() {} | |
public override string ToString() {} | |
} | |
} | |
namespace Smdn.Net.NetworkScanning { | |
public interface INetworkScanner : IDisposable { | |
ValueTask ScanAsync(CancellationToken cancellationToken); | |
ValueTask ScanAsync(IEnumerable<IPAddress> addresses, CancellationToken cancellationToken); | |
} | |
public sealed class ArpScanCommandNetworkScanner : CommandNetworkScanner { | |
public static bool IsSupported { get; } | |
public ArpScanCommandNetworkScanner(IPNetworkProfile? networkProfile, IServiceProvider? serviceProvider = null) {} | |
protected override bool GetCommandLineArguments(IEnumerable<IPAddress> addressesToScan, out string executable, out string arguments) {} | |
protected override bool GetCommandLineArguments(out string executable, out string arguments) {} | |
} | |
public abstract class CommandNetworkScanner : INetworkScanner { | |
public interface IProcessFactory { | |
Process CreateProcess(ProcessStartInfo processStartInfo); | |
} | |
protected readonly struct Command { | |
public Command(string name, string? executablePath) {} | |
public bool IsAvailable { get; } | |
public string Name { get; } | |
public string GetExecutablePathOrThrow() {} | |
} | |
protected static IReadOnlyCollection<string> DefaultCommandPaths { get; } | |
protected static CommandNetworkScanner.Command FindCommand(string command, IEnumerable<string> paths) {} | |
protected CommandNetworkScanner(ILogger? logger, IServiceProvider? serviceProvider) {} | |
protected virtual void Dispose(bool disposing) {} | |
public void Dispose() {} | |
protected abstract bool GetCommandLineArguments(IEnumerable<IPAddress> addressesToScan, out string executable, out string? arguments); | |
protected abstract bool GetCommandLineArguments(out string executable, out string? arguments); | |
public virtual ValueTask ScanAsync(CancellationToken cancellationToken = default) {} | |
public virtual ValueTask ScanAsync(IEnumerable<IPAddress> addresses, CancellationToken cancellationToken = default) {} | |
protected void ThrowIfDisposed() {} | |
} | |
public sealed class IpHlpApiNetworkScanner : NetworkScanner { | |
public static bool IsSupported { get; } | |
public IpHlpApiNetworkScanner(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {} | |
protected override async ValueTask ScanAsyncCore(IPAddress address, CancellationToken cancellationToken = default) {} | |
} | |
public abstract class NetworkScanner : INetworkScanner { | |
public static INetworkScanner Null { get; } | |
public static INetworkScanner Create(IPNetworkProfile? networkProfile, IServiceProvider? serviceProvider = null) {} | |
protected NetworkScanner(IPNetworkProfile networkProfile, ILogger? logger = null) {} | |
protected ILogger? Logger { get; } | |
protected IPNetworkProfile NetworkProfile { get; } | |
protected virtual void Dispose(bool disposing) {} | |
public void Dispose() {} | |
public virtual ValueTask ScanAsync(CancellationToken cancellationToken = default) {} | |
public virtual ValueTask ScanAsync(IEnumerable<IPAddress> addresses, CancellationToken cancellationToken = default) {} | |
protected virtual ValueTask ScanAsyncCore(IPAddress address, CancellationToken cancellationToken) {} | |
protected void ThrowIfDisposed() {} | |
} | |
public sealed class NmapCommandNetworkScanner : CommandNetworkScanner { | |
public static bool IsSupported { get; } | |
public NmapCommandNetworkScanner(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {} | |
protected override bool GetCommandLineArguments(IEnumerable<IPAddress> addressesToScan, out string executable, out string arguments) {} | |
protected override bool GetCommandLineArguments(out string executable, out string arguments) {} | |
} | |
public sealed class PingNetworkScanner : NetworkScanner { | |
public static bool IsSupported { get; } | |
public PingNetworkScanner(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {} | |
protected override void Dispose(bool disposing) {} | |
protected override async ValueTask ScanAsyncCore(IPAddress address, CancellationToken cancellationToken = default) {} | |
} | |
} | |
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.2.2.0. | |
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.3.2.0. | |
// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating) | |
diff --git a/doc/api-list/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution-netstandard2.1.apilist.cs b/doc/api-list/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution-netstandard2.1.apilist.cs | |
index 7e12c8f..39aa175 100644 | |
--- a/doc/api-list/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution-netstandard2.1.apilist.cs | |
+++ b/doc/api-list/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution-netstandard2.1.apilist.cs | |
@@ -1,284 +1,284 @@ | |
-// Smdn.Net.AddressResolution.dll (Smdn.Net.AddressResolution-1.0.2) | |
+// Smdn.Net.AddressResolution.dll (Smdn.Net.AddressResolution-1.1.0) | |
// Name: Smdn.Net.AddressResolution | |
-// AssemblyVersion: 1.0.2.0 | |
-// InformationalVersion: 1.0.2+34189a504878bfc5e98c592355e026ca8e4ee848 | |
+// AssemblyVersion: 1.1.0.0 | |
+// InformationalVersion: 1.1.0+fe88b9191dd60b0f5dc1e1881193ccd376b9795c | |
// TargetFramework: .NETStandard,Version=v2.1 | |
// Configuration: Release | |
// Referenced assemblies: | |
// Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 | |
// Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 | |
// Vanara.PInvoke.IpHlpApi, Version=3.4.13.0, Culture=neutral, PublicKeyToken=c37e4080322237fa | |
// Vanara.PInvoke.Shared, Version=3.4.13.0, Culture=neutral, PublicKeyToken=c37e4080322237fa | |
// Vanara.PInvoke.Ws2_32, Version=3.4.13.0, Culture=neutral, PublicKeyToken=c37e4080322237fa | |
// netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | |
#nullable enable annotations | |
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Net; | |
using System.Net.NetworkInformation; | |
using System.Runtime.CompilerServices; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Microsoft.Extensions.Logging; | |
using Smdn.Net; | |
using Smdn.Net.AddressResolution; | |
using Smdn.Net.AddressTables; | |
using Smdn.Net.NetworkScanning; | |
namespace Smdn.Net { | |
public abstract class IPNetworkProfile { | |
public static IPNetworkProfile Create() {} | |
public static IPNetworkProfile Create(Func<IEnumerable<IPAddress>?> addressRangeGenerator, NetworkInterface? networkInterface = null) {} | |
public static IPNetworkProfile Create(IPAddress baseAddress, IPAddress subnetMask, NetworkInterface? networkInterface = null) {} | |
public static IPNetworkProfile Create(IPAddress baseAddress, int prefixLength, NetworkInterface? networkInterface = null) {} | |
public static IPNetworkProfile Create(NetworkInterface networkInterface) {} | |
public static IPNetworkProfile Create(Predicate<NetworkInterface> predicateForNetworkInterface) {} | |
public static IPNetworkProfile CreateFromNetworkInterface(Guid id) {} | |
public static IPNetworkProfile CreateFromNetworkInterface(PhysicalAddress physicalAddress) {} | |
public static IPNetworkProfile CreateFromNetworkInterface(string id) {} | |
public static IPNetworkProfile CreateFromNetworkInterfaceName(string name) {} | |
protected IPNetworkProfile(NetworkInterface? networkInterface) {} | |
public NetworkInterface? NetworkInterface { get; } | |
public abstract IEnumerable<IPAddress>? GetAddressRange(); | |
} | |
public static class PhysicalAddressExtensions { | |
public static string ToMacAddressString(this PhysicalAddress hardwareAddress, char delimiter = ':') {} | |
} | |
} | |
namespace Smdn.Net.AddressResolution { | |
public interface IAddressResolver<TAddress, TResolvedAddress> where TAddress : notnull where TResolvedAddress : notnull { | |
void Invalidate(TAddress address); | |
ValueTask<TResolvedAddress?> ResolveAsync(TAddress address, CancellationToken cancellationToken); | |
} | |
public class MacAddressResolver : MacAddressResolverBase { | |
protected MacAddressResolver(IAddressTable addressTable, bool shouldDisposeAddressTable, INetworkScanner? networkScanner, bool shouldDisposeNetworkScanner, NetworkInterface? networkInterface, int maxParallelCountForRefreshInvalidatedAddresses, ILogger? logger) {} | |
public MacAddressResolver() {} | |
public MacAddressResolver(IAddressTable? addressTable, INetworkScanner? networkScanner, bool shouldDisposeAddressTable = false, bool shouldDisposeNetworkScanner = false, NetworkInterface? networkInterface = null, int maxParallelCountForRefreshInvalidatedAddresses = 3, IServiceProvider? serviceProvider = null) {} | |
public MacAddressResolver(IPNetworkProfile? networkProfile, IServiceProvider? serviceProvider = null) {} | |
public bool CanPerformNetworkScan { get; } | |
public override bool HasInvalidated { get; } | |
public TimeSpan NetworkScanInterval { get; set; } | |
public TimeSpan NetworkScanMinInterval { get; set; } | |
protected override void Dispose(bool disposing) {} | |
public IAsyncEnumerable<AddressTableEntry> EnumerateAddressTableEntriesAsync(CancellationToken cancellationToken = default) {} | |
public IAsyncEnumerable<AddressTableEntry> EnumerateAddressTableEntriesAsync(Predicate<AddressTableEntry> predicate, CancellationToken cancellationToken = default) {} | |
protected override void InvalidateCore(IPAddress ipAddress) {} | |
protected override void InvalidateCore(PhysicalAddress macAddress) {} | |
protected override ValueTask RefreshAddressTableAsyncCore(CancellationToken cancellationToken = default) {} | |
protected override ValueTask RefreshInvalidatedAddressesAsyncCore(CancellationToken cancellationToken = default) {} | |
protected override async ValueTask<PhysicalAddress?> ResolveIPAddressToMacAddressAsyncCore(IPAddress ipAddress, CancellationToken cancellationToken) {} | |
protected override async ValueTask<IPAddress?> ResolveMacAddressToIPAddressAsyncCore(PhysicalAddress macAddress, CancellationToken cancellationToken) {} | |
protected virtual async ValueTask<AddressTableEntry> SelectAddressTableEntryAsync(Predicate<AddressTableEntry> predicate, CancellationToken cancellationToken) {} | |
} | |
public abstract class MacAddressResolverBase : | |
IAddressResolver<IPAddress, PhysicalAddress>, | |
IAddressResolver<PhysicalAddress, IPAddress>, | |
IDisposable | |
{ | |
protected static PhysicalAddress AllZeroMacAddress { get; } | |
public static MacAddressResolverBase Null { get; } | |
protected MacAddressResolverBase(ILogger? logger = null) {} | |
public abstract bool HasInvalidated { get; } | |
protected ILogger? Logger { get; } | |
protected virtual void Dispose(bool disposing) {} | |
public void Dispose() {} | |
public void Invalidate(IPAddress ipAddress) {} | |
public void Invalidate(PhysicalAddress macAddress) {} | |
protected abstract void InvalidateCore(IPAddress ipAddress); | |
protected abstract void InvalidateCore(PhysicalAddress macAddress); | |
public ValueTask RefreshAddressTableAsync(CancellationToken cancellationToken = default) {} | |
protected virtual ValueTask RefreshAddressTableAsyncCore(CancellationToken cancellationToken) {} | |
public ValueTask RefreshInvalidatedAddressesAsync(CancellationToken cancellationToken = default) {} | |
protected virtual ValueTask RefreshInvalidatedAddressesAsyncCore(CancellationToken cancellationToken) {} | |
public ValueTask<PhysicalAddress?> ResolveIPAddressToMacAddressAsync(IPAddress ipAddress, CancellationToken cancellationToken = default) {} | |
protected abstract ValueTask<PhysicalAddress?> ResolveIPAddressToMacAddressAsyncCore(IPAddress ipAddress, CancellationToken cancellationToken); | |
public ValueTask<IPAddress?> ResolveMacAddressToIPAddressAsync(PhysicalAddress macAddress, CancellationToken cancellationToken = default) {} | |
protected abstract ValueTask<IPAddress?> ResolveMacAddressToIPAddressAsyncCore(PhysicalAddress macAddress, CancellationToken cancellationToken); | |
void IAddressResolver<IPAddress, PhysicalAddress>.Invalidate(IPAddress address) {} | |
ValueTask<PhysicalAddress?> IAddressResolver<IPAddress, PhysicalAddress>.ResolveAsync(IPAddress address, CancellationToken cancellationToken) {} | |
void IAddressResolver<PhysicalAddress, IPAddress>.Invalidate(PhysicalAddress address) {} | |
ValueTask<IPAddress?> IAddressResolver<PhysicalAddress, IPAddress>.ResolveAsync(PhysicalAddress address, CancellationToken cancellationToken) {} | |
protected void ThrowIfDisposed() {} | |
} | |
} | |
namespace Smdn.Net.AddressTables { | |
public interface IAddressTable : IDisposable { | |
IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsync(CancellationToken cancellationToken); | |
} | |
public enum AddressTableEntryState : int { | |
Delay = 4, | |
Incomplete = 1, | |
None = 0, | |
Probe = 5, | |
Reachable = 2, | |
Stale = 3, | |
} | |
public abstract class AddressTable : IAddressTable { | |
public static IAddressTable Null { get; } | |
public static IAddressTable Create(IServiceProvider? serviceProvider = null) {} | |
protected AddressTable(ILogger? logger = null) {} | |
protected ILogger? Logger { get; } | |
protected virtual void Dispose(bool disposing) {} | |
public void Dispose() {} | |
public IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsync(CancellationToken cancellationToken = default) {} | |
protected abstract IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsyncCore(CancellationToken cancellationToken); | |
protected void ThrowIfDisposed() {} | |
} | |
public sealed class IpHlpApiAddressTable : AddressTable { | |
public static bool IsSupported { get; } | |
public IpHlpApiAddressTable(IServiceProvider? serviceProvider = null) {} | |
[AsyncIteratorStateMachine(typeof(IpHlpApiAddressTable.<EnumerateEntriesAsyncCore>d__4))] | |
protected override IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsyncCore([EnumeratorCancellation] CancellationToken cancellationToken) {} | |
} | |
public sealed class ProcfsArpAddressTable : AddressTable { | |
public static bool IsSupported { get; } | |
public ProcfsArpAddressTable(IServiceProvider? serviceProvider = null) {} | |
[AsyncIteratorStateMachine(typeof(ProcfsArpAddressTable.<EnumerateEntriesAsyncCore>d__5))] | |
protected override IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsyncCore([EnumeratorCancellation] CancellationToken cancellationToken) {} | |
} | |
public readonly struct AddressTableEntry : | |
IEquatable<AddressTableEntry>, | |
IEquatable<IPAddress>, | |
IEquatable<PhysicalAddress> | |
{ | |
public static readonly AddressTableEntry Empty; // = "{IP=, MAC=(null), IsPermanent=False, State=None, Iface=}" | |
public static IEqualityComparer<AddressTableEntry> DefaultEqualityComparer { get; } | |
public static IEqualityComparer<AddressTableEntry> ExceptStateEqualityComparer { get; } | |
public AddressTableEntry(IPAddress ipAddress, PhysicalAddress? physicalAddress, bool isPermanent, AddressTableEntryState state, string? interfaceId) {} | |
public IPAddress? IPAddress { get; } | |
public string? InterfaceId { get; } | |
public bool IsEmpty { get; } | |
public bool IsPermanent { get; } | |
public PhysicalAddress? PhysicalAddress { get; } | |
public AddressTableEntryState State { get; } | |
public bool Equals(AddressTableEntry other) {} | |
public bool Equals(IPAddress? other) {} | |
public bool Equals(PhysicalAddress? other) {} | |
public override bool Equals(object? obj) {} | |
public override int GetHashCode() {} | |
public override string ToString() {} | |
} | |
} | |
namespace Smdn.Net.NetworkScanning { | |
public interface INetworkScanner : IDisposable { | |
ValueTask ScanAsync(CancellationToken cancellationToken); | |
ValueTask ScanAsync(IEnumerable<IPAddress> addresses, CancellationToken cancellationToken); | |
} | |
public sealed class ArpScanCommandNetworkScanner : CommandNetworkScanner { | |
public static bool IsSupported { get; } | |
public ArpScanCommandNetworkScanner(IPNetworkProfile? networkProfile, IServiceProvider? serviceProvider = null) {} | |
protected override bool GetCommandLineArguments(IEnumerable<IPAddress> addressesToScan, out string executable, out string arguments) {} | |
protected override bool GetCommandLineArguments(out string executable, out string arguments) {} | |
} | |
public abstract class CommandNetworkScanner : INetworkScanner { | |
public interface IProcessFactory { | |
Process CreateProcess(ProcessStartInfo processStartInfo); | |
} | |
protected readonly struct Command { | |
public Command(string name, string? executablePath) {} | |
public bool IsAvailable { get; } | |
public string Name { get; } | |
public string GetExecutablePathOrThrow() {} | |
} | |
protected static IReadOnlyCollection<string> DefaultCommandPaths { get; } | |
protected static CommandNetworkScanner.Command FindCommand(string command, IEnumerable<string> paths) {} | |
protected CommandNetworkScanner(ILogger? logger, IServiceProvider? serviceProvider) {} | |
protected virtual void Dispose(bool disposing) {} | |
public void Dispose() {} | |
protected abstract bool GetCommandLineArguments(IEnumerable<IPAddress> addressesToScan, out string executable, out string? arguments); | |
protected abstract bool GetCommandLineArguments(out string executable, out string? arguments); | |
public virtual ValueTask ScanAsync(CancellationToken cancellationToken = default) {} | |
public virtual ValueTask ScanAsync(IEnumerable<IPAddress> addresses, CancellationToken cancellationToken = default) {} | |
protected void ThrowIfDisposed() {} | |
} | |
public sealed class IpHlpApiNetworkScanner : NetworkScanner { | |
public static bool IsSupported { get; } | |
public IpHlpApiNetworkScanner(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {} | |
protected override async ValueTask ScanAsyncCore(IPAddress address, CancellationToken cancellationToken = default) {} | |
} | |
public abstract class NetworkScanner : INetworkScanner { | |
public static INetworkScanner Null { get; } | |
public static INetworkScanner Create(IPNetworkProfile? networkProfile, IServiceProvider? serviceProvider = null) {} | |
protected NetworkScanner(IPNetworkProfile networkProfile, ILogger? logger = null) {} | |
protected ILogger? Logger { get; } | |
protected IPNetworkProfile NetworkProfile { get; } | |
protected virtual void Dispose(bool disposing) {} | |
public void Dispose() {} | |
public virtual ValueTask ScanAsync(CancellationToken cancellationToken = default) {} | |
public virtual ValueTask ScanAsync(IEnumerable<IPAddress> addresses, CancellationToken cancellationToken = default) {} | |
protected virtual ValueTask ScanAsyncCore(IPAddress address, CancellationToken cancellationToken) {} | |
protected void ThrowIfDisposed() {} | |
} | |
public sealed class NmapCommandNetworkScanner : CommandNetworkScanner { | |
public static bool IsSupported { get; } | |
public NmapCommandNetworkScanner(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {} | |
protected override bool GetCommandLineArguments(IEnumerable<IPAddress> addressesToScan, out string executable, out string arguments) {} | |
protected override bool GetCommandLineArguments(out string executable, out string arguments) {} | |
} | |
public sealed class PingNetworkScanner : NetworkScanner { | |
public static bool IsSupported { get; } | |
public PingNetworkScanner(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {} | |
protected override void Dispose(bool disposing) {} | |
protected override async ValueTask ScanAsyncCore(IPAddress address, CancellationToken cancellationToken = default) {} | |
} | |
} | |
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.2.2.0. | |
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.3.2.0. | |
// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- Smdn.Net.AddressResolution.latest.nuspec | |
+++ Smdn.Net.AddressResolution.1.1.0.nuspec | |
@@ -1,42 +1,42 @@ | |
<?xml version="1.0" encoding="utf-8"?> | |
-<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd"> | |
+<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd"> | |
<metadata> | |
<id>Smdn.Net.AddressResolution</id> | |
- <version>1.0.2</version> | |
+ <version>1.1.0</version> | |
<title>Smdn.Net.AddressResolution</title> | |
<authors>smdn</authors> | |
<license type="expression">MIT</license> | |
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl> | |
<icon>Smdn.Net.AddressResolution.png</icon> | |
<readme>README.md</readme> | |
<projectUrl>https://github.com/smdn/Smdn.Net.AddressResolution</projectUrl> | |
<description>A network address resolution library for .NET. This library provides APIs for resolving between IP addresses and MAC addresses, mainly the `MacAddressResolver` class in the `Smdn.Net.AddressResolution` namespace. This library also provides a functionality for referencing the system's address table such as the ARP table (`Smdn.Net.AddressTables` namespace), and a network scan functionality to refresh the address cache mainly using the installed commands (`Smdn.Net.NetworkScanning` namespace).</description> | |
- <releaseNotes>https://github.com/smdn/Smdn.Net.AddressResolution/releases/tag/releases%2FSmdn.Net.AddressResolution-1.0.2</releaseNotes> | |
+ <releaseNotes>https://github.com/smdn/Smdn.Net.AddressResolution/releases/tag/releases%2FSmdn.Net.AddressResolution-1.1.0</releaseNotes> | |
<copyright>Copyright © 2022 smdn</copyright> | |
<tags>smdn.jp ARP arp-scan arp-table ip-address mac-address hardware-address address-lookup address-resolution</tags> | |
- <repository type="git" url="https://github.com/smdn/Smdn.Net.AddressResolution" branch="main" commit="34189a504878bfc5e98c592355e026ca8e4ee848" /> | |
+ <repository type="git" url="https://github.com/smdn/Smdn.Net.AddressResolution" commit="fe88b9191dd60b0f5dc1e1881193ccd376b9795c" /> | |
<dependencies> | |
<group targetFramework="net6.0"> | |
<dependency id="Microsoft.Extensions.DependencyInjection.Abstractions" version="6.0.0" exclude="Build,Analyzers" /> | |
<dependency id="Microsoft.Extensions.Logging.Abstractions" version="6.0.0" exclude="Build,Analyzers" /> | |
<dependency id="Vanara.PInvoke.IpHlpApi" version="3.4.13" exclude="Build,Analyzers" /> | |
</group> | |
- <group targetFramework="net7.0"> | |
+ <group targetFramework="net8.0"> | |
<dependency id="Microsoft.Extensions.DependencyInjection.Abstractions" version="6.0.0" exclude="Build,Analyzers" /> | |
<dependency id="Microsoft.Extensions.Logging.Abstractions" version="6.0.0" exclude="Build,Analyzers" /> | |
<dependency id="Vanara.PInvoke.IpHlpApi" version="3.4.13" exclude="Build,Analyzers" /> | |
</group> | |
<group targetFramework=".NETStandard2.0"> | |
<dependency id="Microsoft.Bcl.HashCode" version="1.0.0" exclude="Build,Analyzers" /> | |
<dependency id="Microsoft.Extensions.DependencyInjection.Abstractions" version="6.0.0" exclude="Build,Analyzers" /> | |
<dependency id="Microsoft.Extensions.Logging.Abstractions" version="6.0.0" exclude="Build,Analyzers" /> | |
<dependency id="Vanara.PInvoke.IpHlpApi" version="3.4.13" exclude="Build,Analyzers" /> | |
</group> | |
<group targetFramework=".NETStandard2.1"> | |
<dependency id="Microsoft.Extensions.DependencyInjection.Abstractions" version="6.0.0" exclude="Build,Analyzers" /> | |
<dependency id="Microsoft.Extensions.Logging.Abstractions" version="6.0.0" exclude="Build,Analyzers" /> | |
<dependency id="Vanara.PInvoke.IpHlpApi" version="3.4.13" exclude="Build,Analyzers" /> | |
</group> | |
</dependencies> | |
</metadata> | |
</package> | |
\ No newline at end of file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Smdn.Net.AddressResolution/CompatibilitySuppressions.xml b/src/Smdn.Net.AddressResolution/CompatibilitySuppressions.xml | |
new file mode 100644 | |
index 0000000..f6af1d0 | |
--- /dev/null | |
+++ b/src/Smdn.Net.AddressResolution/CompatibilitySuppressions.xml | |
@@ -0,0 +1,12 @@ | |
+<?xml version="1.0" encoding="utf-8"?> | |
+<!-- https://learn.microsoft.com/en-us/dotnet/fundamentals/package-validation/diagnostic-ids --> | |
+<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | |
+ <!-- 1.0.2 vs 1.1.0 --> | |
+ <Suppression> | |
+ <DiagnosticId>CP0008</DiagnosticId> | |
+ <Target>T:Smdn.Net.AddressTables.AddressTableEntryState</Target> | |
+ <Left>lib/net7.0/Smdn.Net.AddressResolution.dll</Left> | |
+ <Right>lib/net6.0/Smdn.Net.AddressResolution.dll</Right> | |
+ <IsBaselineSuppression>true</IsBaselineSuppression> | |
+ </Suppression> | |
+</Suppressions> | |
diff --git a/src/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution.csproj b/src/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution.csproj | |
index 57c249c..86d31f1 100644 | |
--- a/src/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution.csproj | |
+++ b/src/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution.csproj | |
@@ -4,10 +4,8 @@ SPDX-License-Identifier: MIT | |
--> | |
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
- <TargetFrameworks>netstandard2.0;netstandard2.1;net6.0</TargetFrameworks> | |
- <TargetFrameworks Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(NETCoreSdkVersion)', '7.0.0'))">net7.0;$(TargetFrameworks)</TargetFrameworks> | |
- <TargetFrameworks Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(NETCoreSdkVersion)', '8.0.0'))">net8.0;$(TargetFrameworks)</TargetFrameworks> | |
- <VersionPrefix>1.0.2</VersionPrefix> | |
+ <TargetFrameworks>net8.0;net6.0;netstandard2.1;netstandard2.0</TargetFrameworks> | |
+ <VersionPrefix>1.1.0</VersionPrefix> | |
<VersionSuffix></VersionSuffix> | |
<PackageValidationBaselineVersion>1.0.0</PackageValidationBaselineVersion> | |
<RootNamespace/> <!-- empty the root namespace so that the namespace is determined only by the directory name, for code style rule IDE0030 --> | |
diff --git a/src/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution/IAddressResolver.cs b/src/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution/IAddressResolver.cs | |
index 8ab3da7..fdbe586 100644 | |
--- a/src/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution/IAddressResolver.cs | |
+++ b/src/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution/IAddressResolver.cs | |
@@ -10,10 +10,12 @@ namespace Smdn.Net.AddressResolution; | |
/// </summary> | |
/// <typeparam name="TAddress">The address type to be resolved to the corresponding address type <typeparamref name="TResolvedAddress"/>.</typeparam> | |
/// <typeparam name="TResolvedAddress">The address type that is resolved from and corresponds to the address type <typeparamref name="TAddress"/>.</typeparam> | |
+#pragma warning disable IDE0055 | |
public interface IAddressResolver<TAddress, TResolvedAddress> | |
where TAddress : notnull | |
where TResolvedAddress : notnull | |
{ | |
+#pragma warning restore IDE0055 | |
/// <summary> | |
/// Resolves from a address of <typeparamref name="TAddress"/> to its corresponding address of <typeparamref name="TResolvedAddress"/>. | |
/// </summary> | |
diff --git a/src/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution/MacAddressResolver.ConcurrentSet.cs b/src/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution/MacAddressResolver.ConcurrentSet.cs | |
index 8cc3fc5..f4720a6 100644 | |
--- a/src/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution/MacAddressResolver.ConcurrentSet.cs | |
+++ b/src/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution/MacAddressResolver.ConcurrentSet.cs | |
@@ -9,9 +9,7 @@ partial class MacAddressResolver { | |
#pragma warning restore IDE0040 | |
private readonly struct None { } | |
- private sealed class ConcurrentSet<T> : ConcurrentDictionary<T, None> | |
- where T : notnull | |
- { | |
+ private sealed class ConcurrentSet<T> : ConcurrentDictionary<T, None> where T : notnull { | |
public ConcurrentSet() | |
{ | |
} | |
diff --git a/src/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution/MacAddressResolver.cs b/src/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution/MacAddressResolver.cs | |
index 091068f..f795c03 100644 | |
--- a/src/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution/MacAddressResolver.cs | |
+++ b/src/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution/MacAddressResolver.cs | |
@@ -61,8 +61,8 @@ public partial class MacAddressResolver : MacAddressResolverBase { | |
/// <seealso cref="MacAddressResolverBase.RefreshInvalidatedAddressesAsync(CancellationToken)"/> | |
public bool CanPerformNetworkScan => networkScanner is not null; | |
- private static Exception CreateCanNotPerformNetworkScanException() | |
- => new InvalidOperationException($"The instance can not perform network scan. To perform a network scan, specify {nameof(INetworkScanner)} in the constructor."); | |
+ private static InvalidOperationException CreateCanNotPerformNetworkScanException() | |
+ => new($"The instance can not perform network scan. To perform a network scan, specify {nameof(INetworkScanner)} in the constructor."); | |
private Stopwatch? timeStampForFullScan; | |
private TimeSpan networkScanInterval = Timeout.InfiniteTimeSpan; | |
diff --git a/src/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution/MacAddressResolverBase.cs b/src/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution/MacAddressResolverBase.cs | |
index 3fa67dc..89758ba 100644 | |
--- a/src/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution/MacAddressResolverBase.cs | |
+++ b/src/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution/MacAddressResolverBase.cs | |
@@ -13,11 +13,13 @@ namespace Smdn.Net.AddressResolution; | |
/// <summary> | |
/// Provides an abstract mechanism for the mutual address resolution between IP addresses and corresponding MAC addresses. | |
/// </summary> | |
+#pragma warning disable IDE0055 | |
public abstract class MacAddressResolverBase : | |
IDisposable, | |
IAddressResolver<PhysicalAddress, IPAddress>, | |
IAddressResolver<IPAddress, PhysicalAddress> | |
{ | |
+#pragma warning restore IDE0055 | |
protected static PhysicalAddress AllZeroMacAddress => PhysicalAddressExtensions.AllZeroMacAddress; | |
/// <summary> | |
diff --git a/src/Smdn.Net.AddressResolution/Smdn.Net.AddressTables/IpHlpApiAddressTable.cs b/src/Smdn.Net.AddressResolution/Smdn.Net.AddressTables/IpHlpApiAddressTable.cs | |
index 97cd190..bd7601d 100644 | |
--- a/src/Smdn.Net.AddressResolution/Smdn.Net.AddressTables/IpHlpApiAddressTable.cs | |
+++ b/src/Smdn.Net.AddressResolution/Smdn.Net.AddressTables/IpHlpApiAddressTable.cs | |
@@ -18,9 +18,9 @@ using static Vanara.PInvoke.Ws2_32; | |
namespace Smdn.Net.AddressTables; | |
public sealed class IpHlpApiAddressTable : AddressTable { | |
- public static bool IsSupported => lazyIsSupported.Value; | |
+ public static bool IsSupported => LazyIsSupported.Value; | |
- private static readonly Lazy<bool> lazyIsSupported = new( | |
+ private static readonly Lazy<bool> LazyIsSupported = new( | |
valueFactory: static () => { | |
try { | |
var ret = GetIpNetTable2(ADDRESS_FAMILY.AF_UNSPEC, out var table); | |
diff --git a/src/Smdn.Net.AddressResolution/Smdn.Net.AddressTables/ProcfsArpAddressTable.cs b/src/Smdn.Net.AddressResolution/Smdn.Net.AddressTables/ProcfsArpAddressTable.cs | |
index 14d1b62..b1ecd40 100644 | |
--- a/src/Smdn.Net.AddressResolution/Smdn.Net.AddressTables/ProcfsArpAddressTable.cs | |
+++ b/src/Smdn.Net.AddressResolution/Smdn.Net.AddressTables/ProcfsArpAddressTable.cs | |
@@ -97,7 +97,7 @@ public sealed class ProcfsArpAddressTable : AddressTable { | |
} | |
#if !SYSTEM_STRING_SPLIT_CHAR | |
- private static readonly char[] arpTableEntryDelimiter = new[] { ' ' }; | |
+ private static readonly char[] ArpTableEntryDelimiter = new[] { ' ' }; | |
#endif | |
// [/proc/net/arp] | |
@@ -132,7 +132,7 @@ public sealed class ProcfsArpAddressTable : AddressTable { | |
#elif SYSTEM_STRING_SPLIT_CHAR | |
arpTableEntryLine.Split(' ', StringSplitOptions.RemoveEmptyEntries); | |
#else | |
- arpTableEntryLine.Split(arpTableEntryDelimiter, StringSplitOptions.RemoveEmptyEntries); | |
+ arpTableEntryLine.Split(ArpTableEntryDelimiter, StringSplitOptions.RemoveEmptyEntries); | |
#endif | |
if (columns.Length < 6) | |
diff --git a/src/Smdn.Net.AddressResolution/Smdn.Net.NetworkScanning/ArpScanCommandNetworkScanner.cs b/src/Smdn.Net.AddressResolution/Smdn.Net.NetworkScanning/ArpScanCommandNetworkScanner.cs | |
index 50588ab..6e928eb 100644 | |
--- a/src/Smdn.Net.AddressResolution/Smdn.Net.NetworkScanning/ArpScanCommandNetworkScanner.cs | |
+++ b/src/Smdn.Net.AddressResolution/Smdn.Net.NetworkScanning/ArpScanCommandNetworkScanner.cs | |
@@ -1,7 +1,5 @@ | |
// SPDX-FileCopyrightText: 2023 smdn <smdn@smdn.jp> | |
// SPDX-License-Identifier: MIT | |
-#undef SYSTEM_ENVORINMENT_ISPRIVILEGEDPROCESS // enable this when .NET 8 GA is released | |
- | |
using System; | |
using System.Collections.Generic; | |
#if SYSTEM_IO_UNIXFILEMODE | |
@@ -23,15 +21,17 @@ public sealed class ArpScanCommandNetworkScanner : CommandNetworkScanner { | |
private const string ArpScanCommandBaseOptions = "--numeric --quiet "; | |
public static bool IsSupported => | |
- lazyArpScanCommand.Value.IsAvailable && | |
+ LazyArpScanCommand.Value.IsAvailable && | |
#pragma warning disable IDE0047, SA1003, SA1119 | |
( | |
-#if SYSTEM_ENVORINMENT_ISPRIVILEGEDPROCESS | |
+#if SYSTEM_ENVIRONMENT_ISPRIVILEGEDPROCESS | |
Environment.IsPrivilegedProcess || | |
#endif | |
#if SYSTEM_IO_FILE_GETUNIXFILEMODE | |
+ ( | |
!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && | |
- HasSgidOrSuid(File.GetUnixFileMode(lazyArpScanCommand.Value.GetExecutablePathOrThrow())) | |
+ HasSgidOrSuid(File.GetUnixFileMode(LazyArpScanCommand.Value.GetExecutablePathOrThrow())) | |
+ ) | |
#else | |
false // TODO: use Mono.Posix | |
#endif | |
@@ -43,7 +43,7 @@ public sealed class ArpScanCommandNetworkScanner : CommandNetworkScanner { | |
=> fileMode.HasFlag(UnixFileMode.SetGroup) || fileMode.HasFlag(UnixFileMode.SetUser); | |
#endif | |
- private static readonly Lazy<Command> lazyArpScanCommand = new( | |
+ private static readonly Lazy<Command> LazyArpScanCommand = new( | |
valueFactory: static () => FindCommand( | |
command: "arp-scan", | |
paths: DefaultCommandPaths | |
@@ -89,7 +89,7 @@ public sealed class ArpScanCommandNetworkScanner : CommandNetworkScanner { | |
out string arguments | |
) | |
{ | |
- executable = lazyArpScanCommand.Value.GetExecutablePathOrThrow(); | |
+ executable = LazyArpScanCommand.Value.GetExecutablePathOrThrow(); | |
// perform full scan | |
arguments = arpScanCommandFullScanOptions; | |
@@ -103,7 +103,7 @@ public sealed class ArpScanCommandNetworkScanner : CommandNetworkScanner { | |
out string arguments | |
) | |
{ | |
- executable = lazyArpScanCommand.Value.GetExecutablePathOrThrow(); | |
+ executable = LazyArpScanCommand.Value.GetExecutablePathOrThrow(); | |
var arpScanCommandTargetSpecification = string.Join(" ", addressesToScan); | |
diff --git a/src/Smdn.Net.AddressResolution/Smdn.Net.NetworkScanning/CommandNetworkScanner.cs b/src/Smdn.Net.AddressResolution/Smdn.Net.NetworkScanning/CommandNetworkScanner.cs | |
index 8a4ac97..9ec7124 100644 | |
--- a/src/Smdn.Net.AddressResolution/Smdn.Net.NetworkScanning/CommandNetworkScanner.cs | |
+++ b/src/Smdn.Net.AddressResolution/Smdn.Net.NetworkScanning/CommandNetworkScanner.cs | |
@@ -27,14 +27,16 @@ public abstract class CommandNetworkScanner : INetworkScanner { | |
=> new() { StartInfo = processStartInfo }; | |
} | |
- private static readonly Lazy<IReadOnlyCollection<string>> lazyDefaultCommandPaths = new( | |
+ private static readonly Lazy<IReadOnlyCollection<string>> LazyDefaultCommandPaths = new( | |
valueFactory: GetDefaultCommandCommandPaths, | |
isThreadSafe: true | |
); | |
- protected static IReadOnlyCollection<string> DefaultCommandPaths => lazyDefaultCommandPaths.Value; | |
+ protected static IReadOnlyCollection<string> DefaultCommandPaths => LazyDefaultCommandPaths.Value; | |
+#pragma warning disable CA1859 | |
private static IReadOnlyCollection<string> GetDefaultCommandCommandPaths() | |
+#pragma warning restore CA1859 | |
{ | |
var paths = new HashSet<string>( | |
comparer: RuntimeInformation.IsOSPlatform(OSPlatform.Windows) | |
@@ -273,13 +275,13 @@ public abstract class CommandNetworkScanner : INetworkScanner { | |
#endif | |
if (logger is not null) { | |
- const LogLevel logLevelForStandardOutput = LogLevel.Trace; | |
- const LogLevel logLevelForStandardError = LogLevel.Error; | |
+ const LogLevel LogLevelForStandardOutput = LogLevel.Trace; | |
+ const LogLevel LogLevelForStandardError = LogLevel.Error; | |
static IEnumerable<(StreamReader, LogLevel)> EnumerateLogTarget(StreamReader stdout, StreamReader stderr) | |
{ | |
- yield return (stdout, logLevelForStandardOutput); | |
- yield return (stderr, logLevelForStandardError); | |
+ yield return (stdout, LogLevelForStandardOutput); | |
+ yield return (stderr, LogLevelForStandardError); | |
} | |
foreach (var (stdio, logLevel) in EnumerateLogTarget(commandProcess.StandardOutput, commandProcess.StandardError)) { | |
diff --git a/src/Smdn.Net.AddressResolution/Smdn.Net.NetworkScanning/IpHlpApiNetworkScanner.cs b/src/Smdn.Net.AddressResolution/Smdn.Net.NetworkScanning/IpHlpApiNetworkScanner.cs | |
index fc8293e..d991671 100644 | |
--- a/src/Smdn.Net.AddressResolution/Smdn.Net.NetworkScanning/IpHlpApiNetworkScanner.cs | |
+++ b/src/Smdn.Net.AddressResolution/Smdn.Net.NetworkScanning/IpHlpApiNetworkScanner.cs | |
@@ -29,9 +29,9 @@ public sealed class IpHlpApiNetworkScanner : NetworkScanner { | |
private static readonly Win32Error ERROR_INVALID_PARAMETER = new(0x80070057u); | |
private static readonly Win32Error ERROR_NOT_SUPPORTED = new(0x80070032u); | |
- public static bool IsSupported => lazyIsSupported.Value; | |
+ public static bool IsSupported => LazyIsSupported.Value; | |
- private static readonly Lazy<bool> lazyIsSupported = new( | |
+ private static readonly Lazy<bool> LazyIsSupported = new( | |
valueFactory: static () => { | |
try { | |
MIB_IPNET_ROW2 row = default; | |
diff --git a/src/Smdn.Net.AddressResolution/Smdn.Net.NetworkScanning/NmapCommandNetworkScanner.cs b/src/Smdn.Net.AddressResolution/Smdn.Net.NetworkScanning/NmapCommandNetworkScanner.cs | |
index dc94ac4..05c4082 100644 | |
--- a/src/Smdn.Net.AddressResolution/Smdn.Net.NetworkScanning/NmapCommandNetworkScanner.cs | |
+++ b/src/Smdn.Net.AddressResolution/Smdn.Net.NetworkScanning/NmapCommandNetworkScanner.cs | |
@@ -18,9 +18,9 @@ public sealed class NmapCommandNetworkScanner : CommandNetworkScanner { | |
// -oG <file>: Output scan in Grepable format | |
private const string NmapCommandBaseOptions = "-sn -n -T4 -oG - "; | |
- public static bool IsSupported => lazyNmapCommand.Value.IsAvailable; | |
+ public static bool IsSupported => LazyNmapCommand.Value.IsAvailable; | |
- private static readonly Lazy<Command> lazyNmapCommand = new( | |
+ private static readonly Lazy<Command> LazyNmapCommand = new( | |
valueFactory: static () => FindCommand( | |
command: "nmap", | |
paths: DefaultCommandPaths | |
@@ -71,7 +71,7 @@ public sealed class NmapCommandNetworkScanner : CommandNetworkScanner { | |
out string arguments | |
) | |
{ | |
- executable = lazyNmapCommand.Value.GetExecutablePathOrThrow(); | |
+ executable = LazyNmapCommand.Value.GetExecutablePathOrThrow(); | |
// perform full scan | |
arguments = nmapCommandFullScanOptions; | |
@@ -85,7 +85,7 @@ public sealed class NmapCommandNetworkScanner : CommandNetworkScanner { | |
out string arguments | |
) | |
{ | |
- executable = lazyNmapCommand.Value.GetExecutablePathOrThrow(); | |
+ executable = LazyNmapCommand.Value.GetExecutablePathOrThrow(); | |
var nmapCommandOptionTargetSpecification = string.Join(" ", addressesToScan); | |
diff --git a/src/Smdn.Net.AddressResolution/Smdn.Net.NetworkScanning/PingNetworkScanner.cs b/src/Smdn.Net.AddressResolution/Smdn.Net.NetworkScanning/PingNetworkScanner.cs | |
index 8ebb8d9..31f0968 100644 | |
--- a/src/Smdn.Net.AddressResolution/Smdn.Net.NetworkScanning/PingNetworkScanner.cs | |
+++ b/src/Smdn.Net.AddressResolution/Smdn.Net.NetworkScanning/PingNetworkScanner.cs | |
@@ -48,12 +48,12 @@ public sealed class PingNetworkScanner : NetworkScanner { | |
CancellationToken cancellationToken = default | |
) | |
{ | |
- const int timeoutMilliseconds = 100; | |
+ const int TimeoutMilliseconds = 100; | |
try { | |
var reply = await ping!.SendPingAsync( | |
address: address, | |
- timeout: timeoutMilliseconds, | |
+ timeout: TimeoutMilliseconds, | |
buffer: Array.Empty<byte>(), | |
options: pingOptions | |
).ConfigureAwait(false); | |
diff --git a/src/Smdn.Net.AddressResolution/Smdn.Net/IPNetworkProfile.CreateFromNetworkInterface.cs b/src/Smdn.Net.AddressResolution/Smdn.Net/IPNetworkProfile.CreateFromNetworkInterface.cs | |
index 2189da7..6ae0603 100644 | |
--- a/src/Smdn.Net.AddressResolution/Smdn.Net/IPNetworkProfile.CreateFromNetworkInterface.cs | |
+++ b/src/Smdn.Net.AddressResolution/Smdn.Net/IPNetworkProfile.CreateFromNetworkInterface.cs | |
@@ -75,7 +75,10 @@ partial class IPNetworkProfile { | |
/// which specified by <paramref name="predicateForNetworkInterface"/>. | |
/// </summary> | |
/// <param name="predicateForNetworkInterface">A <see cref="Predicate{NetworkInterface}"/> for selecting a specific network interface.</param> | |
- /// <exception cref="InvalidOperationException">The appropriate <see cref="System.Net.NetworkInformation.NetworkInterface"/> could not be selected.</exception> | |
+ /// <exception cref="InvalidOperationException"> | |
+ /// The appropriate <see cref="System.Net.NetworkInformation.NetworkInterface"/> could not be selected. | |
+ /// Or <paramref name="predicateForNetworkInterface"/> threw an exception. See <see cref="Exception.InnerException"/> for the actual exception thrown. | |
+ /// </exception> | |
public static IPNetworkProfile Create(Predicate<NetworkInterface> predicateForNetworkInterface) | |
{ | |
if (predicateForNetworkInterface is null) | |
@@ -89,9 +92,17 @@ partial class IPNetworkProfile { | |
if (iface.OperationalStatus != OperationalStatus.Up) | |
continue; // except inoperational interfaces | |
+ try { | |
if (predicateForNetworkInterface(iface)) | |
return Create(iface); | |
} | |
+ catch (Exception ex) { | |
+ throw new InvalidOperationException( | |
+ $"{nameof(predicateForNetworkInterface)} threw an exception for network interface '{iface.Name}'.", | |
+ innerException: ex | |
+ ); | |
+ } | |
+ } | |
throw new InvalidOperationException("The appropriate network interface was not selected."); | |
} | |
diff --git a/src/Smdn.Net.AddressResolution/Smdn.Net/IPNetworkProfile.CreateFromSubnetMask.cs b/src/Smdn.Net.AddressResolution/Smdn.Net/IPNetworkProfile.CreateFromSubnetMask.cs | |
index 466dbbf..f6b5da2 100644 | |
--- a/src/Smdn.Net.AddressResolution/Smdn.Net/IPNetworkProfile.CreateFromSubnetMask.cs | |
+++ b/src/Smdn.Net.AddressResolution/Smdn.Net/IPNetworkProfile.CreateFromSubnetMask.cs | |
@@ -1,7 +1,5 @@ | |
// SPDX-FileCopyrightText: 2023 smdn <smdn@smdn.jp> | |
// SPDX-License-Identifier: MIT | |
-#undef SYSTEM_NET_IPNETWORK // enable this when .NET 8 GA is released | |
- | |
using System; | |
using System.Buffers.Binary; | |
using System.Collections.Generic; | |
diff --git a/src/Smdn.Net.AddressResolution/Smdn.Net/IPNetworkProfile.cs b/src/Smdn.Net.AddressResolution/Smdn.Net/IPNetworkProfile.cs | |
index f656eba..ec4c6aa 100644 | |
--- a/src/Smdn.Net.AddressResolution/Smdn.Net/IPNetworkProfile.cs | |
+++ b/src/Smdn.Net.AddressResolution/Smdn.Net/IPNetworkProfile.cs | |
@@ -16,11 +16,11 @@ namespace Smdn.Net; | |
/// <seealso cref="Smdn.Net.AddressResolution.MacAddressResolver"/> | |
/// <seealso cref="Smdn.Net.NetworkScanning.NetworkScanner"/> | |
public abstract partial class IPNetworkProfile { | |
- private static Exception CreateIPv6FeatureNotImplemented() | |
- => new NotImplementedException("IPv6 is not supported yet. Please contribute to the implementation of the feature."); | |
+ private static NotImplementedException CreateIPv6FeatureNotImplemented() | |
+ => new("IPv6 is not supported yet. Please contribute to the implementation of the feature."); | |
- private static Exception CreateNonIPAddressFamilyNotSupported() | |
- => new NotSupportedException("Addresses other than IPv4 and IPv6 are not supported."); | |
+ private static NotSupportedException CreateNonIPAddressFamilyNotSupported() | |
+ => new("Addresses other than IPv4 and IPv6 are not supported."); | |
public NetworkInterface? NetworkInterface { get; } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment