-
Notifications
You must be signed in to change notification settings - Fork 805
Expand file tree
/
Copy pathFirewallPortSpecification.cs
More file actions
66 lines (60 loc) · 2.17 KB
/
FirewallPortSpecification.cs
File metadata and controls
66 lines (60 loc) · 2.17 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
// ReSharper disable MemberCanBePrivate.Global
// Needed for serialization.
namespace NETworkManager.Models.Firewall;
/// <summary>
/// Represents a specification for defining and validating firewall ports.
/// </summary>
/// <remarks>
/// This class is used to encapsulate rules and configurations for
/// managing firewall port restrictions or allowances. It provides
/// properties and methods to define a range of acceptable ports or
/// individual port specifications.
/// </remarks>
public class FirewallPortSpecification
{
/// <summary>
/// Gets or sets the start point or initial value of a process, range, or operation.
/// </summary>
/// <remarks>
/// The <c>Start</c> property typically represents the beginning state or position for sequential
/// processing or iteration. The exact usage of this property may vary depending on the context of
/// the class or object it belongs to.
/// </remarks>
public int Start { get; set; }
/// <summary>
/// Gets or sets the endpoint or final state of a process, range, or operation.
/// </summary>
/// <remarks>
/// This property typically represents the termination position, time, or value
/// in a sequence, operation, or any bounded context. Its specific meaning may vary
/// depending on the context in which it is used.
/// </remarks>
public int End { get; set; }
/// <summary>
/// For serializing.
/// </summary>
public FirewallPortSpecification()
{
Start = -1;
End = -1;
}
/// <summary>
/// Represents the specification for a firewall port, detailing its configuration
/// and rules for inbound or outbound network traffic.
/// </summary>
public FirewallPortSpecification(int start, int end = -1)
{
Start = start;
End = end;
}
/// <summary>
/// Returns a string that represents the current object.
/// </summary>
/// <returns>A string that represents the current instance of the object.</returns>
public override string ToString()
{
if (Start is 0)
return string.Empty;
return End is -1 or 0 ? $"{Start}" : $"{Start}-{End}";
}
}