Initial Commit

master
Harald Wolff 2020-01-07 09:17:08 +01:00
commit fbc3c0a662
10 changed files with 340 additions and 0 deletions

43
.gitignore vendored 100644
View File

@ -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

19
DeviceFlags.cs 100644
View File

@ -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),
}
}

19
IPFlags.cs 100644
View File

@ -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),
}
}

View File

@ -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("")]

View File

@ -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;
}
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

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

View File

@ -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;
}
}
}

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A5BB8163-FA35-44D6-BAB8-B7A921D83462}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>ln.provider.netwatch</RootNamespace>
<AssemblyName>ln.provider.netwatch</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="entities\NetworkDevice.cs" />
<Compile Include="entities\FlaggedIP.cs" />
<Compile Include="entities\NetworkDevicePort.cs" />
<Compile Include="entities\NetworkDeviceList.cs" />
<Compile Include="entities\Layer2Segment.cs" />
<Compile Include="IPFlags.cs" />
<Compile Include="DeviceFlags.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="entities\" />
<Folder Include="container\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ln.types\ln.types.csproj">
<Project>{8D9AB9A5-E513-4BA7-A450-534F6456BF28}</Project>
<Name>ln.types</Name>
</ProjectReference>
<ProjectReference Include="..\ln.logging\ln.logging.csproj">
<Project>{D471A566-9FB6-41B2-A777-3C32874ECD0E}</Project>
<Name>ln.logging</Name>
</ProjectReference>
<ProjectReference Include="..\ln.manage\ln.manage.csproj">
<Project>{D4E4FD39-6C21-4FCC-8DE0-6494FBE82CEA}</Project>
<Name>ln.manage</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>