|
| 1 | +// Smdn.Net.AddressResolution.dll (Smdn.Net.AddressResolution-1.3.0) |
| 2 | +// Name: Smdn.Net.AddressResolution |
| 3 | +// AssemblyVersion: 1.3.0.0 |
| 4 | +// InformationalVersion: 1.3.0+a0c81b27b1d8712b13d3e464d115fb0c983f00ed |
| 5 | +// TargetFramework: .NETCoreApp,Version=v10.0 |
| 6 | +// Configuration: Release |
| 7 | +// Metadata: IsTrimmable=True |
| 8 | +// Metadata: RepositoryUrl=https://github.com/smdn/Smdn.Net.AddressResolution |
| 9 | +// Metadata: RepositoryBranch=main |
| 10 | +// Metadata: RepositoryCommit=a0c81b27b1d8712b13d3e464d115fb0c983f00ed |
| 11 | +// Referenced assemblies: |
| 12 | +// Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 |
| 13 | +// Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 |
| 14 | +// System.Collections, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a |
| 15 | +// System.Collections.Concurrent, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a |
| 16 | +// System.ComponentModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a |
| 17 | +// System.ComponentModel.Primitives, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a |
| 18 | +// System.Diagnostics.Process, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a |
| 19 | +// System.Linq, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a |
| 20 | +// System.Memory, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 |
| 21 | +// System.Net.NetworkInformation, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a |
| 22 | +// System.Net.Ping, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a |
| 23 | +// System.Net.Primitives, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a |
| 24 | +// System.Runtime, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a |
| 25 | +// System.Runtime.InteropServices, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a |
| 26 | +// System.Threading, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a |
| 27 | +// Vanara.Core, Version=4.1.1.0, Culture=neutral, PublicKeyToken=c37e4080322237fa |
| 28 | +// Vanara.PInvoke.IpHlpApi, Version=4.1.1.0, Culture=neutral, PublicKeyToken=c37e4080322237fa |
| 29 | +// Vanara.PInvoke.Shared, Version=4.1.1.0, Culture=neutral, PublicKeyToken=c37e4080322237fa |
| 30 | +// Vanara.PInvoke.Ws2_32, Version=4.1.1.0, Culture=neutral, PublicKeyToken=c37e4080322237fa |
| 31 | +#nullable enable annotations |
| 32 | + |
| 33 | +using System; |
| 34 | +using System.Collections.Generic; |
| 35 | +using System.Diagnostics; |
| 36 | +using System.Diagnostics.CodeAnalysis; |
| 37 | +using System.Net; |
| 38 | +using System.Net.NetworkInformation; |
| 39 | +using System.Runtime.CompilerServices; |
| 40 | +using System.Threading; |
| 41 | +using System.Threading.Tasks; |
| 42 | +using Microsoft.Extensions.Logging; |
| 43 | +using Smdn.Net; |
| 44 | +using Smdn.Net.AddressResolution; |
| 45 | +using Smdn.Net.AddressTables; |
| 46 | +using Smdn.Net.NetworkScanning; |
| 47 | + |
| 48 | +namespace Smdn.Net { |
| 49 | + public abstract class IPNetworkProfile { |
| 50 | + public static IPNetworkProfile Create() {} |
| 51 | + public static IPNetworkProfile Create(Func<IEnumerable<IPAddress>?> addressRangeGenerator, NetworkInterface? networkInterface = null) {} |
| 52 | + public static IPNetworkProfile Create(IPAddress baseAddress, IPAddress subnetMask, NetworkInterface? networkInterface = null) {} |
| 53 | + public static IPNetworkProfile Create(IPAddress baseAddress, int prefixLength, NetworkInterface? networkInterface = null) {} |
| 54 | + public static IPNetworkProfile Create(IPNetwork network, NetworkInterface? networkInterface = null) {} |
| 55 | + public static IPNetworkProfile Create(NetworkInterface networkInterface) {} |
| 56 | + public static IPNetworkProfile Create(Predicate<NetworkInterface> predicateForNetworkInterface) {} |
| 57 | + public static IPNetworkProfile CreateFromNetworkInterface(Guid id) {} |
| 58 | + public static IPNetworkProfile CreateFromNetworkInterface(PhysicalAddress physicalAddress) {} |
| 59 | + public static IPNetworkProfile CreateFromNetworkInterface(string id) {} |
| 60 | + public static IPNetworkProfile CreateFromNetworkInterfaceName(string name) {} |
| 61 | + |
| 62 | + protected IPNetworkProfile(NetworkInterface? networkInterface) {} |
| 63 | + |
| 64 | + public NetworkInterface? NetworkInterface { get; } |
| 65 | + |
| 66 | + public abstract IEnumerable<IPAddress>? GetAddressRange(); |
| 67 | + } |
| 68 | + |
| 69 | + public static class PhysicalAddressExtensions { |
| 70 | + public static string ToMacAddressString(this PhysicalAddress hardwareAddress, char delimiter = ':') {} |
| 71 | + } |
| 72 | +} |
| 73 | + |
| 74 | +namespace Smdn.Net.AddressResolution { |
| 75 | + public interface IAddressResolver<TAddress, TResolvedAddress> where TAddress : notnull where TResolvedAddress : notnull { |
| 76 | + void Invalidate(TAddress address); |
| 77 | + ValueTask<TResolvedAddress?> ResolveAsync(TAddress address, CancellationToken cancellationToken); |
| 78 | + } |
| 79 | + |
| 80 | + public class MacAddressResolver : MacAddressResolverBase { |
| 81 | + protected MacAddressResolver(IAddressTable addressTable, bool shouldDisposeAddressTable, INetworkScanner? networkScanner, bool shouldDisposeNetworkScanner, NetworkInterface? networkInterface, int maxParallelCountForRefreshInvalidatedAddresses, ILogger? logger) {} |
| 82 | + public MacAddressResolver() {} |
| 83 | + public MacAddressResolver(IAddressTable? addressTable, INetworkScanner? networkScanner, bool shouldDisposeAddressTable = false, bool shouldDisposeNetworkScanner = false, NetworkInterface? networkInterface = null, int maxParallelCountForRefreshInvalidatedAddresses = 3, IServiceProvider? serviceProvider = null) {} |
| 84 | + public MacAddressResolver(IPNetworkProfile? networkProfile, IServiceProvider? serviceProvider = null) {} |
| 85 | + |
| 86 | + public bool CanPerformNetworkScan { get; } |
| 87 | + public override bool HasInvalidated { get; } |
| 88 | + public TimeSpan NetworkScanInterval { get; set; } |
| 89 | + public TimeSpan NetworkScanMinInterval { get; set; } |
| 90 | + public bool ShouldResolveIPv4MappedIPv6Address { get; set; } |
| 91 | + |
| 92 | + protected override void Dispose(bool disposing) {} |
| 93 | + public IAsyncEnumerable<AddressTableEntry> EnumerateAddressTableEntriesAsync(CancellationToken cancellationToken = default) {} |
| 94 | + public IAsyncEnumerable<AddressTableEntry> EnumerateAddressTableEntriesAsync(Predicate<AddressTableEntry> predicate, CancellationToken cancellationToken = default) {} |
| 95 | + protected override void InvalidateCore(IPAddress ipAddress) {} |
| 96 | + protected override void InvalidateCore(PhysicalAddress macAddress) {} |
| 97 | + protected override ValueTask RefreshAddressTableAsyncCore(CancellationToken cancellationToken = default) {} |
| 98 | + protected override ValueTask RefreshInvalidatedAddressesAsyncCore(CancellationToken cancellationToken = default) {} |
| 99 | + protected override async ValueTask<PhysicalAddress?> ResolveIPAddressToMacAddressAsyncCore(IPAddress ipAddress, CancellationToken cancellationToken) {} |
| 100 | + protected override async ValueTask<IPAddress?> ResolveMacAddressToIPAddressAsyncCore(PhysicalAddress macAddress, CancellationToken cancellationToken) {} |
| 101 | + protected virtual async ValueTask<AddressTableEntry> SelectAddressTableEntryAsync(Predicate<AddressTableEntry> predicate, CancellationToken cancellationToken) {} |
| 102 | + } |
| 103 | + |
| 104 | + public abstract class MacAddressResolverBase : |
| 105 | + IAddressResolver<IPAddress, PhysicalAddress>, |
| 106 | + IAddressResolver<PhysicalAddress, IPAddress>, |
| 107 | + IDisposable |
| 108 | + { |
| 109 | + protected static PhysicalAddress AllZeroMacAddress { get; } |
| 110 | + public static MacAddressResolverBase Null { get; } |
| 111 | + |
| 112 | + protected MacAddressResolverBase(ILogger? logger = null) {} |
| 113 | + |
| 114 | + public abstract bool HasInvalidated { get; } |
| 115 | + protected ILogger? Logger { get; } |
| 116 | + |
| 117 | + protected virtual void Dispose(bool disposing) {} |
| 118 | + public void Dispose() {} |
| 119 | + public void Invalidate(IPAddress ipAddress) {} |
| 120 | + public void Invalidate(PhysicalAddress macAddress) {} |
| 121 | + protected abstract void InvalidateCore(IPAddress ipAddress); |
| 122 | + protected abstract void InvalidateCore(PhysicalAddress macAddress); |
| 123 | + public ValueTask RefreshAddressTableAsync(CancellationToken cancellationToken = default) {} |
| 124 | + protected virtual ValueTask RefreshAddressTableAsyncCore(CancellationToken cancellationToken) {} |
| 125 | + public ValueTask RefreshInvalidatedAddressesAsync(CancellationToken cancellationToken = default) {} |
| 126 | + protected virtual ValueTask RefreshInvalidatedAddressesAsyncCore(CancellationToken cancellationToken) {} |
| 127 | + public ValueTask<PhysicalAddress?> ResolveIPAddressToMacAddressAsync(IPAddress ipAddress, CancellationToken cancellationToken = default) {} |
| 128 | + protected abstract ValueTask<PhysicalAddress?> ResolveIPAddressToMacAddressAsyncCore(IPAddress ipAddress, CancellationToken cancellationToken); |
| 129 | + public ValueTask<IPAddress?> ResolveMacAddressToIPAddressAsync(PhysicalAddress macAddress, CancellationToken cancellationToken = default) {} |
| 130 | + protected abstract ValueTask<IPAddress?> ResolveMacAddressToIPAddressAsyncCore(PhysicalAddress macAddress, CancellationToken cancellationToken); |
| 131 | + void IAddressResolver<IPAddress, PhysicalAddress>.Invalidate(IPAddress address) {} |
| 132 | + ValueTask<PhysicalAddress?> IAddressResolver<IPAddress, PhysicalAddress>.ResolveAsync(IPAddress address, CancellationToken cancellationToken) {} |
| 133 | + void IAddressResolver<PhysicalAddress, IPAddress>.Invalidate(PhysicalAddress address) {} |
| 134 | + ValueTask<IPAddress?> IAddressResolver<PhysicalAddress, IPAddress>.ResolveAsync(PhysicalAddress address, CancellationToken cancellationToken) {} |
| 135 | + protected void ThrowIfDisposed() {} |
| 136 | + } |
| 137 | +} |
| 138 | + |
| 139 | +namespace Smdn.Net.AddressTables { |
| 140 | + public interface IAddressTable : IDisposable { |
| 141 | + IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsync(CancellationToken cancellationToken); |
| 142 | + } |
| 143 | + |
| 144 | + public enum AddressTableEntryState : int { |
| 145 | + Delay = 4, |
| 146 | + Incomplete = 1, |
| 147 | + None = 0, |
| 148 | + Probe = 5, |
| 149 | + Reachable = 2, |
| 150 | + Stale = 3, |
| 151 | + } |
| 152 | + |
| 153 | + public abstract class AddressTable : IAddressTable { |
| 154 | + public static IAddressTable Null { get; } |
| 155 | + |
| 156 | + public static IAddressTable Create(IServiceProvider? serviceProvider = null) {} |
| 157 | + |
| 158 | + protected AddressTable(ILogger? logger = null) {} |
| 159 | + |
| 160 | + protected ILogger? Logger { get; } |
| 161 | + |
| 162 | + protected virtual void Dispose(bool disposing) {} |
| 163 | + public void Dispose() {} |
| 164 | + public IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsync(CancellationToken cancellationToken = default) {} |
| 165 | + protected abstract IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsyncCore(CancellationToken cancellationToken); |
| 166 | + protected void ThrowIfDisposed() {} |
| 167 | + } |
| 168 | + |
| 169 | + [SupportedOSPlatform("windows")] |
| 170 | + public sealed class IpHlpApiAddressTable : AddressTable { |
| 171 | + public static bool IsSupported { get; } |
| 172 | + |
| 173 | + public IpHlpApiAddressTable(IServiceProvider? serviceProvider = null) {} |
| 174 | + |
| 175 | + [AsyncIteratorStateMachine(typeof(IpHlpApiAddressTable.<EnumerateEntriesAsyncCore>d__4))] |
| 176 | + protected override IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsyncCore([EnumeratorCancellation] CancellationToken cancellationToken) {} |
| 177 | + } |
| 178 | + |
| 179 | + public sealed class ProcfsArpAddressTable : AddressTable { |
| 180 | + public static bool IsSupported { get; } |
| 181 | + |
| 182 | + public ProcfsArpAddressTable(IServiceProvider? serviceProvider = null) {} |
| 183 | + |
| 184 | + [AsyncIteratorStateMachine(typeof(ProcfsArpAddressTable.<EnumerateEntriesAsyncCore>d__5))] |
| 185 | + protected override IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsyncCore([EnumeratorCancellation] CancellationToken cancellationToken) {} |
| 186 | + } |
| 187 | + |
| 188 | + public readonly struct AddressTableEntry : |
| 189 | + IEquatable<AddressTableEntry>, |
| 190 | + IEquatable<IPAddress>, |
| 191 | + IEquatable<PhysicalAddress> |
| 192 | + { |
| 193 | + public static readonly AddressTableEntry Empty; // = "{IP=, MAC=(null), IsPermanent=False, State=None, Iface=}" |
| 194 | + |
| 195 | + public static IEqualityComparer<AddressTableEntry> DefaultEqualityComparer { get; } |
| 196 | + public static IEqualityComparer<AddressTableEntry> ExceptStateEqualityComparer { get; } |
| 197 | + |
| 198 | + public AddressTableEntry(IPAddress ipAddress, PhysicalAddress? physicalAddress, bool isPermanent, AddressTableEntryState state, string? interfaceId) {} |
| 199 | + |
| 200 | + public IPAddress? IPAddress { get; } |
| 201 | + public string? InterfaceId { get; } |
| 202 | + [MemberNotNullWhen(false, "IPAddress")] |
| 203 | + public bool IsEmpty { [MemberNotNullWhen(false, "IPAddress")] get; } |
| 204 | + public bool IsPermanent { get; } |
| 205 | + public PhysicalAddress? PhysicalAddress { get; } |
| 206 | + public AddressTableEntryState State { get; } |
| 207 | + |
| 208 | + public bool Equals(AddressTableEntry other) {} |
| 209 | + public bool Equals(IPAddress? other) {} |
| 210 | + public bool Equals(IPAddress? other, bool shouldConsiderIPv4MappedIPv6Address) {} |
| 211 | + public bool Equals(PhysicalAddress? other) {} |
| 212 | + public override bool Equals(object? obj) {} |
| 213 | + public override int GetHashCode() {} |
| 214 | + public override string ToString() {} |
| 215 | + } |
| 216 | +} |
| 217 | + |
| 218 | +namespace Smdn.Net.NetworkScanning { |
| 219 | + public interface INetworkScanner : IDisposable { |
| 220 | + ValueTask ScanAsync(CancellationToken cancellationToken); |
| 221 | + ValueTask ScanAsync(IEnumerable<IPAddress> addresses, CancellationToken cancellationToken); |
| 222 | + } |
| 223 | + |
| 224 | + public sealed class ArpScanCommandNetworkScanner : CommandNetworkScanner { |
| 225 | + public static bool IsSupported { get; } |
| 226 | + |
| 227 | + public ArpScanCommandNetworkScanner(IPNetworkProfile? networkProfile, IServiceProvider? serviceProvider = null) {} |
| 228 | + |
| 229 | + protected override bool GetCommandLineArguments(IEnumerable<IPAddress> addressesToScan, out string executable, out string arguments) {} |
| 230 | + protected override bool GetCommandLineArguments(out string executable, out string arguments) {} |
| 231 | + } |
| 232 | + |
| 233 | + public abstract class CommandNetworkScanner : INetworkScanner { |
| 234 | + public interface IProcessFactory { |
| 235 | + Process CreateProcess(ProcessStartInfo processStartInfo); |
| 236 | + } |
| 237 | + |
| 238 | + protected readonly struct Command { |
| 239 | + public Command(string name, string? executablePath) {} |
| 240 | + |
| 241 | + public bool IsAvailable { get; } |
| 242 | + public string Name { get; } |
| 243 | + |
| 244 | + public string GetExecutablePathOrThrow() {} |
| 245 | + } |
| 246 | + |
| 247 | + protected static IReadOnlyCollection<string> DefaultCommandPaths { get; } |
| 248 | + |
| 249 | + protected static CommandNetworkScanner.Command FindCommand(string command, IEnumerable<string> paths) {} |
| 250 | + |
| 251 | + protected CommandNetworkScanner(ILogger? logger, IServiceProvider? serviceProvider) {} |
| 252 | + |
| 253 | + protected virtual void Dispose(bool disposing) {} |
| 254 | + public void Dispose() {} |
| 255 | + protected abstract bool GetCommandLineArguments(IEnumerable<IPAddress> addressesToScan, out string executable, out string? arguments); |
| 256 | + protected abstract bool GetCommandLineArguments(out string executable, out string? arguments); |
| 257 | + public virtual ValueTask ScanAsync(CancellationToken cancellationToken = default) {} |
| 258 | + public virtual ValueTask ScanAsync(IEnumerable<IPAddress> addresses, CancellationToken cancellationToken = default) {} |
| 259 | + protected void ThrowIfDisposed() {} |
| 260 | + } |
| 261 | + |
| 262 | + [SupportedOSPlatform("windows")] |
| 263 | + public sealed class IpHlpApiNetworkScanner : NetworkScanner { |
| 264 | + public static bool IsSupported { get; } |
| 265 | + |
| 266 | + public IpHlpApiNetworkScanner(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {} |
| 267 | + |
| 268 | + protected override async ValueTask ScanAsyncCore(IPAddress address, CancellationToken cancellationToken = default) {} |
| 269 | + } |
| 270 | + |
| 271 | + public abstract class NetworkScanner : INetworkScanner { |
| 272 | + public static INetworkScanner Null { get; } |
| 273 | + |
| 274 | + public static INetworkScanner Create(IPNetworkProfile? networkProfile, IServiceProvider? serviceProvider = null) {} |
| 275 | + |
| 276 | + protected NetworkScanner(IPNetworkProfile networkProfile, ILogger? logger = null) {} |
| 277 | + |
| 278 | + protected ILogger? Logger { get; } |
| 279 | + protected IPNetworkProfile NetworkProfile { get; } |
| 280 | + |
| 281 | + protected virtual void Dispose(bool disposing) {} |
| 282 | + public void Dispose() {} |
| 283 | + public virtual ValueTask ScanAsync(CancellationToken cancellationToken = default) {} |
| 284 | + public virtual ValueTask ScanAsync(IEnumerable<IPAddress> addresses, CancellationToken cancellationToken = default) {} |
| 285 | + protected virtual ValueTask ScanAsyncCore(IPAddress address, CancellationToken cancellationToken) {} |
| 286 | + protected void ThrowIfDisposed() {} |
| 287 | + } |
| 288 | + |
| 289 | + public sealed class NmapCommandNetworkScanner : CommandNetworkScanner { |
| 290 | + public static bool IsSupported { get; } |
| 291 | + |
| 292 | + public NmapCommandNetworkScanner(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {} |
| 293 | + |
| 294 | + protected override bool GetCommandLineArguments(IEnumerable<IPAddress> addressesToScan, out string executable, out string arguments) {} |
| 295 | + protected override bool GetCommandLineArguments(out string executable, out string arguments) {} |
| 296 | + } |
| 297 | + |
| 298 | + public sealed class PingNetworkScanner : NetworkScanner { |
| 299 | + public static bool IsSupported { get; } |
| 300 | + |
| 301 | + public PingNetworkScanner(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {} |
| 302 | + |
| 303 | + protected override void Dispose(bool disposing) {} |
| 304 | + protected override async ValueTask ScanAsyncCore(IPAddress address, CancellationToken cancellationToken = default) {} |
| 305 | + } |
| 306 | +} |
| 307 | +// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.7.1.0. |
| 308 | +// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.5.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating) |
0 commit comments