Smdn.Net.AddressResolution 1.0.0-rc1

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
This is a prerelease version of Smdn.Net.AddressResolution.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Smdn.Net.AddressResolution --version 1.0.0-rc1
NuGet\Install-Package Smdn.Net.AddressResolution -Version 1.0.0-rc1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Smdn.Net.AddressResolution" Version="1.0.0-rc1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Smdn.Net.AddressResolution --version 1.0.0-rc1
#r "nuget: Smdn.Net.AddressResolution, 1.0.0-rc1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Smdn.Net.AddressResolution as a Cake Addin
#addin nuget:?package=Smdn.Net.AddressResolution&version=1.0.0-rc1&prerelease

// Install Smdn.Net.AddressResolution as a Cake Tool
#tool nuget:?package=Smdn.Net.AddressResolution&version=1.0.0-rc1&prerelease

Smdn.Net.AddressResolution-1.0.0-rc1

A network address resolution library for .NET. This library provides interfaces for resolving between IP addresses and MAC addresses, also provides implementations of address resolution using the ARP table provided by each platform.

API List

List of APIs exposed by assembly Smdn.Net.AddressResolution-1.0.0-rc1 (net7.0)

// Smdn.Net.AddressResolution.dll (Smdn.Net.AddressResolution-1.0.0-rc1)
//   Name: Smdn.Net.AddressResolution
//   AssemblyVersion: 1.0.0.0
//   InformationalVersion: 1.0.0-rc1+54f2767c7798db11d76ae3836009b55f701af69f
//   TargetFramework: .NETCoreApp,Version=v7.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
//     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) {}

    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 maxParallelCountForRefreshInvalidatedCache, ILogger? logger) {}
    public MacAddressResolver() {}
    public MacAddressResolver(IAddressTable? addressTable, INetworkScanner? networkScanner, bool shouldDisposeAddressTable = false, bool shouldDisposeNetworkScanner = false, NetworkInterface? networkInterface = null, int maxParallelCountForRefreshInvalidatedCache = 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 RefreshCacheAsyncCore(CancellationToken cancellationToken = default) {}
    protected override ValueTask RefreshInvalidatedCacheAsyncCore(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 RefreshCacheAsync(CancellationToken cancellationToken = default) {}
    protected virtual ValueTask RefreshCacheAsyncCore(CancellationToken cancellationToken) {}
    public ValueTask RefreshInvalidatedCacheAsync(CancellationToken cancellationToken = default) {}
    protected virtual ValueTask RefreshInvalidatedCacheAsyncCore(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 sealed class IpHlpApiAddressTable : IAddressTable {
    public static bool IsSupported { get; }

    public IpHlpApiAddressTable(IServiceProvider? serviceProvider = null) {}

    [AsyncIteratorStateMachine(typeof(IpHlpApiAddressTable.<EnumerateEntriesAsync>d__6))]
    public IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsync([EnumeratorCancellation] CancellationToken cancellationToken = default) {}
    void IDisposable.Dispose() {}
  }

  public sealed class ProcfsArpAddressTable : IAddressTable {
    public static bool IsSupported { get; }

    public ProcfsArpAddressTable(IServiceProvider? serviceProvider = null) {}

    [AsyncIteratorStateMachine(typeof(ProcfsArpAddressTable.<EnumerateEntriesAsync>d__7))]
    public IAsyncEnumerable<AddressTableEntry> EnumerateEntriesAsync([EnumeratorCancellation] CancellationToken cancellationToken = default) {}
    void IDisposable.Dispose() {}
  }

  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) {}

    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) {}
  }

  public sealed class IpHlpApiNetworkScanner : INetworkScanner {
    public IpHlpApiNetworkScanner(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {}

    public ValueTask ScanAsync(CancellationToken cancellationToken = default) {}
    public async ValueTask ScanAsync(IEnumerable<IPAddress> addresses, CancellationToken cancellationToken = default) {}
    void IDisposable.Dispose() {}
  }

  public sealed class NmapCommandNetworkScanner : CommandNetworkScanner {
    public static bool IsSupported { get; }

    public NmapCommandNetworkScanner(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider) {}

    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 : INetworkScanner {
    public PingNetworkScanner(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {}

    public void Dispose() {}
    public ValueTask ScanAsync(CancellationToken cancellationToken = default) {}
    public ValueTask ScanAsync(IEnumerable<IPAddress> addresses, CancellationToken cancellationToken = default) {}
  }
}
// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.2.1.0.
// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Smdn.Net.AddressResolution:

Package Downloads
Smdn.TPSmartHomeDevices.MacAddressEndPoint The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

An extension library to add a service to Smdn.TPSmartHomeDevices.Tapo and Smdn.TPSmartHomeDevices.Kasa that enables the resolution of devices' endpoints by MAC address.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 139 1/11/2024
1.0.2 203 5/15/2023
1.0.1 148 5/2/2023
1.0.0 630 4/19/2023
1.0.0-rc2 170 4/15/2023
1.0.0-rc1 132 4/13/2023
1.0.0-preview6 151 3/29/2023
1.0.0-preview5 293 3/23/2023
1.0.0-preview4 211 3/14/2023
1.0.0-preview3 132 3/10/2023
1.0.0-preview2 210 3/8/2023
1.0.0-preview1 227 3/5/2023