aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/measite/minidns/DNSMessage.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/measite/minidns/DNSMessage.java')
-rw-r--r--src/main/java/de/measite/minidns/DNSMessage.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/de/measite/minidns/DNSMessage.java b/src/main/java/de/measite/minidns/DNSMessage.java
index ea1b25c8..977c08d0 100644
--- a/src/main/java/de/measite/minidns/DNSMessage.java
+++ b/src/main/java/de/measite/minidns/DNSMessage.java
@@ -196,6 +196,11 @@ public class DNSMessage {
protected Record additionalResourceRecords[];
/**
+ * The receive timestamp of this message.
+ */
+ protected long receiveTimestamp;
+
+ /**
* Retrieve the current DNS message id.
* @return The current DNS message id.
*/
@@ -212,6 +217,14 @@ public class DNSMessage {
}
/**
+ * Get the receive timestamp if this message was created via parse.
+ * This should be used to evaluate TTLs.
+ */
+ public long getReceiveTimestamp() {
+ return receiveTimestamp;
+ }
+
+ /**
* Retrieve the query type (true or false;
* @return True if this DNS message is a query.
*/
@@ -410,6 +423,7 @@ public class DNSMessage {
message.authenticData = ((header >> 5) & 1) == 1;
message.checkDisabled = ((header >> 4) & 1) == 1;
message.responseCode = RESPONSE_CODE.getResponseCode(header & 0xf);
+ message.receiveTimestamp = System.currentTimeMillis();
int questionCount = dis.readUnsignedShort();
int answerCount = dis.readUnsignedShort();
int nameserverCount = dis.readUnsignedShort();