This repository was archived by the owner on Feb 18, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDeviceModels.cs
More file actions
140 lines (132 loc) · 5.02 KB
/
DeviceModels.cs
File metadata and controls
140 lines (132 loc) · 5.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
namespace Gerbil
{
namespace Data
{
namespace Models
{
namespace Devices
{
/// <summary>
/// Partial data model to represent a discoverable device connected to the network.
/// </summary>
public class Device
{
private SecurityLevel machineSecurityRel;
private string networkName;
private IPAddress deviceAddress;
protected Dictionary<string, string> properties;
public Device(IPAddress dAddr)
{
deviceAddress = dAddr;
networkName = "";
machineSecurityRel = SecurityLevel.Undetermined;
properties = new Dictionary<string, string>();
}
public Device(IPAddress dAddr, string mName)
{
deviceAddress = dAddr;
networkName = mName;
machineSecurityRel = SecurityLevel.Undetermined;
properties = new Dictionary<string, string>();
}
public Device(IPAddress dAddr, string mName, SecurityLevel secState)
{
deviceAddress = dAddr;
networkName = mName;
machineSecurityRel = secState;
properties = new Dictionary<string, string>();
}
public IPAddress getDeviceIPAddress()
{
return deviceAddress;
}
public string getDeviceNetworkName()
{
return networkName;
}
public SecurityLevel getDeviceSecurityLevel()
{
return machineSecurityRel;
}
public void setDeviceSecurityLevel(SecurityLevel sl)
{
machineSecurityRel = sl;
}
}
/// <summary>
/// Data model to represent a computer such as a PC or Mac.
/// </summary>
public class Computer : Device
{
public Computer(IPAddress dAddr)
: base(dAddr)
{
}
public Computer(IPAddress dAddr, string mName)
: base(dAddr, mName)
{
}
public Computer(IPAddress dAddr, string mName, SecurityLevel secState)
: base(dAddr, mName, secState)
{
}
public Computer(IPAddress dAddr, string mName, SecurityLevel secState, string operatingSystemClass)
: base(dAddr, mName, secState)
{
properties.Add("OSCLASS", operatingSystemClass);
}
}
/// <summary>
/// Data model to represent networking equipment such as routers and switches.
/// </summary>
public class NetworkDevice : Device
{
public NetworkDevice(IPAddress dAddr)
: base(dAddr)
{
}
public NetworkDevice(IPAddress dAddr, string mName)
:base(dAddr, mName)
{
}
public NetworkDevice(IPAddress dAddr, string mName, SecurityLevel secState)
: base(dAddr, mName, secState)
{
}
public NetworkDevice(IPAddress dAddr, string mName, SecurityLevel secState, string netDeviceType)
: base(dAddr, mName, secState)
{
properties.Add("NETDEVICETYPE", netDeviceType);
}
}
/// <summary>
/// Enumerated value to show discovered relative security level of associated device.
/// </summary>
public enum SecurityLevel
{
Undetermined,
None,
Low,
Medium,
High,
Locked
};
/// <summary>
/// Enumerated value to show function of associated device.
/// </summary>
public enum DeviceFunction
{
Server,
Router,
Client
};
}
}
}
}