Skip to content

Commit 6eadc0c

Browse files
authored
Merge pull request #7 from smdn/releases/Smdn.Net.AddressResolution-1.0.0-preview6-1680108228
Release main/Smdn.Net.AddressResolution-1.0.0-preview6
2 parents 867630e + 49c6550 commit 6eadc0c

File tree

4 files changed

+567
-68
lines changed

4 files changed

+567
-68
lines changed

doc/api-list/Smdn.Net.AddressResolution/Smdn.Net.AddressResolution-net6.0.apilist.cs

Lines changed: 142 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// Smdn.Net.AddressResolution.dll (Smdn.Net.AddressResolution-1.0.0-preview5)
1+
// Smdn.Net.AddressResolution.dll (Smdn.Net.AddressResolution-1.0.0-preview6)
22
// Name: Smdn.Net.AddressResolution
33
// AssemblyVersion: 1.0.0.0
4-
// InformationalVersion: 1.0.0-preview5+fe261fa7dd16c43347c28935b3055ec3b8ab0674
4+
// InformationalVersion: 1.0.0-preview6+867630e3d8768ccca99d991e9c0c1cca62c64c76
55
// TargetFramework: .NETCoreApp,Version=v6.0
66
// Configuration: Release
77
// Referenced assemblies:
@@ -15,19 +15,43 @@
1515
// System.Net.NetworkInformation, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
1616
// System.Net.Primitives, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
1717
// System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
18+
// System.Runtime.InteropServices, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
1819
// System.Runtime.InteropServices.RuntimeInformation, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
1920
// System.Threading, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
21+
// Vanara.Core, Version=3.4.13.0, Culture=neutral, PublicKeyToken=c37e4080322237fa
22+
// Vanara.PInvoke.IpHlpApi, Version=3.4.13.0, Culture=neutral, PublicKeyToken=c37e4080322237fa
23+
// Vanara.PInvoke.Shared, Version=3.4.13.0, Culture=neutral, PublicKeyToken=c37e4080322237fa
24+
// Vanara.PInvoke.Ws2_32, Version=3.4.13.0, Culture=neutral, PublicKeyToken=c37e4080322237fa
2025
#nullable enable annotations
2126

2227
using System;
28+
using System.Collections.Generic;
2329
using System.Net;
2430
using System.Net.NetworkInformation;
31+
using System.Runtime.CompilerServices;
2532
using System.Threading;
2633
using System.Threading.Tasks;
2734
using Microsoft.Extensions.Logging;
35+
using Smdn.Net;
2836
using Smdn.Net.AddressResolution;
37+
using Smdn.Net.NeighborDiscovery;
2938

