ln.skyspot/session/ClientSession.cs

47 lines
1.2 KiB
C#

using System;
using skyspot.hotspot;
using ln.types.net;
using ln.types.odb.attributes;
namespace skyspot.session
{
public class ClientSession : IComparable
{
[DocumentID]
Guid id = Guid.NewGuid();
public DateTimeOffset Created { get; }
public DateTimeOffset ValidThrough { get; set; }
public HotspotNetwork HotspotNetwork { get; }
public MAC ClientMAC { get; }
public IPv4 ClientIP { get; set; }
public HotspotUser HotspotUser { get; set; }
public ClientProfile CurrentProfile { get; set; }
private ClientSession()
{
Created = DateTimeOffset.Now;
ValidThrough = Created + TimeSpan.FromMinutes(3);
}
public ClientSession(HotspotNetwork hotspotNetwork,MAC clientMac)
:this()
{
HotspotNetwork = hotspotNetwork;
ClientMAC = clientMac;
}
public int CompareTo(object obj)
{
if (obj is ClientSession)
{
ClientSession you = obj as ClientSession;
return ClientMAC.CompareTo(you.ClientMAC);
}
return -1;
}
}
}