Initial Commit

master
Harald Christian Joachim Wolff 2019-04-23 09:24:56 +02:00
commit 042f4c60e2
35 changed files with 11477 additions and 0 deletions

55
Program.cs 100644
View File

@ -0,0 +1,55 @@
// /**
// * File: Program.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.radius;
using System.Net;
using System.Threading;
using ln.logging;
using System.Net.Sockets;
using Newtonsoft.Json;
using ln.dhcp;
using ln.types.net;
namespace skyspot
{
class MainClass
{
public static void Main(string[] args)
{
new IPv4(0);
DHCPServer dhcpServer = new DHCPServer();
if (dhcpServer.Interfaces.Length == 0)
dhcpServer.AddInterface(IPv4.Parse("10.118.200.254"));
dhcpServer.Interfaces[0].InterfaceAddress = IPv4.Parse("10.118.200.254");
if (dhcpServer.IPPools.Length == 0)
{
dhcpServer.AddPool(new IPPool("default", IPv4.Parse("10.118.200.50"), IPv4.Parse("10.118.200.99")));
}
if (dhcpServer.Interfaces[0].Pool == null)
{
dhcpServer.Interfaces[0].Pool = dhcpServer.IPPools[0];
dhcpServer.Commit(dhcpServer.Interfaces[0].Pool);
}
dhcpServer.Start();
//RadiusServer radiusServer = new RadiusServer(new IPEndPoint(IPAddress.Any, 1812));
//radiusServer.MessageReceived = (s, m) => Logging.Log("JO");
//Thread.Sleep(10000);
//radiusServer.Close();
}
}
}

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

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
908aa52658b13933ddb762b76bedacd9788a3698

View File

@ -0,0 +1,46 @@
/home/haraldwolff/src/skyspot/skyspot/bin/Debug/skyspot.exe
/home/haraldwolff/src/skyspot/skyspot/bin/Debug/skyspot.pdb
/home/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.http.dll
/home/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.http.objects.dll
/home/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.radius.dll
/home/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.types.dll
/home/haraldwolff/src/skyspot/skyspot/bin/Debug/sharp.logging.dll
/home/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.templates.dll
/home/haraldwolff/src/skyspot/skyspot/bin/Debug/Newtonsoft.Json.dll
/home/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.http.pdb
/home/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.http.objects.pdb
/home/haraldwolff/src/skyspot/skyspot/bin/Debug/sharp.logging.pdb
/home/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.radius.pdb
/home/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.types.pdb
/home/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.templates.pdb
/home/haraldwolff/src/skyspot/skyspot/bin/Debug/Newtonsoft.Json.pdb
/home/haraldwolff/src/skyspot/skyspot/bin/Debug/Newtonsoft.Json.xml
/home/haraldwolff/src/skyspot/skyspot/obj/x86/Debug/skyspot.csprojAssemblyReference.cache
/home/haraldwolff/src/skyspot/skyspot/obj/x86/Debug/skyspot.csproj.CoreCompileInputs.cache
/home/haraldwolff/src/skyspot/skyspot/obj/x86/Debug/skyspot.csproj.CopyComplete
/home/haraldwolff/src/skyspot/skyspot/obj/x86/Debug/skyspot.exe
/home/haraldwolff/src/skyspot/skyspot/obj/x86/Debug/skyspot.pdb
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/bin/Debug/skyspot.exe
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/bin/Debug/skyspot.pdb
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.http.dll
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.http.objects.dll
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.radius.dll
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.types.dll
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/bin/Debug/sharp.logging.dll
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.templates.dll
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/bin/Debug/Newtonsoft.Json.dll
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.http.pdb
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.http.objects.pdb
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/bin/Debug/sharp.logging.pdb
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.radius.pdb
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.types.pdb
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.templates.pdb
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/bin/Debug/Newtonsoft.Json.pdb
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/bin/Debug/Newtonsoft.Json.xml
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/obj/x86/Debug/skyspot.csprojAssemblyReference.cache
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/obj/x86/Debug/skyspot.csproj.CoreCompileInputs.cache
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/obj/x86/Debug/skyspot.csproj.CopyComplete
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/obj/x86/Debug/skyspot.exe
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/obj/x86/Debug/skyspot.pdb
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.dhcp.dll
/Volumes/HOMES/haraldwolff/src/skyspot/skyspot/bin/Debug/ln.dhcp.pdb

Binary file not shown.

Binary file not shown.

4
packages.config 100644
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net47" />
</packages>

View File

@ -0,0 +1,31 @@
using System;
using ln.types.net;
using skyspot.users;
using ln.types.odb.attributes;
namespace skyspot.session
{
public class HotspotSession
{
[DocumentIDAttribute]
public Guid ID { get; set; }
public IPv4 IP { get; set; }
public MAC MacAddress { get; set; }
public HotspotUser HotspotUser { get; set; }
public DateTimeOffset Created { get; }
public DateTimeOffset Destroyed { get; private set; }
public long RXTrafficVolume { get; set; }
public long TXTrafficVolume { get; set; }
public HotspotSession()
{
ID = Guid.NewGuid();
Created = DateTimeOffset.Now;
Destroyed = DateTimeOffset.MinValue;
}
}
}

View File

@ -0,0 +1,20 @@
using System;
namespace skyspot.session
{
public enum TrafficVolumeState { CREATED, ACTIVE, FULLFILLED, CANCELED }
public class HotspotVolume
{
public DateTimeOffset Created;
public DateTimeOffset FirstUse;
public long TrafficVolume;
public long UsedVolume;
public long RemainingTrafficVolume => TrafficVolume - UsedVolume;
public HotspotVolume()
{
}
}
}

80
skyspot.csproj 100644
View File

@ -0,0 +1,80 @@
<?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)' == '' ">x86</Platform>
<ProjectGuid>{9BE712E3-2C78-4BDD-9CF8-7C1F8376D073}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>skyspot</RootNamespace>
<AssemblyName>skyspot</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ExternalConsole>true</ExternalConsole>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ExternalConsole>true</ExternalConsole>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="session\HotspotSession.cs" />
<Compile Include="users\HotspotUser.cs" />
<Compile Include="users\RegistrationType.cs" />
<Compile Include="users\TrafficProfile.cs" />
<Compile Include="session\HotspotVolume.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ln.http\ln.http.csproj">
<Project>{CEEEEB41-3059-46A2-A871-2ADE22C013D9}</Project>
<Name>ln.http</Name>
</ProjectReference>
<ProjectReference Include="..\ln.http.resources\ln.http.resources.csproj">
<Project>{F9086FE4-8925-42FF-A59C-607341604293}</Project>
<Name>ln.http.resources</Name>
</ProjectReference>
<ProjectReference Include="..\ln.logging\ln.logging.csproj">
<Project>{D471A566-9FB6-41B2-A777-3C32874ECD0E}</Project>
<Name>ln.logging</Name>
</ProjectReference>
<ProjectReference Include="..\ln.radius\ln.radius.csproj">
<Project>{100C21CD-1E24-499E-88FF-C17431FC9D2A}</Project>
<Name>ln.radius</Name>
</ProjectReference>
<ProjectReference Include="..\ln.types\ln.types.csproj">
<Project>{8D9AB9A5-E513-4BA7-A450-534F6456BF28}</Project>
<Name>ln.types</Name>
</ProjectReference>
<ProjectReference Include="..\ln.dhcp\ln.dhcp.csproj">
<Project>{13869452-1A9D-4652-9B51-F9D1A9F7919F}</Project>
<Name>ln.dhcp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="session\" />
<Folder Include="users\" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' ">
<StartAction>Project</StartAction>
<ExternalConsole>false</ExternalConsole>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,46 @@
using System;
using skyspot.session;
using System.Collections.Generic;
using ln.types.odb.attributes;
namespace skyspot.users
{
public class HotspotUser
{
[DocumentIDAttribute]
public Guid ID { get; private set; }
public String FirstName { get; set; }
public string LastName { get; set; }
public string PhoneNumber { get; set; }
public DateTime BirthDay { get; set; }
public RegistrationType RegistrationType { get; set; }
public HotspotVolume[] HotspotVolumes { get; set; }
int currentHotspotVolume = 0;
public HotspotVolume CurrentHotspotVolume
{
get => HotspotVolumes[currentHotspotVolume];
set
{
for (int n=0;n<HotspotVolumes.Length;n++)
if (HotspotVolumes[n] == value)
{
currentHotspotVolume = n;
return;
}
}
}
public IEnumerable<HotspotSession> ActiveSessions { get; }
public HotspotUser()
{
}
}
}

View File

@ -0,0 +1,10 @@
using System;
namespace skyspot.users
{
public enum RegistrationType
{
SELFSERVICE,
OPERATOR,
MANAGED
}
}

View File

@ -0,0 +1,21 @@
using System;
using ln.types.odb.attributes;
namespace skyspot.users
{
public class TrafficProfile
{
[DocumentIDAttribute]
public String Name { get; set; }
public long Speed { get; set; }
public long TrafficVolume { get; set; }
public TimeSpan Interval { get; set; }
public TrafficProfile NextProfile { get; set; }
public TrafficProfile()
{
}
}
}