Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
DnsResponse.cs
1using System;
2using System.Text;
6
8{
12 [CollectionName("DnsCache")]
13 [NoBackup("High probability DNS records are not up-to-date at time of restoration. By not including these records, new ones will be fetched, if requested.")]
14 [Index("Name", "Type", "Class")]
15 public class DnsResponse
16 {
17 private Guid objectId = Guid.Empty;
18 private string name = string.Empty;
19 private QTYPE type = QTYPE.A;
20 private QCLASS _class = QCLASS.IN;
21 private DateTime expires = DateTime.MinValue;
22 private ResourceRecord[] answer = null;
23 private ResourceRecord[] authority = null;
24 private ResourceRecord[] additional = null;
25 private byte[] raw = null;
26
30 public DnsResponse()
31 {
32 }
33
37 [ObjectId]
38 public Guid ObjectId
39 {
40 get => this.objectId;
41 set => this.objectId = value;
42 }
43
47 public string Name
48 {
49 get => this.name;
50 set => this.name = value;
51 }
52
56 public QTYPE Type
57 {
58 get => this.type;
59 set => this.type = value;
60 }
61
66 {
67 get => this._class;
68 set => this._class = value;
69 }
70
74 [DefaultValueDateTimeMinValue]
75 public DateTime Expires
76 {
77 get => this.expires;
78 set => this.expires = value;
79 }
80
84 [DefaultValueNull]
86 {
87 get => this.answer;
88 set => this.answer = value;
89 }
90
94 [DefaultValueNull]
96 {
97 get => this.authority;
98 set => this.authority = value;
99 }
100
104 [DefaultValueNull]
106 {
107 get => this.additional;
108 set => this.additional = value;
109 }
110
114 [DefaultValueNull]
115 public byte[] Raw
116 {
117 get => this.raw;
118 set => this.raw = value;
119 }
120
122 public override string ToString()
123 {
124 StringBuilder sb = new StringBuilder();
125
126 sb.Append("Name: ");
127 sb.AppendLine(this.name);
128 sb.Append("Type: ");
129 sb.AppendLine(this.type.ToString());
130 sb.Append("Class: ");
131 sb.AppendLine(this._class.ToString());
132 sb.Append("Expires: ");
133 sb.AppendLine(this.expires.ToString());
134
135 Append(sb, "Answer", this.answer);
136 Append(sb, "Authority", this.authority);
137 Append(sb, "Additional", this.additional);
138
139 return sb.ToString();
140 }
141
142 private static void Append(StringBuilder sb, string Label, ResourceRecord[] Records)
143 {
144 if ((Records?.Length ?? 0) > 0)
145 {
146 sb.AppendLine();
147 sb.AppendLine(Label);
148 sb.AppendLine(new string('=', Label.Length + 3));
149
150 foreach (ResourceRecord Rec in Records)
151 {
152 sb.AppendLine();
153 sb.AppendLine(Rec.ToString());
154 }
155 }
156 }
157
158 }
159}
ResourceRecord[] Authority
Authority resource records
Definition: DnsResponse.cs:96
ResourceRecord[] Answer
Answer resource records
Definition: DnsResponse.cs:86
ResourceRecord[] Additional
Additional resource records
Definition: DnsResponse.cs:106
Abstract base class for a resource record.
QTYPE
QTYPE fields appear in the question part of a query.
Definition: QTYPE.cs:11
QCLASS
QCLASS fields appear in the question section of a query.
Definition: QCLASS.cs:11