3039
namespace Smdn.Net {
40+
public abstract class IPNetworkProfile {
41+
public static IPNetworkProfile Create() {}
42+
public static IPNetworkProfile Create(Func<IEnumerable<IPAddress>?> addressRangeGenerator, NetworkInterface? networkInterface = null) {}
43+
public static IPNetworkProfile Create(IPAddress baseAddress, IPAddress subnetMask, NetworkInterface? networkInterface = null) {}
44+
public static IPNetworkProfile Create(IPAddress baseAddress, int prefixLength, NetworkInterface? networkInterface = null) {}
45+
public static IPNetworkProfile Create(NetworkInterface networkInterface) {}
46+
public static IPNetworkProfile Create(Predicate<NetworkInterface> predicate) {}
47+
48+
protected IPNetworkProfile(NetworkInterface? networkInterface) {}
49+
50+
public NetworkInterface? NetworkInterface { get; }
51+
52+
public abstract IEnumerable<IPAddress>? GetAddressRange();
53+
}
54+
3155
public static class PhysicalAddressExtensions {
3256
public static string ToMacAddressString(this PhysicalAddress hardwareAddress, char delimiter = ':') {}
3357
}
@@ -39,18 +63,33 @@ public interface IAddressResolver<TAddress, TResolvedAddress> {
3963
ValueTask<TResolvedAddress> ResolveAsync(TAddress address, CancellationToken cancellationToken);
4064
}
4165

42-
public abstract class MacAddressResolver :
66+
public class MacAddressResolver : MacAddressResolverBase {
67+
protected MacAddressResolver(INeighborTable neighborTable, INeighborDiscoverer neighborDiscoverer, TimeSpan neighborDiscoveryInterval, ILogger? logger) {}
68+
public MacAddressResolver(INeighborTable? neighborTable = null, INeighborDiscoverer? neighborDiscoverer = null, int neighborDiscoveryIntervalMilliseconds = -1, IServiceProvider? serviceProvider = null) {}
69+
public MacAddressResolver(IPNetworkProfile? networkProfile, IServiceProvider? serviceProvider = null) {}
70+
public MacAddressResolver(IPNetworkProfile? networkProfile, TimeSpan neighborDiscoveryInterval, IServiceProvider? serviceProvider = null) {}
71+
public MacAddressResolver(TimeSpan neighborDiscoveryInterval, INeighborTable? neighborTable = null, INeighborDiscoverer? neighborDiscoverer = null, IServiceProvider? serviceProvider = null) {}
72+
73+
public override bool HasInvalidated { get; }
74+
75+
protected override void Dispose(bool disposing) {}
76+
protected override void InvalidateCore(IPAddress ipAddress) {}
77+
protected override void InvalidateCore(PhysicalAddress macAddress) {}
78+
protected override ValueTask RefreshCacheAsyncCore(CancellationToken cancellationToken = default) {}
79+
protected override ValueTask RefreshInvalidatedCacheAsyncCore(CancellationToken cancellationToken = default) {}
80+
protected override async ValueTask<PhysicalAddress?> ResolveIPAddressToMacAddressAsyncCore(IPAddress ipAddress, CancellationToken cancellationToken) {}
81+
protected override async ValueTask<IPAddress?> ResolveMacAddressToIPAddressAsyncCore(PhysicalAddress macAddress, CancellationToken cancellationToken) {}
82+
}
83+
84+
public abstract class MacAddressResolverBase :
4385
IAddressResolver<IPAddress, PhysicalAddress>,
4486
IAddressResolver<PhysicalAddress, IPAddress>,
4587
IDisposable
4688
{
47-
protected static readonly PhysicalAddress AllZeroMacAddress; // = "000000000000"
89+
protected static PhysicalAddress AllZeroMacAddress { get; }
90+
public static MacAddressResolverBase Null { get; }
4891

49-
public static MacAddressResolver Null { get; }
50-
51-
public static MacAddressResolver Create(MacAddressResolverOptions? options = null, IServiceProvider? serviceProvider = null) {}
52-
53-
protected MacAddressResolver(ILogger? logger = null) {}
92+
protected MacAddressResolverBase(ILogger? logger = null) {}
5493

5594
public abstract bool HasInvalidated { get; }
5695
protected ILogger? Logger { get; }
@@ -75,17 +114,103 @@ void IAddressResolver<PhysicalAddress, IPAddress>.Invalidate(PhysicalAddress add
75114
ValueTask<IPAddress?> IAddressResolver<PhysicalAddress, IPAddress>.ResolveAsync(PhysicalAddress address, CancellationToken cancellationToken) {}
76115
protected void ThrowIfDisposed() {}
77116
}
117+
}
118+
119+
namespace Smdn.Net.NeighborDiscovery {
120+
public interface INeighborDiscoverer {
121+
ValueTask DiscoverAsync(CancellationToken cancellationToken);
122+
ValueTask DiscoverAsync(IEnumerable<IPAddress> addresses, CancellationToken cancellationToken);
123+
}
124+
125+
public interface INeighborTable {
126+
IAsyncEnumerable<NeighborTableEntry> EnumerateEntriesAsync(CancellationToken cancellationToken);
127+
}
128+
129+
public enum NeighborTableEntryState : int {
130+
Delay = 4,
131+
Incomplete = 1,
132+
None = 0,
133+
Probe = 5,
134+
Reachable = 2,
135+
Stale = 3,
136+
}
137+
138+
public sealed class ArpScanCommandNeighborDiscoverer : RunCommandNeighborDiscovererBase {
139+
public static bool IsSupported { get; }
140+
141+
public ArpScanCommandNeighborDiscoverer(IPNetworkProfile? networkProfile, IServiceProvider? serviceProvider) {}
142+
143+
protected override bool GetCommandLineArguments(IEnumerable<IPAddress> addressesToDiscover, out string executable, out string arguments) {}
144+
protected override bool GetCommandLineArguments(out string executable, out string arguments) {}
145+
}
146+
147+
public sealed class IpHlpApiNeighborDiscoverer : INeighborDiscoverer {
148+
public IpHlpApiNeighborDiscoverer(IPNetworkProfile networkProfile, ILogger? logger = null) {}
78149

79-
public sealed class MacAddressResolverOptions {
80-
public static readonly MacAddressResolverOptions Default; // = "Smdn.Net.AddressResolution.MacAddressResolverOptions"
150+
public ValueTask DiscoverAsync(CancellationToken cancellationToken = default) {}
151+
public async ValueTask DiscoverAsync(IEnumerable<IPAddress> addresses, CancellationToken cancellationToken = default) {}
152+
}
153+
154+
public sealed class IpHlpApiNeighborTable : INeighborTable {
155+
public static bool IsSupported { get; }
156+
157+
public IpHlpApiNeighborTable(IServiceProvider? serviceProvider = null) {}
158+
159+
[AsyncIteratorStateMachine(typeof(IpHlpApiNeighborTable.<EnumerateEntriesAsync>d__5))]
160+
public IAsyncEnumerable<NeighborTableEntry> EnumerateEntriesAsync([EnumeratorCancellation] CancellationToken cancellationToken = default) {}
161+
}
162+
163+
public sealed class NmapCommandNeighborDiscoverer : RunCommandNeighborDiscovererBase {
164+
public static bool IsSupported { get; }
165+
166+
public NmapCommandNeighborDiscoverer(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider) {}
167+
168+
protected override bool GetCommandLineArguments(IEnumerable<IPAddress> addressesToDiscover, out string executable, out string arguments) {}
169+
protected override bool GetCommandLineArguments(out string executable, out string arguments) {}
170+
}
171+
172+
public sealed class NullNeighborDiscoverer : INeighborDiscoverer {
173+
public static readonly NullNeighborDiscoverer Instance; // = "Smdn.Net.NeighborDiscovery.NullNeighborDiscoverer"
174+
175+
public ValueTask DiscoverAsync(CancellationToken cancellationToken) {}
176+
public ValueTask DiscoverAsync(IEnumerable<IPAddress> addresses, CancellationToken cancellationToken) {}
177+
}
178+
179+
public sealed class ProcfsArpNeighborTable : INeighborTable {
180+
public static bool IsSupported { get; }
181+
182+
public ProcfsArpNeighborTable(IServiceProvider? serviceProvider = null) {}
183+
184+
[AsyncIteratorStateMachine(typeof(ProcfsArpNeighborTable.<EnumerateEntriesAsync>d__6))]
185+
public IAsyncEnumerable<NeighborTableEntry> EnumerateEntriesAsync([EnumeratorCancellation] CancellationToken cancellationToken = default) {}
186+
}
187+
188+
public abstract class RunCommandNeighborDiscovererBase : INeighborDiscoverer {
189+
protected static string FindPathToCommand(string command, IEnumerable<string> paths) {}
190+
191+
protected RunCommandNeighborDiscovererBase(ILogger? logger) {}
192+
193+
public virtual ValueTask DiscoverAsync(CancellationToken cancellationToken) {}
194+
public virtual ValueTask DiscoverAsync(IEnumerable<IPAddress> addresses, CancellationToken cancellationToken) {}
195+
protected abstract bool GetCommandLineArguments(IEnumerable<IPAddress> addressesToDiscover, out string executable, out string arguments);
196+
protected abstract bool GetCommandLineArguments(out string executable, out string arguments);
197+
}
198+
199+
public readonly struct NeighborTableEntry :
200+
IEquatable<IPAddress>,
201+
IEquatable<PhysicalAddress>
202+
{
203+
public NeighborTableEntry(IPAddress ipAddress, PhysicalAddress? physicalAddress, bool isPermanent, NeighborTableEntryState state, int? interfaceIndex = null, string? interfaceName = null) {}
81204

82-
public MacAddressResolverOptions() {}
205+
public IPAddress IPAddress { get; }
206+
public int? InterfaceIndex { get; }
207+
public string? InterfaceName { get; }
208+
public bool IsPermanent { get; }
209+
public PhysicalAddress? PhysicalAddress { get; }
210+
public NeighborTableEntryState State { get; }
83211

84-
public string? ArpScanCommandInterfaceSpecification { get; init; }
85-
public string? ArpScanCommandTargetSpecification { get; init; }
86-
public string? NmapCommandInterfaceSpecification { get; init; }
87-
public string? NmapCommandTargetSpecification { get; init; }
88-
public TimeSpan ProcfsArpFullScanInterval { get; init; }
212+
public bool Equals(IPAddress? other) {}
213+
public bool Equals(PhysicalAddress? other) {}
89214
}
90215
}
91216
// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.2.1.0.

0 commit comments

Comments
 (0)