main/Smdn.TPSmartHomeDevices.MacAddressEndPoint-1.0.0-rc1
Created
April 27, 2023 16:49
-
-
Save smdn/6029d3d07677f16f8b57c4c8c8163ff0 to your computer and use it in GitHub Desktop.
Smdn.TPSmartHomeDevices.MacAddressEndPoint 1.0.0-rc1 Release Notes
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.TPSmartHomeDevices.MacAddressEndPoint/Smdn.TPSmartHomeDevices.MacAddressEndPoint-net6.0.apilist.cs b/doc/api-list/Smdn.TPSmartHomeDevices.MacAddressEndPoint/Smdn.TPSmartHomeDevices.MacAddressEndPoint-net6.0.apilist.cs | |
new file mode 100644 | |
index 0000000..43308c5 | |
--- /dev/null | |
+++ b/doc/api-list/Smdn.TPSmartHomeDevices.MacAddressEndPoint/Smdn.TPSmartHomeDevices.MacAddressEndPoint-net6.0.apilist.cs | |
@@ -0,0 +1,49 @@ | |
+// Smdn.TPSmartHomeDevices.MacAddressEndPoint.dll (Smdn.TPSmartHomeDevices.MacAddressEndPoint-1.0.0-rc1) | |
+// Name: Smdn.TPSmartHomeDevices.MacAddressEndPoint | |
+// AssemblyVersion: 1.0.0.0 | |
+// InformationalVersion: 1.0.0-rc1+00727d1f82dcb2b9dd9c6e586f6c54110349bf48 | |
+// TargetFramework: .NETCoreApp,Version=v6.0 | |
+// Configuration: Release | |
+// Referenced assemblies: | |
+// Smdn.Net.AddressResolution, Version=1.0.0.0, Culture=neutral | |
+// Smdn.TPSmartHomeDevices.Primitives, Version=1.0.0.0, Culture=neutral | |
+// System.ComponentModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
+// System.Net.NetworkInformation, 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 | |
+#nullable enable annotations | |
+ | |
+using System; | |
+using System.Net; | |
+using System.Net.NetworkInformation; | |
+using System.Threading; | |
+using System.Threading.Tasks; | |
+using Smdn.Net; | |
+using Smdn.Net.AddressResolution; | |
+using Smdn.TPSmartHomeDevices; | |
+ | |
+namespace Smdn.TPSmartHomeDevices { | |
+ public class MacAddressDeviceEndPointFactory : | |
+ IDeviceEndPointFactory<PhysicalAddress>, | |
+ IDisposable | |
+ { | |
+ protected class MacAddressDeviceEndPoint : IDynamicDeviceEndPoint { | |
+ public MacAddressDeviceEndPoint(IAddressResolver<PhysicalAddress, IPAddress> resolver, PhysicalAddress address) {} | |
+ | |
+ public void Invalidate() {} | |
+ public async ValueTask<EndPoint?> ResolveAsync(CancellationToken cancellationToken) {} | |
+ public override string ToString() {} | |
+ } | |
+ | |
+ protected MacAddressDeviceEndPointFactory(IAddressResolver<PhysicalAddress, IPAddress> resolver, IServiceProvider? serviceProvider = null) {} | |
+ public MacAddressDeviceEndPointFactory(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {} | |
+ public MacAddressDeviceEndPointFactory(MacAddressResolverBase resolver, IServiceProvider? serviceProvider = null) {} | |
+ | |
+ public virtual IDeviceEndPoint Create(PhysicalAddress address) {} | |
+ protected virtual void Dispose(bool disposing) {} | |
+ public void Dispose() {} | |
+ protected void ThrowIfDisposed() {} | |
+ } | |
+} | |
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.2.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.TPSmartHomeDevices.MacAddressEndPoint/Smdn.TPSmartHomeDevices.MacAddressEndPoint-net7.0.apilist.cs b/doc/api-list/Smdn.TPSmartHomeDevices.MacAddressEndPoint/Smdn.TPSmartHomeDevices.MacAddressEndPoint-net7.0.apilist.cs | |
new file mode 100644 | |
index 0000000..6ec0906 | |
--- /dev/null | |
+++ b/doc/api-list/Smdn.TPSmartHomeDevices.MacAddressEndPoint/Smdn.TPSmartHomeDevices.MacAddressEndPoint-net7.0.apilist.cs | |
@@ -0,0 +1,49 @@ | |
+// Smdn.TPSmartHomeDevices.MacAddressEndPoint.dll (Smdn.TPSmartHomeDevices.MacAddressEndPoint-1.0.0-rc1) | |
+// Name: Smdn.TPSmartHomeDevices.MacAddressEndPoint | |
+// AssemblyVersion: 1.0.0.0 | |
+// InformationalVersion: 1.0.0-rc1+00727d1f82dcb2b9dd9c6e586f6c54110349bf48 | |
+// TargetFramework: .NETCoreApp,Version=v7.0 | |
+// Configuration: Release | |
+// Referenced assemblies: | |
+// Smdn.Net.AddressResolution, Version=1.0.0.0, Culture=neutral | |
+// Smdn.TPSmartHomeDevices.Primitives, Version=1.0.0.0, Culture=neutral | |
+// System.ComponentModel, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
+// System.Net.NetworkInformation, 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 | |
+#nullable enable annotations | |
+ | |
+using System; | |
+using System.Net; | |
+using System.Net.NetworkInformation; | |
+using System.Threading; | |
+using System.Threading.Tasks; | |
+using Smdn.Net; | |
+using Smdn.Net.AddressResolution; | |
+using Smdn.TPSmartHomeDevices; | |
+ | |
+namespace Smdn.TPSmartHomeDevices { | |
+ public class MacAddressDeviceEndPointFactory : | |
+ IDeviceEndPointFactory<PhysicalAddress>, | |
+ IDisposable | |
+ { | |
+ protected class MacAddressDeviceEndPoint : IDynamicDeviceEndPoint { | |
+ public MacAddressDeviceEndPoint(IAddressResolver<PhysicalAddress, IPAddress> resolver, PhysicalAddress address) {} | |
+ | |
+ public void Invalidate() {} | |
+ public async ValueTask<EndPoint?> ResolveAsync(CancellationToken cancellationToken) {} | |
+ public override string ToString() {} | |
+ } | |
+ | |
+ protected MacAddressDeviceEndPointFactory(IAddressResolver<PhysicalAddress, IPAddress> resolver, IServiceProvider? serviceProvider = null) {} | |
+ public MacAddressDeviceEndPointFactory(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {} | |
+ public MacAddressDeviceEndPointFactory(MacAddressResolverBase resolver, IServiceProvider? serviceProvider = null) {} | |
+ | |
+ public virtual IDeviceEndPoint Create(PhysicalAddress address) {} | |
+ protected virtual void Dispose(bool disposing) {} | |
+ public void Dispose() {} | |
+ protected void ThrowIfDisposed() {} | |
+ } | |
+} | |
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.2.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.TPSmartHomeDevices.MacAddressEndPoint/Smdn.TPSmartHomeDevices.MacAddressEndPoint-netstandard2.0.apilist.cs b/doc/api-list/Smdn.TPSmartHomeDevices.MacAddressEndPoint/Smdn.TPSmartHomeDevices.MacAddressEndPoint-netstandard2.0.apilist.cs | |
new file mode 100644 | |
index 0000000..da09db3 | |
--- /dev/null | |
+++ b/doc/api-list/Smdn.TPSmartHomeDevices.MacAddressEndPoint/Smdn.TPSmartHomeDevices.MacAddressEndPoint-netstandard2.0.apilist.cs | |
@@ -0,0 +1,47 @@ | |
+// Smdn.TPSmartHomeDevices.MacAddressEndPoint.dll (Smdn.TPSmartHomeDevices.MacAddressEndPoint-1.0.0-rc1) | |
+// Name: Smdn.TPSmartHomeDevices.MacAddressEndPoint | |
+// AssemblyVersion: 1.0.0.0 | |
+// InformationalVersion: 1.0.0-rc1+00727d1f82dcb2b9dd9c6e586f6c54110349bf48 | |
+// TargetFramework: .NETStandard,Version=v2.0 | |
+// Configuration: Release | |
+// Referenced assemblies: | |
+// Smdn.Net.AddressResolution, Version=1.0.0.0, Culture=neutral | |
+// Smdn.TPSmartHomeDevices.Primitives, Version=1.0.0.0, Culture=neutral | |
+// System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | |
+// netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | |
+#nullable enable annotations | |
+ | |
+using System; | |
+using System.Net; | |
+using System.Net.NetworkInformation; | |
+using System.Threading; | |
+using System.Threading.Tasks; | |
+using Smdn.Net; | |
+using Smdn.Net.AddressResolution; | |
+using Smdn.TPSmartHomeDevices; | |
+ | |
+namespace Smdn.TPSmartHomeDevices { | |
+ public class MacAddressDeviceEndPointFactory : | |
+ IDeviceEndPointFactory<PhysicalAddress>, | |
+ IDisposable | |
+ { | |
+ protected class MacAddressDeviceEndPoint : IDynamicDeviceEndPoint { | |
+ public MacAddressDeviceEndPoint(IAddressResolver<PhysicalAddress, IPAddress> resolver, PhysicalAddress address) {} | |
+ | |
+ public void Invalidate() {} | |
+ public async ValueTask<EndPoint?> ResolveAsync(CancellationToken cancellationToken) {} | |
+ public override string ToString() {} | |
+ } | |
+ | |
+ protected MacAddressDeviceEndPointFactory(IAddressResolver<PhysicalAddress, IPAddress> resolver, IServiceProvider? serviceProvider = null) {} | |
+ public MacAddressDeviceEndPointFactory(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {} | |
+ public MacAddressDeviceEndPointFactory(MacAddressResolverBase resolver, IServiceProvider? serviceProvider = null) {} | |
+ | |
+ public virtual IDeviceEndPoint Create(PhysicalAddress address) {} | |
+ protected virtual void Dispose(bool disposing) {} | |
+ public void Dispose() {} | |
+ protected void ThrowIfDisposed() {} | |
+ } | |
+} | |
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.2.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.TPSmartHomeDevices.MacAddressEndPoint/Smdn.TPSmartHomeDevices.MacAddressEndPoint-netstandard2.1.apilist.cs b/doc/api-list/Smdn.TPSmartHomeDevices.MacAddressEndPoint/Smdn.TPSmartHomeDevices.MacAddressEndPoint-netstandard2.1.apilist.cs | |
new file mode 100644 | |
index 0000000..a406cb4 | |
--- /dev/null | |
+++ b/doc/api-list/Smdn.TPSmartHomeDevices.MacAddressEndPoint/Smdn.TPSmartHomeDevices.MacAddressEndPoint-netstandard2.1.apilist.cs | |
@@ -0,0 +1,46 @@ | |
+// Smdn.TPSmartHomeDevices.MacAddressEndPoint.dll (Smdn.TPSmartHomeDevices.MacAddressEndPoint-1.0.0-rc1) | |
+// Name: Smdn.TPSmartHomeDevices.MacAddressEndPoint | |
+// AssemblyVersion: 1.0.0.0 | |
+// InformationalVersion: 1.0.0-rc1+00727d1f82dcb2b9dd9c6e586f6c54110349bf48 | |
+// TargetFramework: .NETStandard,Version=v2.1 | |
+// Configuration: Release | |
+// Referenced assemblies: | |
+// Smdn.Net.AddressResolution, Version=1.0.0.0, Culture=neutral | |
+// Smdn.TPSmartHomeDevices.Primitives, Version=1.0.0.0, Culture=neutral | |
+// netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | |
+#nullable enable annotations | |
+ | |
+using System; | |
+using System.Net; | |
+using System.Net.NetworkInformation; | |
+using System.Threading; | |
+using System.Threading.Tasks; | |
+using Smdn.Net; | |
+using Smdn.Net.AddressResolution; | |
+using Smdn.TPSmartHomeDevices; | |
+ | |
+namespace Smdn.TPSmartHomeDevices { | |
+ public class MacAddressDeviceEndPointFactory : | |
+ IDeviceEndPointFactory<PhysicalAddress>, | |
+ IDisposable | |
+ { | |
+ protected class MacAddressDeviceEndPoint : IDynamicDeviceEndPoint { | |
+ public MacAddressDeviceEndPoint(IAddressResolver<PhysicalAddress, IPAddress> resolver, PhysicalAddress address) {} | |
+ | |
+ public void Invalidate() {} | |
+ public async ValueTask<EndPoint?> ResolveAsync(CancellationToken cancellationToken) {} | |
+ public override string ToString() {} | |
+ } | |
+ | |
+ protected MacAddressDeviceEndPointFactory(IAddressResolver<PhysicalAddress, IPAddress> resolver, IServiceProvider? serviceProvider = null) {} | |
+ public MacAddressDeviceEndPointFactory(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {} | |
+ public MacAddressDeviceEndPointFactory(MacAddressResolverBase resolver, IServiceProvider? serviceProvider = null) {} | |
+ | |
+ public virtual IDeviceEndPoint Create(PhysicalAddress address) {} | |
+ protected virtual void Dispose(bool disposing) {} | |
+ public void Dispose() {} | |
+ protected void ThrowIfDisposed() {} | |
+ } | |
+} | |
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.2.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
diff --git a/src/Smdn.TPSmartHomeDevices.MacAddressEndPoint/Smdn.TPSmartHomeDevices.MacAddressEndPoint.csproj b/src/Smdn.TPSmartHomeDevices.MacAddressEndPoint/Smdn.TPSmartHomeDevices.MacAddressEndPoint.csproj | |
new file mode 100644 | |
index 0000000..3d2232f | |
--- /dev/null | |
+++ b/src/Smdn.TPSmartHomeDevices.MacAddressEndPoint/Smdn.TPSmartHomeDevices.MacAddressEndPoint.csproj | |
@@ -0,0 +1,51 @@ | |
+<!-- | |
+SPDX-FileCopyrightText: 2023 smdn <smdn@smdn.jp> | |
+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> | |
+ <VersionPrefix>1.0.0</VersionPrefix> | |
+ <VersionSuffix>rc1</VersionSuffix> | |
+ <!-- <PackageValidationBaselineVersion>1.0.0</PackageValidationBaselineVersion> --> | |
+ <Nullable>enable</Nullable> | |
+ <GenerateDocumentationFile>true</GenerateDocumentationFile> | |
+ <EnableTrimAnalyzer>true</EnableTrimAnalyzer> | |
+ </PropertyGroup> | |
+ | |
+ <PropertyGroup> | |
+ <NoWarn>CS1591;$(NoWarn)</NoWarn> <!-- CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' --> | |
+ </PropertyGroup> | |
+ | |
+ <PropertyGroup Label="assembly attributes"> | |
+ <Description> | |
+<![CDATA[An extension library to add a service to Smdn.TPSmartHomeDevices.Kasa and Smdn.TPSmartHomeDevices.Tapo that enables the resolution of devices' endpoints by MAC address. | |
+]]></Description> | |
+ <CopyrightYear>2023</CopyrightYear> | |
+ </PropertyGroup> | |
+ | |
+ <PropertyGroup Label="package properties"> | |
+ <PackageTags>tplink-kasa,kasa,tplink-tapo,tapo,mac-address,address-resolution,$(PackageCommonTags)</PackageTags> | |
+ </PropertyGroup> | |
+ | |
+ <ItemGroup> | |
+ <GlobalAnalyzerConfigFiles Include="..\CodeAnalysis.globalconfig" /> | |
+ </ItemGroup> | |
+ | |
+ <ItemGroup> | |
+ <PackageReference Include="Smdn.Net.AddressResolution" Version="1.0.0" /> | |
+ <ProjectOrPackageReference ReferencePackageVersion="[1.0.0-*,2.0.0)" Include="..\Smdn.TPSmartHomeDevices.Primitives\Smdn.TPSmartHomeDevices.Primitives.csproj" /> | |
+ </ItemGroup> | |
+ | |
+ <ItemGroup> | |
+ <!-- Third party notice --> | |
+ <None | |
+ Include="$(MSBuildThisFileDirectory)..\..\ThirdPartyNotices.md" | |
+ Pack="true" | |
+ PackagePath="ThirdPartyNotices.md" | |
+ CopyToOutputDirectory="None" | |
+ /> | |
+ </ItemGroup> | |
+ | |
+</Project> | |
diff --git a/src/Smdn.TPSmartHomeDevices.MacAddressEndPoint/Smdn.TPSmartHomeDevices/MacAddressDeviceEndPointFactory.cs b/src/Smdn.TPSmartHomeDevices.MacAddressEndPoint/Smdn.TPSmartHomeDevices/MacAddressDeviceEndPointFactory.cs | |
new file mode 100644 | |
index 0000000..3574655 | |
--- /dev/null | |
+++ b/src/Smdn.TPSmartHomeDevices.MacAddressEndPoint/Smdn.TPSmartHomeDevices/MacAddressDeviceEndPointFactory.cs | |
@@ -0,0 +1,146 @@ | |
+// SPDX-FileCopyrightText: 2023 smdn <smdn@smdn.jp> | |
+// SPDX-License-Identifier: MIT | |
+using System; | |
+using System.Net; | |
+using System.Net.NetworkInformation; | |
+using System.Threading; | |
+using System.Threading.Tasks; | |
+using Smdn.Net; | |
+using Smdn.Net.AddressResolution; | |
+ | |
+namespace Smdn.TPSmartHomeDevices; | |
+ | |
+/// <summary> | |
+/// Provides a mechanism for creating <see cref="IDeviceEndPoint"/> that represents the device endpoint by using the MAC address. | |
+/// </summary> | |
+/// <seealso cref="IDeviceEndPointFactory{TAddress}" /> | |
+public class MacAddressDeviceEndPointFactory : IDeviceEndPointFactory<PhysicalAddress>, IDisposable { | |
+ /// <summary> | |
+ /// A concrete implementation of <see cref="IDynamicDeviceEndPoint"/>, which represents a device endpoint by MAC address. | |
+ /// </summary> | |
+ protected class MacAddressDeviceEndPoint : IDynamicDeviceEndPoint { | |
+ private readonly IAddressResolver<PhysicalAddress, IPAddress> resolver; | |
+ private readonly PhysicalAddress address; | |
+ | |
+ /// <summary> | |
+ /// Initializes a new instance of the <see cref="MacAddressDeviceEndPoint"/> class. | |
+ /// </summary> | |
+ /// <param name="resolver">An <see cref="IAddressResolver{TAddress, TResolvedAddress}"/> that resolves <see cref="PhysicalAddress"/> to <see cref="IPAddress"/>.</param> | |
+ /// <param name="address"><see cref="PhysicalAddress"/> that representing the MAC address of the device endpoint.</param> | |
+ public MacAddressDeviceEndPoint( | |
+ IAddressResolver<PhysicalAddress, IPAddress> resolver, | |
+ PhysicalAddress address | |
+ ) | |
+ { | |
+ this.resolver = resolver ?? throw new ArgumentNullException(nameof(resolver)); | |
+ this.address = address ?? throw new ArgumentNullException(nameof(address)); | |
+ } | |
+ | |
+ public async ValueTask<EndPoint?> ResolveAsync(CancellationToken cancellationToken) | |
+ { | |
+ var resolvedAddress = await resolver.ResolveAsync( | |
+ address: address, | |
+ cancellationToken: cancellationToken | |
+ ).ConfigureAwait(false); | |
+ | |
+ return resolvedAddress is null | |
+ ? null | |
+ : new IPEndPoint( | |
+ address: resolvedAddress, | |
+ port: 0 | |
+ ); | |
+ } | |
+ | |
+ public void Invalidate() | |
+ => resolver.Invalidate(address); | |
+ | |
+ public override string ToString() | |
+ => address.ToMacAddressString(); | |
+ } | |
+ | |
+ /* | |
+ * instance members | |
+ */ | |
+ private IAddressResolver<PhysicalAddress, IPAddress> resolver; // if null, it indicates a 'disposed' state. | |
+ | |
+ /// <summary> | |
+ /// Initializes a new instance of the <see cref="MacAddressDeviceEndPointFactory"/> class. | |
+ /// </summary> | |
+ /// <param name="networkProfile"> | |
+ /// The <see cref="IPNetworkProfile"/> which specifying the network interface and network scan target addresses. | |
+ /// This is used as necessary for network scan in address resolution. | |
+ /// </param> | |
+ /// <param name="serviceProvider">The <see cref="IServiceProvider"/>.</param> | |
+ public MacAddressDeviceEndPointFactory( | |
+ IPNetworkProfile networkProfile, | |
+ IServiceProvider? serviceProvider = null | |
+ ) | |
+ : this( | |
+ resolver: (IAddressResolver<PhysicalAddress, IPAddress>)new MacAddressResolver( | |
+ networkProfile: networkProfile, | |
+ serviceProvider: serviceProvider | |
+ ), | |
+ serviceProvider: serviceProvider | |
+ ) | |
+ { | |
+ } | |
+ | |
+ /// <summary> | |
+ /// Initializes a new instance of the <see cref="MacAddressDeviceEndPointFactory"/> class. | |
+ /// </summary> | |
+ /// <param name="resolver"> | |
+ /// The <see cref="MacAddressResolverBase"/> that resolves from a MAC address to a specific <see cref="IPAddress"/>. | |
+ /// </param> | |
+ /// <param name="serviceProvider">The <see cref="IServiceProvider"/>.</param> | |
+ public MacAddressDeviceEndPointFactory( | |
+ MacAddressResolverBase resolver, | |
+ IServiceProvider? serviceProvider = null | |
+ ) | |
+ : this( | |
+ resolver: (IAddressResolver<PhysicalAddress, IPAddress>)(resolver ?? throw new ArgumentNullException(nameof(resolver))), | |
+ serviceProvider: serviceProvider | |
+ ) | |
+ { | |
+ } | |
+ | |
+#pragma warning disable IDE0060 | |
+ protected MacAddressDeviceEndPointFactory( | |
+ IAddressResolver<PhysicalAddress, IPAddress> resolver, | |
+ IServiceProvider? serviceProvider = null | |
+ ) | |
+#pragma warning restore IDE0060 | |
+ { | |
+ this.resolver = resolver ?? throw new ArgumentNullException(nameof(resolver)); | |
+ } | |
+ | |
+ public void Dispose() | |
+ { | |
+ Dispose(true); | |
+ GC.SuppressFinalize(this); | |
+ } | |
+ | |
+ protected virtual void Dispose(bool disposing) | |
+ { | |
+ if (!disposing) | |
+ return; | |
+ | |
+ (resolver as IDisposable)?.Dispose(); | |
+ resolver = null!; // mark as disposed | |
+ } | |
+ | |
+ protected void ThrowIfDisposed() | |
+ { | |
+ if (resolver is null) | |
+ throw new ObjectDisposedException(GetType().FullName); | |
+ } | |
+ | |
+ public virtual IDeviceEndPoint Create(PhysicalAddress address) | |
+ { | |
+ ThrowIfDisposed(); | |
+ | |
+ return new MacAddressDeviceEndPoint( | |
+ resolver: resolver, | |
+ address: address ?? throw new ArgumentNullException(nameof(address)) | |
+ ); | |
+ } | |
+} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment