56 lines
1.6 KiB
C#
56 lines
1.6 KiB
C#
// /**
|
|
// * File: HotspotManager.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.odb;
|
|
using ln.types.odb.mapped;
|
|
using ln.types.btree;
|
|
using ln.types.net;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using skyspot.radius;
|
|
using System.Linq;
|
|
namespace skyspot.hotspot
|
|
{
|
|
public class HotspotManager
|
|
{
|
|
public string BasePath { get; private set; } = "/var/cache/ln.skyspot";
|
|
|
|
public RadiusSecretsStore SecretsStore { get; private set; }
|
|
|
|
ODB odb;
|
|
public ODBCollection<HotspotNetwork> hotspotNetworks { get; private set; }
|
|
public ODBCollection<RadiusSecretsStore> radiusSecretsCollection;
|
|
|
|
Dictionary<HotspotNetwork, HotspotRuntime> instances = new Dictionary<HotspotNetwork, HotspotRuntime>();
|
|
|
|
public HotspotManager()
|
|
{
|
|
odb = new ODB(BasePath);
|
|
hotspotNetworks = odb.GetCollection<HotspotNetwork>();
|
|
radiusSecretsCollection = odb.GetCollection<RadiusSecretsStore>();
|
|
|
|
SecretsStore = radiusSecretsCollection.FirstOrDefault();
|
|
if (SecretsStore == null)
|
|
SecretsStore = new RadiusSecretsStore();
|
|
}
|
|
|
|
public void SaveSecretsStore() => radiusSecretsCollection.Upsert(SecretsStore);
|
|
|
|
|
|
|
|
class HotspotRuntime
|
|
{
|
|
public BTree<MAC, HotspotSession> currentSessions { get; } = new BTree<MAC, HotspotSession>();
|
|
|
|
}
|
|
|
|
}
|
|
}
|