Base
This commit is contained in:
73
classlib/address.cs
Normal file
73
classlib/address.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
namespace PS.IPAM;
|
||||
using System;
|
||||
|
||||
public class Address {
|
||||
public int Id { get; }
|
||||
public int SubnetId { get; }
|
||||
public string Ip { get; }
|
||||
public bool IsGateway { get; }
|
||||
public string Description { get; }
|
||||
public string Hostname { get; }
|
||||
public string MAC { get; }
|
||||
public string Owner { get; }
|
||||
public int TagId { get; }
|
||||
public int DeviceId { get; }
|
||||
public string Location { get; }
|
||||
public int Port { get; }
|
||||
public string Note { get; }
|
||||
public DateTime? LastSeen { get; }
|
||||
public bool ExcludePing { get; }
|
||||
public int PTRignore { get; }
|
||||
public int PTR { get; }
|
||||
public string FirewallAddressObject { get; }
|
||||
public DateTime? EditDate { get; }
|
||||
public int CustomerId { get; }
|
||||
|
||||
public Address(
|
||||
int id,
|
||||
int subnetId,
|
||||
string ip,
|
||||
bool is_gateway,
|
||||
string description,
|
||||
string hostname,
|
||||
string mac,
|
||||
string owner,
|
||||
int tag,
|
||||
int deviceId,
|
||||
string location,
|
||||
int port,
|
||||
string note,
|
||||
DateTime? lastSeen,
|
||||
bool excludePing,
|
||||
int PTRignore,
|
||||
int PTR,
|
||||
string firewallAddressObject,
|
||||
DateTime? editDate,
|
||||
int customer_id
|
||||
) {
|
||||
this.Id = id;
|
||||
this.SubnetId = subnetId;
|
||||
this.Ip = ip;
|
||||
this.IsGateway = is_gateway;
|
||||
this.Description = description;
|
||||
this.Hostname = hostname;
|
||||
this.MAC = mac;
|
||||
this.Owner = owner;
|
||||
this.TagId = tag;
|
||||
this.DeviceId = deviceId;
|
||||
this.Location = location;
|
||||
this.Port = port;
|
||||
this.Note = note;
|
||||
this.EditDate = lastSeen;
|
||||
this.ExcludePing = excludePing;
|
||||
this.PTRignore = PTRignore;
|
||||
this.PTR = PTR;
|
||||
this.FirewallAddressObject = firewallAddressObject;
|
||||
this.EditDate = editDate;
|
||||
this.CustomerId = customer_id;
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return this.Ip;
|
||||
}
|
||||
}
|
||||
9
classlib/classlib.csproj
Normal file
9
classlib/classlib.csproj
Normal file
@@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
6
classlib/enum.cs
Normal file
6
classlib/enum.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace PS.IPAM;
|
||||
using System;
|
||||
|
||||
enum Parameters {
|
||||
IsGateway = "is_gateway";
|
||||
}
|
||||
95
classlib/subnet.cs
Normal file
95
classlib/subnet.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
namespace PS.IPAM;
|
||||
using System;
|
||||
|
||||
public class Subnetwork {
|
||||
public int Id { get; }
|
||||
public string Subnet { get; }
|
||||
public int Mask { get; }
|
||||
public int SectionId { get; }
|
||||
public string Description { get; }
|
||||
public string LinkedSubnet { get; }
|
||||
public int FirewallAddressObject { get; }
|
||||
public int VrfId { get; }
|
||||
public int MasterSubnetId { get; }
|
||||
public bool AllowRequests { get; }
|
||||
public int VlanId { get; }
|
||||
public bool ShowName { get; }
|
||||
public int Device { get; }
|
||||
public bool PingSubnet { get; }
|
||||
public bool DiscoverSubnet { get; }
|
||||
public bool ResolveDNS { get; }
|
||||
public Subnetwork(
|
||||
int id,
|
||||
string subnet,
|
||||
int mask,
|
||||
int sectionId,
|
||||
string description,
|
||||
string linkedSubnet,
|
||||
int firewallAddressObject,
|
||||
int vrfId,
|
||||
int masterSubnetId,
|
||||
string permissions,
|
||||
bool allowRequests,
|
||||
int vlanId,
|
||||
bool showName,
|
||||
int device,
|
||||
bool pingSubnet,
|
||||
bool discoverSubnet,
|
||||
bool resolveDNS
|
||||
) {
|
||||
this.Id = id;
|
||||
this.Subnet = subnet;
|
||||
this.Mask = mask;
|
||||
this.SectionId = sectionId;
|
||||
this.Description = description;
|
||||
this.LinkedSubnet = linkedSubnet;
|
||||
this.FirewallAddressObject = firewallAddressObject;
|
||||
this.VrfId = vrfId;
|
||||
this.MasterSubnetId = masterSubnetId;
|
||||
this.AllowRequests = allowRequests;
|
||||
this.VlanId = vlanId;
|
||||
this.ShowName = showName;
|
||||
this.Device = device;
|
||||
this.PingSubnet = pingSubnet;
|
||||
this.DiscoverSubnet = discoverSubnet;
|
||||
this.ResolveDNS = resolveDNS;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{this.Subnet}/{this.Mask}";
|
||||
}
|
||||
}
|
||||
|
||||
id : 1
|
||||
subnet : fd13:6d20:29dc:cf27::
|
||||
mask : 64
|
||||
sectionId : 2
|
||||
description : Private subnet 1
|
||||
linked_subnet :
|
||||
firewallAddressObject :
|
||||
vrfId : 0
|
||||
masterSubnetId : 0
|
||||
allowRequests : 1
|
||||
vlanId : 1
|
||||
showName : 1
|
||||
device : 0
|
||||
permissions : {"3":"1","2":"2"}
|
||||
pingSubnet : 0
|
||||
discoverSubnet : 0
|
||||
resolveDNS : 0
|
||||
DNSrecursive : 0
|
||||
DNSrecords : 0
|
||||
nameserverId : 0
|
||||
scanAgent :
|
||||
customer_id :
|
||||
isFolder : 0
|
||||
isFull : 0
|
||||
isPool : 0
|
||||
tag : 2
|
||||
threshold : 0
|
||||
location :
|
||||
editDate :
|
||||
lastScan :
|
||||
lastDiscovery :
|
||||
calculation : @{Type=IPv6; Host address=/; Host address (uncompressed)=/; Subnet prefix=fd13:6d20:29dc:cf27::/64; Prefix length=64; Subnet Reverse DNS=7.2.f.c.c.d.9.2.0.2.d.6.3.1.d.f.ip6.arpa; Min host IP=fd13:6d20:29dc:cf27::; Max host IP=fd13:6d20:29dc:cf27:ffff:ffff:ffff:ffff; Number of hosts=18446744073709551616; Address type=NET_IPV6}
|
||||
43
classlib/tag.cs
Normal file
43
classlib/tag.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
namespace PS.IPAM;
|
||||
|
||||
public class Tag {
|
||||
public int Id { get; }
|
||||
public string Type { get; }
|
||||
public bool ShowTag { get; }
|
||||
public string BGColor { get; }
|
||||
public string FGColor { get; }
|
||||
public bool Compress { get; }
|
||||
public bool Locked { get; }
|
||||
public bool UpdateTag { get; }
|
||||
|
||||
public Tag(
|
||||
int id,
|
||||
string type,
|
||||
bool showTag,
|
||||
string BGColor,
|
||||
string FGColor,
|
||||
string compress,
|
||||
string locked,
|
||||
bool updateTag
|
||||
) {
|
||||
this.Id = id;
|
||||
this.Type = type;
|
||||
this.ShowTag = showTag;
|
||||
this.BGColor = BGColor;
|
||||
this.FGColor = FGColor;
|
||||
this.Compress = this.StringToBool(compress);
|
||||
this.Locked = this.StringToBool(locked);
|
||||
this.UpdateTag = updateTag;
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return this.Type;
|
||||
}
|
||||
|
||||
private bool StringToBool(string str) {
|
||||
if (str == "Yes") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user