1- // Smdn.Net.MuninNode.dll (Smdn.Net.MuninNode-1.3 .0)
1+ // Smdn.Net.MuninNode.dll (Smdn.Net.MuninNode-2.0 .0)
22// Name: Smdn.Net.MuninNode
3- // AssemblyVersion: 1.3 .0.0
4- // InformationalVersion: 1.3 .0+191d215fe57392cb544e2ffea221644a1007cfc0
3+ // AssemblyVersion: 2.0 .0.0
4+ // InformationalVersion: 2.0 .0+0c4121c0bc87932e6486c3b38a123cb59460ac02
55// TargetFramework: .NETCoreApp,Version=v6.0
66// Configuration: Release
77// Referenced assemblies:
2727using System . Text ;
2828using System . Threading ;
2929using System . Threading . Tasks ;
30+ using Microsoft . Extensions . DependencyInjection ;
3031using Microsoft . Extensions . Logging ;
3132using Smdn . Net . MuninNode ;
3233using Smdn . Net . MuninPlugin ;
3334
3435namespace Smdn . Net . MuninNode {
35- public class LocalNode : NodeBase {
36- public LocalNode ( IPluginProvider pluginProvider , string hostName , int port , ILogger ? logger = null ) { }
37- public LocalNode ( IPluginProvider pluginProvider , string hostName , int port , IServiceProvider ? serviceProvider = null ) { }
38- public LocalNode ( IReadOnlyCollection < IPlugin > plugins , int port , IServiceProvider ? serviceProvider = null ) { }
39- public LocalNode ( IReadOnlyCollection < IPlugin > plugins , string hostName , int port , IServiceProvider ? serviceProvider = null ) { }
36+ public interface IAccessRule {
37+ bool IsAcceptable ( IPEndPoint remoteEndPoint ) ;
38+ }
39+
40+ public static class IAccessRuleServiceCollectionExtensions {
41+ public static IServiceCollection AddMuninNodeAccessRule ( this IServiceCollection services , IAccessRule accessRule ) { }
42+ public static IServiceCollection AddMuninNodeAccessRule ( this IServiceCollection services , IReadOnlyList < IPAddress > addressListAllowFrom ) { }
43+ }
4044
41- public IPEndPoint LocalEndPoint { get ; }
45+ public abstract class LocalNode : NodeBase {
46+ public static LocalNode Create ( IPluginProvider pluginProvider , int port , string ? hostName = null , IReadOnlyList < IPAddress > ? addressListAllowFrom = null , IServiceProvider ? serviceProvider = null ) { }
47+ public static LocalNode Create ( IReadOnlyCollection < IPlugin > plugins , int port , string ? hostName = null , IReadOnlyList < IPAddress > ? addressListAllowFrom = null , IServiceProvider ? serviceProvider = null ) { }
48+
49+ protected LocalNode ( IAccessRule ? accessRule , ILogger ? logger = null ) { }
4250
4351 protected override Socket CreateServerSocket ( ) { }
44- protected override bool IsClientAcceptable ( IPEndPoint remoteEndPoint ) { }
52+ protected virtual EndPoint GetLocalEndPointToBind ( ) { }
4553 }
4654
4755 public abstract class NodeBase :
4856 IAsyncDisposable ,
4957 IDisposable
5058 {
51- private protected class PluginProvider : IPluginProvider {
52- public PluginProvider ( IReadOnlyCollection < IPlugin > plugins ) { }
53-
54- public IReadOnlyCollection < IPlugin > Plugins { get ; }
55- public INodeSessionCallback ? SessionCallback { get ; }
56- }
57-
58- protected NodeBase ( IPluginProvider pluginProvider , string hostName , ILogger ? logger ) { }
59- protected NodeBase ( IReadOnlyCollection < IPlugin > plugins , string hostName , ILogger ? logger ) { }
59+ protected NodeBase ( IAccessRule ? accessRule , ILogger ? logger ) { }
6060
6161 public virtual Encoding Encoding { get ; }
62- public string HostName { get ; }
62+ public abstract string HostName { get ; }
63+ public EndPoint LocalEndPoint { get ; }
6364 protected ILogger ? Logger { get ; }
6465 public virtual Version NodeVersion { get ; }
65- [ Obsolete ( "This member will be deprecated in future version." ) ]
66- public IReadOnlyCollection < IPlugin > Plugins { get ; }
66+ public abstract IPluginProvider PluginProvider { get ; }
6767
6868 public async ValueTask AcceptAsync ( bool throwIfCancellationRequested , CancellationToken cancellationToken ) { }
6969 public async ValueTask AcceptSingleSessionAsync ( CancellationToken cancellationToken = default ) { }
@@ -72,8 +72,8 @@ protected virtual void Dispose(bool disposing) {}
7272 public void Dispose ( ) { }
7373 public async ValueTask DisposeAsync ( ) { }
7474 protected virtual async ValueTask DisposeAsyncCore ( ) { }
75- protected abstract bool IsClientAcceptable ( IPEndPoint remoteEndPoint ) ;
7675 public void Start ( ) { }
76+ protected void ThrowIfPluginProviderIsNull ( ) { }
7777 }
7878}
7979
@@ -85,7 +85,7 @@ public interface INodeSessionCallback {
8585
8686 public interface IPlugin {
8787 IPluginDataSource DataSource { get ; }
88- PluginGraphAttributes GraphAttributes { get ; }
88+ IPluginGraphAttributes GraphAttributes { get ; }
8989 string Name { get ; }
9090 INodeSessionCallback ? SessionCallback { get ; }
9191 }
@@ -101,6 +101,10 @@ public interface IPluginField {
101101 ValueTask < string > GetFormattedValueStringAsync ( CancellationToken cancellationToken ) ;
102102 }
103103
104+ public interface IPluginGraphAttributes {
105+ IEnumerable < string > EnumerateAttributes ( ) ;
106+ }
107+
104108 public interface IPluginProvider {
105109 IReadOnlyCollection < IPlugin > Plugins { get ; }
106110 INodeSessionCallback ? SessionCallback { get ; }
@@ -132,6 +136,7 @@ public Plugin(string name, PluginGraphAttributes graphAttributes, IReadOnlyColle
132136 public PluginGraphAttributes GraphAttributes { get ; }
133137 public string Name { get ; }
134138 IPluginDataSource IPlugin . DataSource { get ; }
139+ IPluginGraphAttributes IPlugin . GraphAttributes { get ; }
135140 INodeSessionCallback ? IPlugin . SessionCallback { get ; }
136141 IReadOnlyCollection < IPluginField > IPluginDataSource . Fields { get ; }
137142
@@ -170,21 +175,22 @@ protected PluginFieldBase(string label, string? name, PluginFieldGraphStyle grap
170175 async ValueTask < string > IPluginField . GetFormattedValueStringAsync ( CancellationToken cancellationToken ) { }
171176 }
172177
173- public sealed class PluginGraphAttributes {
174- [ Obsolete ( "This member will be deprecated in future version." ) ]
175- public PluginGraphAttributes ( string title , string category , string verticalLabel , bool scale , string arguments , TimeSpan updateRate , int ? width = null , int ? height = null ) { }
176- public PluginGraphAttributes ( string title , string category , string verticalLabel , bool scale , string arguments , TimeSpan ? updateRate = null , int ? width = null , int ? height = null ) { }
177- public PluginGraphAttributes ( string title , string category , string verticalLabel , bool scale , string arguments , TimeSpan ? updateRate , int ? width , int ? height , IEnumerable < string > ? order ) { }
178+ public sealed class PluginGraphAttributes : IPluginGraphAttributes {
179+ public PluginGraphAttributes ( string title , string category , string verticalLabel , bool scale , string arguments ) { }
180+ public PluginGraphAttributes ( string title , string category , string verticalLabel , bool scale , string arguments , TimeSpan ? updateRate , int ? width , int ? height , IEnumerable < string > ? order , string ? totalValueLabel ) { }
178181
179182 public string Arguments { get ; }
180183 public string Category { get ; }
181184 public int ? Height { get ; }
182185 public string ? Order { get ; }
183186 public bool Scale { get ; }
184187 public string Title { get ; }
188+ public string ? TotalValueLabel { get ; }
185189 public TimeSpan ? UpdateRate { get ; }
186190 public string VerticalLabel { get ; }
187191 public int ? Width { get ; }
192+
193+ public IEnumerable < string > EnumerateAttributes ( ) { }
188194 }
189195
190196 public readonly struct PluginFieldAttributes {
0 commit comments