commit fbc3c0a662be3cae4cc4e3ed05434a8f2efce18c Author: Harald Wolff Date: Tue Jan 7 09:17:08 2020 +0100 Initial Commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2452a0c --- /dev/null +++ b/.gitignore @@ -0,0 +1,43 @@ +# Autosave files +*~ + +# build +[Oo]bj/ +[Bb]in/ +packages/ +TestResults/ + +# globs +Makefile.in +*.DS_Store +*.sln.cache +*.suo +*.cache +*.pidb +*.userprefs +*.usertasks +config.log +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.user +*.tar.gz +tarballs/ +test-results/ +Thumbs.db +.vs/ + +# Mac bundle stuff +*.dmg +*.app + +# resharper +*_Resharper.* +*.Resharper + +# dotCover +*.dotCover + +ln.logging \ No newline at end of file diff --git a/DeviceFlags.cs b/DeviceFlags.cs new file mode 100644 index 0000000..e2cd935 --- /dev/null +++ b/DeviceFlags.cs @@ -0,0 +1,19 @@ +// /** +// * File: DeviceFlags.cs +// * Author: haraldwolff +// * +// * This file and it's content is copyrighted by the Author and / or copyright holder. +// * Any use wihtout proper permission is illegal and may lead to legal actions. +// * +// * +// **/ +using System; +namespace ln.provider.netwatch +{ + [Flags] + public enum DeviceFlags + { + ROUTER = (1<<0), + TRANSCEIVER = (1<<1), + } +} diff --git a/IPFlags.cs b/IPFlags.cs new file mode 100644 index 0000000..9468a6e --- /dev/null +++ b/IPFlags.cs @@ -0,0 +1,19 @@ +// /** +// * File: IPFlags.cs +// * Author: haraldwolff +// * +// * This file and it's content is copyrighted by the Author and / or copyright holder. +// * Any use wihtout proper permission is illegal and may lead to legal actions. +// * +// * +// **/ +using System; +namespace ln.provider.netwatch +{ + [Flags] + public enum IPFlags + { + MANAGEMENT = (1<<0), + LOCAL = (1<<1), + } +} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8baadb6 --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +// /** +// * File: AssemblyInfo.cs +// * Author: haraldwolff +// * +// * This file and it's content is copyrighted by the Author and / or copyright holder. +// * Any use wihtout proper permission is illegal and may lead to legal actions. +// * +// * +// **/ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("ln.provider.netwatch")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] diff --git a/entities/FlaggedIP.cs b/entities/FlaggedIP.cs new file mode 100644 index 0000000..cdd86b1 --- /dev/null +++ b/entities/FlaggedIP.cs @@ -0,0 +1,27 @@ +// /** +// * File: IPList.cs +// * Author: haraldwolff +// * +// * This file and it's content is copyrighted by the Author and / or copyright holder. +// * Any use wihtout proper permission is illegal and may lead to legal actions. +// * +// * +// **/ +using System; +using ln.types.net; +namespace ln.provider.netwatch.entities +{ + public class FlaggedIP + { + public IPv6 IPAddress { get; set; } + public IPFlags Flags { get; set; } + + public FlaggedIP() : this(IPv6.ANY, 0) { } + public FlaggedIP(IPv6 ip) : this(ip, 0) { } + public FlaggedIP(IPv6 ip, IPFlags flags) + { + IPAddress = ip; + Flags = flags; + } + } +} diff --git a/entities/Layer2Segment.cs b/entities/Layer2Segment.cs new file mode 100644 index 0000000..907f187 --- /dev/null +++ b/entities/Layer2Segment.cs @@ -0,0 +1,42 @@ +// /** +// * File: Layer2Segment.cs +// * Author: haraldwolff +// * +// * This file and it's content is copyrighted by the Author and / or copyright holder. +// * Any use wihtout proper permission is illegal and may lead to legal actions. +// * +// * +// **/ +using System; +using ln.types.net; +using ln.types.threads; +using ln.logging; +using ln.manage; +namespace ln.provider.netwatch.entities +{ + public class Layer2Segment : IDisposable + { + [PropertyDescriptor(Identity = true)] + public String Name { get; set; } = Guid.NewGuid().ToString(); + + public IPv6[] Subnets { get; set; } + public NetworkDevice[] Devices { get; set; } + + public int ServiceLevel { get; set; } + + public Layer2Segment() + { + SchedulingPool.Default.Schedule(Check, 6000); + } + + public void Check() + { + Logging.Log(LogLevel.DEBUG, "Layer2Segment {0}: Check()", Name); + } + + public void Dispose() + { + SchedulingPool.Default.Unschedule(Check); + } + } +} diff --git a/entities/NetworkDevice.cs b/entities/NetworkDevice.cs new file mode 100644 index 0000000..74e84e4 --- /dev/null +++ b/entities/NetworkDevice.cs @@ -0,0 +1,42 @@ +// /** +// * File: NetworkDevice.cs +// * Author: haraldwolff +// * +// * This file and it's content is copyrighted by the Author and / or copyright holder. +// * Any use wihtout proper permission is illegal and may lead to legal actions. +// * +// * +// **/ +using System; +using ln.types.threads; +using ln.logging; +using ln.manage; +using ln.types.net; +namespace ln.provider.netwatch.entities +{ + public class NetworkDevice : IDisposable + { + [PropertyDescriptor(Identity = true)] + public String Name { get; set; } = Guid.NewGuid().ToString(); + + public DeviceFlags Flags { get; set; } + public IPv6[] IPAddresses { get; set; } = new IPv6[0]; + + public NetworkDevicePort[] DevicePorts { get; set; } = new NetworkDevicePort[0]; + + public NetworkDevice() + { + SchedulingPool.Default.Schedule(Check, 4000); + } + + public virtual void Check() + { + Logging.Log(LogLevel.DEBUG, "NetworkDevice {0}: Check()", Name); + } + + public void Dispose() + { + SchedulingPool.Default.Unschedule(Check); + } + } +} diff --git a/entities/NetworkDeviceList.cs b/entities/NetworkDeviceList.cs new file mode 100644 index 0000000..4b26653 --- /dev/null +++ b/entities/NetworkDeviceList.cs @@ -0,0 +1,19 @@ +// /** +// * File: DeviceList.cs +// * Author: haraldwolff +// * +// * This file and it's content is copyrighted by the Author and / or copyright holder. +// * Any use wihtout proper permission is illegal and may lead to legal actions. +// * +// * +// **/ +using System; +namespace ln.provider.netwatch.entities +{ + public class NetworkDeviceList + { + public NetworkDeviceList() + { + } + } +} diff --git a/entities/NetworkDevicePort.cs b/entities/NetworkDevicePort.cs new file mode 100644 index 0000000..9722442 --- /dev/null +++ b/entities/NetworkDevicePort.cs @@ -0,0 +1,33 @@ +// /** +// * File: NetworkDevicePort.cs +// * Author: haraldwolff +// * +// * This file and it's content is copyrighted by the Author and / or copyright holder. +// * Any use wihtout proper permission is illegal and may lead to legal actions. +// * +// * +// **/ +using System; +namespace ln.provider.netwatch.entities +{ + public class NetworkDevicePort + { + public NetworkDevice NetworkDevice { get; } + + public string Name { get; set; } + public byte[] HWAddress { get; set; } + public FlaggedIP[] IPAddresses { get; set; } = new FlaggedIP[0]; + + private NetworkDevicePort() + { + } + + public NetworkDevicePort(NetworkDevice networkDevice,string name) :this(networkDevice,name,new byte[0]){} + public NetworkDevicePort(NetworkDevice networkDevice, string name, byte[] hwaddr) + { + NetworkDevice = networkDevice; + Name = name; + HWAddress = hwaddr; + } + } +} diff --git a/ln.provider.netwatch.csproj b/ln.provider.netwatch.csproj new file mode 100644 index 0000000..05947bb --- /dev/null +++ b/ln.provider.netwatch.csproj @@ -0,0 +1,61 @@ + + + + Debug + AnyCPU + {A5BB8163-FA35-44D6-BAB8-B7A921D83462} + Library + ln.provider.netwatch + ln.provider.netwatch + v4.7 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + + + true + bin\Release + prompt + 4 + false + + + + + + + + + + + + + + + + + + + + + {8D9AB9A5-E513-4BA7-A450-534F6456BF28} + ln.types + + + {D471A566-9FB6-41B2-A777-3C32874ECD0E} + ln.logging + + + {D4E4FD39-6C21-4FCC-8DE0-6494FBE82CEA} + ln.manage + + + + \ No newline at end of file